From d69e77e4fd63b8b2b5179a126301905aec4aa376 Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 6 Jun 2018 17:34:50 -0700 Subject: [PATCH 1/2] Add new property to factory --- ui/mirage/factories/deployment-task-group-summary.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/mirage/factories/deployment-task-group-summary.js b/ui/mirage/factories/deployment-task-group-summary.js index 5858c66fcfe9..addc4c8aa489 100644 --- a/ui/mirage/factories/deployment-task-group-summary.js +++ b/ui/mirage/factories/deployment-task-group-summary.js @@ -1,11 +1,15 @@ import { Factory, faker } from 'ember-cli-mirage'; +const REF_TIME = new Date(); + export default Factory.extend({ name: '', autoRevert: () => Math.random() > 0.5, promoted: () => Math.random() > 0.5, + requireProgressBy: () => faker.date.past(0.5 / 365, REF_TIME), + desiredTotal: faker.random.number({ min: 1, max: 10 }), desiredCanaries() { From 73ce773e11524e30cd334427c8f8ca608e9ababb Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 6 Jun 2018 17:35:18 -0700 Subject: [PATCH 2/2] Show the progress deadline for task groups in a running deployment --- .../models/task-group-deployment-summary.js | 2 ++ .../components/job-deployment/task-groups.hbs | 8 +++++ .../job-page/parts/running-deployment.hbs | 2 +- .../job-page/parts/running-deployment-test.js | 31 +++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ui/app/models/task-group-deployment-summary.js b/ui/app/models/task-group-deployment-summary.js index 8436796466e0..21f795f87ec6 100644 --- a/ui/app/models/task-group-deployment-summary.js +++ b/ui/app/models/task-group-deployment-summary.js @@ -22,4 +22,6 @@ export default Fragment.extend({ placedAllocs: attr('number'), healthyAllocs: attr('number'), unhealthyAllocs: attr('number'), + + requireProgressBy: attr('date'), }); diff --git a/ui/app/templates/components/job-deployment/task-groups.hbs b/ui/app/templates/components/job-deployment/task-groups.hbs index cee10994caff..a25bffd3debb 100644 --- a/ui/app/templates/components/job-deployment/task-groups.hbs +++ b/ui/app/templates/components/job-deployment/task-groups.hbs @@ -15,6 +15,9 @@ Allocs Healthy Allocs Unhealthy Allocs + {{#if inProgress}} + Progress Deadline + {{/if}} {{/t.head}} {{#t.body as |row|}} @@ -31,6 +34,11 @@ {{row.model.placedAllocs}} / {{row.model.desiredTotal}} {{row.model.healthyAllocs}} {{row.model.unhealthyAllocs}} + {{#if inProgress}} + + {{moment-format row.model.requireProgressBy "MM/DD/YY HH:mm:ss"}} + + {{/if}} {{/t.body}} {{/list-table}} diff --git a/ui/app/templates/components/job-page/parts/running-deployment.hbs b/ui/app/templates/components/job-page/parts/running-deployment.hbs index c42bb866d6ac..c04d33c92f47 100644 --- a/ui/app/templates/components/job-page/parts/running-deployment.hbs +++ b/ui/app/templates/components/job-page/parts/running-deployment.hbs @@ -19,7 +19,7 @@ {{#job-deployment-details deployment=job.runningDeployment as |d|}} {{d.metrics}} {{#if isShowingDeploymentDetails}} - {{d.taskGroups}} + {{d.taskGroups inProgress=true}} {{d.allocations}} {{/if}} {{/job-deployment-details}} diff --git a/ui/tests/integration/job-page/parts/running-deployment-test.js b/ui/tests/integration/job-page/parts/running-deployment-test.js index e6cb09bbd242..426de121036d 100644 --- a/ui/tests/integration/job-page/parts/running-deployment-test.js +++ b/ui/tests/integration/job-page/parts/running-deployment-test.js @@ -139,3 +139,34 @@ test('the active deployment section can be expanded to show task groups and allo }); }); }); + +test('each task group in the expanded task group section shows task group details', function(assert) { + this.server.create('node'); + this.server.create('job', { type: 'service', activeDeployment: true }); + + this.store.findAll('job'); + + return wait().then(() => { + const job = this.store.peekAll('job').get('firstObject'); + + this.set('job', job); + this.render(hbs` + {{job-page/parts/running-deployment job=job}} + `); + + return wait() + .then(() => { + click('[data-test-deployment-toggle-details]'); + return wait(); + }) + .then(() => { + const task = job.get('runningDeployment.taskGroupSummaries.firstObject'); + const findForTaskGroup = selector => find(`[data-test-deployment-task-group-${selector}]`); + assert.equal(findForTaskGroup('name').textContent.trim(), task.get('name')); + assert.equal( + findForTaskGroup('progress-deadline').textContent.trim(), + moment(task.get('requireProgressBy')).format('MM/DD/YY HH:mm:ss') + ); + }); + }); +});