修复线路不显示的问题
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user