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

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