github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/controllers/jobs/job/index.js (about)

     1  import Controller from '@ember/controller';
     2  import { alias } from '@ember/object/computed';
     3  import { inject as service } from '@ember/service';
     4  import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
     5  import classic from 'ember-classic-decorator';
     6  import { action } from '@ember/object';
     7  @classic
     8  export default class IndexController extends Controller.extend(
     9    WithNamespaceResetting
    10  ) {
    11    @service system;
    12  
    13    queryParams = [
    14      {
    15        currentPage: 'page',
    16      },
    17      {
    18        sortProperty: 'sort',
    19      },
    20      {
    21        sortDescending: 'desc',
    22      },
    23      'activeTask',
    24    ];
    25  
    26    currentPage = 1;
    27  
    28    @alias('model') job;
    29  
    30    sortProperty = 'name';
    31    sortDescending = false;
    32    activeTask = null;
    33  
    34    @action
    35    setActiveTaskQueryParam(task) {
    36      if (task) {
    37        this.set('activeTask', `${task.allocation.id}-${task.name}`);
    38      } else {
    39        this.set('activeTask', null);
    40      }
    41    }
    42  }