Skip to content

Commit

Permalink
Merge pull request #4388 from hashicorp/f-ui-show-deployment-deadline
Browse files Browse the repository at this point in the history
UI: Show deployment deadline for each task group in the running deployment
  • Loading branch information
DingoEatingFuzz committed Jun 7, 2018
2 parents 9fd25f1 + 73ce773 commit 9f5cc8d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ui/app/models/task-group-deployment-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ export default Fragment.extend({
placedAllocs: attr('number'),
healthyAllocs: attr('number'),
unhealthyAllocs: attr('number'),

requireProgressBy: attr('date'),
});
8 changes: 8 additions & 0 deletions ui/app/templates/components/job-deployment/task-groups.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
<th>Allocs</th>
<th>Healthy Allocs</th>
<th>Unhealthy Allocs</th>
{{#if inProgress}}
<th>Progress Deadline</th>
{{/if}}
{{/t.head}}
{{#t.body as |row|}}
<tr data-test-deployment-task-group>
Expand All @@ -31,6 +34,11 @@
<td data-test-deployment-task-group-allocs>{{row.model.placedAllocs}} / {{row.model.desiredTotal}}</td>
<td data-test-deployment-task-group-healthy>{{row.model.healthyAllocs}}</td>
<td data-test-deployment-task-group-unhealthy>{{row.model.unhealthyAllocs}}</td>
{{#if inProgress}}
<td data-test-deployment-task-group-progress-deadline>
<span class="nowrap">{{moment-format row.model.requireProgressBy "MM/DD/YY HH:mm:ss"}}</span>
</td>
{{/if}}
</tr>
{{/t.body}}
{{/list-table}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
4 changes: 4 additions & 0 deletions ui/mirage/factories/deployment-task-group-summary.js
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
31 changes: 31 additions & 0 deletions ui/tests/integration/job-page/parts/running-deployment-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
);
});
});
});

0 comments on commit 9f5cc8d

Please sign in to comment.