diff --git a/ui/app/components/job-page/abstract.js b/ui/app/components/job-page/abstract.js index eb80479d786e..01358cf34809 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/allocations/allocation.js b/ui/app/controllers/allocations/allocation.js index 75ceaaec3c18..6aa0e219ba74 100644 --- a/ui/app/controllers/allocations/allocation.js +++ b/ui/app/controllers/allocations/allocation.js @@ -1,3 +1,36 @@ import Controller from '@ember/controller'; +import { computed } from '@ember/object'; +import { qpBuilder } from 'nomad-ui/utils/classes/query-params'; -export default Controller.extend({}); +export default Controller.extend({ + breadcrumbs: computed('model.job', function() { + return [ + { label: 'Jobs', args: ['jobs'] }, + { + label: this.get('model.job.name'), + args: [ + 'jobs.job', + this.get('model.job'), + qpBuilder({ + jobNamespace: this.get('model.namespace.name') || 'default', + }), + ], + }, + { + label: this.get('model.taskGroupName'), + args: [ + 'jobs.job.task-group', + this.get('model.job'), + this.get('model.taskGroupName'), + qpBuilder({ + jobNamespace: this.get('model.namespace.name') || 'default', + }), + ], + }, + { + label: this.get('model.shortId'), + args: ['allocations.allocation', this.get('model')], + }, + ]; + }), +}); diff --git a/ui/app/controllers/allocations/allocation/index.js b/ui/app/controllers/allocations/allocation/index.js index 810d0f728296..4e156c69f5cf 100644 --- a/ui/app/controllers/allocations/allocation/index.js +++ b/ui/app/controllers/allocations/allocation/index.js @@ -1,8 +1,10 @@ import { alias } from '@ember/object/computed'; -import Controller from '@ember/controller'; +import Controller, { inject as controller } from '@ember/controller'; import Sortable from 'nomad-ui/mixins/sortable'; export default Controller.extend(Sortable, { + allocationController: controller('allocations.allocation'), + queryParams: { sortProperty: 'sort', sortDescending: 'desc', @@ -11,6 +13,8 @@ export default Controller.extend(Sortable, { sortProperty: 'name', sortDescending: false, + breadcrumbs: alias('allocationController.breadcrumbs'), + listToSort: alias('model.states'), sortedStates: alias('listSorted'), }); diff --git a/ui/app/controllers/allocations/allocation/task.js b/ui/app/controllers/allocations/allocation/task.js new file mode 100644 index 000000000000..616df57a3a5d --- /dev/null +++ b/ui/app/controllers/allocations/allocation/task.js @@ -0,0 +1,15 @@ +import Controller, { inject as controller } from '@ember/controller'; +import { computed } from '@ember/object'; + +export default Controller.extend({ + allocationController: controller('allocations.allocation'), + + breadcrumbs: computed('allocationController.breadcrumbs.[]', 'model.name', function() { + return this.get('allocationController.breadcrumbs').concat([ + { + label: this.get('model.name'), + args: ['allocations.allocation.task', this.get('model.allocation'), this.get('model')], + }, + ]); + }), +}); diff --git a/ui/app/controllers/allocations/allocation/task/index.js b/ui/app/controllers/allocations/allocation/task/index.js index 790e190ec6dd..e45f85230ee2 100644 --- a/ui/app/controllers/allocations/allocation/task/index.js +++ b/ui/app/controllers/allocations/allocation/task/index.js @@ -1,8 +1,12 @@ -import { alias } from '@ember/object/computed'; -import Controller from '@ember/controller'; +import Controller, { inject as controller } from '@ember/controller'; import { computed } from '@ember/object'; +import { alias } from '@ember/object/computed'; export default Controller.extend({ + taskController: controller('allocations.allocation.task'), + + breadcrumbs: alias('taskController.breadcrumbs'), + network: alias('model.resources.networks.firstObject'), ports: computed('network.reservedPorts.[]', 'network.dynamicPorts.[]', function() { return (this.get('network.reservedPorts') || []) diff --git a/ui/app/controllers/allocations/allocation/task/logs.js b/ui/app/controllers/allocations/allocation/task/logs.js new file mode 100644 index 000000000000..6ce1642b542e --- /dev/null +++ b/ui/app/controllers/allocations/allocation/task/logs.js @@ -0,0 +1,7 @@ +import Controller, { inject as controller } from '@ember/controller'; +import { alias } from '@ember/object/computed'; + +export default Controller.extend({ + taskController: controller('allocations.allocation.task'), + breadcrumbs: alias('taskController.breadcrumbs'), +}); diff --git a/ui/app/controllers/jobs/job.js b/ui/app/controllers/jobs/job.js index 5b8865a11bec..d641d5d0a918 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 2e2ab25e72b7..1ace41f8fe81 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/routes/allocations/allocation.js b/ui/app/routes/allocations/allocation.js index 3f46faa2f7cf..b09dc1cb376f 100644 --- a/ui/app/routes/allocations/allocation.js +++ b/ui/app/routes/allocations/allocation.js @@ -1,14 +1,21 @@ import Route from '@ember/routing/route'; -import WithModelErrorHandling from 'nomad-ui/mixins/with-model-error-handling'; import { collect } from '@ember/object/computed'; import { watchRecord } from 'nomad-ui/utils/properties/watch'; import WithWatchers from 'nomad-ui/mixins/with-watchers'; +import notifyError from 'nomad-ui/utils/notify-error'; -export default Route.extend(WithModelErrorHandling, WithWatchers, { +export default Route.extend(WithWatchers, { startWatchers(controller, model) { controller.set('watcher', this.get('watch').perform(model)); }, + model() { + // Preload the job for the allocation since it's required for the breadcrumb trail + return this._super(...arguments) + .then(allocation => allocation.get('job').then(() => allocation)) + .catch(notifyError(this)); + }, + watch: watchRecord('allocation'), watchers: collect('watch'), diff --git a/ui/app/templates/allocations/allocation/index.hbs b/ui/app/templates/allocations/allocation/index.hbs index 659329b6545a..77099f6b0ed6 100644 --- a/ui/app/templates/allocations/allocation/index.hbs +++ b/ui/app/templates/allocations/allocation/index.hbs @@ -1,8 +1,13 @@ {{#global-header class="page-header"}} -