fix(ui): сохранить данные дашборда при сбоях и гонках запросов

This commit is contained in:
Denozordec committed 2026-09-20 00:58:58 +07:00
1 parent 0d418e2e39
commit 6a726b13b4
6 files changed
+316 -94

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
export const DASHBOARD_SOURCES = {
servers: "Серверы", probes: "Пробы", bgp: "BGP", gre: "GRE",
wg: "WireGuard", vxlan: "VXLAN", traffic: "Трафик",
internetPath: "Internet path", events: "События",
} as const
export type DashboardSource = keyof typeof DASHBOARD_SOURCES
export type DashboardSources = Partial<Record<DashboardSource, { receivedAt: number | null; error: string | null; sampledAt?: string }>>
export function updateDashboardSource(previous: DashboardSources, source: DashboardSource, error: string | null, now: number, sampledAt?: string): DashboardSources {
return { ...previous, [source]: { receivedAt: error ? previous[source]?.receivedAt ?? null : now, error, sampledAt: error ? previous[source]?.sampledAt : sampledAt } }
}