From 0ea1d0daaff017641b545ff755225b7595306a79 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 25 Jan 2018 14:18:53 -0800 Subject: [PATCH] Fleshing out job page parts and differences --- ui/app/components/job-page/abstract.js | 1 + ui/app/components/job-page/batch.js | 3 + .../job-page/parameterized-child.js | 3 + ui/app/components/job-page/parameterized.js | 3 + ui/app/components/job-page/parts/children.js | 31 ++++ .../components/job-page/parts/task-groups.js | 1 + ui/app/components/job-page/periodic-child.js | 3 + ui/app/components/job-page/periodic.js | 3 + ui/app/controllers/jobs/job/index.js | 22 +-- ui/app/templates/jobs/job/index.hbs | 170 +----------------- 10 files changed, 63 insertions(+), 177 deletions(-) create mode 100644 ui/app/components/job-page/batch.js create mode 100644 ui/app/components/job-page/parameterized-child.js create mode 100644 ui/app/components/job-page/parameterized.js create mode 100644 ui/app/components/job-page/parts/children.js create mode 100644 ui/app/components/job-page/periodic-child.js create mode 100644 ui/app/components/job-page/periodic.js diff --git a/ui/app/components/job-page/abstract.js b/ui/app/components/job-page/abstract.js index ecd0cc2b2..e9ea804a4 100644 --- a/ui/app/components/job-page/abstract.js +++ b/ui/app/components/job-page/abstract.js @@ -11,6 +11,7 @@ export default Component.extend({ // Provide actions that require routing onNamespaceChange() {}, gotoTaskGroup() {}, + gotoJob() {}, breadcrumbs: computed('job.{name,id}', function() { const job = this.get('job'); diff --git a/ui/app/components/job-page/batch.js b/ui/app/components/job-page/batch.js new file mode 100644 index 000000000..559b3c8b8 --- /dev/null +++ b/ui/app/components/job-page/batch.js @@ -0,0 +1,3 @@ +import AbstractJobPage from './abstract'; + +export default AbstractJobPage.extend(); diff --git a/ui/app/components/job-page/parameterized-child.js b/ui/app/components/job-page/parameterized-child.js new file mode 100644 index 000000000..559b3c8b8 --- /dev/null +++ b/ui/app/components/job-page/parameterized-child.js @@ -0,0 +1,3 @@ +import AbstractJobPage from './abstract'; + +export default AbstractJobPage.extend(); diff --git a/ui/app/components/job-page/parameterized.js b/ui/app/components/job-page/parameterized.js new file mode 100644 index 000000000..559b3c8b8 --- /dev/null +++ b/ui/app/components/job-page/parameterized.js @@ -0,0 +1,3 @@ +import AbstractJobPage from './abstract'; + +export default AbstractJobPage.extend(); diff --git a/ui/app/components/job-page/parts/children.js b/ui/app/components/job-page/parts/children.js new file mode 100644 index 000000000..30772cd0a --- /dev/null +++ b/ui/app/components/job-page/parts/children.js @@ -0,0 +1,31 @@ +import Component from '@ember/component'; +import { computed } from '@ember/object'; +import { alias } from '@ember/object/computed'; +import Sortable from 'nomad-ui/mixins/sortable'; + +export default Component.extend(Sortable, { + job: null, + + classNames: ['boxed-section'], + + // Provide a value that is bound to a query param + sortProperty: null, + sortDescending: null, + currentPage: null, + + // Provide an action with access to the router + gotoJob() {}, + + pageSize: 10, + + taskGroups: computed('job.taskGroups.[]', function() { + return this.get('job.taskGroups') || []; + }), + + children: computed('job.children.[]', function() { + return this.get('job.children') || []; + }), + + listToSort: alias('children'), + sortedChildren: alias('listSorted'), +}); diff --git a/ui/app/components/job-page/parts/task-groups.js b/ui/app/components/job-page/parts/task-groups.js index a1829c33b..f5ce33757 100644 --- a/ui/app/components/job-page/parts/task-groups.js +++ b/ui/app/components/job-page/parts/task-groups.js @@ -12,6 +12,7 @@ export default Component.extend(Sortable, { sortProperty: null, sortDescending: null, + // Provide an action with access to the router gotoTaskGroup() {}, taskGroups: computed('job.taskGroups.[]', function() { diff --git a/ui/app/components/job-page/periodic-child.js b/ui/app/components/job-page/periodic-child.js new file mode 100644 index 000000000..559b3c8b8 --- /dev/null +++ b/ui/app/components/job-page/periodic-child.js @@ -0,0 +1,3 @@ +import AbstractJobPage from './abstract'; + +export default AbstractJobPage.extend(); diff --git a/ui/app/components/job-page/periodic.js b/ui/app/components/job-page/periodic.js new file mode 100644 index 000000000..559b3c8b8 --- /dev/null +++ b/ui/app/components/job-page/periodic.js @@ -0,0 +1,3 @@ +import AbstractJobPage from './abstract'; + +export default AbstractJobPage.extend(); diff --git a/ui/app/controllers/jobs/job/index.js b/ui/app/controllers/jobs/job/index.js index 97b97efb5..c5cb709a9 100644 --- a/ui/app/controllers/jobs/job/index.js +++ b/ui/app/controllers/jobs/job/index.js @@ -1,11 +1,9 @@ import { inject as service } from '@ember/service'; import { alias } from '@ember/object/computed'; import Controller, { inject as controller } from '@ember/controller'; -import { computed } from '@ember/object'; -import Sortable from 'nomad-ui/mixins/sortable'; import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting'; -export default Controller.extend(Sortable, WithNamespaceResetting, { +export default Controller.extend(WithNamespaceResetting, { system: service(), jobController: controller('jobs.job'), @@ -16,7 +14,6 @@ export default Controller.extend(Sortable, WithNamespaceResetting, { }, currentPage: 1, - pageSize: 10, sortProperty: 'name', sortDescending: false, @@ -24,20 +21,15 @@ export default Controller.extend(Sortable, WithNamespaceResetting, { breadcrumbs: alias('jobController.breadcrumbs'), job: alias('model'), - taskGroups: computed('model.taskGroups.[]', function() { - return this.get('model.taskGroups') || []; - }), - - listToSort: alias('taskGroups'), - sortedTaskGroups: alias('listSorted'), - - sortedEvaluations: computed('model.evaluations.@each.modifyIndex', function() { - return (this.get('model.evaluations') || []).sortBy('modifyIndex').reverse(); - }), - actions: { gotoTaskGroup(taskGroup) { this.transitionToRoute('jobs.job.task-group', taskGroup.get('job'), taskGroup); }, + + gotoJob(job) { + this.transitionToRoute('jobs.job', job, { + queryParams: { jobNamespace: job.get('namespace.name') }, + }); + }, }, }); diff --git a/ui/app/templates/jobs/job/index.hbs b/ui/app/templates/jobs/job/index.hbs index bc2e6b7ce..7d81851b2 100644 --- a/ui/app/templates/jobs/job/index.hbs +++ b/ui/app/templates/jobs/job/index.hbs @@ -1,162 +1,8 @@ -{{#global-header class="page-header"}} - {{#each breadcrumbs as |breadcrumb index|}} - - {{/each}} -{{/global-header}} -{{#gutter-menu class="page-body" onNamespaceChange=(action "gotoJobs")}} - {{partial "jobs/job/subnav"}} -
-

- {{model.name}} - {{model.status}} - {{#if model.periodic}} - periodic - {{else if model.parameterized}} - parameterized - {{/if}} -

- -
-
- Type: {{model.type}} | - Priority: {{model.priority}} - {{#if (and model.namespace system.shouldShowNamespaces)}} - | Namespace: {{model.namespace.name}} - {{/if}} -
-
- -
-
-
Allocation Status {{taskGroups.length}}
-
-
- {{#allocation-status-bar allocationContainer=model class="split-view" as |chart|}} -
    - {{#each chart.data as |datum index|}} -
  1. - - {{datum.value}} - - {{datum.label}} - -
  2. - {{/each}} -
- {{/allocation-status-bar}} -
-
- - {{#if model.hasPlacementFailures}} -
-
- Placement Failures -
-
- {{#each model.taskGroups as |taskGroup|}} - {{placement-failure taskGroup=taskGroup}} - {{/each}} -
-
- {{/if}} - - {{#if model.runningDeployment}} -
-
-
- Active Deployment - {{model.runningDeployment.shortId}} - {{#if model.runningDeployment.version.submitTime}} - {{moment-from-now model.runningDeployment.version.submitTime}} - {{/if}} -
-
- Running - {{#if model.runningDeployment.requiresPromotion}} - Deployment is running but requires promotion - {{/if}} -
-
-
- {{#job-deployment-details deployment=model.runningDeployment as |d|}} - {{d.metrics}} - {{#if isShowingDeploymentDetails}} - {{d.taskGroups}} - {{d.allocations}} - {{/if}} - {{/job-deployment-details}} -
- -
- {{/if}} - -
-
- Task Groups -
-
- {{#list-pagination - source=sortedTaskGroups - sortProperty=sortProperty - sortDescending=sortDescending as |p|}} - {{#list-table - source=p.list - sortProperty=sortProperty - sortDescending=sortDescending as |t|}} - {{#t.head}} - {{#t.sort-by prop="name"}}Name{{/t.sort-by}} - {{#t.sort-by prop="count"}}Count{{/t.sort-by}} - {{#t.sort-by prop="queuedOrStartingAllocs" class="is-3"}}Allocation Status{{/t.sort-by}} - {{#t.sort-by prop="reservedCPU"}}Reserved CPU{{/t.sort-by}} - {{#t.sort-by prop="reservedMemory"}}Reserved Memory{{/t.sort-by}} - {{#t.sort-by prop="reservedEphemeralDisk"}}Reserved Disk{{/t.sort-by}} - {{/t.head}} - {{#t.body as |row|}} - {{task-group-row data-test-task-group taskGroup=row.model onClick=(action "gotoTaskGroup" row.model)}} - {{/t.body}} - {{/list-table}} - {{/list-pagination}} -
-
- -
-
- Evaluations -
-
- {{#list-table source=sortedEvaluations as |t|}} - {{#t.head}} - ID - Priority - Triggered By - Status - Placement Failures - {{/t.head}} - {{#t.body as |row|}} - - {{row.model.shortId}} - {{row.model.priority}} - {{row.model.triggeredBy}} - {{row.model.status}} - - {{#if (eq row.model.status "blocked")}} - N/A - In Progress - {{else if row.model.hasPlacementFailures}} - True - {{else}} - False - {{/if}} - - - {{/t.body}} - {{/list-table}} -
-
-
-{{/gutter-menu}} +{{component (concat "job-page/" model.templateType) + job=model + sortProperty=sortProperty + sortDescending=sortDescending + currentPage=currentPage + onNamespaceChange=(action "gotoJobs") + gotoJob=(action "gotoJob") + gotoTaskGroup=(action "gotoTaskGroup")}}