open-nomad/ui/app/controllers/jobs/job/task-group.js
Buck Doyle 577e85b007 Fix query parameters structures
I’d think the codemod would handle this if it’s a requirement
but apparently not, is it a bug?
2020-06-15 09:52:31 -05:00

58 lines
1.3 KiB
JavaScript

import { inject as service } from '@ember/service';
import { alias, readOnly } from '@ember/object/computed';
import Controller from '@ember/controller';
import { action, 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';
import classic from 'ember-classic-decorator';
@classic
export default class TaskGroupController extends Controller.extend(
Sortable,
Searchable,
WithNamespaceResetting
) {
@service userSettings;
queryParams = [
{
currentPage: 'page',
},
{
searchTerm: 'search',
},
{
sortProperty: 'sort',
},
{
sortDescending: 'desc',
},
];
currentPage = 1;
@readOnly('userSettings.pageSize') pageSize;
sortProperty = 'modifyIndex';
sortDescending = true;
@computed
get searchProps() {
return ['shortId', 'name'];
}
@computed('model.allocations.[]')
get allocations() {
return this.get('model.allocations') || [];
}
@alias('allocations') listToSort;
@alias('listSorted') listToSearch;
@alias('listSearched') sortedAllocations;
@action
gotoAllocation(allocation) {
this.transitionToRoute('allocations.allocation', allocation);
}
}