2017-09-19 14:47:10 +00:00
|
|
|
import Ember from 'ember';
|
|
|
|
import Sortable from 'nomad-ui/mixins/sortable';
|
|
|
|
import Searchable from 'nomad-ui/mixins/searchable';
|
|
|
|
|
2017-10-24 23:07:43 +00:00
|
|
|
const { Controller, computed, inject } = Ember;
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
export default Controller.extend(Sortable, Searchable, {
|
2017-10-24 23:07:43 +00:00
|
|
|
nodesController: inject.controller('nodes'),
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
nodes: computed.alias('model.nodes'),
|
|
|
|
agents: computed.alias('model.agents'),
|
|
|
|
|
|
|
|
queryParams: {
|
|
|
|
currentPage: 'page',
|
|
|
|
searchTerm: 'search',
|
|
|
|
sortProperty: 'sort',
|
|
|
|
sortDescending: 'desc',
|
|
|
|
},
|
|
|
|
|
|
|
|
currentPage: 1,
|
|
|
|
pageSize: 8,
|
|
|
|
|
|
|
|
sortProperty: 'modifyIndex',
|
|
|
|
sortDescending: true,
|
|
|
|
|
|
|
|
searchProps: computed(() => ['id', 'name', 'datacenter']),
|
|
|
|
|
|
|
|
listToSort: computed.alias('nodes'),
|
|
|
|
listToSearch: computed.alias('listSorted'),
|
|
|
|
sortedNodes: computed.alias('listSearched'),
|
|
|
|
|
2017-10-24 23:07:43 +00:00
|
|
|
isForbidden: computed.alias('nodesController.isForbidden'),
|
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
actions: {
|
|
|
|
gotoNode(node) {
|
|
|
|
this.transitionToRoute('nodes.node', node);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|