github.com/hernad/nomad@v1.6.112/ui/app/routes/jobs/job/versions.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 {
     9    watchRecord,
    10    watchRelationship,
    11  } from 'nomad-ui/utils/properties/watch';
    12  import WithWatchers from 'nomad-ui/mixins/with-watchers';
    13  import { inject as service } from '@ember/service';
    14  
    15  export default class VersionsRoute extends Route.extend(WithWatchers) {
    16    @service store;
    17  
    18    model() {
    19      const job = this.modelFor('jobs.job');
    20      return job && job.get('versions').then(() => job);
    21    }
    22  
    23    startWatchers(controller, model) {
    24      if (model) {
    25        controller.set('watcher', this.watch.perform(model));
    26        controller.set('watchVersions', this.watchVersions.perform(model));
    27      }
    28    }
    29  
    30    @watchRecord('job') watch;
    31    @watchRelationship('versions') watchVersions;
    32  
    33    @collect('watch', 'watchVersions') watchers;
    34  }