open-nomad/ui/app/mixins/with-namespace-resetting.js
Buck Doyle 1cca7abcab
Add Ember ESLint plugin (#8134)
This is extracted from #8094, where I have run into some snags. Since
these ESLint fixes aren’t actually connected to the Ember 3.16 update
but involve changes to many files, we might as well address them
separately. Where possible I fixed the problems but in cases where
a fix seemed too involved, I added per-line or -file exceptions.
2020-06-09 16:03:28 -05:00

21 lines
756 B
JavaScript

import { inject as controller } from '@ember/controller';
import { inject as service } from '@ember/service';
import Mixin from '@ember/object/mixin';
// eslint-disable-next-line ember/no-new-mixins
export default Mixin.create({
system: service(),
jobsController: 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');
},
},
});