open-nomad/ui/app/routes/allocations/allocation.js

25 lines
789 B
JavaScript
Raw Normal View History

import Route from '@ember/routing/route';
import { collect } from '@ember/object/computed';
import { watchRecord } from 'nomad-ui/utils/properties/watch';
import WithWatchers from 'nomad-ui/mixins/with-watchers';
import notifyError from 'nomad-ui/utils/notify-error';
export default class AllocationRoute extends Route.extend(WithWatchers) {
startWatchers(controller, model) {
2018-11-06 00:33:33 +00:00
if (model) {
2019-03-26 07:46:44 +00:00
controller.set('watcher', this.watch.perform(model));
2018-11-06 00:33:33 +00:00
}
}
model() {
// Preload the job for the allocation since it's required for the breadcrumb trail
return super
.model(...arguments)
.then(allocation => allocation.get('job').then(() => allocation))
.catch(notifyError(this));
}
@watchRecord('allocation') watch;
@collect('watch') watchers;
}