Kv directory fixes (#24129)

* update icon if kv path ends in slash. Fixes #23978

* Correctly link to directory in kv if search-select uses fallback input
This commit is contained in:
Chelsea Shaw 2023-11-15 10:51:26 -06:00 committed by GitHub
parent 28e3507680
commit 8756dccb11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -140,15 +140,17 @@ export default class DashboardQuickActionsCard extends Component {
@action
navigateToPage() {
let route = this.searchSelectParams.route;
let param = this.paramValue.id;
// If search-select falls back to stringInput, paramVlue is a string not object
let param = this.paramValue.id || this.paramValue;
// kv has a special use case where if the paramValue ends in a '/' you should
// link to different route
if (this.selectedEngine.type === 'kv') {
route = pathIsDirectory(this.paramValue?.path)
const path = this.paramValue.path || this.paramValue;
route = pathIsDirectory(path)
? 'vault.cluster.secrets.backend.kv.list-directory'
: 'vault.cluster.secrets.backend.kv.secret.details';
param = this.paramValue?.path;
param = path;
}
this.router.transitionTo(route, this.selectedEngine.id, param);

View File

@ -63,7 +63,7 @@
<div class="level is-mobile">
<div class="level-left">
<div>
<Icon @name="file" class="has-text-grey-light" />
<Icon @name={{if metadata.pathIsDirectory "folder" "file"}} class="has-text-grey-light" />
<span class="has-text-weight-semibold is-underline">
{{metadata.path}}
</span>