mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-24 08:01:07 +02:00
* Revert "UI: Remove custom service (#19925)" This reverts commit b04751d22437b06947a84148c499c4728602b5e1. * replace stickyInfo with options info * revert replacing custom stickyInfo * change flash message name to be consistent throughout application * make service imports consistent for k8 engine * replace stickyInfo with options info * Revert "change flash message name to be consistent throughout application" This reverts commit 17de49894de3976ed708fcf15f19f6f1eb1012a5. * add comment --------- Co-authored-by: Chelsea Shaw <cshaw@hashicorp.com>
33 lines
1015 B
TypeScript
33 lines
1015 B
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import { action } from '@ember/object';
|
|
import Component from '@glimmer/component';
|
|
import RouterService from '@ember/routing/router-service';
|
|
import FlashMessageService from 'vault/services/flash-messages';
|
|
import { inject as service } from '@ember/service';
|
|
import errorMessage from 'vault/utils/error-message';
|
|
import PkiKeyModel from 'vault/models/pki/key';
|
|
interface Args {
|
|
key: PkiKeyModel;
|
|
}
|
|
|
|
export default class PkiKeyDetails extends Component<Args> {
|
|
@service declare readonly router: RouterService;
|
|
@service declare readonly flashMessages: FlashMessageService;
|
|
|
|
@action
|
|
async deleteKey() {
|
|
try {
|
|
await this.args.key.destroyRecord();
|
|
this.flashMessages.success('Key deleted successfully.');
|
|
this.router.transitionTo('vault.cluster.secrets.backend.pki.keys.index');
|
|
} catch (error) {
|
|
this.args.key.rollbackAttributes();
|
|
this.flashMessages.danger(errorMessage(error));
|
|
}
|
|
}
|
|
}
|