github.com/blixtra/nomad@v0.7.2-0.20171221000451-da9a1d7bb050/ui/app/routes/allocations/allocation/task.js (about) 1 import Ember from 'ember'; 2 3 const { Route, inject, Error: EmberError } = Ember; 4 5 export default Route.extend({ 6 store: inject.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 });