github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/routes/allocations/allocation/index.js (about)

     1  import Route from '@ember/routing/route';
     2  
     3  export default class IndexRoute extends Route {
     4    setupController(controller, model) {
     5      // Suppress the preemptedByAllocation fetch error in the event it's a 404
     6      if (model) {
     7        const setPreempter = () =>
     8          controller.set('preempter', model.preemptedByAllocation);
     9        model.preemptedByAllocation.then(setPreempter, setPreempter);
    10      }
    11  
    12      return super.setupController(...arguments);
    13    }
    14  
    15    resetController(controller, isExiting) {
    16      if (isExiting) {
    17        controller.watchNext.cancelAll();
    18      }
    19    }
    20  }