修复无法正常渲染的问题
This commit is contained in:
@@ -586,7 +586,7 @@ input:checked+.slider:before {
|
|||||||
/* ---- Charts Section ---- */
|
/* ---- Charts Section ---- */
|
||||||
.charts-section {
|
.charts-section {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 3fr 2fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
margin-bottom: 24px;
|
margin-bottom: 24px;
|
||||||
}
|
}
|
||||||
@@ -761,8 +761,8 @@ input:checked+.slider:before {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.globe-body {
|
.globe-body {
|
||||||
flex: 1;
|
height: 280px; /* Match chart-body height exactly */
|
||||||
min-height: 280px;
|
padding: 12px 22px;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: grab;
|
cursor: grab;
|
||||||
|
|||||||
@@ -248,6 +248,20 @@
|
|||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="globe-body" id="globeContainer"></div>
|
<div class="globe-body" id="globeContainer"></div>
|
||||||
|
<div class="chart-footer">
|
||||||
|
<div class="traffic-stat">
|
||||||
|
<span class="traffic-label">全球节点总数</span>
|
||||||
|
<span class="traffic-value" id="globeTotalNodes">0</span>
|
||||||
|
</div>
|
||||||
|
<div class="traffic-stat">
|
||||||
|
<span class="traffic-label">覆盖地区/国家</span>
|
||||||
|
<span class="traffic-value" id="globeTotalRegions">0</span>
|
||||||
|
</div>
|
||||||
|
<div class="traffic-stat">
|
||||||
|
<span class="traffic-label">实时活跃状态</span>
|
||||||
|
<span class="traffic-value" style="color: var(--accent-emerald);">Active</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,9 @@
|
|||||||
confirmNewPasswordInput: document.getElementById('confirmNewPassword'),
|
confirmNewPasswordInput: document.getElementById('confirmNewPassword'),
|
||||||
btnChangePassword: document.getElementById('btnChangePassword'),
|
btnChangePassword: document.getElementById('btnChangePassword'),
|
||||||
changePasswordMessage: document.getElementById('changePasswordMessage'),
|
changePasswordMessage: document.getElementById('changePasswordMessage'),
|
||||||
globeContainer: document.getElementById('globeContainer')
|
globeContainer: document.getElementById('globeContainer'),
|
||||||
|
globeTotalNodes: document.getElementById('globeTotalNodes'),
|
||||||
|
globeTotalRegions: document.getElementById('globeTotalRegions')
|
||||||
};
|
};
|
||||||
|
|
||||||
// ---- State ----
|
// ---- State ----
|
||||||
@@ -373,9 +375,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const width = dom.globeContainer.clientWidth || 400;
|
||||||
|
const height = dom.globeContainer.clientHeight || 280;
|
||||||
|
|
||||||
myGlobe = Globe()
|
myGlobe = Globe()
|
||||||
(dom.globeContainer)
|
(dom.globeContainer)
|
||||||
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-dark.jpg')
|
.width(width)
|
||||||
|
.height(height)
|
||||||
|
.globeImageUrl('//unpkg.com/three-globe/example/img/earth-blue-marble.jpg')
|
||||||
.bumpImageUrl('//unpkg.com/three-globe/example/img/earth-topology.png')
|
.bumpImageUrl('//unpkg.com/three-globe/example/img/earth-topology.png')
|
||||||
.backgroundColor('rgba(0,0,0,0)')
|
.backgroundColor('rgba(0,0,0,0)')
|
||||||
.showAtmosphere(true)
|
.showAtmosphere(true)
|
||||||
@@ -396,20 +403,25 @@
|
|||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
|
|
||||||
// Resizing
|
// Resizing with initial dimensions
|
||||||
|
myGlobe.width(dom.globeContainer.clientWidth).height(dom.globeContainer.clientHeight);
|
||||||
|
|
||||||
const resizeObserver = new ResizeObserver(() => {
|
const resizeObserver = new ResizeObserver(() => {
|
||||||
if (myGlobe) {
|
if (myGlobe && dom.globeContainer.clientWidth > 0) {
|
||||||
const width = dom.globeContainer.clientWidth;
|
myGlobe.width(dom.globeContainer.clientWidth).height(dom.globeContainer.clientHeight);
|
||||||
const height = dom.globeContainer.clientHeight;
|
|
||||||
myGlobe.width(width).height(height);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
resizeObserver.observe(dom.globeContainer);
|
resizeObserver.observe(dom.globeContainer);
|
||||||
|
|
||||||
// Initial view
|
// Initial view
|
||||||
myGlobe.controls().autoRotate = true;
|
myGlobe.controls().autoRotate = true;
|
||||||
myGlobe.controls().autoRotateSpeed = 0.5;
|
myGlobe.controls().autoRotateSpeed = 1.2; // Slightly faster for visual appeal
|
||||||
myGlobe.controls().enableZoom = false; // Disable zoom to maintain dashboard feel
|
myGlobe.controls().enableZoom = false;
|
||||||
|
|
||||||
|
// Initial data sync if available
|
||||||
|
if (allServersData.length > 0) {
|
||||||
|
updateGlobe(allServersData);
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[Globe] Initialization failed:', err);
|
console.error('[Globe] Initialization failed:', err);
|
||||||
}
|
}
|
||||||
@@ -435,6 +447,13 @@
|
|||||||
|
|
||||||
myGlobe.pointsData(geoData);
|
myGlobe.pointsData(geoData);
|
||||||
|
|
||||||
|
// Update footer stats
|
||||||
|
if (dom.globeTotalNodes) dom.globeTotalNodes.textContent = geoData.length;
|
||||||
|
if (dom.globeTotalRegions) {
|
||||||
|
const regions = new Set(geoData.map(d => d.country)).size;
|
||||||
|
dom.globeTotalRegions.textContent = regions;
|
||||||
|
}
|
||||||
|
|
||||||
// Also add arcs for "traffic flow" if we have multiple servers
|
// Also add arcs for "traffic flow" if we have multiple servers
|
||||||
// For now, let's just show rings or pulses for active traffic
|
// For now, let's just show rings or pulses for active traffic
|
||||||
myGlobe.ringsData(geoData.filter(d => (d.netRx + d.netTx) > 1024 * 1024)); // Pulse for servers > 1MB/s
|
myGlobe.ringsData(geoData.filter(d => (d.netRx + d.netTx) > 1024 * 1024)); // Pulse for servers > 1MB/s
|
||||||
|
|||||||
Reference in New Issue
Block a user