From 4e953c01fca5af874b6f83da01d5e49c942d5d08 Mon Sep 17 00:00:00 2001 From: CN-JS-HuiBai Date: Sun, 5 Apr 2026 23:50:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BA=BF=E8=B7=AF=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/js/app.js | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 442331e..b15f197 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -320,6 +320,7 @@ // setInterval(fetchMetrics, REFRESH_INTERVAL); - Now using WebSockets initWebSocket(); setInterval(fetchNetworkHistory, NETWORK_HISTORY_INTERVAL); + fetchLatency(); setInterval(fetchLatency, REFRESH_INTERVAL); } @@ -335,6 +336,7 @@ if (msg.type === 'overview') { allServersData = msg.data.servers || []; updateDashboard(msg.data); + updateMap2D(allServersData); } } catch (err) { console.error('WS Message Error:', err); @@ -689,26 +691,38 @@ data: lineData }; - // Add or update line series - const options = myMap2D.getOption(); - const series = options.series; - - // Filter out existing latency lines to update - const newSeries = series.filter(s => s.type !== 'lines' || !s.latencyLine); - lineSeries.latencyLine = true; - newSeries.push(lineSeries); - - myMap2D.setOption({ series: newSeries }); + window.latencySeries = lineSeries; + } else { + window.latencySeries = null; } + } else { + window.latencySeries = null; + } + + // Combine all series + const finalSeries = [ + { + type: 'scatter', + coordinateSystem: 'geo', + geoIndex: 0, + symbolSize: 6, + itemStyle: { + color: '#06b6d4', + shadowBlur: 3, + shadowColor: 'rgba(6, 182, 212, 0.5)' + }, + data: geoData, + zlevel: 1 + } + ]; + + if (window.latencySeries) { + finalSeries.push(window.latencySeries); } myMap2D.setOption({ - series: [{ - coordinateSystem: 'geo', - geoIndex: 0, - data: geoData - }] - }, { replaceMerge: ['series'] }); + series: finalSeries + }); // Update footer stats if (dom.globeTotalNodes) dom.globeTotalNodes.textContent = geoData.length;