Self-hosted homelab infrastructure visualizer — interactive network diagram with live status monitoring
TypeScript diagramhomelabhomelab-infrastructure-observabilitynetworkproxmox-veself-hostedzigbeezwavezwave-js
aligned services and path styling
findthelorax26be37f731ca
diff --git a/frontend/src/components/panels/DetailPanel.tsx b/frontend/src/components/panels/DetailPanel.tsxindex 47b0f1d..b35da39 100644--- a/frontend/src/components/panels/DetailPanel.tsx+++ b/frontend/src/components/panels/DetailPanel.tsx@@ -659,25 +659,78 @@ const CATEGORY_COLORS: Record<string, string> = {}function ServiceBadge({ svc, host, onEdit, onRemove }: { svc: ServiceInfo; host?: string; onEdit: () => void; onRemove: () => void }) {- const url = getServiceUrl(svc, host)- const color = CATEGORY_COLORS[svc.category ?? ''] ?? '#8b949e'- const portLabel = svc.port != null ? String(svc.port) : 'host'- const pathLabel = svc.path?.trim() ? svc.path.trim() : null- const inner = (- <div className="group flex items-center justify-between gap-2 px-2 py-1.5 rounded-md border text-xs transition-colors" style={{ background: '#21262d', borderColor: '#30363d', cursor: url ? 'pointer' : 'default' }}>- <div className="flex items-center gap-1.5 min-w-0">- <span className="shrink-0 w-1.5 h-1.5 rounded-full" style={{ backgroundColor: color }} />- <span className="font-medium truncate" style={{ color }} title={svc.service_name}>{svc.service_name}</span>- {pathLabel && <span className="truncate text-[#8b949e]" title={pathLabel}>{pathLabel}</span>}- </div>- <div className="flex items-center gap-1.5 shrink-0">- <span className="font-mono text-[#8b949e]">{portLabel}/{svc.protocol}</span>- {url && <ExternalLink size={10} className="text-muted-foreground" />}- <button onClick={(e) => { e.preventDefault(); e.stopPropagation(); onEdit() }} className="opacity-0 group-hover:opacity-100 transition-opacity text-[#8b949e] hover:text-[#00d4ff] ml-0.5" title="Edit service"><Pencil size={10} /></button>- <button onClick={(e) => { e.preventDefault(); e.stopPropagation(); onRemove() }} className="opacity-0 group-hover:opacity-100 transition-opacity text-[#8b949e] hover:text-[#f85149] ml-0.5" title="Remove service"><X size={10} /></button>+ const url = getServiceUrl(svc, host);+ const color = CATEGORY_COLORS[svc.category ?? ''] ?? '#8b949e';+ const hasPort = svc.port != null;+ const portLabel = hasPort ? String(svc.port) : '';+ const pathLabel = svc.path?.trim() ? svc.path.trim() : '';+ // Layout: service name takes all available space, path/port are always right-aligned next to buttons, path is hidden if name must truncate+ return (+ <div+ className="group flex items-center border rounded-md text-xs transition-colors px-2 py-1.5 min-w-0"+ style={{ background: '#21262d', borderColor: '#30363d', position: 'relative' }}+ >+ <span className="shrink-0 w-1.5 h-1.5 rounded-full mr-1" style={{ backgroundColor: color }} />+ <span+ className="font-medium truncate flex-grow min-w-0"+ style={{ color, marginRight: 12, maxWidth: '100%' }}+ title={svc.service_name}+ tabIndex={0}+ aria-label={svc.service_name}+ >+ {svc.service_name}+ </span>+ <div className="flex items-center gap-1 shrink-0" style={{ maxWidth: 180, minWidth: 0 }}>+ {pathLabel && (+ <span+ className="truncate text-[#8b949e] text-right"+ style={{ minWidth: 0, maxWidth: 70, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', display: 'block' }}+ title={pathLabel}+ tabIndex={0}+ aria-label={pathLabel}+ >+ {pathLabel}+ </span>+ )}+ {hasPort && (+ <span className="font-mono text-[#8b949e]" style={{ whiteSpace: 'nowrap', flexShrink: 0 }}>{portLabel}/{svc.protocol}</span>+ )}+ <span className="inline-flex w-2.5 h-2.5 items-center justify-center shrink-0" aria-hidden="true">+ {url ? <ExternalLink size={10} className="text-muted-foreground" /> : <span style={{ width: 10, display: 'inline-block' }} />}+ </span>+ <button+ onClick={(e) => { e.preventDefault(); e.stopPropagation(); onEdit(); }}+ className="opacity-100 transition-opacity text-[#8b949e] hover:text-[#00d4ff] ml-0.5"+ title="Edit service"+ >+ <Pencil size={10} />+ </button>+ <button+ onClick={(e) => { e.preventDefault(); e.stopPropagation(); onRemove(); }}+ className="opacity-100 transition-opacity text-[#8b949e] hover:text-[#f85149] ml-0.5"+ title="Remove service"+ >+ <X size={10} />+ </button></div>+ {url && (+ <a+ href={url}+ target="_blank"+ rel="noopener noreferrer"+ style={{+ position: 'absolute',+ left: 0,+ top: 0,+ bottom: 0,+ right: 80,+ zIndex: 1,+ opacity: 0,+ }}+ tabIndex={-1}+ aria-hidden="true"+ />+ )}</div>- )- if (url) return <a href={url} target="_blank" rel="noopener noreferrer" className="block hover:opacity-80 transition-opacity">{inner}</a>- return inner+ );}diff --git a/frontend/src/components/ui/tooltip.tsx b/frontend/src/components/ui/tooltip.tsxdeleted file mode 100644index 69e8a82..0000000--- a/frontend/src/components/ui/tooltip.tsx+++ /dev/null@@ -1,66 +0,0 @@-"use client"--import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"--import { cn } from "@/lib/utils"--function TooltipProvider({- delay = 0,- ...props-}: TooltipPrimitive.Provider.Props) {- return (- <TooltipPrimitive.Provider- data-slot="tooltip-provider"- delay={delay}- {...props}- />- )-}--function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {- return <TooltipPrimitive.Root data-slot="tooltip" {...props} />-}--function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {- return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />-}--function TooltipContent({- className,- side = "top",- sideOffset = 4,- align = "center",- alignOffset = 0,- children,- ...props-}: TooltipPrimitive.Popup.Props &- Pick<- TooltipPrimitive.Positioner.Props,- "align" | "alignOffset" | "side" | "sideOffset"- >) {- return (- <TooltipPrimitive.Portal>- <TooltipPrimitive.Positioner- align={align}- alignOffset={alignOffset}- side={side}- sideOffset={sideOffset}- className="isolate z-50"- >- <TooltipPrimitive.Popup- data-slot="tooltip-content"- className={cn(- "z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",- className- )}- {...props}- >- {children}- <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" />- </TooltipPrimitive.Popup>- </TooltipPrimitive.Positioner>- </TooltipPrimitive.Portal>- )-}--export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }