github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/routes/jobs/job/services.js (about)

     1  import Route from '@ember/routing/route';
     2  import WithWatchers from 'nomad-ui/mixins/with-watchers';
     3  import { collect } from '@ember/object/computed';
     4  import {
     5    watchRecord,
     6    watchRelationship,
     7  } from 'nomad-ui/utils/properties/watch';
     8  
     9  export default class JobsJobServicesRoute extends Route.extend(WithWatchers) {
    10    model() {
    11      const job = this.modelFor('jobs.job');
    12      return job && job.get('services').then(() => job);
    13    }
    14  
    15    startWatchers(controller, model) {
    16      if (model) {
    17        controller.set('watchServices', this.watchServices.perform(model));
    18        controller.set('watchJob', this.watchJob.perform(model));
    19      }
    20    }
    21  
    22    @watchRelationship('services', true) watchServices;
    23    @watchRecord('job') watchJob;
    24  
    25    @collect('watchServices', 'watchJob') watchers;
    26  }