2017-12-15 21:39:18 +00:00
|
|
|
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';
|
|
|
|
import Searchable from 'nomad-ui/mixins/searchable';
|
|
|
|
|
|
|
|
export default Controller.extend(Sortable, Searchable, {
|
2017-12-15 21:39:18 +00:00
|
|
|
clientsController: controller('clients'),
|
2017-10-24 23:07:43 +00:00
|
|
|
|
2017-12-15 21:39:18 +00:00
|
|
|
nodes: alias('model.nodes'),
|
|
|
|
agents: alias('model.agents'),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
queryParams: {
|
|
|
|
currentPage: 'page',
|
|
|
|
searchTerm: 'search',
|
|
|
|
sortProperty: 'sort',
|
|
|
|
sortDescending: 'desc',
|
|
|
|
},
|
|
|
|
|
|
|
|
currentPage: 1,
|
|
|
|
pageSize: 8,
|
|
|
|
|
|
|
|
sortProperty: 'modifyIndex',
|
|
|
|
sortDescending: true,
|
|
|
|
|
|
|
|
searchProps: computed(() => ['id', 'name', 'datacenter']),
|
|
|
|
|
2017-12-15 21:39:18 +00:00
|
|
|
listToSort: alias('nodes'),
|
|
|
|
listToSearch: alias('listSorted'),
|
|
|
|
sortedNodes: alias('listSearched'),
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2017-12-15 21:39:18 +00:00
|
|
|
isForbidden: alias('clientsController.isForbidden'),
|
2017-10-24 23:07:43 +00:00
|
|
|
|
2017-09-19 14:47:10 +00:00
|
|
|
actions: {
|
|
|
|
gotoNode(node) {
|
2017-10-28 01:23:41 +00:00
|
|
|
this.transitionToRoute('clients.client', node);
|
2017-09-19 14:47:10 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|