2018-02-28 02:58:25 +00:00
|
|
|
import Route from '@ember/routing/route';
|
|
|
|
import { collect } from '@ember/object/computed';
|
|
|
|
import { watchRecord, watchRelationship } from 'nomad-ui/utils/properties/watch';
|
2018-03-01 00:27:15 +00:00
|
|
|
import WithWatchers from 'nomad-ui/mixins/with-watchers';
|
2018-02-28 02:58:25 +00:00
|
|
|
|
2018-03-01 00:27:15 +00:00
|
|
|
export default Route.extend(WithWatchers, {
|
2018-03-06 22:27:01 +00:00
|
|
|
startWatchers(controller, model) {
|
2018-03-20 18:35:31 +00:00
|
|
|
if (!model) {
|
|
|
|
return;
|
|
|
|
}
|
2018-02-28 02:58:25 +00:00
|
|
|
controller.set('watchers', {
|
|
|
|
model: this.get('watch').perform(model),
|
|
|
|
summary: this.get('watchSummary').perform(model),
|
|
|
|
evaluations: this.get('watchEvaluations').perform(model),
|
2018-03-20 18:35:31 +00:00
|
|
|
deployments: model.get('supportsDeployments') && this.get('watchDeployments').perform(model),
|
2018-02-28 02:58:25 +00:00
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: watchRecord('job'),
|
|
|
|
watchSummary: watchRelationship('summary'),
|
|
|
|
watchEvaluations: watchRelationship('evaluations'),
|
|
|
|
watchDeployments: watchRelationship('deployments'),
|
|
|
|
|
2018-03-01 00:27:15 +00:00
|
|
|
watchers: collect('watch', 'watchSummary', 'watchEvaluations', 'watchDeployments'),
|
2018-02-28 02:58:25 +00:00
|
|
|
});
|