dce8717866
* basic-functionality demo for token CRUD * Styling for tokens crud * Tokens crud styles * Expires, not expiry * Mobile styles etc * Refresh and redirect rules for policy save and token creation * Delete method and associated serializer change * Ability-checking for tokens * Update policies acceptance tests to reflect new redirect rules * Token ability unit tests * Mirage config methods for token crud * Token CRUD acceptance tests * A couple visual diff snapshots * Add and Delete abilities referenced for token operations * Changing timeouts and adding a copy to clipboard action * replaced accessor with secret when copying to clipboard * PR comments addressed * Simplified error passing for policy editor
30 lines
775 B
JavaScript
30 lines
775 B
JavaScript
import Route from '@ember/routing/route';
|
|
import withForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
|
|
import WithModelErrorHandling from 'nomad-ui/mixins/with-model-error-handling';
|
|
import { inject as service } from '@ember/service';
|
|
import { hash } from 'rsvp';
|
|
|
|
export default class PoliciesRoute extends Route.extend(
|
|
withForbiddenState,
|
|
WithModelErrorHandling
|
|
) {
|
|
@service can;
|
|
@service store;
|
|
@service router;
|
|
|
|
beforeModel() {
|
|
if (this.can.cannot('list policies')) {
|
|
this.router.transitionTo('/jobs');
|
|
}
|
|
}
|
|
|
|
async model() {
|
|
return await hash({
|
|
policies: this.store.query('policy', { reload: true }),
|
|
tokens:
|
|
this.can.can('list tokens') &&
|
|
this.store.query('token', { reload: true }),
|
|
});
|
|
}
|
|
}
|