github.com/thomasobenaus/nomad@v0.11.1/ui/app/mixins/with-namespace-resetting.js (about)

     1  import { inject as controller } from '@ember/controller';
     2  import { inject as service } from '@ember/service';
     3  import Mixin from '@ember/object/mixin';
     4  
     5  export default Mixin.create({
     6    system: service(),
     7    jobsController: controller('jobs'),
     8  
     9    actions: {
    10      gotoJobs(namespace) {
    11        // Since the setupController hook doesn't fire when transitioning up the
    12        // route hierarchy, the two sides of the namespace bindings need to be manipulated
    13        // in order for the jobs route model to reload.
    14        this.set('system.activeNamespace', this.get('jobsController.jobNamespace'));
    15        this.set('jobsController.jobNamespace', namespace.get('id'));
    16        this.transitionToRoute('jobs');
    17      },
    18    },
    19  });