mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
* mimic engine disable function from list view into dropdown option * add line Co-authored-by: Dan Rivera <dan.rivera@hashicorp.com>
This commit is contained in:
parent
ba4b639445
commit
72d941454f
2 changed files with 35 additions and 2 deletions
|
|
@ -11,9 +11,12 @@ import BackendCrumbMixin from 'vault/mixins/backend-crumb';
|
|||
import ListController from 'core/mixins/list-controller';
|
||||
import { keyIsFolder } from 'core/utils/key-utils';
|
||||
import engineDisplayData from 'vault/helpers/engines-display-data';
|
||||
import { task } from 'ember-concurrency';
|
||||
|
||||
export default Controller.extend(ListController, BackendCrumbMixin, {
|
||||
flashMessages: service(),
|
||||
api: service(),
|
||||
router: service(),
|
||||
queryParams: ['page', 'pageFilter', 'tab'],
|
||||
|
||||
tab: '',
|
||||
|
|
@ -71,4 +74,20 @@ export default Controller.extend(ListController, BackendCrumbMixin, {
|
|||
});
|
||||
},
|
||||
},
|
||||
|
||||
disableEngine: task(function* (engine) {
|
||||
const { engineType, id, path } = engine;
|
||||
try {
|
||||
yield this.api.sys.mountsDisableSecretsEngine(id);
|
||||
this.flashMessages.success(`The ${engineType} Secrets Engine at ${path} has been disabled.`);
|
||||
this.router.transitionTo('vault.cluster.secrets.backends');
|
||||
} catch (err) {
|
||||
const { message } = yield this.api.parseError(err);
|
||||
this.flashMessages.danger(
|
||||
`There was an error disabling the ${engineType} Secrets Engines at ${path}: ${message}.`
|
||||
);
|
||||
} finally {
|
||||
this.engineToDisable = null;
|
||||
}
|
||||
}).drop(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -64,7 +64,11 @@
|
|||
<Hds::Dropdown as |D|>
|
||||
<D.ToggleButton @text="Manage" @color="secondary" data-test-manage-dropdown />
|
||||
<D.Interactive @icon="settings" @route="vault.cluster.secrets.backend.configuration.index">Configure</D.Interactive>
|
||||
<D.Interactive {{on "click" D.close}} @color="critical" @icon="trash">Delete</D.Interactive>
|
||||
<D.Interactive
|
||||
{{on "click" (fn (mut this.engineToDisable) this.backendModel)}}
|
||||
@color="critical"
|
||||
@icon="trash"
|
||||
>Delete</D.Interactive>
|
||||
</Hds::Dropdown>
|
||||
|
||||
<Hds::Button
|
||||
|
|
@ -153,4 +157,14 @@
|
|||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/let}}
|
||||
{{/let}}
|
||||
|
||||
{{#if this.engineToDisable}}
|
||||
<ConfirmModal
|
||||
@color="critical"
|
||||
@confirmMessage="Any data in this engine will be permanently deleted."
|
||||
@confirmTitle="Disable engine?"
|
||||
@onClose={{fn (mut this.engineToDisable) null}}
|
||||
@onConfirm={{perform this.disableEngine this.engineToDisable}}
|
||||
/>
|
||||
{{/if}}
|
||||
Loading…
Reference in a new issue