支持服务器详情24h流量统计

This commit is contained in:
CN-JS-HuiBai
2026-04-13 15:21:26 +08:00
parent 0a8efaf29d
commit 83e8a96b2b
3 changed files with 29 additions and 2 deletions

View File

@@ -1482,6 +1482,10 @@
valA = a.netTx ?? 0;
valB = b.netTx ?? 0;
break;
case 'traffic24h':
valA = (a.traffic24hRx ?? 0) + (a.traffic24hTx ?? 0);
valB = (b.traffic24hRx ?? 0) + (b.traffic24hTx ?? 0);
break;
default:
valA = (a.job || '').toLowerCase();
valB = (b.job || '').toLowerCase();
@@ -1607,7 +1611,7 @@
if (!servers || servers.length === 0) {
dom.serverTableBody.innerHTML = `
<tr class="empty-row">
<td colspan="8">暂无数据 - 请先配置 Prometheus 数据源</td>
<td colspan="9">暂无数据 - 请先配置 Prometheus 数据源</td>
</tr>
`;
return;
@@ -1652,6 +1656,10 @@
</td>
<td>${formatBandwidth(server.netRx)}</td>
<td>${formatBandwidth(server.netTx)}</td>
<td>
<div style="font-size: 0.85rem; font-weight: 500; color: var(--text-primary);">${formatBytes((server.traffic24hRx || 0) + (server.traffic24hTx || 0))}</div>
<div style="font-size: 0.65rem; color: var(--text-muted); margin-top: 2px;">↓${formatBytes(server.traffic24hRx || 0)} / ↑${formatBytes(server.traffic24hTx || 0)}</div>
</td>
</tr>
`;
}).join('');