mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-19 21:51:09 +02:00
* wip, all actions wired up, not finished or tested. * move the rotate action to it's own component to clarify scope * clean up and refresh component on queryParam change without forcing a refresh from component as before * solve issue of carrying over props we want to keep * clean up and add clearProps action * transit key actions passing * update assert and doc * remove unecessary changes * Address pr comments * replace perform in submit action and instead pass it in as perform * address claire's pr comments * welp * trying to rearrange closer to original * addressing pr comments * move things around * pr comments * remove ciphertext when last action was rewrap * add args and istruncated and isfullwidth
28 lines
812 B
JavaScript
28 lines
812 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { service } from '@ember/service';
|
|
import { action } from '@ember/object';
|
|
import errorMessage from 'vault/utils/error-message';
|
|
|
|
export default class TransitFormShow extends Component {
|
|
@service store;
|
|
@service router;
|
|
@service flashMessages;
|
|
|
|
@action async rotateKey() {
|
|
const { backend, id } = this.args.key;
|
|
try {
|
|
await this.store.adapterFor('transit-key').keyAction('rotate', { backend, id });
|
|
this.flashMessages.success('Key rotated.');
|
|
// must refresh to see the updated versions, a model refresh does not trigger the change.
|
|
await this.router.refresh();
|
|
} catch (e) {
|
|
this.flashMessages.danger(errorMessage(e));
|
|
}
|
|
}
|
|
}
|