open-nomad/ui/app/mixins/with-namespace-resetting.js
Michael Lange 7abf621441 On namespace change on a job detail page, redirect to /jobs
And reload jobs for the new namespace.
2017-10-23 17:42:36 -07:00

20 lines
632 B
JavaScript

import Ember from 'ember';
const { Mixin, inject } = Ember;
export default Mixin.create({
system: inject.service(),
jobsController: inject.controller('jobs'),
actions: {
gotoJobs(namespace) {
// Since the setupController hook doesn't fire when transitioning up the
// route hierarchy, the two sides of the namespace bindings need to be manipulated
// in order for the jobs route model to reload.
this.set('system.activeNamespace', this.get('jobsController.jobNamespace'));
this.set('jobsController.jobNamespace', namespace.get('id'));
this.transitionToRoute('jobs');
},
},
});