github.com/ferranbt/nomad@v0.9.3-0.20190607002617-85c449b7667c/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 6 export default Route.extend(WithForbiddenState, { 7 system: service(), 8 store: service(), 9 10 breadcrumbs: [ 11 { 12 label: 'Jobs', 13 args: ['jobs.index'], 14 }, 15 ], 16 17 queryParams: { 18 jobNamespace: { 19 refreshModel: true, 20 }, 21 }, 22 23 beforeModel(transition) { 24 return this.get('system.namespaces').then(namespaces => { 25 const queryParam = transition.queryParams.namespace; 26 this.set('system.activeNamespace', queryParam || 'default'); 27 28 return namespaces; 29 }); 30 }, 31 32 model() { 33 return this.store 34 .findAll('job', { reload: true }) 35 .catch(notifyForbidden(this)); 36 }, 37 38 actions: { 39 refreshRoute() { 40 this.refresh(); 41 }, 42 }, 43 });