github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/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 model() { 14 return RSVP.hash({ 15 allocations: this.store.query('allocation', { 16 resources: true, 17 task_states: false, 18 namespace: '*', 19 }), 20 nodes: this.store.query('node', { resources: true }), 21 }).catch(notifyForbidden(this)); 22 } 23 24 setupController(controller, model) { 25 // When the model throws, make sure the interface expected by the controller is consistent. 26 if (!model) { 27 controller.model = { 28 allocations: [], 29 nodes: [], 30 }; 31 } 32 33 return super.setupController(...arguments); 34 } 35 }