修改排版

This commit is contained in:
CN-JS-HuiBai
2026-04-05 01:00:40 +08:00
parent ded8d1b18d
commit b3580c15cc
2 changed files with 9 additions and 17 deletions

View File

@@ -11,8 +11,7 @@
// ---- DOM Elements ----
const dom = {
clock: document.getElementById('clock'), // May be null if removed from UI
serverCountText: document.getElementById('serverCountText'),
sourceCount: document.getElementById('sourceCount'),
totalServersLabel: document.getElementById('totalServersLabel'),
totalServers: document.getElementById('totalServers'),
cpuPercent: document.getElementById('cpuPercent'),
cpuDetail: document.getElementById('cpuDetail'),
@@ -347,8 +346,7 @@
// ---- Update Dashboard ----
function updateDashboard(data) {
// Server count
dom.totalServers.textContent = data.totalServers;
dom.serverCountText.textContent = `${data.activeServers} / ${data.totalServers} 在线`;
dom.totalServers.textContent = `${data.activeServers} / ${data.totalServers}`;
// CPU
const cpuPct = data.cpu.percent;
@@ -866,7 +864,7 @@
try {
const response = await fetch('/api/sources');
const sources = await response.json();
dom.sourceCount.textContent = `${sources.length} 数据源`;
if (dom.totalServersLabel) dom.totalServersLabel.textContent = `服务器总数 (${sources.length} 数据源)`;
updateSourceFilterOptions(sources);
renderSources(sources);
} catch (err) {
@@ -1030,7 +1028,7 @@
const response = await fetch('/api/sources');
const sources = await response.json();
const sourcesArray = Array.isArray(sources) ? sources : [];
dom.sourceCount.textContent = `${sourcesArray.length} 数据源`;
if (dom.totalServersLabel) dom.totalServersLabel.textContent = `服务器总数 (${sourcesArray.length} 数据源)`;
updateSourceFilterOptions(sourcesArray);
} catch (err) {
// ignore