github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/routes/jobs.js (about) 1 import { inject as service } from '@ember/service'; 2 import Route from '@ember/routing/route'; 3 import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state'; 4 import notifyForbidden from 'nomad-ui/utils/notify-forbidden'; 5 import { action } from '@ember/object'; 6 import classic from 'ember-classic-decorator'; 7 8 @classic 9 export default class JobsRoute extends Route.extend(WithForbiddenState) { 10 @service store; 11 @service system; 12 13 breadcrumbs = [ 14 { 15 label: 'Jobs', 16 args: ['jobs.index'], 17 }, 18 ]; 19 20 queryParams = { 21 jobNamespace: { 22 refreshModel: true, 23 }, 24 }; 25 26 beforeModel(transition) { 27 return this.get('system.namespaces').then(namespaces => { 28 const queryParam = transition.to.queryParams.namespace; 29 this.set('system.activeNamespace', queryParam || 'default'); 30 31 return namespaces; 32 }); 33 } 34 35 model() { 36 return this.store.findAll('job', { reload: true }).catch(notifyForbidden(this)); 37 } 38 39 @action 40 refreshRoute() { 41 this.refresh(); 42 } 43 }