fix(ui): связывать OSPF узлы по подтверждённым ID

This commit is contained in:
Denozordec committed 2026-09-30 20:19:37 +07:00
1 parent 7a68ae8184
commit 259c5c3014
16 files changed
+123 -41

No files matched your search

+3 -2
View File
@@ -31,7 +31,7 @@ export interface BfdSessionRow {
multiplier: number | null
iface: string
uptime: string | null
multihop: boolean
multihop: boolean | null
rxInterval: number | null
holdTime: number | null
packetsRx: number | null
@@ -85,7 +85,8 @@ function OspfBfdDataGrid({ sessions }: OspfBfdDataGridProps) {
return (
<div className="flex flex-col gap-0.5">
<span className="font-mono whitespace-nowrap">{b.serverLabel}</span>
{b.multihop && (
{b.multihop === null && <Chip>Режим неизвестен</Chip>}
{b.multihop === true && (
<Chip color="bg-violet-500/10 text-violet-600 dark:text-violet-400 border-violet-500/20">
multihop
</Chip>
@@ -194,7 +194,7 @@ function OspfNeighborsDataGrid({
const rowSelection = useMemo(() => {
if (!selectedRouterId) return {}
const match = neighbors.find(
(n) => n.localRouter === selectedRouterId || n.remoteRouter === selectedRouterId,
(n) => n.localRouter === selectedRouterId || n.remoteRouter === selectedRouterId || selectedRouterId === `remote-${n.remoteRouterId}`,
)
return match ? { [match.id]: true as const } : {}
}, [neighbors, selectedRouterId])
@@ -22,7 +22,7 @@ export interface OspfRouteRow {
id: string
dataUnknown?: boolean
destination: string
type: "O" | "O IA" | "O E1" | "O E2"
type: "O" | "O IA" | "O E1" | "O E2" | "Unknown"
cost: number | null
nextHop: string
via: string
@@ -32,6 +32,7 @@ export interface OspfRouteRow {
}
function routeTypeClass(type: OspfRouteRow["type"]) {
if (type === "Unknown") return "bg-muted text-muted-foreground border-border"
if (type === "O") return "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/25"
if (type === "O IA") return "bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/25"
if (type === "O E1") return "bg-purple-500/10 text-purple-600 dark:text-purple-400 border-purple-500/25"
@@ -70,7 +71,7 @@ function OspfRoutesDataGrid({ routes, emptyTitle }: OspfRoutesDataGridProps) {
routeTypeClass(row.original.type),
)}
>
{row.original.type}
{row.original.type === "Unknown" ? "Тип неизвестен" : row.original.type}
</span>
),
meta: { headerTitle: "Тип", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD },