2017-12-15 21:39:18 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import Route from '@ember/routing/route';
|
2017-09-28 17:06:24 +00:00
|
|
|
import notifyError from 'nomad-ui/utils/notify-error';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-06-13 03:59:33 +00:00
|
|
|
export default class ClientRoute extends Route {
|
2020-06-10 13:49:16 +00:00
|
|
|
@service store;
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2017-09-28 17:06:24 +00:00
|
|
|
model() {
|
2020-06-10 13:49:16 +00:00
|
|
|
return super.model(...arguments).catch(notifyError(this));
|
|
|
|
}
|
2017-09-28 17:06:24 +00:00
|
|
|
|
2018-06-20 01:15:46 +00:00
|
|
|
breadcrumbs(model) {
|
|
|
|
if (!model) return [];
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
label: model.get('shortId'),
|
|
|
|
args: ['clients.client', model.get('id')],
|
|
|
|
},
|
|
|
|
];
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
2018-06-20 01:15:46 +00:00
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
afterModel(model) {
|
2017-09-28 17:06:24 +00:00
|
|
|
if (model && model.get('isPartial')) {
|
2017-09-19 14:47:10 +00:00
|
|
|
return model.reload().then(node => node.get('allocations'));
|
|
|
|
}
|
2017-09-28 17:06:24 +00:00
|
|
|
return model && model.get('allocations');
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
}
|