open-nomad/ui/app/templates/components/topo-viz.hbs
Michael Lange 0ab6b31cab Refactor topo viz to do as much computation upfront & use faster data structures
Now all data loading happens in the TopoViz component as well as
computation of resource proportions.

Allocation selection state is also managed centrally uses a dedicated
structure indexed by group key (job id and task group name). This way
allocations don't need to be scanned at the node level, which is O(n) at
the best (assuming no ember overhead on recomputes).
2020-10-15 02:54:14 -07:00

22 lines
852 B
Handlebars

<div class="topo-viz {{if (eq this.datacenters.length 1) "is-single-column"}}" {{did-insert (perform this.buildTopology)}} {{did-insert this.captureElement}}>
{{#if this.buildTopology.isRunning}}
<div class="has-text-centered"><LoadingSpinner /></div>
{{else}}
{{#each this.topology.datacenters as |dc|}}
<TopoViz::Datacenter
@datacenter={{dc}}
@heightScale={{this.topology.heightScale}}
@onAllocationSelect={{this.associateAllocations}}
@onLoad={{action this.masonry}}/>
{{/each}}
{{#if this.activeAllocation}}
<svg class="chart topo-viz-edges" {{window-resize this.computedActiveEdges}}>
{{#each this.activeEdges as |edge|}}
<line class="edge" x1={{edge.x1}} y1={{edge.y1}} x2={{edge.x2}} y2={{edge.y2}} />
{{/each}}
</svg>
{{/if}}
{{/if}}
</div>