github.com/hernad/nomad@v1.6.112/ui/app/templates/components/topo-viz/node.hbs (about) 1 {{! 2 Copyright (c) HashiCorp, Inc. 3 SPDX-License-Identifier: MPL-2.0 4 ~}} 5 6 <div data-test-topo-viz-node class="topo-viz-node {{unless this.allocations.length "is-empty"}}" {{did-insert this.reloadNode}}> 7 {{#unless @isDense}} 8 <p data-test-label class="label"> 9 {{#if @node.node.isDraining}} 10 <span data-test-status-icon class="tooltip" aria-label="Client is draining">{{x-icon "clock-outline" class="is-info"}}</span> 11 {{else if (not @node.node.isEligible)}} 12 <span data-test-status-icon class="tooltip" aria-label="Client is ineligible">{{x-icon "lock-closed" class="is-warning"}}</span> 13 {{/if}} 14 <span class="tooltip" aria-label="Node Name"><strong><LinkTo @route="clients.client" @model={{@node.node.id}}>{{@node.node.name}}</LinkTo></strong></span> 15 <span class="bumper-left tooltip" aria-label="Number of Allocations">{{this.count}} Allocs</span> 16 <span class="bumper-left is-faded tooltip" aria-label="Node Pool">{{@node.node.nodePool}}</span> 17 <span class="bumper-left is-faded"> 18 <span class="tooltip" aria-label="Node Memory">{{format-scheduled-bytes @node.memory start="MiB"}}</span>, 19 <span class="tooltip" aria-label="Node CPU">{{format-scheduled-hertz @node.cpu}}</span> 20 </span> 21 <span class="bumper-left is-faded tooltip" aria-label="Node Status">{{@node.node.status}}</span> 22 <span class="bumper-left is-faded tooltip" aria-label="Nomad Version">{{@node.node.version}}</span> 23 </p> 24 {{/unless}} 25 <svg 26 data-test-topo-node-svg 27 class="chart" 28 height="{{this.totalHeight}}px" 29 {{did-insert this.render}} 30 {{did-update this.updateRender}} 31 {{window-resize this.render}} 32 {{on "mouseout" this.allocationBlur}}> 33 <defs> 34 <clipPath id="{{this.maskId}}"> 35 <rect class="mask" x="0" y="0" width="{{this.dimensionsWidth}}px" height="{{this.maskHeight}}px" rx="2px" ry="2px" /> 36 </clipPath> 37 </defs> 38 <rect 39 data-test-node-background 40 class="node-background {{if @node.isSelected "is-selected"}} {{if @isDense "is-interactive"}}" 41 width="100%" 42 height="{{this.totalHeight}}px" 43 rx="2px" 44 ry="2px" 45 {{on "click" this.selectNode}} /> 46 {{#if this.allocations.length}} 47 <g 48 class="dimensions {{if this.activeAllocation "is-active"}}" 49 transform="translate({{this.paddingLeft}},{{this.padding}})" 50 width="{{this.dimensionsWidth}}px" 51 height="{{this.maskHeight}}px" 52 pointer-events="all" 53 {{on "mouseleave" this.clearHighlight}} 54 > 55 <g class="memory"> 56 {{#if this.data.memoryLabel}} 57 <text class="label" aria-label="Memory" transform="translate({{this.data.memoryLabel.x}},{{this.data.memoryLabel.y}})">M</text> 58 {{/if}} 59 {{#if this.data.memoryRemainder}} 60 <rect 61 class="dimension-background" 62 x="{{this.data.memoryRemainder.x}}px" 63 width="{{this.data.memoryRemainder.width}}px" 64 height="{{this.height}}px" /> 65 {{/if}} 66 {{#each this.data.memory key="allocation.id" as |memory|}} 67 <g 68 data-test-memory-rect="{{memory.allocation.allocation.id}}" 69 class="bar {{memory.className}} {{if (eq this.activeAllocation memory.allocation) "is-active"}} {{if memory.allocation.isSelected "is-selected"}}" 70 clip-path="url(#{{this.maskId}})" 71 data-allocation-id="{{memory.allocation.allocation.id}}" 72 {{on "mouseenter" (fn this.highlightAllocation memory.allocation)}} 73 {{on "click" (fn this.selectAllocation memory.allocation)}}> 74 <rect 75 width="{{memory.width}}px" 76 height="{{if memory.allocation.isSelected this.selectedHeight this.height}}px" 77 x="{{memory.x}}px" 78 y="{{if memory.allocation.isSelected 0.5 0}}px" 79 class="layer-0" /> 80 {{#if (or (eq memory.className "starting") (eq memory.className "pending"))}} 81 <rect 82 width="{{memory.width}}px" 83 height="{{if memory.allocation.isSelected this.selectedHeight this.height}}px" 84 x="{{memory.x}}px" 85 y="{{if memory.allocation.isSelected 0.5 0}}px" 86 class="layer-1" /> 87 {{/if}} 88 </g> 89 {{/each}} 90 </g> 91 <g class="cpu"> 92 {{#if this.data.cpuLabel}} 93 <text class="label" aria-label="CPU" transform="translate({{this.data.cpuLabel.x}},{{this.data.cpuLabel.y}})">C</text> 94 {{/if}} 95 {{#if this.data.cpuRemainder}} 96 <rect 97 class="dimension-background" 98 x="{{this.data.cpuRemainder.x}}px" 99 y="{{this.yOffset}}px" 100 width="{{this.data.cpuRemainder.width}}px" 101 height="{{this.height}}px" /> 102 {{/if}} 103 {{#each this.data.cpu key="allocation.id" as |cpu|}} 104 <g 105 data-test-cpu-rect="{{cpu.allocation.allocation.id}}" 106 class="bar {{cpu.className}} {{if (eq this.activeAllocation cpu.allocation) "is-active"}} {{if cpu.allocation.isSelected "is-selected"}}" 107 clip-path="url(#{{this.maskId}})" 108 data-allocation-id="{{cpu.allocation.allocation.id}}" 109 {{on "mouseenter" (fn this.highlightAllocation cpu.allocation)}} 110 {{on "click" (fn this.selectAllocation cpu.allocation)}}> 111 <rect 112 width="{{cpu.width}}px" 113 height="{{if cpu.allocation.isSelected this.selectedHeight this.height}}px" 114 x="{{cpu.x}}px" 115 y="{{if cpu.allocation.isSelected this.selectedYOffset this.yOffset}}px" 116 class="layer-0" /> 117 {{#if (or (eq cpu.className "starting") (eq cpu.className "pending"))}} 118 <rect 119 width="{{cpu.width}}px" 120 height="{{if cpu.allocation.isSelected this.selectedHeight this.height}}px" 121 x="{{cpu.x}}px" 122 y="{{if cpu.allocation.isSelected this.selectedYOffset this.yOffset}}px" 123 class="layer-1" /> 124 {{/if}} 125 </g> 126 {{/each}} 127 </g> 128 </g> 129 {{else}} 130 <g class="empty-text"><text data-test-empty-message>Empty Client</text></g> 131 {{/if}} 132 </svg> 133 </div> 134