github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/routes/topology.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 classic from 'ember-classic-decorator'; 6 import RSVP from 'rsvp'; 7 8 @classic 9 export default class TopologyRoute extends Route.extend(WithForbiddenState) { 10 @service store; 11 @service system; 12 13 breadcrumbs = [ 14 { 15 label: 'Topology', 16 args: ['topology'], 17 }, 18 ]; 19 20 model() { 21 return RSVP.hash({ 22 jobs: this.store.findAll('job'), 23 allocations: this.store.query('allocation', { 24 resources: true, 25 task_states: false, 26 namespace: '*', 27 }), 28 nodes: this.store.query('node', { resources: true }), 29 }).catch(notifyForbidden(this)); 30 } 31 32 setupController(controller, model) { 33 // When the model throws, make sure the interface expected by the controller is consistent. 34 if (!model) { 35 controller.model = { 36 jobs: [], 37 allocations: [], 38 nodes: [], 39 }; 40 } 41 42 return super.setupController(...arguments); 43 } 44 }