From e7a26ce8d16bacaa2b9a7f18311a8eea876e6c85 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 28 Feb 2018 11:48:06 -0800 Subject: [PATCH] Watch the allocation on the allocation and task pages --- ui/app/adapters/allocation.js | 3 +++ ui/app/routes/allocations/allocation.js | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 ui/app/adapters/allocation.js diff --git a/ui/app/adapters/allocation.js b/ui/app/adapters/allocation.js new file mode 100644 index 000000000..8aa4b662f --- /dev/null +++ b/ui/app/adapters/allocation.js @@ -0,0 +1,3 @@ +import Watchable from './watchable'; + +export default Watchable.extend(); diff --git a/ui/app/routes/allocations/allocation.js b/ui/app/routes/allocations/allocation.js index 17aa8b10c..4d2cbe66c 100644 --- a/ui/app/routes/allocations/allocation.js +++ b/ui/app/routes/allocations/allocation.js @@ -1,4 +1,17 @@ import Route from '@ember/routing/route'; import WithModelErrorHandling from 'nomad-ui/mixins/with-model-error-handling'; +import { watchRecord } from 'nomad-ui/utils/properties/watch'; -export default Route.extend(WithModelErrorHandling); +export default Route.extend(WithModelErrorHandling, { + setupController(controller, model) { + controller.set('watcher', this.get('watch').perform(model)); + return this._super(...arguments); + }, + + deactivate() { + this.get('watch').cancelAll(); + return this._super(...arguments); + }, + + watch: watchRecord('allocation'), +});