Files
nomad/ui/app/routes/policies/policy.js
Phil Renaud c314661baf [ui] Token management interface on policy pages (#15435)
* 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
2022-12-15 13:11:28 -05:00

25 lines
736 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 PoliciesPolicyRoute extends Route.extend(
withForbiddenState,
WithModelErrorHandling
) {
@service store;
async model(params) {
return hash({
policy: this.store.findRecord('policy', decodeURIComponent(params.name), {
reload: true,
}),
tokens: this.store
.peekAll('token')
.filter((token) =>
token.policyNames?.includes(decodeURIComponent(params.name))
),
});
}
}