github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/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  // eslint-disable-next-line ember/no-new-mixins
     6  export default Mixin.create({
     7    system: service(),
     8    jobsController: controller('jobs'),
     9  
    10    actions: {
    11      gotoJobs(namespace) {
    12        // Since the setupController hook doesn't fire when transitioning up the
    13        // route hierarchy, the two sides of the namespace bindings need to be manipulated
    14        // in order for the jobs route model to reload.
    15        this.set('system.activeNamespace', this.get('jobsController.jobNamespace'));
    16        this.set('jobsController.jobNamespace', namespace.get('id'));
    17        this.transitionToRoute('jobs');
    18      },
    19    },
    20  });