fix(traffic): отличать измеренный ноль от отсутствия наблюдений

This commit is contained in:
Denozordec committed 2026-10-03 23:10:39 +07:00
1 parent a28f871fd4
commit 9e0f695684
12 files changed
+111 -30

No files matched your search

+2 -2
View File
@@ -282,7 +282,7 @@ export function useDashboardLive() {
const results = { probes: overviewRes, servers: serversRes, bgp: br, gre: greRes, wg: wgRes, traffic: trafficRes, vxlan: vxRes }
for (const [key, result] of Object.entries(results)) {
recordSource(key as DashboardSource, result.status === "rejected"
? result.reason instanceof Error ? result.reason.message : "Источник недоступен" : null)
? result.reason instanceof Error ? result.reason.message : "Источник недоступен" : null,key==="traffic"&&trafficRes.status==="fulfilled"?trafficRes.value.sampledAt??undefined:undefined)
}
const failures = Object.values(results).filter(result => result.status === "rejected").length
setError(failures ? "Не все источники обновлены. Последние полученные данные сохранены." : null)
@@ -560,7 +560,7 @@ export function useDashboardLive() {
tx: mockTraffic.tx,
rxNow: mockTraffic.rx[mockTraffic.rx.length - 1] ?? 0,
txNow: mockTraffic.tx[mockTraffic.tx.length - 1] ?? 0,
demo: true,
demo: true,observationsKnown:true,sampledAt:null,
}
}
if (!trafficSeries) return null