-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter Secret Engine List view by engineType and/or name #20481
Changes from 12 commits
7f39915
152aac3
252c396
4e9682e
e54db03
c143cf9
97b80df
b5c2e93
577886c
4a1c09f
34f71f9
586d8e5
994ccde
f11e204
7d1c095
a66e319
eed1407
3faa498
ed8ec45
92f8aa9
d90698a
5ea6e66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:improvement | ||
ui: Add filtering by engine type and engine name on the Secret Engine list view. | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,106 +7,115 @@ | |
</PageHeader> | ||
|
||
<Toolbar> | ||
<ToolbarFilters> | ||
<SearchSelect | ||
@id="filter-by-engine-type" | ||
@options={{this.secretEngineArrayByType}} | ||
@selectLimit="1" | ||
@disallowNewItems={{true}} | ||
@fallbackComponent="input-search" | ||
@onChange={{this.filterEngineType}} | ||
@placeholder={{"Filter by engine type"}} | ||
@displayInherit={{true}} | ||
@inputValue={{if this.selectedEngineType (array this.selectedEngineType)}} | ||
@disabled={{if this.selectedEngineName true false}} | ||
class="is-marginless" | ||
/> | ||
<SearchSelect | ||
@id="filter-by-engine-name" | ||
@options={{this.secretEngineArrayByName}} | ||
@selectLimit="1" | ||
@disallowNewItems={{true}} | ||
@fallbackComponent="input-search" | ||
@onChange={{this.filterEngineName}} | ||
@placeholder={{"Filter by engine name"}} | ||
@displayInherit={{true}} | ||
@inputValue={{if this.selectedEngineName (array this.selectedEngineName)}} | ||
class="is-marginless has-left-padding-s" | ||
/> | ||
</ToolbarFilters> | ||
<ToolbarActions> | ||
<ToolbarLink @route="vault.cluster.settings.mount-secret-backend" @type="add" data-test-enable-engine> | ||
Enable new engine | ||
</ToolbarLink> | ||
</ToolbarActions> | ||
</Toolbar> | ||
|
||
{{#each this.supportedBackends as |backend|}} | ||
{{#let | ||
(if | ||
(eq backend.engineType "kmip") | ||
"vault.cluster.secrets.backend.kmip.scopes" | ||
(if | ||
(eq backend.engineType "database") "vault.cluster.secrets.backend.overview" "vault.cluster.secrets.backend.list-root" | ||
) | ||
) | ||
as |backendLink| | ||
}} | ||
<LinkableItem data-test-secret-backend-row={{backend.id}} @link={{hash route=backendLink model=backend.id}} as |Li|> | ||
<Li.content | ||
@accessor={{if (eq backend.version 2) (concat "v2 " backend.accessor) backend.accessor}} | ||
@description={{backend.description}} | ||
@glyphText={{backend.engineType}} | ||
@glyph={{backend.icon}} | ||
@link={{hash route=backendLink model=backend.id}} | ||
@title={{backend.path}} | ||
/> | ||
<Li.menu> | ||
<PopupMenu @name="engine-menu"> | ||
<Confirm as |c|> | ||
<nav class="menu" aria-label="supported secrets engine menu"> | ||
<ul class="menu-list"> | ||
<li class="action"> | ||
<LinkTo @route="vault.cluster.secrets.backend.configuration" @model={{backend.id}}> | ||
View configuration | ||
</LinkTo> | ||
</li> | ||
{{#if (not-eq backend.type "cubbyhole")}} | ||
<li class="action"> | ||
<c.Message | ||
@id={{backend.id}} | ||
@triggerText="Disable" | ||
@message="Any data in this engine will be permanently deleted." | ||
@title="Disable engine?" | ||
@confirmButtonText="Disable" | ||
@onConfirm={{perform this.disableEngine backend}} | ||
data-test-engine-disable="true" | ||
/> | ||
</li> | ||
{{/if}} | ||
{{#if this.item.updatePath.isPending}} | ||
<li class="action"> | ||
<button disabled type="button" class="link button is-loading is-transparent"> | ||
loading | ||
</button> | ||
</li> | ||
{{/if}} | ||
</ul> | ||
</nav> | ||
</Confirm> | ||
</PopupMenu> | ||
</Li.menu> | ||
</LinkableItem> | ||
{{/let}} | ||
{{/each}} | ||
|
||
{{#each this.unsupportedBackends as |backend|}} | ||
<LinkableItem data-test-secret-backend-row={{backend.id}} @disabled={{true}} as |Li|> | ||
<Li.content | ||
@accessor={{if (eq backend.version 2) (concat "v2 " backend.accessor) backend.accessor}} | ||
@description={{backend.description}} | ||
@glyphText={{backend.engineType}} | ||
@glyph={{or (if (eq backend.engineType "kmip") "secrets" backend.engineType) "secrets"}} | ||
@title={{backend.path}} | ||
/> | ||
<Li.menu> | ||
<PopupMenu name="engine-menu"> | ||
{{#each this.sortedDisplayableBackends as |backend|}} | ||
<LinkedBlock | ||
@params={{array backend.backendLink backend.id}} | ||
class="list-item-row linkable-item is-no-underline" | ||
data-test-auth-backend-link={{backend.id}} | ||
@disabled={{if backend.isSupportedBackend false true}} | ||
> | ||
<div class="linkable-item-content" data-test-linkable-item-content> | ||
<div class="has-text-grey"> | ||
{{#if backend.icon}} | ||
<ToolTip @horizontalPosition="left" as |T|> | ||
<T.Trigger> | ||
<Icon @name={{backend.icon}} class="has-text-grey-light" data-test-linkable-item-glyph /> | ||
</T.Trigger> | ||
<T.Content @defaultClass="tool-tip"> | ||
<div class="box"> | ||
{{or backend.engineType backend.path}} | ||
</div> | ||
</T.Content> | ||
</ToolTip> | ||
{{/if}} | ||
{{#if backend.path}} | ||
{{#if backend.isSupportedBackend}} | ||
<LinkTo | ||
@route={{backend.backendLink}} | ||
@model={{backend.id}} | ||
class="has-text-black has-text-weight-semibold" | ||
data-test-secret-path | ||
> | ||
{{backend.path}} | ||
</LinkTo> | ||
{{else}} | ||
<span data-test-secret-path>{{backend.path}}</span> | ||
{{/if}} | ||
{{/if}} | ||
</div> | ||
{{#if backend.accessor}} | ||
<code class="has-text-grey is-size-8" data-test-linkable-item-accessor> | ||
{{backend.accessor}} | ||
</code> | ||
{{/if}} | ||
{{#if backend.description}} | ||
<ReadMore data-test-linkable-item-description> | ||
{{backend.description}} | ||
</ReadMore> | ||
{{/if}} | ||
{{yield}} | ||
</div> | ||
{{! meatball sandwich menu }} | ||
<div class="linkable-item-menu" data-test-linkable-item-menu> | ||
<PopupMenu @name="engine-menu"> | ||
<Confirm as |c|> | ||
<nav class="menu" aria-label="unsupported secrets engine menu"> | ||
<nav class="menu" aria-label="{{if backend.isSupportedBackend 'supported' 'unsupported'}} secrets engine menu"> | ||
<ul class="menu-list"> | ||
<li class="action"> | ||
<LinkTo @route="vault.cluster.secrets.backend.configuration" @model={{backend.id}} data-test-engine-config> | ||
<LinkTo @route="vault.cluster.secrets.backend.configuration" @model={{backend.id}}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This route might be different for engines like pki and kmip, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good question. That is an issue when you click on the whole row, but not when you click on the menu to go to configuration. For example, for PKI when you click on the row it navigates you to the overview page. But the configuration page is the same for all. I confirmed the same behavior on this branch is seen on main. |
||
View configuration | ||
</LinkTo> | ||
</li> | ||
<li> | ||
<c.Message | ||
@id={{backend.id}} | ||
@triggerText="Disable" | ||
@message="Any data in this engine will be permanently deleted." | ||
@title="Disable engine?" | ||
@confirmButtonText="Disable" | ||
@onConfirm={{perform this.disableEngine backend}} | ||
data-test-engine-disable="true" | ||
/> | ||
</li> | ||
{{#if (not-eq backend.type "cubbyhole")}} | ||
<li class="action"> | ||
<c.Message | ||
@id={{backend.id}} | ||
@triggerText="Disable" | ||
@message="Any data in this engine will be permanently deleted." | ||
@title="Disable engine?" | ||
@confirmButtonText="Disable" | ||
@onConfirm={{perform this.disableEngine backend}} | ||
data-test-engine-disable="true" | ||
/> | ||
</li> | ||
{{/if}} | ||
</ul> | ||
</nav> | ||
</Confirm> | ||
</PopupMenu> | ||
</Li.menu> | ||
</LinkableItem> | ||
</div> | ||
</LinkedBlock> | ||
{{/each}} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open to suggestions on ways to make this cleaner, but for context here is the flow:
options
param passed into the SearchSelect components.