mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-25 00:21:07 +02:00
* add deletion in progress banner * update kv details banner to inline alert * add logic for purge error * add params to mirage * comment in purge_initiated_at for mirage * update flash message for deleting * add test for banner * transition to destination associations after delete * redirect to details after delete instead of list * remove attrs from serializer * update mirage handler to mock purge_initiated_at
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { inject as service } from '@ember/service';
|
|
import errorMessage from 'vault/utils/error-message';
|
|
|
|
import type SyncDestinationModel from 'vault/models/sync/destination';
|
|
import type RouterService from '@ember/routing/router-service';
|
|
import type StoreService from 'vault/services/store';
|
|
import type FlashMessageService from 'vault/services/flash-messages';
|
|
|
|
interface Args {
|
|
destination: SyncDestinationModel;
|
|
}
|
|
|
|
export default class DestinationsTabsToolbar extends Component<Args> {
|
|
@service declare readonly router: RouterService;
|
|
@service declare readonly store: StoreService;
|
|
@service declare readonly flashMessages: FlashMessageService;
|
|
|
|
@action
|
|
async deleteDestination() {
|
|
try {
|
|
const { destination } = this.args;
|
|
const message = `Destination ${destination.name} has been queued for deletion.`;
|
|
await destination.destroyRecord();
|
|
this.store.clearDataset('sync/destination');
|
|
this.router.transitionTo(
|
|
'vault.cluster.sync.secrets.destinations.destination.secrets',
|
|
destination.type,
|
|
destination.name
|
|
);
|
|
this.flashMessages.success(message);
|
|
} catch (error) {
|
|
this.flashMessages.danger(`Error deleting destination \n ${errorMessage(error)}`);
|
|
}
|
|
}
|
|
}
|