fix(ui): не подставлять выдуманный cost соседа OSPF

This commit is contained in:
Denozordec committed 2026-09-30 18:04:14 +07:00
1 parent 3dc25628af
commit 748a3c00ad
5 files changed
+18 -8

No files matched your search

+5 -5
View File
@@ -64,7 +64,7 @@ interface OspfNeighbor {
remoteRouterId: string
area: string
state: OspfNeighborState
cost: number
cost: number | null
uptime: string
priority: number
dataUnknown?: boolean
@@ -152,7 +152,7 @@ function backendToNeighbor(b: BackendNeighbor, ifaceMap: Map<string, number>): O
remoteRouterId: b.routerId,
area: b.areaId !== b.area ? `${b.area} (${b.areaId})` : b.area,
state,
cost: ifaceMap.get(costKey) ?? 10,
cost: ifaceMap.get(costKey) ?? null,
uptime: b.uptime ?? "—",
priority: b.priority,
}
@@ -298,7 +298,7 @@ const EDGE_COLOR: Record<string, string> = {
}
interface GraphNode { id: string; label: string; short: string; site: string; x: number; y: number }
interface GraphEdge { from: string; to: string; state: OspfNeighbor["state"]; cost: number }
interface GraphEdge { from: string; to: string; state: OspfNeighbor["state"]; cost: number | null }
// Mock topology (static layout for mock mode)
const MOCK_GRAPH_NODES: GraphNode[] = [
@@ -459,7 +459,7 @@ function TopologyGraph({ graphNodes, graphEdges, highlightId, selectedId, showDo
<rect x="-15" y="-10" width="30" height="18" rx="4"
fill="#060d1a" stroke={color} strokeWidth="0.8" opacity="0.95" />
<text textAnchor="middle" y="4" fontSize="8.5" fontWeight="700"
fill={color} fontFamily="ui-monospace,monospace">{e.cost}</text>
fill={color} fontFamily="ui-monospace,monospace">{e.cost ?? "—"}</text>
</g>
</g>
)
@@ -613,7 +613,7 @@ function NodeDetailPanel({
<span className="size-1.5 rounded-full shrink-0 mt-1.5" style={{ background: ec }} />
<div className="flex-1 min-w-0">
<p className="text-xs font-mono font-medium text-[#f1f5f9] truncate leading-tight">{adj.peerLabel}</p>
<p className="text-[10px] font-mono text-[#64748b] mt-0.5">{adj.iface} · cost {adj.cost}</p>
<p className="text-[10px] font-mono text-[#64748b] mt-0.5">{adj.iface} · cost {adj.cost ?? "—"}</p>
<p className="text-[10px] text-[#475569] mt-0.5 tabular-nums">{adj.uptime}</p>
</div>
<span className="text-[10px] font-mono font-semibold shrink-0 mt-0.5" style={{ color: ec }}>{adj.state}</span>