github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/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('jobsController.jobNamespace', namespace.get('id'));
    16        this.transitionToRoute('jobs');
    17      },
    18    },
    19  });