mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 02:57:59 +00:00
Allow Dashboard's QA card to search for nested KVv2 secrets (#25001)
* improve overview test * add new component for KVv2 dashboard quick actions card * add changelog * revert carry over test change from ember data work. * redo test * remove the check for v2 because test suite is strange on return value CI vs locally
This commit is contained in:
3
changelog/25001.txt
Normal file
3
changelog/25001.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
```release-note:bug
|
||||||
|
ui: Allows users to search within KV v2 directories from the Dashboard's quick action card.
|
||||||
|
```
|
||||||
@@ -40,6 +40,15 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{{#if this.searchSelectParams.model}}
|
{{#if this.searchSelectParams.model}}
|
||||||
|
{{! use special input to allow searching for KVv2 secrets inside a directory }}
|
||||||
|
{{#if (eq this.selectedEngine.type "kv")}}
|
||||||
|
<KvSuggestionInput
|
||||||
|
@label="Secret Path"
|
||||||
|
@value={{this.paramValue}}
|
||||||
|
@mountPath={{this.selectedEngine.id}}
|
||||||
|
@onChange={{fn (mut this.paramValue)}}
|
||||||
|
/>
|
||||||
|
{{else}}
|
||||||
<h4 class="title is-6" data-test-card-subtitle="param">{{this.searchSelectParams.title}}</h4>
|
<h4 class="title is-6" data-test-card-subtitle="param">{{this.searchSelectParams.title}}</h4>
|
||||||
|
|
||||||
<SearchSelect
|
<SearchSelect
|
||||||
@@ -58,7 +67,7 @@
|
|||||||
@shouldRenderName={{this.searchSelectParams.nameKey}}
|
@shouldRenderName={{this.searchSelectParams.nameKey}}
|
||||||
data-test-search-select="params"
|
data-test-search-select="params"
|
||||||
/>
|
/>
|
||||||
|
{{/if}}
|
||||||
<div>
|
<div>
|
||||||
<Hds::Button
|
<Hds::Button
|
||||||
@text={{this.searchSelectParams.buttonText}}
|
@text={{this.searchSelectParams.buttonText}}
|
||||||
|
|||||||
@@ -330,16 +330,17 @@ module('Acceptance | landing page dashboard', function (hooks) {
|
|||||||
await consoleComponent.runCommands(deleteEngineCmd(databaseBackend));
|
await consoleComponent.runCommands(deleteEngineCmd(databaseBackend));
|
||||||
});
|
});
|
||||||
|
|
||||||
test('shows the correct actions and links associated with kv v1', async function (assert) {
|
test('does not show kv1 mounts', async function (assert) {
|
||||||
await runCommands(['write sys/mounts/kv type=kv', 'write kv/foo bar=baz']);
|
// delete before in case you are rerunning the test and it fails without deleting
|
||||||
|
await consoleComponent.runCommands(deleteEngineCmd('kv1'));
|
||||||
|
await consoleComponent.runCommands([`write sys/mounts/kv1 type=kv`]);
|
||||||
await settled();
|
await settled();
|
||||||
await visit('/vault/dashboard');
|
await visit('/vault/dashboard');
|
||||||
await selectChoose(SELECTORS.searchSelect('secrets-engines'), 'kv');
|
await click('[data-test-component="search-select"] .ember-basic-dropdown-trigger');
|
||||||
await fillIn(SELECTORS.selectEl, 'Find KV secrets');
|
assert
|
||||||
assert.dom(SELECTORS.emptyState('quick-actions')).doesNotExist();
|
.dom('.ember-power-select-option')
|
||||||
assert.dom(SELECTORS.subtitle('param')).hasText('Secret path');
|
.doesNotHaveTextContaining('kv1', 'dropdown does not show kv1 mount');
|
||||||
assert.dom(SELECTORS.actionButton('Read secrets')).exists({ count: 1 });
|
await consoleComponent.runCommands(deleteEngineCmd('kv1'));
|
||||||
await consoleComponent.runCommands(deleteEngineCmd('kv'));
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const SELECTORS = {
|
|||||||
cardHeader: (name) => `[data-test-dashboard-card-header="${name}"]`,
|
cardHeader: (name) => `[data-test-dashboard-card-header="${name}"]`,
|
||||||
tableRow: (name) => `[data-test-dashboard-table="${name}"] tr`,
|
tableRow: (name) => `[data-test-dashboard-table="${name}"] tr`,
|
||||||
searchSelect: (name) => `[data-test-search-select="${name}"]`,
|
searchSelect: (name) => `[data-test-search-select="${name}"]`,
|
||||||
|
kvSearchSelect: `[data-test-kv-suggestion-input]`,
|
||||||
actionButton: (action) => `[data-test-button="${action}"]`,
|
actionButton: (action) => `[data-test-button="${action}"]`,
|
||||||
title: (name) => `[data-test-title="${name}"]`,
|
title: (name) => `[data-test-title="${name}"]`,
|
||||||
subtitle: (name) => `[data-test-card-subtitle="${name}"]`,
|
subtitle: (name) => `[data-test-card-subtitle="${name}"]`,
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ module('Integration | Component | dashboard/quick-actions-card', function (hooks
|
|||||||
await selectChoose(SELECTORS.searchSelect('secrets-engines'), 'kv-v2-test');
|
await selectChoose(SELECTORS.searchSelect('secrets-engines'), 'kv-v2-test');
|
||||||
assert.dom(SELECTORS.emptyState('quick-actions')).doesNotExist();
|
assert.dom(SELECTORS.emptyState('quick-actions')).doesNotExist();
|
||||||
await fillIn(SELECTORS.selectEl, 'Find KV secrets');
|
await fillIn(SELECTORS.selectEl, 'Find KV secrets');
|
||||||
assert.dom(SELECTORS.subtitle('param')).hasText('Secret path');
|
assert.dom(SELECTORS.kvSearchSelect).exists('Shows option to search fo KVv2 secret');
|
||||||
assert.dom(SELECTORS.actionButton('Read secrets')).exists({ count: 1 });
|
assert.dom(SELECTORS.actionButton('Read secrets')).exists({ count: 1 });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user