github.com/hernad/nomad@v1.6.112/ui/app/mixins/with-namespace-resetting.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import { inject as controller } from '@ember/controller';
     7  import { inject as service } from '@ember/service';
     8  import Mixin from '@ember/object/mixin';
     9  
    10  // eslint-disable-next-line ember/no-new-mixins
    11  export default Mixin.create({
    12    system: service(),
    13    jobsController: controller('jobs'),
    14  
    15    actions: {
    16      gotoJobs(namespace) {
    17        // Since the setupController hook doesn't fire when transitioning up the
    18        // route hierarchy, the two sides of the namespace bindings need to be manipulated
    19        // in order for the jobs route model to reload.
    20        this.set('jobsController.jobNamespace', namespace.get('id'));
    21        this.transitionToRoute('jobs');
    22      },
    23    },
    24  });