diff --git a/web/src/pages/TopologyPage.tsx b/web/src/pages/TopologyPage.tsx index f6faa30..a99116a 100644 --- a/web/src/pages/TopologyPage.tsx +++ b/web/src/pages/TopologyPage.tsx @@ -825,14 +825,20 @@ export function TopologyPage() { return built.map((e) => { const d = (e.data || {}) as EdgeStyleData; const count = Number(d.member_count || 1); - const keepCountLabel = !expandPhysicalLinks && count > 1; const selected = e.id === selectedEdgeId || Boolean(d.members?.some((m: LinkMember) => m.id === selectedEdgeId)); + let label: string | undefined; + if (hidePorts) { + // Keep only the bundle count when ports are hidden — never leak port names. + label = !expandPhysicalLinks && count > 1 ? `×${count}` : undefined; + } else { + label = e.label ? String(e.label) : undefined; + } return { ...e, selected, - label: hidePorts && !keepCountLabel ? undefined : e.label, + label, animated: edgeFlow, }; }); diff --git a/web/src/pages/topology/linkDisplay.ts b/web/src/pages/topology/linkDisplay.ts index 8e6fe0c..b89bbb6 100644 --- a/web/src/pages/topology/linkDisplay.ts +++ b/web/src/pages/topology/linkDisplay.ts @@ -43,8 +43,15 @@ export function formatPortPairLabel(aPort: string, bPort: string): string { return a || b || ""; } -export function formatBundleLabel(count: number, sample?: { a_port?: string; b_port?: string }): string { - if (count <= 1) return formatPortPairLabel(sample?.a_port || "", sample?.b_port || ""); +export function formatBundleLabel( + count: number, + sample?: { a_port?: string; b_port?: string }, + opts?: { hidePorts?: boolean }, +): string { + if (count <= 1) { + return opts?.hidePorts ? "" : formatPortPairLabel(sample?.a_port || "", sample?.b_port || ""); + } + if (opts?.hidePorts) return `×${count}`; const sampleLabel = formatPortPairLabel(sample?.a_port || "", sample?.b_port || ""); return sampleLabel ? `×${count} · ${sampleLabel}` : `×${count}`; }