mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
* Gallery allows picking stuff * Small fixes * added sentinel templates * Can set enforcement level on policies * Working on the interactive sentinel dev mode * Very rough development flow on FE * Changed position in gutter menu * More sentinel stuff * PR cleanup: removed testmode, removed unneeded mixins and deps * Heliosification * Index-level sentinel policy deletion and page title fixes * Makes the Canaries sentinel policy real and then comments out the unfinished ones * rename Access Control to Administration in prep for moving Sentinel Policies and Node Pool admin there * Sentinel policies moved within the Administration section * Mirage fixture for sentinel policy endpoints * Description length check and 500 prevention * Sync review PR feedback addressed, implied butons on radio cards * Cull un-used sentinel policies --------- Co-authored-by: Mike Nomitch <mail@mikenomitch.com>
89 lines
1.9 KiB
JavaScript
89 lines
1.9 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Controller from '@ember/controller';
|
|
import { inject as service } from '@ember/service';
|
|
import { action } from '@ember/object';
|
|
import { task } from 'ember-concurrency';
|
|
|
|
export default class AccessControlRolesIndexController extends Controller {
|
|
@service router;
|
|
@service notifications;
|
|
@service can;
|
|
|
|
get columns() {
|
|
const defaultColumns = [
|
|
{
|
|
key: 'name',
|
|
label: 'Name',
|
|
isSortable: true,
|
|
},
|
|
{
|
|
key: 'description',
|
|
label: 'Description',
|
|
},
|
|
];
|
|
|
|
const policiesColumn = {
|
|
key: 'policies',
|
|
label: 'Policies',
|
|
};
|
|
|
|
const tokensColumn = {
|
|
key: 'tokens',
|
|
label: 'Tokens',
|
|
isSortable: true,
|
|
};
|
|
|
|
const deleteColumn = {
|
|
key: 'delete',
|
|
label: 'Delete',
|
|
};
|
|
|
|
return [
|
|
...defaultColumns,
|
|
...(this.can.can('list token') ? [tokensColumn] : []),
|
|
...(this.can.can('list policy') ? [policiesColumn] : []),
|
|
...(this.can.can('destroy role') ? [deleteColumn] : []),
|
|
];
|
|
}
|
|
|
|
get roles() {
|
|
return this.model.roles.map((role) => {
|
|
role.tokens = (this.model.tokens || []).filter((token) => {
|
|
return token.roles.includes(role);
|
|
});
|
|
return role;
|
|
});
|
|
}
|
|
|
|
@action openRole(role) {
|
|
this.router.transitionTo('administration.roles.role', role.id);
|
|
}
|
|
|
|
@action goToNewRole() {
|
|
this.router.transitionTo('administration.roles.new');
|
|
}
|
|
|
|
@task(function* (role) {
|
|
try {
|
|
yield role.deleteRecord();
|
|
yield role.save();
|
|
this.notifications.add({
|
|
title: `Role ${role.name} successfully deleted`,
|
|
color: 'success',
|
|
});
|
|
} catch (err) {
|
|
this.error = {
|
|
title: 'Error deleting role',
|
|
description: err,
|
|
};
|
|
|
|
throw err;
|
|
}
|
|
})
|
|
deleteRole;
|
|
}
|