admin update

This commit is contained in:
2026-02-18 01:27:21 +08:00
parent 4667021944
commit 4f6d7d9035

View File

@@ -994,12 +994,12 @@
const startGpuMonitoring = () => { const startGpuMonitoring = () => {
if (gpuInterval) clearInterval(gpuInterval); if (gpuInterval) clearInterval(gpuInterval);
// Use setTimeout to ensure DOM is ready after v-if switch // Use setTimeout to ensure DOM is ready after v-if switch (wait for slide-up transition ~700ms)
setTimeout(() => { setTimeout(() => {
initGpuCharts(); initGpuCharts();
fetchGpuStatus(); // Initial fetch fetchGpuStatus(); // Initial fetch
gpuInterval = setInterval(fetchGpuStatus, 2000); // Every 2s gpuInterval = setInterval(fetchGpuStatus, 2000); // Every 2s
}, 300); }, 800);
}; };
const stopGpuMonitoring = () => { const stopGpuMonitoring = () => {
@@ -1007,6 +1007,9 @@
clearInterval(gpuInterval); clearInterval(gpuInterval);
gpuInterval = null; gpuInterval = null;
} }
// Dispose charts to free memory and avoid resize issues on re-init
if (gpuUtilChartInst) { gpuUtilChartInst.dispose(); gpuUtilChartInst = null; }
if (gpuTempChartInst) { gpuTempChartInst.dispose(); gpuTempChartInst = null; }
}; };
const initGpuCharts = () => { const initGpuCharts = () => {
@@ -1051,11 +1054,20 @@
] ]
}); });
// Explicitly resize to ensure correct rendering
gpuUtilChartInst.resize();
gpuTempChartInst.resize();
// Render initial data if available // Render initial data if available
updateGpuCharts(); updateGpuCharts();
}; };
const updateGpuCharts = () => { const updateGpuCharts = () => {
// Lazy init check
if ((!gpuUtilChartInst || !gpuTempChartInst) && gpuUtilChartRef.value && gpuTempChartRef.value) {
initGpuCharts();
}
if (!gpuUtilChartInst || !gpuTempChartInst) return; if (!gpuUtilChartInst || !gpuTempChartInst) return;
const times = gpuHistory.value.map(h => h.time); const times = gpuHistory.value.map(h => h.time);