2017-12-15 21:39:18 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { alias } from '@ember/object/computed';
|
|
|
|
import Controller, { inject as controller } from '@ember/controller';
|
|
|
|
import { computed } from '@ember/object';
|
2017-09-19 14:47:10 +00:00
|
|
|
import Sortable from 'nomad-ui/mixins/sortable';
|
2017-10-23 23:59:30 +00:00
|
|
|
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2017-10-23 23:59:30 +00:00
|
|
|
export default Controller.extend(Sortable, WithNamespaceResetting, {
|
2017-12-15 21:39:18 +00:00
|
|
|
system: service(),
|
|
|
|
jobController: controller('jobs.job'),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
queryParams: {
|
|
|
|
currentPage: 'page',
|
|
|
|
sortProperty: 'sort',
|
|
|
|
sortDescending: 'desc',
|
|
|
|
},
|
|
|
|
|
|
|
|
currentPage: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
|
|
|
|
sortProperty: 'name',
|
|
|
|
sortDescending: false,
|
|
|
|
|
2017-12-15 21:39:18 +00:00
|
|
|
breadcrumbs: alias('jobController.breadcrumbs'),
|
|
|
|
job: alias('model'),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
taskGroups: computed('model.taskGroups.[]', function() {
|
|
|
|
return this.get('model.taskGroups') || [];
|
|
|
|
}),
|
|
|
|
|
2017-12-15 21:39:18 +00:00
|
|
|
listToSort: alias('taskGroups'),
|
|
|
|
sortedTaskGroups: alias('listSorted'),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2017-11-29 01:24:30 +00:00
|
|
|
sortedEvaluations: computed('model.evaluations.@each.modifyIndex', function() {
|
|
|
|
return (this.get('model.evaluations') || []).sortBy('modifyIndex').reverse();
|
|
|
|
}),
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
actions: {
|
|
|
|
gotoTaskGroup(taskGroup) {
|
|
|
|
this.transitionToRoute('jobs.job.task-group', taskGroup.get('job'), taskGroup);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|