From 9eae03013db53bfc4625ff1d992546e470e55c77 Mon Sep 17 00:00:00 2001 From: Pablo Revilla Date: Wed, 27 Aug 2025 14:08:11 -0700 Subject: [PATCH] Added the traceroute and neighbours to the map --- meshview/templates/map.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/meshview/templates/map.html b/meshview/templates/map.html index 0b071e2..41155e4 100644 --- a/meshview/templates/map.html +++ b/meshview/templates/map.html @@ -205,19 +205,25 @@ function loadEdges(callback) { } function onNodeClick(node) { + console.log(`Clicked node ${node.long_name}: lat=${node.lat}, long=${node.long}`); + loadEdges(edges => { edgeLayer.clearLayers(); edges.forEach(edge => { - // Only consider edges connected to the clicked node + // Only draw edges connected to the clicked node if (edge.from !== node.id && edge.to !== node.id) return; let fromNode = nodes.find(n => n.id === edge.from); let toNode = nodes.find(n => n.id === edge.to); - // Validate coordinates if (fromNode && toNode && fromNode.lat != null && fromNode.long != null && toNode.lat != null && toNode.long != null) { + // Determine the "other" node + let otherNode = edge.from === node.id ? toNode : fromNode; + console.log(` Connected to node ${otherNode.long_name}: lat=${otherNode.lat}, long=${otherNode.long}`); + + // Draw the edge L.polyline( [[fromNode.lat, fromNode.long], [toNode.lat, toNode.long]], { @@ -233,6 +239,7 @@ function onNodeClick(node) { } + // Attach edge click events nodes.forEach(node => { if (node.lat != null && node.long != null) {