From c8693ba5250d542752e8fec46b8f1f006f4124c1 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Tue, 13 Mar 2018 14:59:03 -0700 Subject: [PATCH] Make task page breadcrumbs extend the allocation breadcrumbs --- .../allocations/allocation/task.js | 15 ++++++++++++++ .../allocations/allocation/task/index.js | 8 ++++++-- .../allocations/allocation/task/logs.js | 7 +++++++ .../allocations/allocation/task/index.hbs | 20 +++++++++---------- .../allocations/allocation/task/logs.hbs | 20 +++++++++---------- 5 files changed, 46 insertions(+), 24 deletions(-) create mode 100644 ui/app/controllers/allocations/allocation/task.js create mode 100644 ui/app/controllers/allocations/allocation/task/logs.js diff --git a/ui/app/controllers/allocations/allocation/task.js b/ui/app/controllers/allocations/allocation/task.js new file mode 100644 index 000000000..616df57a3 --- /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 790e190ec..e45f85230 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 000000000..6ce1642b5 --- /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/templates/allocations/allocation/task/index.hbs b/ui/app/templates/allocations/allocation/task/index.hbs index 60a311bfa..46fdd49f9 100644 --- a/ui/app/templates/allocations/allocation/task/index.hbs +++ b/ui/app/templates/allocations/allocation/task/index.hbs @@ -1,15 +1,13 @@ {{#global-header class="page-header"}} -
  • Allocations
  • -
  • - {{#link-to "allocations.allocation" model.allocation data-test-breadcrumb="allocation"}} - {{model.allocation.shortId}} - {{/link-to}} -
  • -
  • - {{#link-to "allocations.allocation.task" model.allocation model data-test-breadcrumb="task"}} - {{model.name}} - {{/link-to}} -
  • + {{#each breadcrumbs as |breadcrumb index|}} + + {{/each}} {{/global-header}} {{#gutter-menu class="page-body"}} {{partial "allocations/allocation/task/subnav"}} diff --git a/ui/app/templates/allocations/allocation/task/logs.hbs b/ui/app/templates/allocations/allocation/task/logs.hbs index 01a7440cf..d4ee3da56 100644 --- a/ui/app/templates/allocations/allocation/task/logs.hbs +++ b/ui/app/templates/allocations/allocation/task/logs.hbs @@ -1,15 +1,13 @@ {{#global-header class="page-header"}} -
  • Allocations
  • -
  • - {{#link-to "allocations.allocation" model.allocation}} - {{model.allocation.shortId}} - {{/link-to}} -
  • -
  • - {{#link-to "allocations.allocation.task" model.allocation model}} - {{model.name}} - {{/link-to}} -
  • + {{#each breadcrumbs as |breadcrumb index|}} + + {{/each}} {{/global-header}} {{#gutter-menu class="page-body"}} {{partial "allocations/allocation/task/subnav"}}