From 7f39915f10da1d98f5e835e02e46c39015449798 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Mon, 1 May 2023 14:28:09 -0600 Subject: [PATCH 01/19] initial WIP glimmerize the controller --- .../vault/cluster/secrets/backends.js | 61 ++++++++++++------- .../vault/cluster/secrets/backends.hbs | 16 +++++ 2 files changed, 55 insertions(+), 22 deletions(-) diff --git a/ui/app/controllers/vault/cluster/secrets/backends.js b/ui/app/controllers/vault/cluster/secrets/backends.js index fd1ef17c794d..d2cb4f20b9d8 100644 --- a/ui/app/controllers/vault/cluster/secrets/backends.js +++ b/ui/app/controllers/vault/cluster/secrets/backends.js @@ -2,36 +2,36 @@ * Copyright (c) HashiCorp, Inc. * SPDX-License-Identifier: MPL-2.0 */ - -import { filterBy } from '@ember/object/computed'; -import { computed } from '@ember/object'; +/* eslint ember/no-computed-properties-in-native-classes: 'warn' */ import Controller from '@ember/controller'; -import { task } from 'ember-concurrency'; -import { supportedSecretBackends } from 'vault/helpers/supported-secret-backends'; import { inject as service } from '@ember/service'; +import { action } from '@ember/object'; +import { tracked } from '@glimmer/tracking'; +import { filterBy } from '@ember/object/computed'; +import { dropTask, task } from 'ember-concurrency'; +import { supportedSecretBackends } from 'vault/helpers/supported-secret-backends'; + const LINKED_BACKENDS = supportedSecretBackends(); -export default Controller.extend({ - flashMessages: service(), - displayableBackends: filterBy('model', 'shouldIncludeInList'), +export default class VaultClusterSecretsBackendController extends Controller { + @service flashMessages; + @filterBy('model', 'shouldIncludeInList') displayableBackends; + + @tracked secretEngineOptions = []; - supportedBackends: computed('displayableBackends', 'displayableBackends.[]', function () { + get supportedBackends() { return (this.displayableBackends || []) .filter((backend) => LINKED_BACKENDS.includes(backend.get('engineType'))) .sortBy('id'); - }), + } - unsupportedBackends: computed( - 'displayableBackends', - 'displayableBackends.[]', - 'supportedBackends', - 'supportedBackends.[]', - function () { - return (this.displayableBackends || []).slice().removeObjects(this.supportedBackends).sortBy('id'); - } - ), + get unsupportedBackends() { + return (this.displayableBackends || []).slice().removeObjects(this.supportedBackends).sortBy('id'); + } - disableEngine: task(function* (engine) { + @task + @dropTask + *disableEngine(engine) { const { engineType, path } = engine; try { yield engine.destroyRecord(); @@ -41,5 +41,22 @@ export default Controller.extend({ `There was an error disabling the ${engineType} Secrets Engine at ${path}: ${err.errors.join(' ')}.` ); } - }).drop(), -}); + } + + @action + selectEngineType([engine]) { + this.engineType = engine; + if (!engine) { + this.secretEngineOptions = []; + // // on clear, also make sure auth method is cleared + // this.selectedAuthMethod = null; + } else { + // Side effect: set auth namespaces + // const mounts = this.filteredActivityByNamespace.mounts?.map((mount) => ({ + // id: mount.label, + // name: mount.label, + // })); + this.secretEngineOptions = ['Test', 'test']; + } + } +} diff --git a/ui/app/templates/vault/cluster/secrets/backends.hbs b/ui/app/templates/vault/cluster/secrets/backends.hbs index e4bd54c5926d..31611a848664 100644 --- a/ui/app/templates/vault/cluster/secrets/backends.hbs +++ b/ui/app/templates/vault/cluster/secrets/backends.hbs @@ -7,6 +7,21 @@ + + {{#if true}} + + {{/if}} + Enable new engine @@ -57,6 +72,7 @@ /> {{/if}} + {{! ARG THERE IS NO ITEM??? }} {{#if this.item.updatePath.isPending}}
  • -
  • - {{/if}} @@ -94,42 +91,4 @@ {{/let}} -{{/each}} - -{{#each this.unsupportedBackends as |backend|}} - - - - - - - - - - {{/each}} \ No newline at end of file From c143cf9078fe7e14f61cd4c56b1a1f513010cebd Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Tue, 2 May 2023 20:31:45 -0600 Subject: [PATCH 06/19] fixed when you have two selected filters, but broken for multiples of the same type with different names --- ui/app/controllers/vault/cluster/secrets/backends.js | 7 +++---- ui/app/templates/vault/cluster/secrets/backends.hbs | 2 ++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ui/app/controllers/vault/cluster/secrets/backends.js b/ui/app/controllers/vault/cluster/secrets/backends.js index 0c01e36ca173..a989c466bf9e 100644 --- a/ui/app/controllers/vault/cluster/secrets/backends.js +++ b/ui/app/controllers/vault/cluster/secrets/backends.js @@ -23,7 +23,7 @@ export default class VaultClusterSecretsBackendController extends Controller { // ARG TMRW: solve for when both filters are set get sortedDisplayableBackends() { - // show supported SE first and organize those groups by id. + // show supported secret engines first and then organize those by id. const sortedDisplayableBackends = this.displayableBackends.sort( (a, b) => b.isSupportedBackend - a.isSupportedBackend || a.id - b.id ); @@ -46,16 +46,15 @@ export default class VaultClusterSecretsBackendController extends Controller { return sortedDisplayableBackends; } - // FOR FILTER LISTS get secretEngineArrayByType() { - return this.displayableBackends.map((modelObject) => ({ + return this.sortedDisplayableBackends.map((modelObject) => ({ name: modelObject.engineType, id: modelObject.engineType, })); } get secretEngineArrayByName() { - return this.displayableBackends.map((modelObject) => ({ + return this.sortedDisplayableBackends.map((modelObject) => ({ name: modelObject.id, id: modelObject.id, })); diff --git a/ui/app/templates/vault/cluster/secrets/backends.hbs b/ui/app/templates/vault/cluster/secrets/backends.hbs index 38e326ca8709..33052187bb46 100644 --- a/ui/app/templates/vault/cluster/secrets/backends.hbs +++ b/ui/app/templates/vault/cluster/secrets/backends.hbs @@ -16,6 +16,7 @@ @onChange={{this.filterEngineType}} @placeholder={{"Filter by engine type"}} @displayInherit={{true}} + @inputValue={{if this.selectedEngineType (array this.selectedEngineType)}} class="is-marginless" /> From 97b80df03445354d4de70f77b2524c63f6f7449a Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Wed, 3 May 2023 08:24:43 -0600 Subject: [PATCH 07/19] remove repeated engineTypes in filter list --- ui/app/controllers/vault/cluster/secrets/backends.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/app/controllers/vault/cluster/secrets/backends.js b/ui/app/controllers/vault/cluster/secrets/backends.js index a989c466bf9e..aef310b7747b 100644 --- a/ui/app/controllers/vault/cluster/secrets/backends.js +++ b/ui/app/controllers/vault/cluster/secrets/backends.js @@ -21,6 +21,7 @@ export default class VaultClusterSecretsBackendController extends Controller { // ARG TODO: check multiple types of same secret Engine // check pagination. // ARG TMRW: solve for when both filters are set + // test with hundreds of mounts get sortedDisplayableBackends() { // show supported secret engines first and then organize those by id. @@ -47,9 +48,13 @@ export default class VaultClusterSecretsBackendController extends Controller { } get secretEngineArrayByType() { - return this.sortedDisplayableBackends.map((modelObject) => ({ - name: modelObject.engineType, - id: modelObject.engineType, + const arrayOfAllEngineTypes = this.sortedDisplayableBackends.map((modelObject) => modelObject.engineType); + // filter out repeated engineTypes (e.g. [secret, secret] => [secret]) + const arrayOfUniqueEngineTypes = [...new Set(arrayOfAllEngineTypes)]; + + return arrayOfUniqueEngineTypes.map((engineType) => ({ + name: engineType, + id: engineType, })); } From b5c2e93831d341f93b4af3c659c99e1db54aa745 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Wed, 3 May 2023 08:54:11 -0600 Subject: [PATCH 08/19] add disabled to power select --- ui/app/controllers/vault/cluster/secrets/backends.js | 10 ++++------ ui/app/templates/vault/cluster/secrets/backends.hbs | 3 +++ ui/lib/core/addon/components/search-select.hbs | 1 + ui/lib/core/addon/components/search-select.js | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/app/controllers/vault/cluster/secrets/backends.js b/ui/app/controllers/vault/cluster/secrets/backends.js index aef310b7747b..aa0943854ba0 100644 --- a/ui/app/controllers/vault/cluster/secrets/backends.js +++ b/ui/app/controllers/vault/cluster/secrets/backends.js @@ -36,12 +36,10 @@ export default class VaultClusterSecretsBackendController extends Controller { } // filter list by engine name, ex: 'secret' if (this.selectedEngineName) { - const engineObject = sortedDisplayableBackends.find( - (modelObject) => modelObject.id === this.selectedEngineName - ); - return sortedDisplayableBackends.filter( - (backend) => engineObject.engineType === backend.get('engineType') - ); + // const engineObject = sortedDisplayableBackends.find( + // (modelObject) => modelObject.id === this.selectedEngineName + // ); + return sortedDisplayableBackends.filter((backend) => this.selectedEngineName === backend.get('id')); } // if no filter, return full sorted list return sortedDisplayableBackends; diff --git a/ui/app/templates/vault/cluster/secrets/backends.hbs b/ui/app/templates/vault/cluster/secrets/backends.hbs index 33052187bb46..f4bea52e463b 100644 --- a/ui/app/templates/vault/cluster/secrets/backends.hbs +++ b/ui/app/templates/vault/cluster/secrets/backends.hbs @@ -9,6 +9,7 @@ {{#if this.shouldRenderName}} diff --git a/ui/lib/core/addon/components/search-select.js b/ui/lib/core/addon/components/search-select.js index 7380e6d57b5d..f3c13c40737f 100644 --- a/ui/lib/core/addon/components/search-select.js +++ b/ui/lib/core/addon/components/search-select.js @@ -53,6 +53,7 @@ import { filterOptions, defaultMatcher } from 'ember-power-select/utils/group-ut * @param {string} [placeholder] - text you wish to replace the default "search" with * @param {boolean} [displayInherit=false] - if you need the search select component to display inherit instead of box. * @param {function} [renderInfoTooltip] - receives each inputValue string and list of dropdownOptions as args, so parent can determine when to render a tooltip beside a selectedOption and the tooltip text. see 'oidc/provider-form.js' + * @param {boolean} [disabled] - if true sets the disabled property on the ember-power-select component and makes it unusable. * // * advanced customization * @param {Array} options - array of objects passed directly to the power-select component. If doing this, `models` should not also be passed as that will overwrite the From 577886c4cd6b1384aba16bb6c4a0886728370615 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Wed, 3 May 2023 10:49:02 -0600 Subject: [PATCH 09/19] fix bug of glimmer for the concurrency task. --- .../vault/cluster/secrets/backends.js | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/ui/app/controllers/vault/cluster/secrets/backends.js b/ui/app/controllers/vault/cluster/secrets/backends.js index aa0943854ba0..012ccd3e10d4 100644 --- a/ui/app/controllers/vault/cluster/secrets/backends.js +++ b/ui/app/controllers/vault/cluster/secrets/backends.js @@ -8,7 +8,7 @@ import { inject as service } from '@ember/service'; import { action } from '@ember/object'; import { tracked } from '@glimmer/tracking'; import { filterBy } from '@ember/object/computed'; -import { dropTask, task } from 'ember-concurrency'; +import { dropTask } from 'ember-concurrency'; export default class VaultClusterSecretsBackendController extends Controller { @service flashMessages; @@ -18,9 +18,7 @@ export default class VaultClusterSecretsBackendController extends Controller { @tracked selectedEngineType = null; @tracked selectedEngineName = null; - // ARG TODO: check multiple types of same secret Engine // check pagination. - // ARG TMRW: solve for when both filters are set // test with hundreds of mounts get sortedDisplayableBackends() { @@ -28,23 +26,33 @@ export default class VaultClusterSecretsBackendController extends Controller { const sortedDisplayableBackends = this.displayableBackends.sort( (a, b) => b.isSupportedBackend - a.isSupportedBackend || a.id - b.id ); + // filter list by engine type, ex: 'kv' if (this.selectedEngineType) { - return sortedDisplayableBackends.filter( - (backend) => this.selectedEngineType === backend.get('engineType') - ); + // check first if the user has also filtered by name. + if (this.selectedEngineName) { + return this.filterByName(sortedDisplayableBackends); + } + // otherwise filter by engine type + return this.filterByEngineType(sortedDisplayableBackends); } + // filter list by engine name, ex: 'secret' if (this.selectedEngineName) { - // const engineObject = sortedDisplayableBackends.find( - // (modelObject) => modelObject.id === this.selectedEngineName - // ); - return sortedDisplayableBackends.filter((backend) => this.selectedEngineName === backend.get('id')); + return this.filterByName(sortedDisplayableBackends); } - // if no filter, return full sorted list + // no filters, return full sorted list. return sortedDisplayableBackends; } + filterByName(backendList) { + return backendList.filter((backend) => this.selectedEngineName === backend.get('id')); + } + + filterByEngineType(backendList) { + return backendList.filter((backend) => this.selectedEngineType === backend.get('engineType')); + } + get secretEngineArrayByType() { const arrayOfAllEngineTypes = this.sortedDisplayableBackends.map((modelObject) => modelObject.engineType); // filter out repeated engineTypes (e.g. [secret, secret] => [secret]) @@ -73,7 +81,6 @@ export default class VaultClusterSecretsBackendController extends Controller { this.selectedEngineName = name; } - @task @dropTask *disableEngine(engine) { const { engineType, path } = engine; From 4a1c09f80a48c8c929f241d14993c514e01ad0fc Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Wed, 3 May 2023 11:01:41 -0600 Subject: [PATCH 10/19] wording fix --- ui/app/templates/vault/cluster/secrets/backends.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/app/templates/vault/cluster/secrets/backends.hbs b/ui/app/templates/vault/cluster/secrets/backends.hbs index f4bea52e463b..75e5f9c5a801 100644 --- a/ui/app/templates/vault/cluster/secrets/backends.hbs +++ b/ui/app/templates/vault/cluster/secrets/backends.hbs @@ -28,7 +28,7 @@ @disallowNewItems={{true}} @fallbackComponent="input-search" @onChange={{this.filterEngineName}} - @placeholder={{"Filter by name"}} + @placeholder={{"Filter by engine name"}} @displayInherit={{true}} @inputValue={{if this.selectedEngineName (array this.selectedEngineName)}} class="is-marginless has-left-padding-s" From 34f71f9ad07b1c01019c0efd8048424cbcc96d27 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Thu, 4 May 2023 13:13:20 -0600 Subject: [PATCH 11/19] remove linkableItem and the nested contextual compnents to help with loading speed. --- .../vault/cluster/secrets/backends.js | 13 +- ui/app/models/secret-engine.js | 17 +++ .../vault/cluster/secrets/backends.hbs | 130 ++++++++++-------- ui/lib/core/addon/components/linkable-item.js | 28 ---- .../addon/components/linkable-item/content.js | 36 ----- .../addon/components/linkable-item/menu.js | 27 ---- .../templates/components/linkable-item.hbs | 17 --- .../components/linkable-item/content.hbs | 44 ------ .../components/linkable-item/menu.hbs | 3 - ui/lib/core/app/components/linkable-item.js | 6 - 10 files changed, 98 insertions(+), 223 deletions(-) delete mode 100644 ui/lib/core/addon/components/linkable-item.js delete mode 100644 ui/lib/core/addon/components/linkable-item/content.js delete mode 100644 ui/lib/core/addon/components/linkable-item/menu.js delete mode 100644 ui/lib/core/addon/templates/components/linkable-item.hbs delete mode 100644 ui/lib/core/addon/templates/components/linkable-item/content.hbs delete mode 100644 ui/lib/core/addon/templates/components/linkable-item/menu.hbs delete mode 100644 ui/lib/core/app/components/linkable-item.js diff --git a/ui/app/controllers/vault/cluster/secrets/backends.js b/ui/app/controllers/vault/cluster/secrets/backends.js index 012ccd3e10d4..7e5f6bdfec8d 100644 --- a/ui/app/controllers/vault/cluster/secrets/backends.js +++ b/ui/app/controllers/vault/cluster/secrets/backends.js @@ -18,12 +18,9 @@ export default class VaultClusterSecretsBackendController extends Controller { @tracked selectedEngineType = null; @tracked selectedEngineName = null; - // check pagination. - // test with hundreds of mounts - get sortedDisplayableBackends() { // show supported secret engines first and then organize those by id. - const sortedDisplayableBackends = this.displayableBackends.sort( + const sortedBackends = this.displayableBackends.sort( (a, b) => b.isSupportedBackend - a.isSupportedBackend || a.id - b.id ); @@ -31,18 +28,18 @@ export default class VaultClusterSecretsBackendController extends Controller { if (this.selectedEngineType) { // check first if the user has also filtered by name. if (this.selectedEngineName) { - return this.filterByName(sortedDisplayableBackends); + return this.filterByName(sortedBackends); } // otherwise filter by engine type - return this.filterByEngineType(sortedDisplayableBackends); + return this.filterByEngineType(sortedBackends); } // filter list by engine name, ex: 'secret' if (this.selectedEngineName) { - return this.filterByName(sortedDisplayableBackends); + return this.filterByName(sortedBackends); } // no filters, return full sorted list. - return sortedDisplayableBackends; + return sortedBackends; } filterByName(backendList) { diff --git a/ui/app/models/secret-engine.js b/ui/app/models/secret-engine.js index e16c85a6d154..afda9977d87f 100644 --- a/ui/app/models/secret-engine.js +++ b/ui/app/models/secret-engine.js @@ -150,6 +150,23 @@ export default class SecretEngineModel extends Model { return LINKED_BACKENDS.includes(this.engineType); } + get backendLink() { + if (this.engineType === 'kmip') { + return 'vault.cluster.secrets.backend.kmip.scopes'; + } + if (this.engineType === 'database') { + return 'vault.cluster.secrets.backend.overview'; + } + return 'vault.cluster.secrets.backend.list-root'; + } + + get accessor() { + if (this.version === 2) { + return `v2 ${this.accessor}`; + } + return this.accessor; + } + get localDisplay() { return this.local ? 'local' : 'replicated'; } diff --git a/ui/app/templates/vault/cluster/secrets/backends.hbs b/ui/app/templates/vault/cluster/secrets/backends.hbs index 75e5f9c5a801..7d894424748b 100644 --- a/ui/app/templates/vault/cluster/secrets/backends.hbs +++ b/ui/app/templates/vault/cluster/secrets/backends.hbs @@ -22,7 +22,7 @@ class="is-marginless" />
    - {{#each this.sortedDisplayableBackends 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| - }} - - - - - - + + + + {{/each}} \ No newline at end of file diff --git a/ui/lib/core/addon/components/linkable-item.js b/ui/lib/core/addon/components/linkable-item.js deleted file mode 100644 index 00ea3100c840..000000000000 --- a/ui/lib/core/addon/components/linkable-item.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -import Component from '@glimmer/component'; -import layout from '../templates/components/linkable-item'; -import { setComponentTemplate } from '@ember/component'; - -/** - * @module LinkableItem - * LinkableItem components have two contextual components, a Content component used to show information on the left with a Menu component on the right, all aligned vertically centered. If passed a link, the block will be clickable. - * - * @example - * ```js - * - * // Use and here - * - * ``` - * - * @param {object} [link=null] - Link should have route and model - * @param {boolean} [disabled=false] - If no link then should be given a disabled attribute equal to true - */ - -/* eslint ember/no-empty-glimmer-component-classes: 'warn' */ -class LinkableItemComponent extends Component {} - -export default setComponentTemplate(layout, LinkableItemComponent); diff --git a/ui/lib/core/addon/components/linkable-item/content.js b/ui/lib/core/addon/components/linkable-item/content.js deleted file mode 100644 index 5f29692e3bba..000000000000 --- a/ui/lib/core/addon/components/linkable-item/content.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -import Component from '@glimmer/component'; -import layout from '../../templates/components/linkable-item/content'; -import { setComponentTemplate } from '@ember/component'; - -/** - * @module Content - * Content components are contextual components of LinkableItem, used to display content on the left side of a LinkableItem component. - * - * @example - * ```js - * - * - * - * ``` - * @param {string} accessor=null - formatted as HTML tag - * @param {string} description=null - will truncate if wider than parent div - * @param {string} glyphText=null - tooltip for glyph - * @param {string} glyph=null - will display as icon beside the title - * @param {string} title=null - if @link object is passed in then title will link to @link.route - */ - -/* eslint ember/no-empty-glimmer-component-classes: 'warn' */ -class ContentComponent extends Component {} - -export default setComponentTemplate(layout, ContentComponent); diff --git a/ui/lib/core/addon/components/linkable-item/menu.js b/ui/lib/core/addon/components/linkable-item/menu.js deleted file mode 100644 index acc36b3eec34..000000000000 --- a/ui/lib/core/addon/components/linkable-item/menu.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -import Component from '@glimmer/component'; -import layout from '../../templates/components/linkable-item/menu'; -import { setComponentTemplate } from '@ember/component'; - -/** - * @module Menu - * Menu components are contextual components of LinkableItem, used to display a menu on the right side of a LinkableItem component. - * - * @example - * ```js - * - * - * Some menu here - * - * - * ``` - */ - -/* eslint ember/no-empty-glimmer-component-classes: 'warn' */ -class MenuComponent extends Component {} - -export default setComponentTemplate(layout, MenuComponent); diff --git a/ui/lib/core/addon/templates/components/linkable-item.hbs b/ui/lib/core/addon/templates/components/linkable-item.hbs deleted file mode 100644 index d2de17e04502..000000000000 --- a/ui/lib/core/addon/templates/components/linkable-item.hbs +++ /dev/null @@ -1,17 +0,0 @@ -
    - {{#if @disabled}} -
    - {{yield (hash content=(component "linkable-item/content"))}} - {{yield (hash menu=(component "linkable-item/menu"))}} -
    - {{else}} - - {{yield (hash content=(component "linkable-item/content"))}} - {{yield (hash menu=(component "linkable-item/menu"))}} - - {{/if}} -
    \ No newline at end of file diff --git a/ui/lib/core/addon/templates/components/linkable-item/content.hbs b/ui/lib/core/addon/templates/components/linkable-item/content.hbs deleted file mode 100644 index d8f77fa01b84..000000000000 --- a/ui/lib/core/addon/templates/components/linkable-item/content.hbs +++ /dev/null @@ -1,44 +0,0 @@ -
    -
    - {{#if @glyph}} - - - - - -
    - {{or @glyphText @title}} -
    -
    -
    - {{/if}} - - {{#if @title}} - {{#if @link}} - - {{@title}} - - {{else}} - {{@title}} - {{/if}} - {{/if}} -
    - {{#if @accessor}} - - {{@accessor}} - - {{/if}} - - {{#if @description}} - - {{@description}} - - {{/if}} - - {{yield}} -
    \ No newline at end of file diff --git a/ui/lib/core/addon/templates/components/linkable-item/menu.hbs b/ui/lib/core/addon/templates/components/linkable-item/menu.hbs deleted file mode 100644 index 2361fb7da48e..000000000000 --- a/ui/lib/core/addon/templates/components/linkable-item/menu.hbs +++ /dev/null @@ -1,3 +0,0 @@ -
    - {{yield}} -
    \ No newline at end of file diff --git a/ui/lib/core/app/components/linkable-item.js b/ui/lib/core/app/components/linkable-item.js deleted file mode 100644 index 628caf8912b9..000000000000 --- a/ui/lib/core/app/components/linkable-item.js +++ /dev/null @@ -1,6 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -export { default } from 'core/components/linkable-item'; From 586d8e5327f114c3a4d92255eb908c5c56d22ea2 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Thu, 4 May 2023 13:34:51 -0600 Subject: [PATCH 12/19] add changelog --- changelog/20481.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/20481.txt diff --git a/changelog/20481.txt b/changelog/20481.txt new file mode 100644 index 000000000000..49e1fe867626 --- /dev/null +++ b/changelog/20481.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: Add filtering by engine type and engine name on the Secret Engine list view. +``` \ No newline at end of file From 994ccde81084f0815f06795dbd03a5443b30ecd9 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Thu, 4 May 2023 19:53:43 -0600 Subject: [PATCH 13/19] fix some tests --- ui/app/controllers/vault/cluster/secrets/backends.js | 6 +++--- ui/tests/acceptance/settings/mount-secret-backend-test.js | 2 +- ui/tests/pages/secrets/backends.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ui/app/controllers/vault/cluster/secrets/backends.js b/ui/app/controllers/vault/cluster/secrets/backends.js index 7e5f6bdfec8d..2ee3dfe978ec 100644 --- a/ui/app/controllers/vault/cluster/secrets/backends.js +++ b/ui/app/controllers/vault/cluster/secrets/backends.js @@ -24,7 +24,7 @@ export default class VaultClusterSecretsBackendController extends Controller { (a, b) => b.isSupportedBackend - a.isSupportedBackend || a.id - b.id ); - // filter list by engine type, ex: 'kv' + // return an options list to filter by engine type, ex: 'kv' if (this.selectedEngineType) { // check first if the user has also filtered by name. if (this.selectedEngineName) { @@ -34,7 +34,7 @@ export default class VaultClusterSecretsBackendController extends Controller { return this.filterByEngineType(sortedBackends); } - // filter list by engine name, ex: 'secret' + // return an options list to filter by engine name, ex: 'secret' if (this.selectedEngineName) { return this.filterByName(sortedBackends); } @@ -52,7 +52,7 @@ export default class VaultClusterSecretsBackendController extends Controller { get secretEngineArrayByType() { const arrayOfAllEngineTypes = this.sortedDisplayableBackends.map((modelObject) => modelObject.engineType); - // filter out repeated engineTypes (e.g. [secret, secret] => [secret]) + // filter out repeated engineTypes (e.g. [kv, kv] => [kv]) const arrayOfUniqueEngineTypes = [...new Set(arrayOfAllEngineTypes)]; return arrayOfUniqueEngineTypes.map((engineType) => ({ diff --git a/ui/tests/acceptance/settings/mount-secret-backend-test.js b/ui/tests/acceptance/settings/mount-secret-backend-test.js index 33c9152e5994..12c3ef68446f 100644 --- a/ui/tests/acceptance/settings/mount-secret-backend-test.js +++ b/ui/tests/acceptance/settings/mount-secret-backend-test.js @@ -126,7 +126,7 @@ module('Acceptance | settings/mount-secret-backend', function (hooks) { await page.secretList(); await settled(); assert - .dom(`[data-test-secret-backend-row=${path}]`) + .dom(`[data-test-auth-backend-link=${path}]`) .exists({ count: 1 }, 'renders only one instance of the engine'); }); diff --git a/ui/tests/pages/secrets/backends.js b/ui/tests/pages/secrets/backends.js index f0dc796e47f6..1a7d3ebbbfdf 100644 --- a/ui/tests/pages/secrets/backends.js +++ b/ui/tests/pages/secrets/backends.js @@ -9,7 +9,7 @@ import uiPanel from 'vault/tests/pages/components/console/ui-panel'; export default create({ consoleToggle: clickable('[data-test-console-toggle]'), visit: visitable('/vault/secrets'), - rows: collection('[data-test-secret-backend-row]', { + rows: collection('[data-test-auth-backend-link]', { path: text('[data-test-secret-path]'), menu: clickable('[data-test-popup-menu-trigger]'), }), From f11e204603dcb47f7db537fb7eb77dce2cdb6b67 Mon Sep 17 00:00:00 2001 From: Angel Garbarino Date: Fri, 5 May 2023 10:15:01 -0600 Subject: [PATCH 14/19] add test coverage --- .../vault/cluster/secrets/backends.hbs | 2 +- .../secrets/backend/engines-test.js | 99 ++++++++++++++++--- .../components/linkable-item-test.js | 88 ----------------- 3 files changed, 87 insertions(+), 102 deletions(-) delete mode 100644 ui/tests/integration/components/linkable-item-test.js diff --git a/ui/app/templates/vault/cluster/secrets/backends.hbs b/ui/app/templates/vault/cluster/secrets/backends.hbs index 7d894424748b..a3bf5d6a499d 100644 --- a/ui/app/templates/vault/cluster/secrets/backends.hbs +++ b/ui/app/templates/vault/cluster/secrets/backends.hbs @@ -89,7 +89,7 @@ {{yield}} {{! meatball sandwich menu }} -
    +