From 1a9b70688aa01e6ebdffbaac5b1837105d04dfe7 Mon Sep 17 00:00:00 2001 From: Jai Bhagat Date: Mon, 3 Jan 2022 12:35:00 -0500 Subject: [PATCH] refact: move gotoClients logic down to component --- .../job-page/parts/job-client-status-summary.js | 12 +++++++++++- ui/app/controllers/jobs/job/index.js | 15 ++------------- .../components/job-page/parameterized-child.hbs | 2 +- .../components/job-page/periodic-child.hbs | 2 +- ui/app/templates/components/job-page/sysbatch.hbs | 2 +- ui/app/templates/components/job-page/system.hbs | 2 +- ui/app/templates/jobs/job/index.hbs | 1 - 7 files changed, 17 insertions(+), 19 deletions(-) diff --git a/ui/app/components/job-page/parts/job-client-status-summary.js b/ui/app/components/job-page/parts/job-client-status-summary.js index e583aae24..6aa683ce3 100644 --- a/ui/app/components/job-page/parts/job-client-status-summary.js +++ b/ui/app/components/job-page/parts/job-client-status-summary.js @@ -8,6 +8,7 @@ import jobClientStatus from 'nomad-ui/utils/properties/job-client-status'; @classic @classNames('boxed-section') export default class JobClientStatusSummary extends Component { + @service router; @service store; @jobClientStatus('nodes', 'job') jobClientStatus; @@ -17,7 +18,16 @@ export default class JobClientStatusSummary extends Component { } job = null; - gotoClients() {} + + @action + gotoClients(statusFilter) { + this.router.transitionTo('jobs.job.clients', this.job, { + queryParams: { + status: JSON.stringify(statusFilter), + namespace: this.job.get('namespace.name'), + }, + }); + } @computed get isExpanded() { diff --git a/ui/app/controllers/jobs/job/index.js b/ui/app/controllers/jobs/job/index.js index 644f1b247..f066ac554 100644 --- a/ui/app/controllers/jobs/job/index.js +++ b/ui/app/controllers/jobs/job/index.js @@ -1,8 +1,7 @@ -import { inject as service } from '@ember/service'; -import { alias } from '@ember/object/computed'; import Controller from '@ember/controller'; +import { alias } from '@ember/object/computed'; +import { inject as service } from '@ember/service'; import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; -import { action } from '@ember/object'; import classic from 'ember-classic-decorator'; @classic @@ -29,14 +28,4 @@ export default class IndexController extends Controller.extend( sortProperty = 'name'; sortDescending = false; - - @action - gotoClients(statusFilter) { - this.transitionToRoute('jobs.job.clients', this.job, { - queryParams: { - status: JSON.stringify(statusFilter), - namespace: this.job.get('namespace.name'), - }, - }); - } } diff --git a/ui/app/templates/components/job-page/parameterized-child.hbs b/ui/app/templates/components/job-page/parameterized-child.hbs index cb98f1bcd..7acbeecee 100644 --- a/ui/app/templates/components/job-page/parameterized-child.hbs +++ b/ui/app/templates/components/job-page/parameterized-child.hbs @@ -18,7 +18,7 @@ - + diff --git a/ui/app/templates/components/job-page/periodic-child.hbs b/ui/app/templates/components/job-page/periodic-child.hbs index 0a57c3bb5..89f20b7f1 100644 --- a/ui/app/templates/components/job-page/periodic-child.hbs +++ b/ui/app/templates/components/job-page/periodic-child.hbs @@ -18,7 +18,7 @@ - + diff --git a/ui/app/templates/components/job-page/sysbatch.hbs b/ui/app/templates/components/job-page/sysbatch.hbs index 863f4351f..2b9c7e0c0 100644 --- a/ui/app/templates/components/job-page/sysbatch.hbs +++ b/ui/app/templates/components/job-page/sysbatch.hbs @@ -3,7 +3,7 @@ - + diff --git a/ui/app/templates/components/job-page/system.hbs b/ui/app/templates/components/job-page/system.hbs index 1c9e06371..693e74bcc 100644 --- a/ui/app/templates/components/job-page/system.hbs +++ b/ui/app/templates/components/job-page/system.hbs @@ -4,7 +4,7 @@ - + diff --git a/ui/app/templates/jobs/job/index.hbs b/ui/app/templates/jobs/job/index.hbs index f893b4e29..0ff6bd3ac 100644 --- a/ui/app/templates/jobs/job/index.hbs +++ b/ui/app/templates/jobs/job/index.hbs @@ -5,5 +5,4 @@ sortProperty=this.sortProperty sortDescending=this.sortDescending currentPage=this.currentPage - gotoClients=(action "gotoClients") }} \ No newline at end of file