github.com/hernad/nomad@v1.6.112/ui/app/routes/jobs/job/allocations.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 import Route from '@ember/routing/route'; 7 import { collect } from '@ember/object/computed'; 8 import { watchRelationship } from 'nomad-ui/utils/properties/watch'; 9 import WithWatchers from 'nomad-ui/mixins/with-watchers'; 10 import { inject as service } from '@ember/service'; 11 12 export default class AllocationsRoute extends Route.extend(WithWatchers) { 13 @service store; 14 15 model() { 16 const job = this.modelFor('jobs.job'); 17 return job && job.get('allocations').then(() => job); 18 } 19 20 startWatchers(controller, model) { 21 if (model) { 22 controller.set('watchAllocations', this.watchAllocations.perform(model)); 23 } 24 } 25 26 @watchRelationship('allocations') watchAllocations; 27 28 @collect('watchAllocations') watchers; 29 }