github.com/hernad/nomad@v1.6.112/ui/app/controllers/jobs/job/index.js (about) 1 /** 2 * Copyright (c) HashiCorp, Inc. 3 * SPDX-License-Identifier: MPL-2.0 4 */ 5 6 // @ts-check 7 import Controller from '@ember/controller'; 8 import { alias } from '@ember/object/computed'; 9 import { inject as service } from '@ember/service'; 10 import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; 11 import classic from 'ember-classic-decorator'; 12 import { action } from '@ember/object'; 13 import { tracked } from '@glimmer/tracking'; 14 @classic 15 export default class IndexController extends Controller.extend( 16 WithNamespaceResetting 17 ) { 18 @service system; 19 20 queryParams = [ 21 { 22 currentPage: 'page', 23 }, 24 { 25 sortProperty: 'sort', 26 }, 27 { 28 sortDescending: 'desc', 29 }, 30 'activeTask', 31 'statusMode', 32 ]; 33 34 currentPage = 1; 35 36 @alias('model') job; 37 38 sortProperty = 'name'; 39 sortDescending = false; 40 41 @tracked activeTask = null; 42 43 /** 44 * @type {('current'|'historical')} 45 */ 46 @tracked 47 statusMode = 'current'; 48 49 @action 50 setActiveTaskQueryParam(task) { 51 if (task) { 52 this.activeTask = `${task.allocation.id}-${task.name}`; 53 } else { 54 this.activeTask = null; 55 } 56 } 57 58 /** 59 * @param {('current'|'historical')} mode 60 */ 61 @action 62 setStatusMode(mode) { 63 this.statusMode = mode; 64 } 65 }