diff --git a/ui/app/templates/allocations/allocation/index.hbs b/ui/app/templates/allocations/allocation/index.hbs index 335d2cf5aac..9ea4f650dc5 100644 --- a/ui/app/templates/allocations/allocation/index.hbs +++ b/ui/app/templates/allocations/allocation/index.hbs @@ -37,29 +37,36 @@
Tasks
-
- {{#list-table - source=sortedStates - sortProperty=sortProperty - sortDescending=sortDescending - class="is-striped" as |t|}} - {{#t.head}} - - {{#t.sort-by prop="name"}}Name{{/t.sort-by}} - {{#t.sort-by prop="state"}}State{{/t.sort-by}} - Last Event - {{#t.sort-by prop="events.lastObject.time"}}Time{{/t.sort-by}} - Addresses - CPU - Memory - {{/t.head}} - {{#t.body as |row|}} - {{task-row - data-test-task-row=row.model.name - task=row.model - onClick=(action "taskClick" row.model.allocation row.model)}} - {{/t.body}} - {{/list-table}} +
+ {{#if sortedStates.length}} + {{#list-table + source=sortedStates + sortProperty=sortProperty + sortDescending=sortDescending + class="is-striped" as |t|}} + {{#t.head}} + + {{#t.sort-by prop="name"}}Name{{/t.sort-by}} + {{#t.sort-by prop="state"}}State{{/t.sort-by}} + Last Event + {{#t.sort-by prop="events.lastObject.time"}}Time{{/t.sort-by}} + Addresses + CPU + Memory + {{/t.head}} + {{#t.body as |row|}} + {{task-row + data-test-task-row=row.model.name + task=row.model + onClick=(action "taskClick" row.model.allocation row.model)}} + {{/t.body}} + {{/list-table}} + {{else}} +
+

No Tasks

+

Allocations will not have tasks until they are in a running state.

+
+ {{/if}}
diff --git a/ui/tests/acceptance/allocation-detail-test.js b/ui/tests/acceptance/allocation-detail-test.js index 14447a14631..bb7854ac9e5 100644 --- a/ui/tests/acceptance/allocation-detail-test.js +++ b/ui/tests/acceptance/allocation-detail-test.js @@ -15,7 +15,7 @@ moduleForAcceptance('Acceptance | allocation detail', { node = server.create('node'); job = server.create('job', { groupsCount: 1, createAllocations: false }); - allocation = server.create('allocation', 'withTaskWithPorts'); + allocation = server.create('allocation', 'withTaskWithPorts', { clientStatus: 'running' }); // Make sure the node has an unhealthy driver node.update({ @@ -76,6 +76,7 @@ test('/allocation/:id should list all tasks for the allocation', function(assert server.db.taskStates.where({ allocationId: allocation.id }).length, 'Table lists all tasks' ); + assert.notOk(Allocation.isEmpty, 'Task table empty state is not shown'); }); test('each task row should list high-level information for the task', function(assert) { @@ -146,6 +147,16 @@ test('tasks with an unhealthy driver have a warning icon', function(assert) { assert.ok(Allocation.firstUnhealthyTask().hasUnhealthyDriver, 'Warning is shown'); }); +test('when there are no tasks, an empty state is shown', function(assert) { + // Make sure the allocation is pending in order to ensure there are no tasks + allocation = server.create('allocation', 'withTaskWithPorts', { clientStatus: 'pending' }); + Allocation.visit({ id: allocation.id }); + + andThen(() => { + assert.ok(Allocation.isEmpty, 'Task table empty state is shown'); + }); +}); + test('when the allocation has not been rescheduled, the reschedule events section is not rendered', function(assert) { assert.notOk(Allocation.hasRescheduleEvents, 'Reschedule Events section exists'); }); diff --git a/ui/tests/pages/allocations/detail.js b/ui/tests/pages/allocations/detail.js index c824f961036..bc3bc165d4c 100644 --- a/ui/tests/pages/allocations/detail.js +++ b/ui/tests/pages/allocations/detail.js @@ -47,6 +47,8 @@ export default create({ hasRescheduleEvents: isPresent('[data-test-reschedule-events]'), + isEmpty: isPresent('[data-test-empty-tasks-list]'), + error: { isShown: isPresent('[data-test-error]'), title: text('[data-test-error-title]'),