open-nomad/ui/app/routes/jobs.js

44 lines
934 B
JavaScript
Raw Normal View History

import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import WithForbiddenState from 'nomad-ui/mixins/with-forbidden-state';
import notifyForbidden from 'nomad-ui/utils/notify-forbidden';
2017-09-19 14:47:10 +00:00
export default Route.extend(WithForbiddenState, {
system: service(),
store: service(),
2017-09-19 14:47:10 +00:00
2018-06-27 18:29:04 +00:00
breadcrumbs: [
{
label: 'Jobs',
args: ['jobs.index'],
},
],
queryParams: {
jobNamespace: {
refreshModel: true,
},
},
beforeModel(transition) {
return this.get('system.namespaces').then(namespaces => {
const queryParam = transition.queryParams.namespace;
this.set('system.activeNamespace', queryParam || 'default');
return namespaces;
});
},
model() {
return this.get('store')
.findAll('job', { reload: true })
.catch(notifyForbidden(this));
},
actions: {
refreshRoute() {
this.refresh();
},
},
2017-09-19 14:47:10 +00:00
});