From e60681963f45f0d65af923ce3e7fa2873a56400f Mon Sep 17 00:00:00 2001 From: Alex Cheema <41707476+AlexCheema@users.noreply.github.com> Date: Thu, 6 Nov 2025 11:18:07 -0800 Subject: [PATCH] show ips on dashboard --- dashboard/index.html | 316 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 311 insertions(+), 5 deletions(-) diff --git a/dashboard/index.html b/dashboard/index.html index 24c6132f..715fdb54 100644 --- a/dashboard/index.html +++ b/dashboard/index.html @@ -165,6 +165,20 @@ } } + .edge-label { + font-size: 10px; + fill: var(--exo-light-gray); + text-anchor: middle; + pointer-events: none; + font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace; + opacity: 0.95; + } + + .edge-label-bg { + fill: var(--exo-dark-gray); + opacity: 0.85; + } + .node-info-grid { display: grid; grid-template-columns: repeat(2, 1fr); @@ -363,6 +377,16 @@ margin-bottom: 12px; border-left: 4px solid var(--exo-yellow); transition: background-color 0.2s ease; + position: relative; + } + + .instance-color-indicator { + position: absolute; + top: 15px; + left: -4px; + width: 4px; + height: calc(100% - 30px); + border-radius: 0 2px 2px 0; } .instance-item:hover { @@ -1006,6 +1030,25 @@ } setRgbVar('exo-yellow', getComputedStyle(document.documentElement).getPropertyValue('--exo-yellow').trim()); + // Generate a consistent color for an instance ID using a simple hash + function generateInstanceColor(instanceId) { + if (!instanceId) return '#888888'; + + // Simple hash function + let hash = 0; + for (let i = 0; i < instanceId.length; i++) { + hash = instanceId.charCodeAt(i) + ((hash << 5) - hash); + } + + // Convert to HSL for better color distribution + // Use high saturation and medium lightness for vibrant, distinguishable colors + const hue = Math.abs(hash % 360); + const saturation = 65 + (Math.abs(hash >> 8) % 20); // 65-85% + const lightness = 55 + (Math.abs(hash >> 16) % 15); // 55-70% + + return `hsl(${hue}, ${saturation}%, ${lightness}%)`; + } + const topologyGraphContainer = document.getElementById('topologyGraphContainer'); const lastUpdatedElement = document.getElementById('lastUpdated'); const nodeDetailPanel = document.getElementById('nodeDetailPanel'); @@ -1027,6 +1070,8 @@ const USE_MOCK_DATA = false; // <<< FLAG TO TOGGLE MOCK DATA let currentlySelectedNodeId = null; // To store the ID of the currently selected node let nodeIdToFriendlyName = {}; // Map nodeId -> friendly name for download sections + let instanceIdToColor = {}; // Map instanceId -> color for visual coding + let connectionToInstances = {}; // Map "nodeA|nodeB" -> [instanceIds] using that connection const API_ENDPOINT = window.location.origin + window.location.pathname.replace(/\/$/, "") + '/state'; const REFRESH_INTERVAL = 1000; // 1 second @@ -1449,6 +1494,33 @@ return; } + // Build maps for instance colors and connection usage + instanceIdToColor = {}; + connectionToInstances = {}; + + instancesArray.forEach(instance => { + const instanceId = instance.instanceId; + instanceIdToColor[instanceId] = generateInstanceColor(instanceId); + + // Determine which nodes this instance uses + const nodeToRunner = instance.shardAssignments?.nodeToRunner || {}; + const nodesUsed = Object.keys(nodeToRunner); + + // For each pair of nodes, record that this instance uses that connection + for (let i = 0; i < nodesUsed.length; i++) { + for (let j = i + 1; j < nodesUsed.length; j++) { + const nodeA = nodesUsed[i]; + const nodeB = nodesUsed[j]; + const key = nodeA < nodeB ? `${nodeA}|${nodeB}` : `${nodeB}|${nodeA}`; + + if (!connectionToInstances[key]) { + connectionToInstances[key] = []; + } + connectionToInstances[key].push(instanceId); + } + } + }); + const instancesHTML = instancesArray.map(instance => { const modelId = instance.shardAssignments?.modelId || 'Unknown Model'; const truncatedInstanceId = instance.instanceId.length > 8 @@ -1586,8 +1658,14 @@ } const shardCount = Object.keys(runnerToShard).length; + + // Use the instance's color for the indicator + const instanceColor = instanceIdToColor[instance.instanceId] || 'var(--exo-yellow)'; + const borderStyle = `background-color: ${instanceColor};`; + return `