github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/app/components/job-page/parts/children.js (about) 1 import Component from '@ember/component'; 2 import { inject as service } from '@ember/service'; 3 import { computed } from '@ember/object'; 4 import { alias, readOnly } from '@ember/object/computed'; 5 import Sortable from 'nomad-ui/mixins/sortable'; 6 import { classNames } from '@ember-decorators/component'; 7 import classic from 'ember-classic-decorator'; 8 9 @classic 10 @classNames('boxed-section') 11 export default class Children extends Component.extend(Sortable) { 12 @service userSettings; 13 14 job = null; 15 16 // Provide a value that is bound to a query param 17 sortProperty = null; 18 sortDescending = null; 19 currentPage = null; 20 21 // Provide an action with access to the router 22 gotoJob() {} 23 24 @readOnly('userSettings.pageSize') pageSize; 25 26 @computed('job.taskGroups.[]') 27 get taskGroups() { 28 return this.get('job.taskGroups') || []; 29 } 30 31 @computed('job.children.[]') 32 get children() { 33 return this.get('job.children') || []; 34 } 35 36 @alias('children') listToSort; 37 @alias('listSorted') sortedChildren; 38 39 resetPagination() { 40 if (this.currentPage != null) { 41 this.set('currentPage', 1); 42 } 43 } 44 }