mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
UI: check path change against all mountable backends (#23749)
* reset path when user clicks back from mount backend form * update test
This commit is contained in:
@@ -9,9 +9,8 @@ import { inject as service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import { task } from 'ember-concurrency';
|
||||
import { waitFor } from '@ember/test-waiters';
|
||||
import { supportedSecretBackends } from 'vault/helpers/supported-secret-backends';
|
||||
import { methods } from 'vault/helpers/mountable-auth-methods';
|
||||
import { isAddonEngine } from 'vault/helpers/mountable-secret-engines';
|
||||
import { isAddonEngine, allEngines } from 'vault/helpers/mountable-secret-engines';
|
||||
|
||||
/**
|
||||
* @module MountBackendForm
|
||||
@@ -49,7 +48,9 @@ export default class MountBackendForm extends Component {
|
||||
const mount = this.args.mountModel;
|
||||
const currentPath = mount.path;
|
||||
const mountTypes =
|
||||
this.args.mountType === 'secret' ? supportedSecretBackends() : methods().map((auth) => auth.type);
|
||||
this.args.mountType === 'secret'
|
||||
? allEngines().map((engine) => engine.type)
|
||||
: methods().map((auth) => auth.type);
|
||||
// if the current path has not been altered by user,
|
||||
// change it here to match the new type
|
||||
if (!currentPath || mountTypes.includes(currentPath)) {
|
||||
|
||||
@@ -147,13 +147,13 @@ module('Integration | Component | mount backend form', function (hooks) {
|
||||
await render(
|
||||
hbs`<MountBackendForm @mountType="secret" @mountModel={{this.model}} @onMountSuccess={{this.onMountSuccess}} />`
|
||||
);
|
||||
await component.selectType('kv');
|
||||
await component.selectType('azure');
|
||||
await component.next();
|
||||
assert.strictEqual(component.pathValue, 'kv', 'sets the value of the type');
|
||||
assert.strictEqual(component.pathValue, 'azure', 'sets the value of the type');
|
||||
await component.back();
|
||||
await component.selectType('ssh');
|
||||
await component.selectType('nomad');
|
||||
await component.next();
|
||||
assert.strictEqual(component.pathValue, 'ssh', 'updates the value of the type');
|
||||
assert.strictEqual(component.pathValue, 'nomad', 'updates the value of the type');
|
||||
});
|
||||
|
||||
test('it keeps path value if the user has changed it', async function (assert) {
|
||||
|
||||
Reference in New Issue
Block a user