fix(ui): показывать ошибки и свежесть NetFlow карты

This commit is contained in:
Denozordec committed 2026-10-01 01:56:39 +07:00
1 parent e47e2b4029
commit 1bce4e1ea2
7 files changed
+139 -45

No files matched your search

+10
View File
@@ -18,3 +18,13 @@ export function validateNetworkMapSnapshot(servers:unknown,gre:unknown,probes:un
if(tunnels.failures.length)throw new Error("Неполный каталог GRE: "+tunnels.failures.map(failure=>failure.serverName||failure.serverId).join(", "))
return {servers:inventory,tunnels:tunnels.tunnels,probes:measurements.probes}
}
import {flowMapHopsDtoSchema} from "@mmapp/contracts/traffic-flow"
import {isIpv4String} from "./gre-endpoint-resolve"
export const networkMapFlowSchema=flowMapHopsDtoSchema.required().refine(data=>data.rangeMinutes===5&&data.namedBytes<=data.totalBytes&&data.unclassifiedBytes<=data.totalBytes)
export function validateNetworkMapDns(raw:unknown,hosts:string[]){
const data=z.object({results:z.record(z.string(),z.string().refine(isIpv4String).nullable())}).parse(raw)
const requested=new Set(hosts.map(host=>host.toLowerCase()))
if(Object.keys(data.results).length!==requested.size||Object.keys(data.results).some(host=>!requested.has(host)))throw new Error("DNS-ответ не соответствует запрошенным именам")
return data.results
}