mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-28 10:01:11 +02:00
* use alias for router injection * update @router declarations in engine files * fix remaining pki router imports * dynamically set router based on owner * address replication routers * update markdown docs * use non-deprecated import for getOwner * revert out of scope changes * add transition-to test
32 lines
993 B
TypeScript
32 lines
993 B
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { service } from '@ember/service';
|
|
import errorMessage from 'vault/utils/error-message';
|
|
import type RouterService from '@ember/routing/router-service';
|
|
import type FlashMessageService from 'vault/services/flash-messages';
|
|
import type PkiKeyModel from 'vault/models/pki/key';
|
|
interface Args {
|
|
key: PkiKeyModel;
|
|
}
|
|
|
|
export default class PkiKeyDetails extends Component<Args> {
|
|
@service('app-router') 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.flashMessages.danger(errorMessage(error));
|
|
}
|
|
}
|
|
}
|