2020-08-24 16:59:55 +00:00
|
|
|
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 classic from 'ember-classic-decorator';
|
|
|
|
import RSVP from 'rsvp';
|
|
|
|
|
|
|
|
@classic
|
|
|
|
export default class TopologyRoute extends Route.extend(WithForbiddenState) {
|
|
|
|
@service store;
|
|
|
|
@service system;
|
|
|
|
|
|
|
|
model() {
|
|
|
|
return RSVP.hash({
|
|
|
|
jobs: this.store.findAll('job'),
|
2020-10-29 18:28:41 +00:00
|
|
|
allocations: this.store.query('allocation', {
|
|
|
|
resources: true,
|
|
|
|
task_states: false,
|
|
|
|
namespace: '*',
|
|
|
|
}),
|
2020-10-12 22:27:37 +00:00
|
|
|
nodes: this.store.query('node', { resources: true }),
|
2020-08-24 16:59:55 +00:00
|
|
|
}).catch(notifyForbidden(this));
|
|
|
|
}
|
2020-11-04 20:32:22 +00:00
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
// When the model throws, make sure the interface expected by the controller is consistent.
|
|
|
|
if (!model) {
|
|
|
|
controller.model = {
|
|
|
|
jobs: [],
|
|
|
|
allocations: [],
|
|
|
|
nodes: [],
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return super.setupController(...arguments);
|
|
|
|
}
|
2020-08-24 16:59:55 +00:00
|
|
|
}
|