Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring
TypeScript diagramhomelabhomelab-infrastructure-observabilitynetworkproxmox-veself-hostedzigbeezwavezwave-js
feat(canvas): hover highlight — dim unconnected nodes and edges on hover (#537)
Sam Mingo1251234b55d1
diff --git a/frontend/src/components/canvas/CanvasContainer.tsx b/frontend/src/components/canvas/CanvasContainer.tsxindex ef0567e..0132e43 100644--- a/frontend/src/components/canvas/CanvasContainer.tsx+++ b/frontend/src/components/canvas/CanvasContainer.tsx@@ -27,6 +27,7 @@ import { FloorMapLayer } from './FloorMapLayer'import { useAlignmentGuides } from '@/hooks/useAlignmentGuides'import { setViewportCenterProjector } from '@/utils/viewportCenter'import { isTypingTarget } from '@/utils/keyboard'+import { readHoverHighlightSettings, subscribeHoverHighlightSettings } from '@/utils/hoverHighlightSettings'import type { NodeData, EdgeData } from '@/types'interface CanvasContainerProps {@@ -42,6 +43,9 @@ interface CanvasContainerProps {export function CanvasContainer({ onConnect: onConnectProp, onEdgeDoubleClick, onNodeDoubleClick, onNodeDragStart, onRequestAddToGroup, onRequestAddToContainer, onRequestAddToZone, onOpenInventory }: CanvasContainerProps) {const [lassoMode, setLassoMode] = useState(true)+ const [hoveredNodeId, setHoveredNodeId] = useState<string | null>(null)+ const [hoverHighlight, setHoverHighlight] = useState(readHoverHighlightSettings)+ useEffect(() => subscribeHoverHighlightSettings(setHoverHighlight), [])const {nodes, edges,onNodesChange, onEdgesChange,@@ -122,6 +126,58 @@ export function CanvasContainer({ onConnect: onConnectProp, onEdgeDoubleClick, o[edges, nodes, collapseInfo],)+ // Hover highlight: dim nodes and edges not connected to the hovered node.+ const hoveredConnected = useMemo(() => {+ if (!hoverHighlight.enabled || !hoveredNodeId) return null+ const nodeIds = new Set<string>([hoveredNodeId])+ const edgeIds = new Set<string>()+ for (const e of visibleEdges) {+ if (e.source === hoveredNodeId || e.target === hoveredNodeId) {+ edgeIds.add(e.id)+ nodeIds.add(e.source)+ nodeIds.add(e.target)+ }+ }+ // A lit device container (Proxmox host, Docker host…) keeps what it holds+ // lit, all the way down. Zones and groups don't: lighting one linked to the+ // hovered node would light every member inside it.+ const children = new Map<string, string[]>()+ const furniture = new Set<string>()+ for (const n of visibleNodes) {+ if (n.data.type === 'groupRect' || n.data.type === 'group') furniture.add(n.id)+ if (n.parentId) children.set(n.parentId, [...(children.get(n.parentId) ?? []), n.id])+ }+ const queue = [...nodeIds].filter((id) => !furniture.has(id))+ while (queue.length > 0) {+ for (const child of children.get(queue.pop()!) ?? []) {+ if (nodeIds.has(child)) continue+ nodeIds.add(child)+ if (!furniture.has(child)) queue.push(child)+ }+ }+ return { nodeIds, edgeIds }+ }, [hoverHighlight.enabled, hoveredNodeId, visibleEdges, visibleNodes])++ const displayNodes = useMemo(+ () => hoveredConnected+ ? visibleNodes.map((n) => ({+ ...n,+ style: { ...n.style, opacity: hoveredConnected.nodeIds.has(n.id) ? 1 : 0.12 },+ }))+ : visibleNodes,+ [visibleNodes, hoveredConnected],+ )++ const displayEdges = useMemo(+ () => hoveredConnected+ ? visibleEdges.map((e) => ({+ ...e,+ style: { ...e.style, opacity: hoveredConnected.edgeIds.has(e.id) ? 1 : 0.08 },+ }))+ : visibleEdges,+ [visibleEdges, hoveredConnected],+ )+const onNodeClick = useCallback((e: React.MouseEvent, node: Node<NodeData>) => {if (e.ctrlKey || e.metaKey) {setSelectedNode(null)@@ -158,6 +214,18 @@ export function CanvasContainer({ onConnect: onConnectProp, onEdgeDoubleClick, o[])+ // Canvas furniture (zones, groups, text) carries no links of its own: hovering+ // one would dim the whole canvas, and a zone background sits under the cursor+ // most of the time, so it clears the highlight instead.+ const handleNodeMouseEnter = useCallback((_: React.MouseEvent, node: Node<NodeData>) => {+ const furniture = node.data.type === 'groupRect' || node.data.type === 'group' || node.data.type === 'text'+ setHoveredNodeId(furniture ? null : node.id)+ }, [])++ const handleNodeMouseLeave = useCallback(() => {+ setHoveredNodeId(null)+ }, [])+const { guides, onNodeDrag, onNodeDragStop } = useAlignmentGuides()// Drop a selection onto a group → ask App to confirm adding it. Runs before@@ -219,8 +287,8 @@ export function CanvasContainer({ onConnect: onConnectProp, onEdgeDoubleClick, oreturn (<div ref={wrapperRef} className="w-full h-full" style={{ background: theme.colors.canvasBackground }} onMouseMove={onMouseMove}><ReactFlow- nodes={visibleNodes}- edges={visibleEdges}+ nodes={displayNodes}+ edges={displayEdges}onNodesChange={onNodesChange}onEdgesChange={onEdgesChange}onConnect={onConnectProp}@@ -233,6 +301,8 @@ export function CanvasContainer({ onConnect: onConnectProp, onEdgeDoubleClick, oonNodeDragStop={handleNodeDragStop}onMoveEnd={handleMoveEnd}defaultViewport={initialViewport ?? undefined}+ onNodeMouseEnter={handleNodeMouseEnter}+ onNodeMouseLeave={handleNodeMouseLeave}nodeTypes={nodeTypes}edgeTypes={edgeTypes}deleteKeyCode={['Backspace', 'Delete']}diff --git a/frontend/src/components/canvas/__tests__/CanvasContainer.test.tsx b/frontend/src/components/canvas/__tests__/CanvasContainer.test.tsxindex 7caa2a6..57b6e25 100644--- a/frontend/src/components/canvas/__tests__/CanvasContainer.test.tsx+++ b/frontend/src/components/canvas/__tests__/CanvasContainer.test.tsx@@ -1,10 +1,13 @@import { describe, it, expect, vi, beforeEach } from 'vitest'+import { readFileSync } from 'node:fs'+import { resolve } from 'node:path'import { act, render } from '@testing-library/react'import { CanvasContainer } from '../CanvasContainer'import { useCanvasStore } from '@/stores/canvasStore'import { useThemeStore } from '@/stores/themeStore'import type { Node, Edge } from '@xyflow/react'-import type { NodeData, EdgeData } from '@/types'+import type { NodeData, EdgeData, NodeType } from '@/types'+import { writeHoverHighlightSettings } from '@/utils/hoverHighlightSettings'// Capture props passed to ReactFlow so we can test the callbackslet rfProps: Record<string, unknown> = {}@@ -510,4 +513,151 @@ describe('CanvasContainer', () => {vi.useRealTimers()}})++ // ── Hover highlight ───────────────────────────────────────────────────────++ describe('hover highlight', () => {+ beforeEach(() => {+ localStorage.removeItem('homelable.hoverHighlight')+ })++ // n1 — n2 — n3, plus n4 on its own.+ function setupChain() {+ useCanvasStore.setState({+ nodes: [makeNode('n1'), makeNode('n2'), makeNode('n3'), makeNode('n4')],+ edges: [+ { id: 'e12', source: 'n1', target: 'n2', type: 'ethernet', data: { type: 'ethernet' } },+ { id: 'e23', source: 'n2', target: 'n3', type: 'ethernet', data: { type: 'ethernet' } },+ ],+ })+ render(<CanvasContainer />)+ }++ const hover = (node: Node<NodeData>) => act(() => {+ ;(rfProps.onNodeMouseEnter as (...args: unknown[]) => unknown)({}, node)+ })+ const opacities = (items: unknown) =>+ Object.fromEntries((items as (Node | Edge)[]).map((i) => [i.id, i.style?.opacity]))++ it('fades node opacity both ways through a stylesheet transition, not an inline one', () => {+ // The inline opacity is dropped on leave; an inline transition would go+ // with it and make the restore instant.+ const css = readFileSync(resolve(__dirname, '../../../index.css'), 'utf8')+ expect(css).toMatch(/\.react-flow__node\s*\{[^}]*transition:\s*opacity 0\.15s/)+ setupChain()+ hover(makeNode('n1'))+ expect((rfProps.nodes as Node[]).every((n) => n.style?.transition === undefined)).toBe(true)+ })++ it('applies no opacity until a node is hovered', () => {+ setupChain()+ expect(opacities(rfProps.nodes)).toEqual({ n1: undefined, n2: undefined, n3: undefined, n4: undefined })+ expect(opacities(rfProps.edges)).toEqual({ e12: undefined, e23: undefined })+ })++ it('keeps the hovered node, its neighbours and incident edges opaque and dims the rest', () => {+ setupChain()+ hover(makeNode('n1'))+ expect(opacities(rfProps.nodes)).toEqual({ n1: 1, n2: 1, n3: 0.12, n4: 0.12 })+ expect(opacities(rfProps.edges)).toEqual({ e12: 1, e23: 0.08 })+ })++ it('follows edges in both directions', () => {+ setupChain()+ hover(makeNode('n2'))+ expect(opacities(rfProps.nodes)).toEqual({ n1: 1, n2: 1, n3: 1, n4: 0.12 })+ expect(opacities(rfProps.edges)).toEqual({ e12: 1, e23: 1 })+ })++ it('restores everything when the pointer leaves the node', () => {+ setupChain()+ hover(makeNode('n1'))+ act(() => {+ ;(rfProps.onNodeMouseLeave as (...args: unknown[]) => unknown)({}, makeNode('n1'))+ })+ expect(opacities(rfProps.nodes)).toEqual({ n1: undefined, n2: undefined, n3: undefined, n4: undefined })+ expect(opacities(rfProps.edges)).toEqual({ e12: undefined, e23: undefined })+ })++ it('never writes the hover opacity into the store', () => {+ setupChain()+ hover(makeNode('n1'))+ expect(useCanvasStore.getState().nodes.every((n) => n.style?.opacity === undefined)).toBe(true)+ expect(useCanvasStore.getState().edges.every((e) => e.style?.opacity === undefined)).toBe(true)+ })++ it.each(['groupRect', 'group', 'text'] as const)('does not dim the canvas when a %s is hovered', (type) => {+ setupChain()+ hover({ ...makeNode('furniture'), type, data: { ...makeNode('furniture').data, type } })+ expect(opacities(rfProps.nodes)).toEqual({ n1: undefined, n2: undefined, n3: undefined, n4: undefined })+ })++ function child(id: string, parentId: string, type: NodeType = 'docker_container'): Node<NodeData> {+ return { ...makeNode(id), type, parentId, data: { ...makeNode(id).data, type } }+ }++ it('keeps the children of a lit container lit, all the way down', () => {+ useCanvasStore.setState({+ nodes: [+ makeNode('sw'),+ { ...makeNode('pve'), type: 'proxmox', data: { ...makeNode('pve').data, type: 'proxmox' } },+ child('docker', 'pve', 'docker_host'),+ child('grafana', 'docker'),+ makeNode('other'),+ ],+ edges: [{ id: 'e1', source: 'sw', target: 'pve', type: 'ethernet', data: { type: 'ethernet' } }],+ })+ render(<CanvasContainer />)+ hover(makeNode('sw'))+ expect(opacities(rfProps.nodes)).toEqual({ sw: 1, pve: 1, docker: 1, grafana: 1, other: 0.12 })+ })++ it('keeps the children of the hovered container itself lit', () => {+ useCanvasStore.setState({+ nodes: [makeNode('host'), child('c1', 'host'), child('c2', 'host'), makeNode('other')],+ edges: [],+ })+ render(<CanvasContainer />)+ hover(makeNode('host'))+ expect(opacities(rfProps.nodes)).toEqual({ host: 1, c1: 1, c2: 1, other: 0.12 })+ })++ it('does not light the members of a zone linked to the hovered node', () => {+ useCanvasStore.setState({+ nodes: [+ makeNode('sw'),+ { ...makeNode('zone'), type: 'groupRect', data: { ...makeNode('zone').data, type: 'groupRect' } },+ child('member', 'zone', 'server'),+ ],+ edges: [{ id: 'e1', source: 'sw', target: 'zone', type: 'ethernet', data: { type: 'ethernet' } }],+ })+ render(<CanvasContainer />)+ hover(makeNode('sw'))+ expect(opacities(rfProps.nodes)).toEqual({ sw: 1, zone: 1, member: 0.12 })+ })++ it('does nothing when the setting is off', () => {+ writeHoverHighlightSettings({ enabled: false })+ setupChain()+ hover(makeNode('n1'))+ expect(opacities(rfProps.nodes)).toEqual({ n1: undefined, n2: undefined, n3: undefined, n4: undefined })+ expect(opacities(rfProps.edges)).toEqual({ e12: undefined, e23: undefined })+ })++ it('follows the setting live, without a remount', () => {+ setupChain()+ hover(makeNode('n1'))+ act(() => writeHoverHighlightSettings({ enabled: false }))+ expect(opacities(rfProps.edges)).toEqual({ e12: undefined, e23: undefined })+ act(() => writeHoverHighlightSettings({ enabled: true }))+ expect(opacities(rfProps.edges)).toEqual({ e12: 1, e23: 0.08 })+ })++ it('clears an active highlight when the pointer moves onto a zone', () => {+ setupChain()+ hover(makeNode('n1'))+ hover({ ...makeNode('zone'), type: 'groupRect', data: { ...makeNode('zone').data, type: 'groupRect' } })+ expect(opacities(rfProps.edges)).toEqual({ e12: undefined, e23: undefined })+ })+ })})diff --git a/frontend/src/components/canvas/edges/__tests__/HomelableEdge.fade.test.tsx b/frontend/src/components/canvas/edges/__tests__/HomelableEdge.fade.test.tsxnew file mode 100644index 0000000..e050623--- /dev/null+++ b/frontend/src/components/canvas/edges/__tests__/HomelableEdge.fade.test.tsx@@ -0,0 +1,92 @@+import { describe, it, expect, vi } from 'vitest'+import { render } from '@testing-library/react'+import { ReactFlowProvider } from '@xyflow/react'+import type { EdgeProps, Edge } from '@xyflow/react'+import type { EdgeData, EdgeTypeStyle } from '@/types'+import { useThemeStore } from '@/stores/themeStore'++/**+ * PR #537 — the canvas hover highlight dims an edge through `edge.style.opacity`.+ * HomelableEdge builds its stroke style from the edge type, so it must read+ * that prop itself and fade the line, its animation overlay and its labels.+ *+ * <EdgeLabelRenderer> is stubbed to a passthrough so the label markup renders+ * outside a full <ReactFlow> host.+ */+vi.mock('@xyflow/react', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@xyflow/react')>()+ return {+ ...actual,+ EdgeLabelRenderer: ({ children }: { children: React.ReactNode }) => <>{children}</>,+ }+})++const { HomelableEdge } = await import('../index')++function renderEdge(style: React.CSSProperties | undefined, data: Partial<EdgeData> = {}, selected = false) {+ const props = {+ id: 'e1',+ source: 'a',+ target: 'b',+ sourceX: 0,+ sourceY: 0,+ targetX: 100,+ targetY: 100,+ sourcePosition: 'bottom',+ targetPosition: 'top',+ data: { type: 'ethernet', ...data } as EdgeData,+ selected,+ style,+ } as unknown as EdgeProps<Edge<EdgeData>>++ return render(+ <ReactFlowProvider>+ <svg>+ <HomelableEdge {...props} />+ </svg>+ </ReactFlowProvider>,+ )+}++describe('HomelableEdge fade', () => {+ it('wraps the line and its animation overlay in a group carrying the opacity', () => {+ const { container } = renderEdge({ opacity: 0.08, transition: 'opacity 0.15s' }, { animated: 'flow' })+ const group = container.querySelector('svg > g') as SVGGElement+ expect(group.style.opacity).toBe('0.08')+ expect(group.style.transition).toBe('opacity 0.15s')+ // BaseEdge path, interaction path and the flow overlay all sit inside it.+ expect(group.querySelectorAll('path').length).toBeGreaterThanOrEqual(3)+ })++ it('fades the label and the LQI badge with the line', () => {+ useThemeStore.setState({+ customStyle: { nodes: {}, edges: { ethernet: { showLqi: true } as EdgeTypeStyle } },+ })+ const { getByText } = renderEdge({ opacity: 0.08 }, { label: 'uplink', lqi: 120 })+ expect((getByText('uplink') as HTMLElement).style.opacity).toBe('0.08')+ expect((getByText('LQI 120') as HTMLElement).style.opacity).toBe('0.08')+ })++ it('sets no opacity when no style is passed, but keeps the transition so the restore fades', () => {+ const { container, getByText } = renderEdge(undefined, { label: 'uplink' })+ const group = container.querySelector('svg > g') as SVGGElement+ expect(group.style.opacity).toBe('')+ expect(group.style.transition).toBe('opacity 0.15s')+ expect((getByText('uplink') as HTMLElement).style.opacity).toBe('')+ expect((getByText('uplink') as HTMLElement).style.transition).toBe('opacity 0.15s')+ })++ it('fades the endpoint dots of a selected edge with the line', () => {+ const { getAllByTitle } = renderEdge({ opacity: 0.08 }, {}, true)+ const dots = getAllByTitle('Drag to reconnect')+ expect(dots).toHaveLength(2)+ for (const dot of dots) {+ expect((dot.parentElement as HTMLElement).style.opacity).toBe('0.08')+ }+ })++ it('renders no handle wrapper for an unselected edge', () => {+ const { queryAllByTitle } = renderEdge({ opacity: 0.08 })+ expect(queryAllByTitle('Drag to reconnect')).toHaveLength(0)+ })+})diff --git a/frontend/src/components/canvas/edges/index.tsx b/frontend/src/components/canvas/edges/index.tsxindex aa5a0a4..198b79b 100644--- a/frontend/src/components/canvas/edges/index.tsx+++ b/frontend/src/components/canvas/edges/index.tsx@@ -290,7 +290,7 @@ function EndpointDot({ edgeId, role, x, y, position, color, source, target, sour// ── Main edge component ──────────────────────────────────────────────────────-export function HomelableEdge({ id, source, target, sourceHandleId, targetHandleId, sourceX: rawSourceX, sourceY: rawSourceY, targetX: rawTargetX, targetY: rawTargetY, sourcePosition, targetPosition, data, selected }: EdgeProps<Edge<EdgeData>>) {+export function HomelableEdge({ id, source, target, sourceHandleId, targetHandleId, sourceX: rawSourceX, sourceY: rawSourceY, targetX: rawTargetX, targetY: rawTargetY, sourcePosition, targetPosition, data, selected, style: rfStyle }: EdgeProps<Edge<EdgeData>>) {const [drag, setDrag] = useState<{ role: 'source' | 'target'; x: number; y: number } | null>(null)const sourceX = drag?.role === 'source' ? drag.x : rawSourceX@@ -428,74 +428,83 @@ export function HomelableEdge({ id, source, target, sourceHandleId, targetHandle)}+ // Opacity set on `edge.style` by the canvas (hover highlight). The stroke+ // style above is built from the edge type, so the prop is otherwise unused;+ // it fades the whole edge — line, markers, animation, labels and the+ // selected-edge handles — as one. The transition is fixed so that dropping+ // the opacity on leave fades back too.+ const fade: React.CSSProperties = { opacity: rfStyle?.opacity, transition: 'opacity 0.15s' }+return (<>- {hasMarkers && (- <defs>- {startShape !== 'none' && arrowMarker(startMarkerId, startShape, 'auto-start-reverse')}- {endShape !== 'none' && arrowMarker(endMarkerId, endShape, 'auto')}- </defs>- )}-- <BaseEdge- id={id}- path={edgePath}- style={animMode === 'basic' ? { ...style, stroke: 'transparent' } : style}- interactionWidth={16}- markerStart={startShape !== 'none' ? `url(#${startMarkerId})` : undefined}- markerEnd={endShape !== 'none' ? `url(#${endMarkerId})` : undefined}- />-- {animMode === 'basic' && (- <path- d={edgePath}- fill="none"- stroke={strokeColor}- strokeWidth={style.strokeWidth as number ?? 2}- strokeDasharray="5"- style={{- pointerEvents: 'none',- // Direction comes from the keyframes alone (see index.css), never- // from the endpoints' screen positions: an edge drawn bottom-to-top- // marches the same way as one drawn top-to-bottom, like the snake- // and flow modes.- animation: `homelable-basic-dash ${animDuration('basic', animSpeed)} linear infinite`,- }}- />- )}-- {animMode === 'snake' && (- <path- d={edgePath}- fill="none"- stroke={animColor}- strokeWidth={((style.strokeWidth as number ?? 2) + 1.5) * 2}- strokeDasharray="20 10000"- strokeLinecap="round"- style={{- pointerEvents: 'none',- // CSS (not SMIL) so it pauses when the tab is hidden — see index.css.- // Bidirectional yo-yos via `alternate` (10s each way at 1× = 20s round- // trip, matching the old SMIL keyTimes); unidirectional loops in one direction.- animation: `homelable-snake ${animDuration('snake', animSpeed)} linear infinite${isBidirectional ? ' alternate' : ''}`,- }}- />- )}- {animMode === 'flow' && (- <path- d={edgePath}- fill="none"- stroke={animColor}- strokeWidth={Math.max(3, (style.strokeWidth as number ?? 2) * 1.8)}- strokeDasharray="6 12"- strokeLinecap="round"- strokeOpacity={0.85}- style={{- pointerEvents: 'none',- animation: `homelable-flow ${animDuration('flow', animSpeed)} linear infinite`,- }}+ <g style={fade}>+ {hasMarkers && (+ <defs>+ {startShape !== 'none' && arrowMarker(startMarkerId, startShape, 'auto-start-reverse')}+ {endShape !== 'none' && arrowMarker(endMarkerId, endShape, 'auto')}+ </defs>+ )}++ <BaseEdge+ id={id}+ path={edgePath}+ style={animMode === 'basic' ? { ...style, stroke: 'transparent' } : style}+ interactionWidth={16}+ markerStart={startShape !== 'none' ? `url(#${startMarkerId})` : undefined}+ markerEnd={endShape !== 'none' ? `url(#${endMarkerId})` : undefined}/>- )}++ {animMode === 'basic' && (+ <path+ d={edgePath}+ fill="none"+ stroke={strokeColor}+ strokeWidth={style.strokeWidth as number ?? 2}+ strokeDasharray="5"+ style={{+ pointerEvents: 'none',+ // Direction comes from the keyframes alone (see index.css), never+ // from the endpoints' screen positions: an edge drawn bottom-to-top+ // marches the same way as one drawn top-to-bottom, like the snake+ // and flow modes.+ animation: `homelable-basic-dash ${animDuration('basic', animSpeed)} linear infinite`,+ }}+ />+ )}++ {animMode === 'snake' && (+ <path+ d={edgePath}+ fill="none"+ stroke={animColor}+ strokeWidth={((style.strokeWidth as number ?? 2) + 1.5) * 2}+ strokeDasharray="20 10000"+ strokeLinecap="round"+ style={{+ pointerEvents: 'none',+ // CSS (not SMIL) so it pauses when the tab is hidden — see index.css.+ // Bidirectional yo-yos via `alternate` (10s each way at 1× = 20s round+ // trip, matching the old SMIL keyTimes); unidirectional loops in one direction.+ animation: `homelable-snake ${animDuration('snake', animSpeed)} linear infinite${isBidirectional ? ' alternate' : ''}`,+ }}+ />+ )}+ {animMode === 'flow' && (+ <path+ d={edgePath}+ fill="none"+ stroke={animColor}+ strokeWidth={Math.max(3, (style.strokeWidth as number ?? 2) * 1.8)}+ strokeDasharray="6 12"+ strokeLinecap="round"+ strokeOpacity={0.85}+ style={{+ pointerEvents: 'none',+ animation: `homelable-flow ${animDuration('flow', animSpeed)} linear infinite`,+ }}+ />+ )}+ </g><EdgeLabelRenderer>{showLqi && (@@ -507,6 +516,7 @@ export function HomelableEdge({ id, source, target, sourceHandleId, targetHandlebackground: theme.colors.edgeLabelBackground,color: theme.colors.edgeLabelColor,border: `1px solid ${theme.colors.edgeLabelBorder}`,+ ...fade,}}>LQI {data!.lqi}@@ -521,82 +531,87 @@ export function HomelableEdge({ id, source, target, sourceHandleId, targetHandlebackground: theme.colors.edgeLabelBackground,color: theme.colors.edgeLabelColor,border: `1px solid ${theme.colors.edgeLabelBorder}`,+ ...fade,}}>{data.label as string}</div>)}- {/* Endpoint dots — visual indicators for reconnection targets */}- {selected && (- <>- <EndpointDot- edgeId={id}- role="source"- x={sourceX}- y={sourceY}- position={sourcePosition}- color={strokeColor}- source={source}- target={target}- sourceHandle={sourceHandleId}- targetHandle={targetHandleId}- onDrag={onSourceDrag}- />- <EndpointDot- edgeId={id}- role="target"- x={targetX}- y={targetY}- position={targetPosition}- color={strokeColor}- source={source}- target={target}- sourceHandle={sourceHandleId}- targetHandle={targetHandleId}- onDrag={onTargetDrag}- />- </>- )}-- {/* Existing waypoint drag handles */}- {selected && waypoints.map((wp, idx) => {- const prevPoint = idx === 0 ? { x: sourceX, y: sourceY } : waypoints[idx - 1]- const nextPoint = idx === waypoints.length - 1 ? { x: targetX, y: targetY } : waypoints[idx + 1]- return (- <WaypointHandle- key={`wp-${idx}`}- edgeId={id}- index={idx}- waypoint={wp}- waypoints={waypoints}- color={strokeColor}- pathStyle={pathStyle}- prevPoint={prevPoint}- nextPoint={nextPoint}- />- )- })}-- {/* + handles at segment midpoints to add new waypoints */}- {selected && midpoints.map((mp) => {- const prevPoint = mp.insertIndex === 0- ? { x: sourceX, y: sourceY }- : waypoints[mp.insertIndex - 1]- return (- <AddWaypointHandle- key={`add-${mp.insertIndex}`}- edgeId={id}- insertIndex={mp.insertIndex}- x={mp.x}- y={mp.y}- waypoints={waypoints}- color={strokeColor}- pathStyle={pathStyle}- prevPoint={prevPoint}- />- )- })}+ {/* Selected-edge handles, faded with the line. The wrapper is static, so+ the absolutely-positioned handles still place against the renderer. */}+ {selected && <div style={fade}>+ {/* Endpoint dots — visual indicators for reconnection targets */}+ {selected && (+ <>+ <EndpointDot+ edgeId={id}+ role="source"+ x={sourceX}+ y={sourceY}+ position={sourcePosition}+ color={strokeColor}+ source={source}+ target={target}+ sourceHandle={sourceHandleId}+ targetHandle={targetHandleId}+ onDrag={onSourceDrag}+ />+ <EndpointDot+ edgeId={id}+ role="target"+ x={targetX}+ y={targetY}+ position={targetPosition}+ color={strokeColor}+ source={source}+ target={target}+ sourceHandle={sourceHandleId}+ targetHandle={targetHandleId}+ onDrag={onTargetDrag}+ />+ </>+ )}++ {/* Existing waypoint drag handles */}+ {selected && waypoints.map((wp, idx) => {+ const prevPoint = idx === 0 ? { x: sourceX, y: sourceY } : waypoints[idx - 1]+ const nextPoint = idx === waypoints.length - 1 ? { x: targetX, y: targetY } : waypoints[idx + 1]+ return (+ <WaypointHandle+ key={`wp-${idx}`}+ edgeId={id}+ index={idx}+ waypoint={wp}+ waypoints={waypoints}+ color={strokeColor}+ pathStyle={pathStyle}+ prevPoint={prevPoint}+ nextPoint={nextPoint}+ />+ )+ })}++ {/* + handles at segment midpoints to add new waypoints */}+ {selected && midpoints.map((mp) => {+ const prevPoint = mp.insertIndex === 0+ ? { x: sourceX, y: sourceY }+ : waypoints[mp.insertIndex - 1]+ return (+ <AddWaypointHandle+ key={`add-${mp.insertIndex}`}+ edgeId={id}+ insertIndex={mp.insertIndex}+ x={mp.x}+ y={mp.y}+ waypoints={waypoints}+ color={strokeColor}+ pathStyle={pathStyle}+ prevPoint={prevPoint}+ />+ )+ })}+ </div>}</EdgeLabelRenderer></>)diff --git a/frontend/src/components/modals/SettingsModal.tsx b/frontend/src/components/modals/SettingsModal.tsxindex 783f129..f614946 100644--- a/frontend/src/components/modals/SettingsModal.tsx+++ b/frontend/src/components/modals/SettingsModal.tsx@@ -30,6 +30,12 @@ import {writeAutosaveSettings,subscribeAutosaveSettings,} from '@/utils/autosaveSettings'+import {+ type HoverHighlightSettings,+ readHoverHighlightSettings,+ writeHoverHighlightSettings,+ subscribeHoverHighlightSettings,+} from '@/utils/hoverHighlightSettings'const STANDALONE = import.meta.env.VITE_STANDALONE === 'true'@@ -172,6 +178,7 @@ export function SettingsModal({ open, onClose }: SettingsModalProps) {const [unSyncing, setUnSyncing] = useState(false)const [alignment, setAlignment] = useState<AlignmentSettings>(readAlignmentSettings)const [autosave, setAutosave] = useState<AutosaveSettings>(readAutosaveSettings)+ const [hoverHighlight, setHoverHighlight] = useState<HoverHighlightSettings>(readHoverHighlightSettings)const anyUnifiSource = unModes.infrastructure || unModes.known_clients || unModes.active_clients// Saving with every source unticked 422s on the backend, aborting the save// after the other configs already persisted — refuse it up front instead.@@ -231,6 +238,7 @@ export function SettingsModal({ open, onClose }: SettingsModalProps) {useEffect(() => subscribeAlignmentSettings(setAlignment), [])useEffect(() => subscribeAutosaveSettings(setAutosave), [])+ useEffect(() => subscribeHoverHighlightSettings(setHoverHighlight), [])const updateAlignment = (patch: Partial<AlignmentSettings>) => {const next = { ...alignment, ...patch }@@ -238,6 +246,12 @@ export function SettingsModal({ open, onClose }: SettingsModalProps) {writeAlignmentSettings(next)}+ const updateHoverHighlight = (patch: Partial<HoverHighlightSettings>) => {+ const next = { ...hoverHighlight, ...patch }+ setHoverHighlight(next)+ writeHoverHighlightSettings(next)+ }+const updateAutosave = (patch: Partial<AutosaveSettings>) => {const next = { ...autosave, ...patch }setAutosave(next)@@ -473,6 +487,17 @@ export function SettingsModal({ open, onClose }: SettingsModalProps) {/></label>+ <label className="flex items-center justify-between gap-2 cursor-pointer">+ <span className="text-xs text-foreground">Highlight links on hover</span>+ <input+ type="checkbox"+ checked={hoverHighlight.enabled}+ onChange={(e) => updateHoverHighlight({ enabled: e.target.checked })}+ className="cursor-pointer accent-[#00d4ff]"+ aria-label="Toggle hover highlight"+ />+ </label>+<div className={alignment.enabled ? 'space-y-1.5' : 'space-y-1.5 opacity-50 pointer-events-none'}><label className="text-xs text-muted-foreground">Snap distance</label><div className="flex items-center gap-2">diff --git a/frontend/src/components/modals/__tests__/SettingsModal.test.tsx b/frontend/src/components/modals/__tests__/SettingsModal.test.tsxindex 32e89b9..60957f3 100644--- a/frontend/src/components/modals/__tests__/SettingsModal.test.tsx+++ b/frontend/src/components/modals/__tests__/SettingsModal.test.tsx@@ -122,6 +122,16 @@ describe('SettingsModal', () => {expect(localStorage.getItem('homelable.hideIp')).toBe('true')})+ it('shows the hover highlight on by default and persists turning it off', async () => {+ localStorage.removeItem('homelable.hoverHighlight')+ render(<SettingsModal open onClose={vi.fn()} />)+ const checkbox = screen.getByLabelText('Toggle hover highlight') as HTMLInputElement+ expect(checkbox.checked).toBe(true)+ fireEvent.click(checkbox)+ expect(checkbox.checked).toBe(false)+ expect(JSON.parse(localStorage.getItem('homelable.hoverHighlight')!)).toEqual({ enabled: false })+ })+it('loads and toggles the per-service check setting, saving its interval', async () => {vi.mocked(settingsApi.get).mockResolvedValue({ data: { interval_seconds: 60, service_check_enabled: true, service_check_interval: 600 } } as never)render(<SettingsModal open onClose={vi.fn()} />)diff --git a/frontend/src/index.css b/frontend/src/index.cssindex d97913e..ee495fd 100644--- a/frontend/src/index.css+++ b/frontend/src/index.css@@ -149,6 +149,12 @@padding: 0 !important;}+/* Hover highlight: the canvas dims a node with an inline opacity and drops it+ on leave. The transition lives here, not inline, so the restore fades too. */+.react-flow__node {+ transition: opacity 0.15s;+}+/* Mono font utility */.font-mono {font-family: 'JetBrains Mono', monospace;diff --git a/frontend/src/utils/__tests__/hoverHighlightSettings.test.ts b/frontend/src/utils/__tests__/hoverHighlightSettings.test.tsnew file mode 100644index 0000000..0476d07--- /dev/null+++ b/frontend/src/utils/__tests__/hoverHighlightSettings.test.ts@@ -0,0 +1,43 @@+import { describe, it, expect, beforeEach, vi } from 'vitest'+import {+ DEFAULT_HOVER_HIGHLIGHT_SETTINGS,+ readHoverHighlightSettings,+ writeHoverHighlightSettings,+ subscribeHoverHighlightSettings,+} from '../hoverHighlightSettings'++describe('hoverHighlightSettings', () => {+ beforeEach(() => {+ localStorage.clear()+ })++ it('is on by default when nothing is stored', () => {+ expect(readHoverHighlightSettings()).toEqual({ enabled: true })+ expect(DEFAULT_HOVER_HIGHLIGHT_SETTINGS.enabled).toBe(true)+ })++ it('roundtrips through localStorage', () => {+ writeHoverHighlightSettings({ enabled: false })+ expect(readHoverHighlightSettings()).toEqual({ enabled: false })+ })++ it('falls back to defaults when stored value is corrupted', () => {+ localStorage.setItem('homelable.hoverHighlight', '{not json')+ expect(readHoverHighlightSettings()).toEqual(DEFAULT_HOVER_HIGHLIGHT_SETTINGS)+ })++ it('ignores a non-boolean enabled flag', () => {+ localStorage.setItem('homelable.hoverHighlight', JSON.stringify({ enabled: 'no' }))+ expect(readHoverHighlightSettings()).toEqual(DEFAULT_HOVER_HIGHLIGHT_SETTINGS)+ })++ it('notifies subscribers on write', () => {+ const listener = vi.fn()+ const unsubscribe = subscribeHoverHighlightSettings(listener)+ writeHoverHighlightSettings({ enabled: false })+ expect(listener).toHaveBeenCalledWith({ enabled: false })+ unsubscribe()+ writeHoverHighlightSettings({ enabled: true })+ expect(listener).toHaveBeenCalledTimes(1)+ })+})diff --git a/frontend/src/utils/hoverHighlightSettings.ts b/frontend/src/utils/hoverHighlightSettings.tsnew file mode 100644index 0000000..4a9f2e1--- /dev/null+++ b/frontend/src/utils/hoverHighlightSettings.ts@@ -0,0 +1,41 @@+// Persisted client-side setting for the canvas hover highlight (dim what is+// not linked to the hovered node). Kept in localStorage (per-user UI+// preference, not canvas data). Same-tab updates propagate via a CustomEvent so+// the canvas and the settings panel stay in sync without a global store.++export interface HoverHighlightSettings {+ enabled: boolean+}++export const DEFAULT_HOVER_HIGHLIGHT_SETTINGS: HoverHighlightSettings = { enabled: true }++const KEY = 'homelable.hoverHighlight'+const EVENT = 'homelable:hover-highlight-settings-changed'++export function readHoverHighlightSettings(): HoverHighlightSettings {+ try {+ const raw = localStorage.getItem(KEY)+ if (!raw) return DEFAULT_HOVER_HIGHLIGHT_SETTINGS+ const parsed = JSON.parse(raw) as Partial<HoverHighlightSettings>+ return {+ enabled: typeof parsed.enabled === 'boolean' ? parsed.enabled : DEFAULT_HOVER_HIGHLIGHT_SETTINGS.enabled,+ }+ } catch {+ return DEFAULT_HOVER_HIGHLIGHT_SETTINGS+ }+}++export function writeHoverHighlightSettings(s: HoverHighlightSettings): void {+ try {+ localStorage.setItem(KEY, JSON.stringify(s))+ window.dispatchEvent(new CustomEvent<HoverHighlightSettings>(EVENT, { detail: s }))+ } catch {+ /* quota / SSR */+ }+}++export function subscribeHoverHighlightSettings(listener: (s: HoverHighlightSettings) => void): () => void {+ const handler = (e: Event) => listener((e as CustomEvent<HoverHighlightSettings>).detail)+ window.addEventListener(EVENT, handler)+ return () => window.removeEventListener(EVENT, handler)+}