open-nomad/ui/app/controllers/allocations/allocation/index.js
2018-09-17 15:57:23 -07:00

31 lines
770 B
JavaScript

import { alias } from '@ember/object/computed';
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import Sortable from 'nomad-ui/mixins/sortable';
import { lazyClick } from 'nomad-ui/helpers/lazy-click';
export default Controller.extend(Sortable, {
token: service(),
queryParams: {
sortProperty: 'sort',
sortDescending: 'desc',
},
sortProperty: 'name',
sortDescending: false,
listToSort: alias('model.states'),
sortedStates: alias('listSorted'),
actions: {
gotoTask(allocation, task) {
this.transitionToRoute('allocations.allocation.task', task);
},
taskClick(allocation, task, event) {
lazyClick([() => this.send('gotoTask', allocation, task), event]);
},
},
});