github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/controllers/jobs/job/allocations.js (about) 1 import { alias } from '@ember/object/computed'; 2 import Controller from '@ember/controller'; 3 import { action, computed } from '@ember/object'; 4 import Sortable from 'nomad-ui/mixins/sortable'; 5 import Searchable from 'nomad-ui/mixins/searchable'; 6 import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; 7 import classic from 'ember-classic-decorator'; 8 9 @classic 10 export default class AllocationsController extends Controller.extend( 11 Sortable, 12 Searchable, 13 WithNamespaceResetting 14 ) { 15 queryParams = [ 16 { 17 currentPage: 'page', 18 }, 19 { 20 searchTerm: 'search', 21 }, 22 { 23 sortProperty: 'sort', 24 }, 25 { 26 sortDescending: 'desc', 27 }, 28 ]; 29 30 currentPage = 1; 31 pageSize = 25; 32 33 sortProperty = 'modifyIndex'; 34 sortDescending = true; 35 36 @alias('model') job; 37 38 @computed 39 get searchProps() { 40 return ['shortId', 'name', 'taskGroupName']; 41 } 42 43 @computed('model.allocations.[]') 44 get allocations() { 45 return this.get('model.allocations') || []; 46 } 47 48 @alias('allocations') listToSort; 49 @alias('listSorted') listToSearch; 50 @alias('listSearched') sortedAllocations; 51 52 @action 53 gotoAllocation(allocation) { 54 this.transitionToRoute('allocations.allocation', allocation); 55 } 56 }