mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-18 12:37:02 +02:00
* hides roles toolbar actions when k8s is not configured * adds error page component to core addon * moves fetch-config to decorator * updates kubernetes prompt config logic * adds kubernetes error route * fixes tests * adds error handling for kubernetes roles list view * removes unneeded arg to withConfig decorator
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import { inject as service } from '@ember/service';
|
|
import { action } from '@ember/object';
|
|
import { getOwner } from '@ember/application';
|
|
import errorMessage from 'vault/utils/error-message';
|
|
|
|
/**
|
|
* @module Roles
|
|
* RolesPage component is a child component to show list of roles
|
|
*
|
|
* @param {array} roles - array of roles
|
|
* @param {boolean} promptConfig - whether or not to display config cta
|
|
* @param {array} pageFilter - array of filtered roles
|
|
* @param {array} breadcrumbs - breadcrumbs as an array of objects that contain label and route
|
|
*/
|
|
export default class RolesPageComponent extends Component {
|
|
@service flashMessages;
|
|
|
|
get mountPoint() {
|
|
return getOwner(this).mountPoint;
|
|
}
|
|
|
|
@action
|
|
async onDelete(model) {
|
|
try {
|
|
const message = `Successfully deleted role ${model.name}`;
|
|
await model.destroyRecord();
|
|
this.args.roles.removeObject(model);
|
|
this.flashMessages.success(message);
|
|
} catch (error) {
|
|
const message = errorMessage(error, 'Error deleting role. Please try again or contact support');
|
|
this.flashMessages.danger(message);
|
|
}
|
|
}
|
|
}
|