github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/ui/app/routes/jobs/job/index.js (about) 1 import Route from '@ember/routing/route'; 2 import { collect } from '@ember/object/computed'; 3 import { watchRecord, watchRelationship, watchAll } from 'nomad-ui/utils/properties/watch'; 4 import WithWatchers from 'nomad-ui/mixins/with-watchers'; 5 6 export default Route.extend(WithWatchers, { 7 startWatchers(controller, model) { 8 if (!model) { 9 return; 10 } 11 controller.set('watchers', { 12 model: this.watch.perform(model), 13 summary: this.watchSummary.perform(model.get('summary')), 14 allocations: this.watchAllocations.perform(model), 15 evaluations: this.watchEvaluations.perform(model), 16 latestDeployment: 17 model.get('supportsDeployments') && this.watchLatestDeployment.perform(model), 18 list: model.get('hasChildren') && this.watchAll.perform(), 19 }); 20 }, 21 22 watch: watchRecord('job'), 23 watchAll: watchAll('job'), 24 watchSummary: watchRecord('job-summary'), 25 watchAllocations: watchRelationship('allocations'), 26 watchEvaluations: watchRelationship('evaluations'), 27 watchLatestDeployment: watchRelationship('latestDeployment'), 28 29 watchers: collect( 30 'watch', 31 'watchAll', 32 'watchSummary', 33 'watchAllocations', 34 'watchEvaluations', 35 'watchLatestDeployment' 36 ), 37 });