github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/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 system; 13 @service userSettings; 14 15 job = null; 16 17 // Provide a value that is bound to a query param 18 sortProperty = null; 19 sortDescending = null; 20 currentPage = null; 21 22 @readOnly('userSettings.pageSize') pageSize; 23 24 @computed('job.taskGroups.[]') 25 get taskGroups() { 26 return this.get('job.taskGroups') || []; 27 } 28 29 @computed('job.children.[]') 30 get children() { 31 return this.get('job.children') || []; 32 } 33 34 @alias('children') listToSort; 35 @alias('listSorted') sortedChildren; 36 37 resetPagination() { 38 if (this.currentPage != null) { 39 this.set('currentPage', 1); 40 } 41 } 42 }