2020-03-31 04:29:30 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
2020-06-10 13:49:16 +00:00
|
|
|
import { alias, readOnly } from '@ember/object/computed';
|
2018-06-27 20:39:57 +00:00
|
|
|
import Controller from '@ember/controller';
|
2020-06-10 13:49:16 +00:00
|
|
|
import { action, 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';
|
2020-06-10 13:49:16 +00:00
|
|
|
import classic from 'ember-classic-decorator';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@classic
|
|
|
|
export default class TaskGroupController extends Controller.extend(
|
|
|
|
Sortable,
|
|
|
|
Searchable,
|
|
|
|
WithNamespaceResetting
|
|
|
|
) {
|
|
|
|
@service userSettings;
|
2020-03-31 04:29:30 +00:00
|
|
|
|
2020-06-11 13:38:33 +00:00
|
|
|
queryParams = [
|
|
|
|
{
|
|
|
|
currentPage: 'page',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
searchTerm: 'search',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
sortProperty: 'sort',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
sortDescending: 'desc',
|
|
|
|
},
|
|
|
|
];
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
currentPage = 1;
|
|
|
|
@readOnly('userSettings.pageSize') pageSize;
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
sortProperty = 'modifyIndex';
|
|
|
|
sortDescending = true;
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@computed
|
|
|
|
get searchProps() {
|
2020-06-09 21:03:28 +00:00
|
|
|
return ['shortId', 'name'];
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@computed('model.allocations.[]')
|
|
|
|
get allocations() {
|
2017-09-19 14:47:10 +00:00
|
|
|
return this.get('model.allocations') || [];
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@alias('allocations') listToSort;
|
|
|
|
@alias('listSorted') listToSearch;
|
|
|
|
@alias('listSearched') sortedAllocations;
|
|
|
|
|
|
|
|
@action
|
|
|
|
gotoAllocation(allocation) {
|
|
|
|
this.transitionToRoute('allocations.allocation', allocation);
|
|
|
|
}
|
|
|
|
}
|