2017-12-15 21:39:18 +00:00
|
|
|
import { alias } from '@ember/object/computed';
|
|
|
|
import Controller, { inject as controller } from '@ember/controller';
|
|
|
|
import { computed } from '@ember/object';
|
2017-09-19 14:47:10 +00:00
|
|
|
import Sortable from 'nomad-ui/mixins/sortable';
|
|
|
|
import Searchable from 'nomad-ui/mixins/searchable';
|
2017-10-23 23:59:30 +00:00
|
|
|
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
|
2018-03-13 21:47:09 +00:00
|
|
|
import { qpBuilder } from 'nomad-ui/utils/classes/query-params';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2017-10-23 23:59:30 +00:00
|
|
|
export default Controller.extend(Sortable, Searchable, WithNamespaceResetting, {
|
2017-12-15 21:39:18 +00:00
|
|
|
jobController: controller('jobs.job'),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
queryParams: {
|
|
|
|
currentPage: 'page',
|
|
|
|
searchTerm: 'search',
|
|
|
|
sortProperty: 'sort',
|
|
|
|
sortDescending: 'desc',
|
|
|
|
},
|
|
|
|
|
|
|
|
currentPage: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
|
2017-10-18 00:51:00 +00:00
|
|
|
sortProperty: 'modifyIndex',
|
|
|
|
sortDescending: true,
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2017-10-18 19:52:24 +00:00
|
|
|
searchProps: computed(() => ['shortId', 'name']),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
allocations: computed('model.allocations.[]', function() {
|
|
|
|
return this.get('model.allocations') || [];
|
|
|
|
}),
|
|
|
|
|
2017-12-15 21:39:18 +00:00
|
|
|
listToSort: alias('allocations'),
|
|
|
|
listToSearch: alias('listSorted'),
|
|
|
|
sortedAllocations: alias('listSearched'),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
breadcrumbs: computed('jobController.breadcrumbs.[]', 'model.{name}', function() {
|
|
|
|
return this.get('jobController.breadcrumbs').concat([
|
2018-03-13 21:47:09 +00:00
|
|
|
{
|
|
|
|
label: this.get('model.name'),
|
|
|
|
args: [
|
|
|
|
'jobs.job.task-group',
|
|
|
|
this.get('model.name'),
|
|
|
|
qpBuilder({ jobNamespace: this.get('model.job.namespace.name') || 'default' }),
|
|
|
|
],
|
|
|
|
},
|
2017-09-19 14:47:10 +00:00
|
|
|
]);
|
|
|
|
}),
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
gotoAllocation(allocation) {
|
|
|
|
this.transitionToRoute('allocations.allocation', allocation);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|