open-nomad/ui/app/routes/jobs/job/index.js

39 lines
1.2 KiB
JavaScript
Raw Normal View History

import Route from '@ember/routing/route';
import { collect } from '@ember/object/computed';
import { watchRecord, watchRelationship, watchAll } from 'nomad-ui/utils/properties/watch';
import WithWatchers from 'nomad-ui/mixins/with-watchers';
export default class IndexRoute extends Route.extend(WithWatchers) {
startWatchers(controller, model) {
if (!model) {
return;
}
controller.set('watchers', {
2019-03-26 07:46:44 +00:00
model: this.watch.perform(model),
summary: this.watchSummary.perform(model.get('summary')),
allocations: this.watchAllocations.perform(model),
evaluations: this.watchEvaluations.perform(model),
latestDeployment:
2019-03-26 07:46:44 +00:00
model.get('supportsDeployments') && this.watchLatestDeployment.perform(model),
list: model.get('hasChildren') && this.watchAll.perform(),
});
}
@watchRecord('job') watch;
@watchAll('job') watchAll;
@watchRecord('job-summary') watchSummary;
@watchRelationship('allocations') watchAllocations;
@watchRelationship('evaluations') watchEvaluations;
@watchRelationship('latestDeployment') watchLatestDeployment;
@collect(
'watch',
'watchAll',
'watchSummary',
'watchAllocations',
'watchEvaluations',
'watchLatestDeployment'
)
watchers;
}