open-nomad/ui/app/controllers/jobs/job/task-group.js
Buck Doyle 1cca7abcab
Add Ember ESLint plugin (#8134)
This is extracted from #8094, where I have run into some snags. Since
these ESLint fixes aren’t actually connected to the Ember 3.16 update
but involve changes to many files, we might as well address them
separately. Where possible I fixed the problems but in cases where
a fix seemed too involved, I added per-line or -file exceptions.
2020-06-09 16:03:28 -05:00

43 lines
1.1 KiB
JavaScript

import { alias, readOnly } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import Controller from '@ember/controller';
import { computed } from '@ember/object';
import Sortable from 'nomad-ui/mixins/sortable';
import Searchable from 'nomad-ui/mixins/searchable';
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
export default Controller.extend(Sortable, Searchable, WithNamespaceResetting, {
userSettings: service(),
queryParams: {
currentPage: 'page',
searchTerm: 'search',
sortProperty: 'sort',
sortDescending: 'desc',
},
currentPage: 1,
pageSize: readOnly('userSettings.pageSize'),
sortProperty: 'modifyIndex',
sortDescending: true,
searchProps: computed(function() {
return ['shortId', 'name'];
}),
allocations: computed('model.allocations.[]', function() {
return this.get('model.allocations') || [];
}),
listToSort: alias('allocations'),
listToSearch: alias('listSorted'),
sortedAllocations: alias('listSearched'),
actions: {
gotoAllocation(allocation) {
this.transitionToRoute('allocations.allocation', allocation);
},
},
});