feat(topology): add device description support and polish UI layouts

- Topology: query /api/node-info on node select and display multi-line description
- Topology: widen device node cards and remove SID truncation for full display
- Topology: tune d3-force layout parameters (increased distance & repulsion)
- Topology: fix d3-force string ID matching error ("node not found: 0")
- Settings: switch device description field from Input to multi-line Textarea
- Overview: fix active lines count logic and broken badge layout
- Sidebar: remove redundant Live badge from overview navigation item
This commit is contained in:
2026-08-26 21:27:44 +08:00
parent f38d640ac4
commit ad94d2c274
8 changed files with 103 additions and 27 deletions
@@ -5,10 +5,12 @@ import {
Gauge,
Network,
Clock3,
FileText,
} from 'lucide-react'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import { Separator } from '@/components/ui/separator'
import { Skeleton } from '@/components/ui/skeleton'
import {
Sheet,
SheetContent,
@@ -40,6 +42,9 @@ interface NodeDetailSheetProps {
neighbors: SheetNeighborInfo[]
copiedId: string | null
onCopy: (text: string) => void
/** 设备描述(来自 /api/node-info 查询) */
description?: string | null
descriptionLoading?: boolean
}
export function NodeDetailSheet({
@@ -49,6 +54,8 @@ export function NodeDetailSheet({
neighbors,
copiedId,
onCopy,
description,
descriptionLoading,
}: NodeDetailSheetProps) {
if (!node) return null
@@ -85,6 +92,24 @@ export function NodeDetailSheet({
</SheetHeader>
<div className="flex flex-1 flex-col gap-4 overflow-y-auto p-4">
{/* Device Description */}
<div className="flex flex-col gap-1.5 rounded-lg border bg-muted/30 p-3">
<span className="flex items-center gap-1.5 text-xs font-medium text-muted-foreground">
<FileText className="size-3.5" />
</span>
{descriptionLoading ? (
<div className="flex flex-col gap-1.5">
<Skeleton className="h-3.5 w-full" />
<Skeleton className="h-3.5 w-2/3" />
</div>
) : (
<span className="whitespace-pre-wrap break-words text-xs leading-relaxed text-foreground">
{description ? description : '无描述信息'}
</span>
)}
</div>
{/* Full Address */}
<div className="flex flex-col gap-1.5 rounded-lg border bg-muted/30 p-3">
<span className="text-xs font-medium text-muted-foreground">