Merge pull request #8807 from hashicorp/f-ui/lifecycle-poststop
UI: Task lifecycle poststop phase.
This commit is contained in:
commit
65d2d28fc9
|
@ -47,6 +47,11 @@ export default class LifecycleChart extends Component {
|
||||||
phases.push({
|
phases.push({
|
||||||
name: 'Poststart',
|
name: 'Poststart',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
phases.push({
|
||||||
|
name: 'Poststop',
|
||||||
|
isActive: lifecycles.poststops.some(stateActiveIterator),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return phases;
|
return phases;
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|
||||||
border-top: 2px solid transparent;
|
border-top: 2px solid transparent;
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
|
@ -58,12 +59,12 @@
|
||||||
|
|
||||||
&.main {
|
&.main {
|
||||||
left: 25%;
|
left: 25%;
|
||||||
right: 0;
|
right: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.poststart {
|
&.poststart {
|
||||||
left: 40%;
|
left: 35%;
|
||||||
right: 0;
|
right: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.poststop {
|
&.poststop {
|
||||||
|
@ -126,20 +127,28 @@
|
||||||
|
|
||||||
&.main {
|
&.main {
|
||||||
margin-left: 25%;
|
margin-left: 25%;
|
||||||
margin-right: 0;
|
margin-right: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.prestart-ephemeral {
|
&.prestart-ephemeral {
|
||||||
margin-right: 75%;
|
margin-right: 75%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.prestart-sidecar {
|
||||||
|
margin-right: 25%;
|
||||||
|
}
|
||||||
|
|
||||||
&.poststart-ephemeral,
|
&.poststart-ephemeral,
|
||||||
&.poststart-sidecar {
|
&.poststart-sidecar {
|
||||||
margin-left: 40%;
|
margin-left: 35%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.poststart-sidecar {
|
||||||
|
margin-right: 25%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.poststart-ephemeral {
|
&.poststart-ephemeral {
|
||||||
margin-right: 10%;
|
margin-right: 35%;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.poststop {
|
&.poststop {
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
<svg class="divider prestart">
|
<svg class="divider prestart">
|
||||||
<line x1="0" y1="0" x2="0" y2="100%" />
|
<line x1="0" y1="0" x2="0" y2="100%" />
|
||||||
</svg>
|
</svg>
|
||||||
|
<svg class="divider poststop">
|
||||||
|
<line x1="0" y1="0" x2="0" y2="100%" />
|
||||||
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="lifecycle-chart-rows">
|
<div class="lifecycle-chart-rows">
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default Factory.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
Lifecycle: i => {
|
Lifecycle: i => {
|
||||||
const cycle = i % 5;
|
const cycle = i % 6;
|
||||||
|
|
||||||
if (cycle === 0) {
|
if (cycle === 0) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -43,6 +43,8 @@ export default Factory.extend({
|
||||||
return { Hook: 'poststart', Sidecar: false };
|
return { Hook: 'poststart', Sidecar: false };
|
||||||
} else if (cycle === 4) {
|
} else if (cycle === 4) {
|
||||||
return { Hook: 'poststart', Sidecar: true };
|
return { Hook: 'poststart', Sidecar: true };
|
||||||
|
} else if (cycle === 5) {
|
||||||
|
return { Hook: 'poststop' };
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ module('Acceptance | allocation detail', function(hooks) {
|
||||||
|
|
||||||
assert.ok(Allocation.lifecycleChart.isPresent);
|
assert.ok(Allocation.lifecycleChart.isPresent);
|
||||||
assert.equal(Allocation.lifecycleChart.title, 'Task Lifecycle Status');
|
assert.equal(Allocation.lifecycleChart.title, 'Task Lifecycle Status');
|
||||||
assert.equal(Allocation.lifecycleChart.phases.length, 3);
|
assert.equal(Allocation.lifecycleChart.phases.length, 4);
|
||||||
assert.equal(Allocation.lifecycleChart.tasks.length, 6);
|
assert.equal(Allocation.lifecycleChart.tasks.length, 6);
|
||||||
|
|
||||||
await Allocation.lifecycleChart.tasks[0].visit();
|
await Allocation.lifecycleChart.tasks[0].visit();
|
||||||
|
|
|
@ -42,6 +42,9 @@ module('Acceptance | task detail', function(hooks) {
|
||||||
if (lifecycle && (lifecycle.Hook === 'prestart' || lifecycle.Hook === 'poststart')) {
|
if (lifecycle && (lifecycle.Hook === 'prestart' || lifecycle.Hook === 'poststart')) {
|
||||||
lifecycleName = `${lifecycle.Hook}-${lifecycle.Sidecar ? 'sidecar' : 'ephemeral'}`;
|
lifecycleName = `${lifecycle.Hook}-${lifecycle.Sidecar ? 'sidecar' : 'ephemeral'}`;
|
||||||
}
|
}
|
||||||
|
if (lifecycle && lifecycle.Hook === 'poststop') {
|
||||||
|
lifecycleName = 'poststop';
|
||||||
|
}
|
||||||
|
|
||||||
assert.equal(Task.lifecycle, lifecycleName);
|
assert.equal(Task.lifecycle, lifecycleName);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,10 @@ const tasks = [
|
||||||
lifecycleName: 'poststart-sidecar',
|
lifecycleName: 'poststart-sidecar',
|
||||||
name: 'poststart sidecar: 4',
|
name: 'poststart sidecar: 4',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
lifecycleName: 'poststop',
|
||||||
|
name: 'poststop: 6',
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
module('Integration | Component | lifecycle-chart', function(hooks) {
|
module('Integration | Component | lifecycle-chart', function(hooks) {
|
||||||
|
@ -48,6 +52,7 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
|
||||||
assert.equal(Chart.phases[0].name, 'Prestart');
|
assert.equal(Chart.phases[0].name, 'Prestart');
|
||||||
assert.equal(Chart.phases[1].name, 'Main');
|
assert.equal(Chart.phases[1].name, 'Main');
|
||||||
assert.equal(Chart.phases[2].name, 'Poststart');
|
assert.equal(Chart.phases[2].name, 'Poststart');
|
||||||
|
assert.equal(Chart.phases[3].name, 'Poststop');
|
||||||
|
|
||||||
Chart.phases.forEach(phase => assert.notOk(phase.isActive));
|
Chart.phases.forEach(phase => assert.notOk(phase.isActive));
|
||||||
|
|
||||||
|
@ -58,6 +63,7 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
|
||||||
'main two: 3',
|
'main two: 3',
|
||||||
'poststart sidecar: 4',
|
'poststart sidecar: 4',
|
||||||
'poststart ephemeral: 5',
|
'poststart ephemeral: 5',
|
||||||
|
'poststop: 6',
|
||||||
]);
|
]);
|
||||||
assert.deepEqual(Chart.tasks.mapBy('lifecycle'), [
|
assert.deepEqual(Chart.tasks.mapBy('lifecycle'), [
|
||||||
'Prestart Task',
|
'Prestart Task',
|
||||||
|
@ -66,6 +72,7 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
|
||||||
'Main Task',
|
'Main Task',
|
||||||
'Sidecar Task',
|
'Sidecar Task',
|
||||||
'Poststart Task',
|
'Poststart Task',
|
||||||
|
'Poststop Task',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
assert.ok(Chart.tasks[0].isPrestartEphemeral);
|
assert.ok(Chart.tasks[0].isPrestartEphemeral);
|
||||||
|
@ -73,6 +80,7 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
|
||||||
assert.ok(Chart.tasks[2].isMain);
|
assert.ok(Chart.tasks[2].isMain);
|
||||||
assert.ok(Chart.tasks[4].isPoststartSidecar);
|
assert.ok(Chart.tasks[4].isPoststartSidecar);
|
||||||
assert.ok(Chart.tasks[5].isPoststartEphemeral);
|
assert.ok(Chart.tasks[5].isPoststartEphemeral);
|
||||||
|
assert.ok(Chart.tasks[6].isPoststop);
|
||||||
|
|
||||||
Chart.tasks.forEach(task => {
|
Chart.tasks.forEach(task => {
|
||||||
assert.notOk(task.isActive);
|
assert.notOk(task.isActive);
|
||||||
|
@ -94,10 +102,10 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it renders all phases when there are any non-main tasks', async function(assert) {
|
test('it renders all phases when there are any non-main tasks', async function(assert) {
|
||||||
this.set('tasks', [tasks[0], tasks[2]]);
|
this.set('tasks', [tasks[0], tasks[6]]);
|
||||||
|
|
||||||
await render(hbs`<LifecycleChart @tasks={{tasks}} />`);
|
await render(hbs`<LifecycleChart @tasks={{tasks}} />`);
|
||||||
assert.equal(Chart.phases.length, 3);
|
assert.equal(Chart.phases.length, 4);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('it reflects phase and task states when states are passed in', async function(assert) {
|
test('it reflects phase and task states when states are passed in', async function(assert) {
|
||||||
|
@ -141,8 +149,8 @@ module('Integration | Component | lifecycle-chart', function(hooks) {
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
testName: 'expected active phases',
|
testName: 'expected active phases',
|
||||||
runningTaskNames: ['prestart ephemeral', 'main one'],
|
runningTaskNames: ['prestart ephemeral', 'main one', 'poststop'],
|
||||||
activePhaseNames: ['Prestart', 'Main'],
|
activePhaseNames: ['Prestart', 'Main', 'Poststop'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
testName: 'sidecar task states don’t affect phase active states',
|
testName: 'sidecar task states don’t affect phase active states',
|
||||||
|
|
|
@ -23,6 +23,7 @@ export default {
|
||||||
isPrestartSidecar: hasClass('prestart-sidecar'),
|
isPrestartSidecar: hasClass('prestart-sidecar'),
|
||||||
isPoststartEphemeral: hasClass('poststart-ephemeral'),
|
isPoststartEphemeral: hasClass('poststart-ephemeral'),
|
||||||
isPoststartSidecar: hasClass('poststart-sidecar'),
|
isPoststartSidecar: hasClass('poststart-sidecar'),
|
||||||
|
isPoststop: hasClass('poststop'),
|
||||||
|
|
||||||
visit: clickable('a'),
|
visit: clickable('a'),
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue