c1cc51a057
This is no longer needed! https://guides.emberjs.com/release/upgrading/current-edition/native-classes/#toc_properties-and-fields
44 lines
1,015 B
JavaScript
44 lines
1,015 B
JavaScript
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';
|
|
import { action } from '@ember/object';
|
|
import classic from 'ember-classic-decorator';
|
|
|
|
@classic
|
|
export default class JobsRoute extends Route.extend(WithForbiddenState) {
|
|
@service store;
|
|
@service system;
|
|
|
|
breadcrumbs = [
|
|
{
|
|
label: 'Jobs',
|
|
args: ['jobs.index'],
|
|
},
|
|
];
|
|
|
|
queryParams = {
|
|
jobNamespace: {
|
|
refreshModel: true,
|
|
},
|
|
};
|
|
|
|
beforeModel(transition) {
|
|
return this.get('system.namespaces').then(namespaces => {
|
|
const queryParam = transition.to.queryParams.namespace;
|
|
this.set('system.activeNamespace', queryParam || 'default');
|
|
|
|
return namespaces;
|
|
});
|
|
}
|
|
|
|
model() {
|
|
return this.store.findAll('job', { reload: true }).catch(notifyForbidden(this));
|
|
}
|
|
|
|
@action
|
|
refreshRoute() {
|
|
this.refresh();
|
|
}
|
|
}
|