From 5f9267cd2dd8005bb0239075ee5df5b8701f5f3a Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Wed, 4 Nov 2020 12:32:22 -0800 Subject: [PATCH] Forbidden state for the topo viz --- ui/app/routes/topology.js | 13 ++ ui/app/templates/topology.hbs | 388 +++++++++++++++++----------------- 2 files changed, 209 insertions(+), 192 deletions(-) diff --git a/ui/app/routes/topology.js b/ui/app/routes/topology.js index d97c85644..a53a92708 100644 --- a/ui/app/routes/topology.js +++ b/ui/app/routes/topology.js @@ -28,4 +28,17 @@ export default class TopologyRoute extends Route.extend(WithForbiddenState) { nodes: this.store.query('node', { resources: true }), }).catch(notifyForbidden(this)); } + + setupController(controller, model) { + // When the model throws, make sure the interface expected by the controller is consistent. + if (!model) { + controller.model = { + jobs: [], + allocations: [], + nodes: [], + }; + } + + return super.setupController(...arguments); + } } diff --git a/ui/app/templates/topology.hbs b/ui/app/templates/topology.hbs index 641546d54..820e5c385 100644 --- a/ui/app/templates/topology.hbs +++ b/ui/app/templates/topology.hbs @@ -1,203 +1,207 @@ {{title "Cluster Topology"}}
-
-
-
-
Legend
-
-
-

Metrics

-
-
M:
Memory
-
C:
CPU
-
+ {{#if this.isForbidden}} + + {{else}} +
+
+
+
Legend
+
+
+

Metrics

+
+
M:
Memory
+
C:
CPU
+
+
+
+

Allocation Status

+
+
Running
+
Starting
+
+
-
-

Allocation Status

-
-
Running
-
Starting
-
+
+
+
+ {{#if this.activeNode}}Client{{else if this.activeAllocation}}Allocation{{else}}Cluster{{/if}} Details +
+
+ {{#if this.activeNode}} + {{#let this.activeNode.node as |node|}} +
+

{{this.activeNode.allocations.length}} Allocations

+
+
+

+ Client: + + {{node.shortId}} + +

+

Name: {{node.name}}

+

Address: {{node.httpAddr}}

+

Status: {{node.status}}

+
+
+

+ Draining? {{if node.isDraining "Yes" "No"}} +

+

+ Eligible? {{if node.isEligible "Yes" "No"}} +

+
+
+

+ {{this.nodeUtilization.totalMemoryFormatted}} + {{this.nodeUtilization.totalMemoryUnits}} + of memory +

+
+
+
+ + {{this.nodeUtilization.reservedMemoryPercent}} + +
+
+
+ {{format-percentage this.nodeUtilization.reservedMemoryPercent total=1}} +
+
+
+ {{format-bytes this.nodeUtilization.totalReservedMemory}} / {{format-bytes this.nodeUtilization.totalMemory}} reserved +
+
+
+

{{this.nodeUtilization.totalCPU}} Mhz of CPU

+
+
+
+ + {{this.nodeUtilization.reservedCPUPercent}} + +
+
+
+ {{format-percentage this.nodeUtilization.reservedCPUPercent total=1}} +
+
+
+ {{this.nodeUtilization.totalReservedCPU}} Mhz / {{this.nodeUtilization.totalCPU}} Mhz reserved +
+
+ {{/let}} + {{else if this.activeAllocation}} +
+

+ Allocation: + {{this.activeAllocation.shortId}} +

+

Sibling Allocations: {{this.siblingAllocations.length}}

+

Unique Client Placements: {{this.uniqueActiveAllocationNodes.length}}

+
+
+

+ Job: + + {{this.activeAllocation.job.name}} + / {{this.activeAllocation.taskGroupName}} +

+

Type: {{this.activeAllocation.job.type}}

+

Priority: {{this.activeAllocation.job.priority}}

+
+
+

+ Client: + + {{this.activeAllocation.node.shortId}} + +

+

Name: {{this.activeAllocation.node.name}}

+

Address: {{this.activeAllocation.node.httpAddr}}

+
+
+ +
+
+ +
+ {{else}} +
+
+

{{this.model.nodes.length}} Clients

+
+
+

{{this.scheduledAllocations.length}} Allocations

+
+
+
+

{{this.totalMemoryFormatted}} {{this.totalMemoryUnits}} of memory

+
+
+
+ + {{this.reservedMemoryPercent}} + +
+
+
+ {{format-percentage this.reservedMemoryPercent total=1}} +
+
+
+ {{format-bytes this.totalReservedMemory}} / {{format-bytes this.totalMemory}} reserved +
+
+
+

{{this.totalCPU}} Mhz of CPU

+
+
+
+ + {{this.reservedCPUPercent}} + +
+
+
+ {{format-percentage this.reservedCPUPercent total=1}} +
+
+
+ {{this.totalReservedCPU}} Mhz / {{this.totalCPU}} Mhz reserved +
+
+ {{/if}}
-
-
- {{#if this.activeNode}}Client{{else if this.activeAllocation}}Allocation{{else}}Cluster{{/if}} Details -
-
- {{#if this.activeNode}} - {{#let this.activeNode.node as |node|}} -
-

{{this.activeNode.allocations.length}} Allocations

-
-
-

- Client: - - {{node.shortId}} - -

-

Name: {{node.name}}

-

Address: {{node.httpAddr}}

-

Status: {{node.status}}

-
-
-

- Draining? {{if node.isDraining "Yes" "No"}} -

-

- Eligible? {{if node.isEligible "Yes" "No"}} -

-
-
-

- {{this.nodeUtilization.totalMemoryFormatted}} - {{this.nodeUtilization.totalMemoryUnits}} - of memory -

-
-
-
- - {{this.nodeUtilization.reservedMemoryPercent}} - -
-
-
- {{format-percentage this.nodeUtilization.reservedMemoryPercent total=1}} -
-
-
- {{format-bytes this.nodeUtilization.totalReservedMemory}} / {{format-bytes this.nodeUtilization.totalMemory}} reserved -
-
-
-

{{this.nodeUtilization.totalCPU}} Mhz of CPU

-
-
-
- - {{this.nodeUtilization.reservedCPUPercent}} - -
-
-
- {{format-percentage this.nodeUtilization.reservedCPUPercent total=1}} -
-
-
- {{this.nodeUtilization.totalReservedCPU}} Mhz / {{this.nodeUtilization.totalCPU}} Mhz reserved -
-
- {{/let}} - {{else if this.activeAllocation}} -
-

- Allocation: - {{this.activeAllocation.shortId}} -

-

Sibling Allocations: {{this.siblingAllocations.length}}

-

Unique Client Placements: {{this.uniqueActiveAllocationNodes.length}}

-
-
-

- Job: - - {{this.activeAllocation.job.name}} - / {{this.activeAllocation.taskGroupName}} -

-

Type: {{this.activeAllocation.job.type}}

-

Priority: {{this.activeAllocation.job.priority}}

-
-
-

- Client: - - {{this.activeAllocation.node.shortId}} - -

-

Name: {{this.activeAllocation.node.name}}

-

Address: {{this.activeAllocation.node.httpAddr}}

-
-
- -
-
- -
- {{else}} -
-
-

{{this.model.nodes.length}} Clients

-
-
-

{{this.scheduledAllocations.length}} Allocations

-
-
-
-

{{this.totalMemoryFormatted}} {{this.totalMemoryUnits}} of memory

-
-
-
- - {{this.reservedMemoryPercent}} - -
-
-
- {{format-percentage this.reservedMemoryPercent total=1}} -
-
-
- {{format-bytes this.totalReservedMemory}} / {{format-bytes this.totalMemory}} reserved -
-
-
-

{{this.totalCPU}} Mhz of CPU

-
-
-
- - {{this.reservedCPUPercent}} - -
-
-
- {{format-percentage this.reservedCPUPercent total=1}} -
-
-
- {{this.totalReservedCPU}} Mhz / {{this.totalCPU}} Mhz reserved -
-
- {{/if}} -
+
+
-
- -
-
+ {{/if}}