mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-20 06:01:10 +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>
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import { action } from '@ember/object';
|
|
import RouterService from '@ember/routing/router-service';
|
|
import Component from '@glimmer/component';
|
|
import FlashMessageService from 'vault/services/flash-messages';
|
|
import SecretMountPath from 'vault/services/secret-mount-path';
|
|
import { inject as service } from '@ember/service';
|
|
import errorMessage from 'vault/utils/error-message';
|
|
import PkiRoleModel from 'vault/models/pki/role';
|
|
|
|
interface Args {
|
|
role: PkiRoleModel;
|
|
}
|
|
|
|
export default class DetailsPage extends Component<Args> {
|
|
@service declare readonly router: RouterService;
|
|
@service declare readonly flashMessages: FlashMessageService;
|
|
@service declare readonly secretMountPath: SecretMountPath;
|
|
|
|
get breadcrumbs() {
|
|
return [
|
|
{ label: 'secrets', route: 'secrets', linkExternal: true },
|
|
{ label: this.secretMountPath.currentPath, route: 'overview' },
|
|
{ label: 'roles', route: 'roles.index' },
|
|
{ label: this.args.role.id },
|
|
];
|
|
}
|
|
|
|
get arrayAttrs() {
|
|
return ['keyUsage', 'extKeyUsage', 'extKeyUsageOids'];
|
|
}
|
|
|
|
@action
|
|
async deleteRole() {
|
|
try {
|
|
await this.args.role.destroyRecord();
|
|
this.flashMessages.success('Role deleted successfully');
|
|
this.router.transitionTo('vault.cluster.secrets.backend.pki.roles.index');
|
|
} catch (error) {
|
|
this.args.role.rollbackAttributes();
|
|
this.flashMessages.danger(errorMessage(error));
|
|
}
|
|
}
|
|
}
|