diff --git a/ui/app/abilities/job.js b/ui/app/abilities/job.js index 8a29384d573..8757c6acea2 100644 --- a/ui/app/abilities/job.js +++ b/ui/app/abilities/job.js @@ -48,7 +48,7 @@ export default class Job extends AbstractAbility { @computed('token.selfTokenPolicies.[]') get policiesSupportRunning() { return this.policyNamespacesIncludePermissions( - this.get('token.selfTokenPolicies'), + this.token.selfTokenPolicies, ['submit-job'] ); } diff --git a/ui/app/controllers/jobs/run.js b/ui/app/controllers/jobs/run.js index 76c9c1b012a..974fc0defbe 100644 --- a/ui/app/controllers/jobs/run.js +++ b/ui/app/controllers/jobs/run.js @@ -3,11 +3,19 @@ import { inject as service } from '@ember/service'; import { computed } from '@ember/object'; import { scheduleOnce } from '@ember/runloop'; import { serialize } from 'nomad-ui/utils/qp-serialize'; +import { get, set } from '@ember/object'; export default class RunController extends Controller { @service router; @service system; @service store; + + queryParams = [ + { + qpNamespace: 'namespace', + }, + ]; + onSubmit(id, namespace) { this.router.transitionTo('jobs.job', `${id}@${namespace || 'default'}`); } @@ -29,7 +37,7 @@ export default class RunController extends Controller { if (!availableNamespaces.mapBy('key').includes(this.qpNamespace)) { scheduleOnce('actions', () => { // eslint-disable-next-line ember/no-side-effects - this.set('qpNamespace', '*'); + set(this, 'qpNamespace', '*'); }); } @@ -38,8 +46,10 @@ export default class RunController extends Controller { setFacetQueryParam(queryParam, selection) { this.set(queryParam, serialize(selection)); - this.set( - 'model.namespace', + const model = get(this, 'model'); + set( + model, + 'namespace', this.store.peekAll('namespace').find((ns) => ns.id === this.qpNamespace) ); }