From efeb5abbcbcd81603c4194dcbd61af3a5821badb Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Tue, 13 Mar 2018 14:47:09 -0700 Subject: [PATCH] Fix a bug where job links didn't always include the namespace QP --- ui/app/components/job-page/abstract.js | 9 ++++++++- ui/app/controllers/jobs/job.js | 9 ++++++++- ui/app/controllers/jobs/job/task-group.js | 10 +++++++++- ui/app/templates/jobs/job/task-group.hbs | 5 +---- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/ui/app/components/job-page/abstract.js b/ui/app/components/job-page/abstract.js index eb80479d7..01358cf34 100644 --- a/ui/app/components/job-page/abstract.js +++ b/ui/app/components/job-page/abstract.js @@ -1,6 +1,7 @@ import Component from '@ember/component'; import { computed } from '@ember/object'; import { inject as service } from '@ember/service'; +import { qpBuilder } from 'nomad-ui/utils/classes/query-params'; export default Component.extend({ system: service(), @@ -22,7 +23,13 @@ export default Component.extend({ { label: 'Jobs', args: ['jobs'] }, { label: job.get('name'), - args: ['jobs.job', job], + args: [ + 'jobs.job', + job, + qpBuilder({ + jobNamespace: job.get('namespace.name') || 'default', + }), + ], }, ]; }), diff --git a/ui/app/controllers/jobs/job.js b/ui/app/controllers/jobs/job.js index 5b8865a11..d641d5d0a 100644 --- a/ui/app/controllers/jobs/job.js +++ b/ui/app/controllers/jobs/job.js @@ -1,5 +1,6 @@ import Controller from '@ember/controller'; import { computed } from '@ember/object'; +import { qpBuilder } from 'nomad-ui/utils/classes/query-params'; export default Controller.extend({ breadcrumbs: computed('model.{name,id}', function() { @@ -7,7 +8,13 @@ export default Controller.extend({ { label: 'Jobs', args: ['jobs'] }, { label: this.get('model.name'), - args: ['jobs.job', this.get('model')], + args: [ + 'jobs.job', + this.get('model'), + qpBuilder({ + jobNamespace: this.get('model.namespace.name') || 'default', + }), + ], }, ]; }), diff --git a/ui/app/controllers/jobs/job/task-group.js b/ui/app/controllers/jobs/job/task-group.js index 2e2ab25e7..1ace41f8f 100644 --- a/ui/app/controllers/jobs/job/task-group.js +++ b/ui/app/controllers/jobs/job/task-group.js @@ -4,6 +4,7 @@ import { computed } from '@ember/object'; import Sortable from 'nomad-ui/mixins/sortable'; import Searchable from 'nomad-ui/mixins/searchable'; import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; +import { qpBuilder } from 'nomad-ui/utils/classes/query-params'; export default Controller.extend(Sortable, Searchable, WithNamespaceResetting, { jobController: controller('jobs.job'), @@ -33,7 +34,14 @@ export default Controller.extend(Sortable, Searchable, WithNamespaceResetting, { breadcrumbs: computed('jobController.breadcrumbs.[]', 'model.{name}', function() { return this.get('jobController.breadcrumbs').concat([ - { label: this.get('model.name'), args: ['jobs.job.task-group', this.get('model.name')] }, + { + label: this.get('model.name'), + args: [ + 'jobs.job.task-group', + this.get('model.name'), + qpBuilder({ jobNamespace: this.get('model.job.namespace.name') || 'default' }), + ], + }, ]); }), diff --git a/ui/app/templates/jobs/job/task-group.hbs b/ui/app/templates/jobs/job/task-group.hbs index 2934d2c1a..f1ab0acb2 100644 --- a/ui/app/templates/jobs/job/task-group.hbs +++ b/ui/app/templates/jobs/job/task-group.hbs @@ -3,10 +3,7 @@