claire bontempo 1fbbf9d76b
UI: Ember-data upgrade 5.3.2 prep: use custom service instead of extending ember-data store (#28695)
* rename store to pagination, remove store extension

* initial update of service test

* remove superfluous helper

* replace store with pagination service in main app

* update kmip engine syntax

* add pagination to kmip engine

* update to pagination in config-ui engine

* update sync engine to use pagination service

* use pagination service in kv engine

* use pagination service in ldap engine

* use pagination in pki engine

* update renaming clearDataset functions

* link to jira VAULT-31721

* remove comment
2024-10-17 10:00:57 -07:00

42 lines
1.1 KiB
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';
/**
* @module Page::MessageDetails
* Page::MessageDetails components are used to display a message
* @example
* ```js
* <Page::MessageDetails @message={{this.message}} />
* ```
* @param {model} message - message model
*/
export default class MessageDetails extends Component {
@service('app-router') router;
@service flashMessages;
@service customMessages;
@service namespace;
@service pagination;
@action
async deleteMessage() {
try {
await this.args.message.destroyRecord(this.args.message.id);
this.pagination.clearDataset('config-ui/message');
this.router.transitionTo('vault.cluster.config-ui.messages');
this.customMessages.fetchMessages(this.namespace.path);
this.flashMessages.success(`Successfully deleted ${this.args.message.title}.`);
} catch (e) {
const message = errorMessage(e);
this.flashMessages.danger(message);
}
}
}