github.com/hernad/nomad@v1.6.112/ui/app/components/job-page/parts/children.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import Component from '@ember/component';
     7  import { inject as service } from '@ember/service';
     8  import { computed } from '@ember/object';
     9  import { alias, readOnly } from '@ember/object/computed';
    10  import Sortable from 'nomad-ui/mixins/sortable';
    11  import { classNames } from '@ember-decorators/component';
    12  import classic from 'ember-classic-decorator';
    13  
    14  @classic
    15  @classNames('boxed-section')
    16  export default class Children extends Component.extend(Sortable) {
    17    @service system;
    18    @service userSettings;
    19  
    20    job = null;
    21  
    22    // Provide a value that is bound to a query param
    23    sortProperty = null;
    24    sortDescending = null;
    25    currentPage = null;
    26  
    27    @readOnly('userSettings.pageSize') pageSize;
    28  
    29    @computed('job.taskGroups.[]')
    30    get taskGroups() {
    31      return this.get('job.taskGroups') || [];
    32    }
    33  
    34    @computed('job.children.[]')
    35    get children() {
    36      return this.get('job.children') || [];
    37    }
    38  
    39    @alias('children') listToSort;
    40    @alias('listSorted') sortedChildren;
    41  
    42    resetPagination() {
    43      if (this.currentPage != null) {
    44        this.set('currentPage', 1);
    45      }
    46    }
    47  }