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