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> 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 } } }