github.com/hspak/nomad@v0.7.2-0.20180309000617-bc4ae22a39a5/ui/app/routes/allocations/allocation/task.js (about)

     1  import { inject as service } from '@ember/service';
     2  import Route from '@ember/routing/route';
     3  import EmberError from '@ember/error';
     4  
     5  export default Route.extend({
     6    store: service(),
     7  
     8    model({ name }) {
     9      const allocation = this.modelFor('allocations.allocation');
    10      if (allocation) {
    11        const task = allocation.get('states').findBy('name', name);
    12  
    13        if (task) {
    14          return task;
    15        }
    16  
    17        const err = new EmberError(`Task ${name} not found for allocation ${allocation.get('id')}`);
    18        err.code = '404';
    19        this.controllerFor('application').set('error', err);
    20      }
    21    },
    22  });