feat(network-map): добавить сворачивание групп и категории трафика
Docker images / prepare-release (push) Successful in 13s
Docker images / backend-test (push) Successful in 11m8s
Docker images / frontend-image (push) Successful in 2m25s
Docker images / updater-image (push) Successful in 41s
Docker images / netflow-agent-image (push) Successful in 34s
Docker images / backend-image (push) Successful in 2m1s
Docker images / publish-release (push) Successful in 13s
Docker images / notify-webhook (push) Successful in 2s
Docker images / prepare-release (push) Successful in 13s
Docker images / backend-test (push) Successful in 11m8s
Docker images / frontend-image (push) Successful in 2m25s
Docker images / updater-image (push) Successful in 41s
Docker images / netflow-agent-image (push) Successful in 34s
Docker images / backend-image (push) Successful in 2m1s
Docker images / publish-release (push) Successful in 13s
Docker images / notify-webhook (push) Successful in 2s
This commit is contained in:
1 parent
37025f1f94
commit
545a9bbcd2
24 files changed
+1607
-352
No files matched your search
@@ -12,6 +12,25 @@ export function isolatedIxServers(servers: Pick<Server, "id" | "type">[], links:
|
||||
return new Set(servers.filter(server => server.type === "ix-node" && !connected.has(server.id)).map(server => server.id))
|
||||
}
|
||||
|
||||
function scopedClassification(paths: FlowMapServicePath[], bytes: number) {
|
||||
if (!paths.length || paths.reduce((sum, path) => sum + path.bytes, 0) !== bytes) return {}
|
||||
const bases = new Map<string, NonNullable<FlowMapService["serviceEvidence"]>[number]>()
|
||||
const types = new Map<string, NonNullable<FlowMapService["trafficTypes"]>[number]>()
|
||||
for (const path of paths) {
|
||||
for (const row of path.serviceEvidence ?? []) {
|
||||
bases.set(row.basis, { ...row, bytes: (bases.get(row.basis)?.bytes ?? 0) + row.bytes })
|
||||
}
|
||||
for (const row of path.trafficTypes ?? []) {
|
||||
const key = JSON.stringify([row.transport, row.application])
|
||||
types.set(key, { ...row, bytes: (types.get(key)?.bytes ?? 0) + row.bytes })
|
||||
}
|
||||
}
|
||||
return {
|
||||
...(bases.size && {serviceEvidence: [...bases.values()].sort((a,b) => b.bytes - a.bytes)}),
|
||||
...(types.size && {trafficTypes: [...types.values()].sort((a,b) => b.bytes - a.bytes).slice(0,5)}),
|
||||
}
|
||||
}
|
||||
|
||||
export function scopeMapDestinations(
|
||||
services: FlowMapService[], edges: FlowMapServiceEdge[], paths: FlowMapServicePath[],
|
||||
includes: (id: string) => boolean, userId?: string, retainUnassigned = false,
|
||||
@@ -56,13 +75,14 @@ export function scopeMapDestinations(
|
||||
const shareOfVisible = Boolean(userId) || services.some(service => (totals.get(service.id)?.bytes ?? 0) !== service.bytes)
|
||||
return {
|
||||
shareOfVisible,
|
||||
services: services.flatMap(service => {
|
||||
services: services.flatMap<FlowMapService>(service => {
|
||||
const total = totals.get(service.id)
|
||||
if (!total) return []
|
||||
const { trafficTypes, serviceEvidence, lastBucketAt, ...destination } = service
|
||||
const visibleShare = bytes ? total.bytes / bytes : 0
|
||||
return [{ ...destination, ...total, share: shareOfVisible ? visibleShare : service.share,
|
||||
...(total.bytes === service.bytes ? { trafficTypes, serviceEvidence, lastBucketAt } : {}) }]
|
||||
...(total.bytes === service.bytes ? { trafficTypes, serviceEvidence, lastBucketAt } :
|
||||
scopedClassification(visiblePaths.filter(path => path.serviceId === service.id), total.bytes)) }]
|
||||
}).sort((a, b) => b.bytes - a.bytes || a.label.localeCompare(b.label)),
|
||||
edges: visibleEdges,
|
||||
paths: visiblePaths,
|
||||
|
||||
Reference in new issue
Block a user