mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-23 15:41:07 +02:00
* move role-form files * Revert "move role-form files" This reverts commit ad16dd059b1f3e86d649c9e06e3f7b4486041058. * show credentials after generating * add changelog * periods
31 lines
999 B
JavaScript
31 lines
999 B
JavaScript
/**
|
|
* 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 { tracked } from '@glimmer/tracking';
|
|
import errorMessage from 'vault/utils/error-message';
|
|
|
|
export default class KmipPageCredentialsGenerate extends Component {
|
|
@service flashMessages;
|
|
@service('app-router') router;
|
|
@tracked hasGenerated = false;
|
|
|
|
@action
|
|
async revokeCredentials() {
|
|
const { scope, role } = this.args.credentials;
|
|
try {
|
|
await this.args.credentials.destroyRecord();
|
|
this.flashMessages.success('Successfully revoked credentials.');
|
|
this.router.transitionTo('vault.cluster.secrets.backend.kmip.credentials.index', scope, role);
|
|
} catch (e) {
|
|
const message = errorMessage(e);
|
|
this.flashMessages.danger(`There was an error revoking credentials: ${message}.`);
|
|
this.args.credentials.rollbackAttributes();
|
|
}
|
|
}
|
|
}
|