diff --git a/changelog/27131.txt b/changelog/27131.txt new file mode 100644 index 000000000000..465da55fe963 --- /dev/null +++ b/changelog/27131.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fix configuration link from Secret Engine list view for Ember engines. +``` \ No newline at end of file diff --git a/ui/app/models/secret-engine.js b/ui/app/models/secret-engine.js index 3171de36f593..aff586183d4f 100644 --- a/ui/app/models/secret-engine.js +++ b/ui/app/models/secret-engine.js @@ -155,6 +155,13 @@ export default class SecretEngineModel extends Model { return `vault.cluster.secrets.backend.list-root`; } + get backendConfigurationLink() { + if (isAddonEngine(this.engineType, this.version)) { + return `vault.cluster.secrets.backend.${this.engineType}.configuration`; + } + return `vault.cluster.secrets.backend.configuration`; + } + 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 5a86dd7e446c..5457cb4328e7 100644 --- a/ui/app/templates/vault/cluster/secrets/backends.hbs +++ b/ui/app/templates/vault/cluster/secrets/backends.hbs @@ -96,7 +96,7 @@ /> diff --git a/ui/tests/acceptance/settings-test.js b/ui/tests/acceptance/settings-test.js index 0b9d568318c5..a2c005a4af83 100644 --- a/ui/tests/acceptance/settings-test.js +++ b/ui/tests/acceptance/settings-test.js @@ -3,7 +3,7 @@ * SPDX-License-Identifier: BUSL-1.1 */ -import { currentURL, find, visit, settled } from '@ember/test-helpers'; +import { currentURL, find, visit, settled, click } from '@ember/test-helpers'; import { module, test } from 'qunit'; import { setupApplicationTest } from 'ember-qunit'; import { v4 as uuidv4 } from 'uuid'; @@ -11,8 +11,12 @@ import { v4 as uuidv4 } from 'uuid'; import backendListPage from 'vault/tests/pages/secrets/backends'; import mountSecrets from 'vault/tests/pages/settings/mount-secret-backend'; import authPage from 'vault/tests/pages/auth'; +import { deleteEngineCmd, mountEngineCmd, runCmd } from 'vault/tests/helpers/commands'; +import { GENERAL } from 'vault/tests/helpers/general-selectors'; -module('Acceptance | settings', function (hooks) { +const { searchSelect } = GENERAL; + +module('Acceptance | secret engine mount settings', function (hooks) { setupApplicationTest(hooks); hooks.beforeEach(function () { @@ -20,7 +24,7 @@ module('Acceptance | settings', function (hooks) { return authPage.login(); }); - test('settings', async function (assert) { + test('it allows you to mount a secret engine', async function (assert) { const type = 'consul'; const path = `settings-path-${this.uid}`; @@ -44,9 +48,47 @@ module('Acceptance | settings', function (hooks) { ); await settled(); assert.strictEqual(currentURL(), `/vault/secrets`, 'redirects to secrets page'); - const row = backendListPage.rows.filterBy('path', path + '/')[0]; - await row.menu(); + // cleanup + await runCmd(deleteEngineCmd(path)); + }); + + test('it navigates to ember engine configuration page', async function (assert) { + const type = 'ldap'; + const path = `ldap-${this.uid}`; + + await visit('/vault/settings/mount-secret-backend'); + await runCmd(mountEngineCmd(type, path), false); + await visit('/vault/secrets'); + await click(searchSelect.trigger('filter-by-engine-name')); + await click(searchSelect.option(searchSelect.optionIndex(path))); + await click(GENERAL.menuTrigger); + await backendListPage.configLink(); + assert.strictEqual( + currentURL(), + `/vault/secrets/${path}/${type}/configuration`, + 'navigates to the config page for ember engine' + ); + // clean up + await runCmd(deleteEngineCmd(path)); + }); + + test('it navigates to non-ember engine configuration page', async function (assert) { + const type = 'ssh'; + const path = `ssh-${this.uid}`; + + await visit('/vault/settings/mount-secret-backend'); + await runCmd(mountEngineCmd(type, path), false); + await visit('/vault/secrets'); + await click(searchSelect.trigger('filter-by-engine-name')); + await click(searchSelect.option(searchSelect.optionIndex(path))); + await click(GENERAL.menuTrigger); await backendListPage.configLink(); - assert.strictEqual(currentURL(), `/vault/secrets/${path}/configuration`, 'navigates to the config page'); + assert.strictEqual( + currentURL(), + `/vault/secrets/${path}/configuration`, + 'navigates to the config page for non-ember engine' + ); + // clean up + await runCmd(deleteEngineCmd(path)); }); });