From c201d3ae8fbeef7f108fb38d14fd7cad939534db Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 28 Feb 2018 11:31:48 -0800 Subject: [PATCH] Watch job, job-summary, and job-allocs on the task group page --- ui/app/routes/jobs/job/task-group.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ui/app/routes/jobs/job/task-group.js b/ui/app/routes/jobs/job/task-group.js index def6e57ea..bca649f68 100644 --- a/ui/app/routes/jobs/job/task-group.js +++ b/ui/app/routes/jobs/job/task-group.js @@ -1,4 +1,6 @@ import Route from '@ember/routing/route'; +import { collect } from '@ember/object/computed'; +import { watchRecord, watchRelationship } from 'nomad-ui/utils/properties/watch'; export default Route.extend({ model({ name }) { @@ -15,4 +17,27 @@ export default Route.extend({ }); }); }, + + setupController(controller, model) { + const job = model.get('job'); + controller.set('watchers', { + job: this.get('watchJob').perform(job), + summary: this.get('watchSummary').perform(job), + allocations: this.get('watchAllocations').perform(job), + }); + return this._super(...arguments); + }, + + deactivate() { + this.get('allWatchers').forEach(watcher => { + watcher.cancelAll(); + }); + return this._super(...arguments); + }, + + watchJob: watchRecord('job'), + watchSummary: watchRelationship('summary'), + watchAllocations: watchRelationship('allocations'), + + allWatchers: collect('watchJob', 'watchSummary', 'watchAllocations'), });