open-nomad/ui/app/controllers/jobs/job/task-group.js

38 lines
1 KiB
JavaScript
Raw Normal View History

import { alias } from '@ember/object/computed';
import 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';
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
2017-09-19 14:47:10 +00:00
export default Controller.extend(Sortable, Searchable, WithNamespaceResetting, {
2017-09-19 14:47:10 +00:00
queryParams: {
currentPage: 'page',
searchTerm: 'search',
sortProperty: 'sort',
sortDescending: 'desc',
},
currentPage: 1,
pageSize: 10,
sortProperty: 'modifyIndex',
sortDescending: true,
2017-09-19 14:47:10 +00:00
searchProps: computed(() => ['shortId', 'name']),
2017-09-19 14:47:10 +00:00
allocations: computed('model.allocations.[]', function() {
return this.get('model.allocations') || [];
}),
listToSort: alias('allocations'),
listToSearch: alias('listSorted'),
sortedAllocations: alias('listSearched'),
2017-09-19 14:47:10 +00:00
actions: {
gotoAllocation(allocation) {
this.transitionToRoute('allocations.allocation', allocation);
},
},
});