Просмотр исходного кода

feat(rack): free rack height and group names that match the UI (#1808)

* feat(rack): free rack height and group names that match the UI (#1804)

* feat(rack): show the port name in the tooltip instead of the ifIndex (#1804)

* feat(rack): mount units at half and third width (#1804)

* fix(rack): number patch panel ports in the tooltip (#1804)

* fix(rack): offer every rackable wired client in the picker (#1804)

* fix(rack): keep virtual interfaces off the faceplate (#1804)

* fix(rack): give the unit name the room, not the model tag (#1804)
Nacho 1 месяц назад
Родитель
Сommit
2ec805a4b8

+ 8 - 0
CHANGELOG.md

@@ -11,6 +11,14 @@ y este proyecto se adhiere a [Versionado Semántico](https://semver.org/lang/es/
 
 - The per-unit actions live together now (#1803). **Regenerate token** moved from Settings > Fleet to the Actions column of the agents card, and **Forget host key** moved from the unit detail to the same card, so a unit's configuration is not split across three screens. Both keep their confirmation dialog and only appear where they apply: the token for netpulse agents, the host key for units NetPulse polls over SSH.
 - The settings group goes back to its Integrations label and the section that hosts the vendor integrations manager is the one called Complementos (Add-ons in English), which is how the code comment already described it (#1784).
+- The rack picker names its groups the way the rest of the UI does (#1804): **Fleet units** instead of Routers and **Clients** instead of Devices.
+- A unit can be mounted at full width, half width or a third of the rack (#1804). Two or three devices now fit on the same shelf: the placement dialog asks for the width, and the slot search already worked in columns, so the free-space check and the drag respect it. Patch panels keep the width of their template.
+- A rack is created with any height you type instead of picking from six presets (#1804). Home-built racks are rarely 6, 9, 12, 18, 24 or 42 U; the field accepts 1 to 45 and keeps the same validation as before.
+- Ports of a racked fleet unit show their name in the tooltip instead of the SNMP ifIndex (#1804): the port keeps its id as the key for cables and profiles, but the label the unit publishes (`ifName`/`ifAlias`) is what you read. Existing profiles get the label from the live unit detail, so a switch placed before this change reads the same as a new one.
+- Patch panel ports are numbered the way the panel is (#1804): the tooltip and the accessible name say 1 to 48 instead of the internal `p01` key, which is what a person reads off the hardware.
+- The rack picker favours the unit name over its model (#1804): the model tag used to hold its full width and truncated the hostname first, so two units of the same family looked identical. The tag now gives way and caps at under half the row, and both show their full text on hover.
+- The rack picker lists every wired client that can be racked (#1804), not a short list of guessed types. The old filter only offered switches, servers, desktops and cameras, so modems, single-board computers, printers and anything the classifier could not name stayed hidden: the reporter saw 7 of their 32 clients and could not mount three of them. Phones, tablets, laptops and room appliances are still left out, and the panel says so.
+- The front panel of a racked unit only shows its physical ports (#1804). SNMP units publish their VLAN interface and their LAG as ethernet, so a TP-Link Omada put `vlan1` (ifIndex 1) and the port-channel (32769) on the faceplate next to the 28 real ports. The poller already classifies each interface by its IANA `ifType`; the faceplate now skips anything with a family, so VLANs, LAGs, bridges and tunnels stay out of the drawing while cables and profiles keep resolving by ifIndex.
 
 ## [2.50.0] - 2026-10-31
 

+ 7 - 2
app/public/locales/en/translation.json

@@ -2969,8 +2969,9 @@
     "empty": "No racks yet",
     "emptyHint": "Create a rack first",
     "pickHint": "Drag onto a rack (or click) to mount into the active rack (the cyan one). Then drag to adjust the slot.",
-    "pickFleet": "Routers",
-    "pickDevice": "Devices",
+    "pickFleet": "Fleet units",
+    "pickDevice": "Clients",
+    "pickDeviceHint": "Wired clients not mounted yet. Only what cannot be racked is left out: phones, tablets, laptops and room appliances.",
     "pickAccessory": "Accessories",
     "plates": {
       "server-1u": "1U server",
@@ -3008,6 +3009,10 @@
     "askTitle": "Place “{{name}}”",
     "askTitlePatch": "Place patch panel",
     "askHeight": "Height (U)",
+    "askWidth": "Width",
+    "widthFull": "Full",
+    "widthHalf": "Half",
+    "widthThird": "One third",
     "askPorts": "Ports",
     "askPlace": "Place",
     "dropNoRack": "Drop it inside a rack",

+ 7 - 2
app/public/locales/es/translation.json

@@ -2969,8 +2969,9 @@
     "empty": "Todavía no hay ningún rack",
     "emptyHint": "Crea primero un rack",
     "pickHint": "Arrastra al rack (o haz clic) para montar en el rack activo (el resaltado en cyan). Luego arrastra para ajustar el hueco.",
-    "pickFleet": "Routers",
-    "pickDevice": "Dispositivos",
+    "pickFleet": "Unidades",
+    "pickDevice": "Clientes",
+    "pickDeviceHint": "Clientes cableados sin montar. Fuera solo lo que no se atornilla: móviles, tablets, portátiles y electrodomésticos de sala.",
     "pickAccessory": "Accesorios",
     "plates": {
       "server-1u": "Servidor 1U",
@@ -3008,6 +3009,10 @@
     "askTitle": "Colocar «{{name}}»",
     "askTitlePatch": "Colocar patch panel",
     "askHeight": "Altura (U)",
+    "askWidth": "Ancho",
+    "widthFull": "Completo",
+    "widthHalf": "Mitad",
+    "widthThird": "Un tercio",
     "askPorts": "Puertos",
     "askPlace": "Colocar",
     "dropNoRack": "Suéltalo dentro de un rack",

+ 12 - 2
app/src/components/rack/Faceplate.tsx

@@ -7,6 +7,16 @@ import { useTranslation } from 'react-i18next'
 import { EthernetPort } from 'lucide-react'
 import type { FaceplateTemplate, FaceplatePort } from '@/lib/rackFaceplates'
 
+/** #1804: un id de boca tipo "p01" es interno (lo genera la plantilla). Al
+ *  usuario se le muestra el número de puerto, no el identificador. Cualquier
+ *  otro id sin etiqueta se pinta tal cual: "lan1" y "snmp-49153" ya son lo que
+ *  el usuario ve en el equipo. */
+function portDisplay(p: FaceplatePort): string {
+  if (p.label) return p.label
+  const m = /^p0*(\d+)$/.exec(p.id)
+  return m ? m[1]! : p.id
+}
+
 export interface PortState {
   /** el puerto tiene al menos un cable */
   cabled: boolean
@@ -112,9 +122,9 @@ export function Faceplate({
               key={p.id}
               type="button"
               tabIndex={st.interactive ? 0 : -1}
-              aria-label={p.id}
+              aria-label={portDisplay(p)}
               data-port={p.id}
-              title={`${p.id} · ${p.kind}`}
+              title={`${portDisplay(p)} · ${p.kind}`}
               onClick={(e) => {
                 e.stopPropagation()
                 if (st.interactive) onPortClick?.(p.id)

+ 2 - 0
app/src/lib/rackApi.ts

@@ -47,6 +47,8 @@ export interface ProfilePortDTO {
   kind: RackPortKindWire
   x: number
   y: number
+  /** #1804: nombre legible de la boca; el id sigue siendo la clave. */
+  label?: string
 }
 
 export interface ProfileDTO {

+ 7 - 4
app/src/lib/rackFaceplates.ts

@@ -15,6 +15,8 @@ export interface FaceplatePort {
   kind: RackPortKind
   x: number
   y: number
+  /** #1804: nombre legible de la boca (ifName/ifAlias). El id sigue mandando. */
+  label?: string
 }
 
 export interface PortRow {
@@ -299,22 +301,23 @@ export function layoutPortZone(
  * mismo algoritmo de zona, preservando los ids en el orden de disposición.
  */
 export function layoutPhysicalPorts(
-  ports: { id: string; kind: RackPortKind }[],
+  ports: { id: string; kind: RackPortKind; label?: string }[],
   zone?: { xStart: number; xEnd: number },
 ): FaceplatePort[] {
   const counts: Partial<Record<RackPortKind, number>> = {}
   for (const p of ports) counts[p.kind] = (counts[p.kind] ?? 0) + 1
   const laid = layoutPortZone(counts, zone ?? { xStart: 0.24, xEnd: 0.94 })
-  const byKind: Record<string, string[]> = {}
+  const byKind: Record<string, { id: string; label?: string }[]> = {}
   for (const p of ports) {
-    ;(byKind[p.kind] = byKind[p.kind] ?? []).push(p.id)
+    ;(byKind[p.kind] = byKind[p.kind] ?? []).push({ id: p.id, label: p.label })
   }
   const used: Record<string, number> = {}
   return laid.map((slot) => {
     const ids = byKind[slot.kind] ?? []
     const idx = Math.min(used[slot.kind] ?? 0, ids.length - 1)
     used[slot.kind] = (used[slot.kind] ?? 0) + 1
-    return { ...slot, id: ids[idx] ?? slot.id }
+    const hit = ids[idx]
+    return { ...slot, id: hit?.id ?? slot.id, label: hit?.label }
   })
 }
 

+ 144 - 45
app/src/pages/Rack.tsx

@@ -55,6 +55,11 @@ interface Working {
 let localSeq = 0
 const localId = (p: string) => `${p}-local-${++localSeq}`
 
+// #1804: tipos que no se montan en un rack. El resto de clientes cableados sí
+// se ofrece: el tipo lo adivina el clasificador y excluir por conjetura era lo
+// que dejaba equipos fuera de la lista.
+const NOT_RACKABLE = new Set(['movil', 'tablet', 'portatil', 'aspirador', 'videoportero', 'clima', 'caldera'])
+
 function RackCanvas() {
   const { t } = useTranslation()
   const np = useNetPulse()
@@ -64,11 +69,54 @@ function RackCanvas() {
     () => new Map(np.routers.flatMap((r) => (r.mac ? [[r.mac.toLowerCase(), r.name] as const] : []))),
     [np.routers],
   )
+  // #1804: los perfiles guardados antes de este cambio solo llevan el id de la
+  // boca (snmp-49153 en un switch SNMP). La etiqueta legible se resuelve
+  // contra el detalle vivo de cada unidad montada, una vez por MAC.
+  const routerIdByMac = useMemo(
+    () => new Map(np.routers.flatMap((r) => (r.mac ? [[r.mac.toLowerCase(), r.id] as const] : []))),
+    [np.routers],
+  )
+  const [portLabels, setPortLabels] = useState<Map<string, Record<string, string>>>(new Map())
   const services = useServicesVisibility()[0]
   const auth = useAuth()
   const isAdmin = auth?.role === 'admin'
 
   const [working, setWorking] = useState<Working>({ racks: [], mounts: [], cables: [], profiles: new Map(), audit: {} })
+
+  const labelMacs = useMemo(() => {
+    const out = new Set<string>()
+    for (const m of working.mounts) if (m.device_mac) out.add(m.device_mac.toLowerCase())
+    return out
+  }, [working.mounts])
+
+  useEffect(() => {
+    let cancelled = false
+    void (async () => {
+      for (const mac of labelMacs) {
+        if (portLabels.has(mac)) continue
+        const rid = routerIdByMac.get(mac)
+        if (!rid) continue
+        try {
+          const res = await fetch(`/api/routers/${encodeURIComponent(rid)}`)
+          if (!res.ok) continue
+          const detail = await res.json()
+          const eth: { id?: string; iface?: string; name?: string; label?: string }[] = detail?.extras?.ethPorts ?? []
+          const map: Record<string, string> = {}
+          for (const p of eth) {
+            const id = p.id || p.iface || p.name || ''
+            const label = p.label || p.iface || ''
+            if (id && label) map[id] = label
+          }
+          if (!cancelled) setPortLabels((prev) => new Map(prev).set(mac, map))
+        } catch {
+          // Sin detalle: el tooltip cae al id, como antes.
+        }
+      }
+    })()
+    return () => {
+      cancelled = true
+    }
+  }, [labelMacs, routerIdByMac, portLabels])
   const [loaded, setLoaded] = useState(false)
   const [activeRackId, setActiveRackId] = useState<string | null>(null)
   const [patchMode, setPatchMode] = useState(false)
@@ -95,7 +143,7 @@ function RackCanvas() {
     deviceType: string
     label: string
     faceplateId?: string
-    physicalPorts?: { id: string; kind: RackPortKind }[]
+    physicalPorts?: { id: string; kind: RackPortKind; label?: string }[]
     defaultU: number
     isPatch: boolean
     /** punto de drop en coords relativas al rack (coloca donde se soltó) */
@@ -103,6 +151,9 @@ function RackCanvas() {
   } | null>(null)
   const [askU, setAskU] = useState('1')
   const [askPorts, setAskPorts] = useState('24')
+  // #1804: ancho del montaje. El rack son 12 columnas; media balda son 6 y un
+  // tercio son 4, para meter dos o tres equipos en el mismo U.
+  const [askWidth, setAskWidth] = useState<'full' | 'half' | 'third'>('full')
 
   // Dirty tracking (todo lo que Save debe persistir).
   const [newMountIds, setNewMountIds] = useState<Set<string>>(new Set())
@@ -400,7 +451,10 @@ function RackCanvas() {
         style: { width: m.col_span * COL_PX, height: m.u_height * U_PX },
         data: {
           plate,
-          ports: portsFor(m),
+          ports: portsFor(m).map((p) => ({
+            ...p,
+            label: p.label ?? (m.device_mac ? portLabels.get(m.device_mac.toLowerCase())?.[p.id] : undefined),
+          })),
           mountId: m.id,
           label:
             m.label ||
@@ -583,7 +637,7 @@ function RackCanvas() {
       mac: string,
       deviceType: string,
       label: string,
-      physicalPorts?: { id: string; kind: RackPortKind }[],
+      physicalPorts?: { id: string; kind: RackPortKind; label?: string }[],
       rackId?: string,
       dropRel?: { x: number; y: number },
     ) => {
@@ -614,6 +668,7 @@ function RackCanvas() {
         dropRel,
       })
       setAskU(String(defU))
+      setAskWidth('full')
     },
     [activeRackId, working.racks, rackById, working.profiles, t],
   )
@@ -631,6 +686,7 @@ function RackCanvas() {
       setMountAsk({ rackId: rid!, deviceType: '', label: '', faceplateId, defaultU: plate.uHeight, isPatch, dropRel })
       setAskU(String(plate.uHeight))
       setAskPorts(faceplateId === 'patch-panel-12p' ? '12' : faceplateId === 'patch-panel-48p' ? '48' : '24')
+      setAskWidth('full')
     },
     [activeRackId, working.racks, rackById, t],
   )
@@ -650,7 +706,9 @@ function RackCanvas() {
       uHeight = getFaceplate(faceplateId)?.uHeight ?? uHeight
     }
     const plate = getFaceplate(faceplateId)
-    const colSpan = plate?.colSpan ?? 12
+    // #1804: un panel de parcheo manda su ancho de plantilla; el resto usa el
+    // que eligio el usuario (completo, media balda o un tercio).
+    const colSpan = ask.isPatch ? (plate?.colSpan ?? 12) : askWidth === 'half' ? 6 : askWidth === 'third' ? 4 : 12
     // Coloca donde se soltó (snap al hueco libre más cercano a ese punto);
     // sin punto de drop, el primer hueco libre desde abajo.
     let dropU = 1
@@ -667,7 +725,7 @@ function RackCanvas() {
     }
     if (ask.mac) {
       const existing = working.profiles.get(ask.mac)
-      if (plate && (!existing || (existing.ports.length === 0 && !existing.faceplate_id) || existing.u_height !== uHeight)) {
+      if (plate && (!existing || (existing.ports.length === 0 && !existing.faceplate_id) || existing.u_height !== uHeight || existing.col_span !== colSpan)) {
         const prof: ProfileDTO = {
           mac: ask.mac,
           faceplate_id: plate.id,
@@ -694,24 +752,33 @@ function RackCanvas() {
       label: ask.label,
     })
     setMountAsk(null)
-  }, [mountAsk, askU, askPorts, rackById, footprintsOfRack, working.profiles, mountAt, t])
+  }, [mountAsk, askU, askPorts, askWidth, rackById, footprintsOfRack, working.profiles, mountAt, t])
 
   // Los routers de flota traen sus bocas reales del poller (extras.ethPorts).
   const mountRouter = useCallback(
     async (router: { id: string; mac?: string; name: string }, rackId?: string, dropRel?: { x: number; y: number }) => {
       if (!router.mac) return
-      let physical: { id: string; kind: RackPortKind }[] | undefined
+      let physical: { id: string; kind: RackPortKind; label?: string }[] | undefined
       try {
         const res = await fetch(`/api/routers/${encodeURIComponent(router.id)}`)
         if (res.ok) {
           const detail = await res.json()
-          const eth: { id?: string; iface?: string; name?: string }[] = detail?.extras?.ethPorts ?? []
+          const eth: { id?: string; iface?: string; name?: string; label?: string; family?: string }[] =
+            detail?.extras?.ethPorts ?? []
           physical = eth
-            .map((p) => p.id || p.iface || p.name || '')
-            .filter((id) => id && !id.startsWith('wlan'))
-            .map((id) => {
-              const k = /sfp\+|10g|fiber|fibre/i.test(id) ? 'sfp+' : /sfp/i.test(id) ? 'sfp' : 'rj45'
-              return { id, kind: k as RackPortKind }
+            // #1804: `family` sale del ifType IANA del sondeo. vlan, lag,
+            // bridge, tunnel y virtual no son bocas del frontal: un Omada
+            // declara vlan1 (ifIndex 1) y el port-channel (32769) como
+            // ethernet y ocupaban sitio en el panel. Las bocas físicas llegan
+            // sin familia.
+            .filter((p) => !p.family)
+            .map((p) => ({ id: p.id || p.iface || p.name || '', label: p.label || p.iface || '' }))
+            .filter((p) => p.id && !p.id.startsWith('wlan'))
+            .map((p) => {
+              // #1804: el id sigue siendo la clave (snmp-49153); el label es lo
+              // que se pinta en el tooltip, para no enseñar un ifIndex.
+              const k = /sfp\+|10g|fiber|fibre/i.test(p.id) ? 'sfp+' : /sfp/i.test(p.id) ? 'sfp' : 'rj45'
+              return { id: p.id, kind: k as RackPortKind, label: p.label || undefined }
             })
         }
       } catch {
@@ -990,17 +1057,20 @@ function RackCanvas() {
   // Solo cableados: el rack es físico; WiFi (2.4/5/6/60 GHz) queda fuera.
   const unmountedDevices = useMemo(
     () =>
-      // El rack es hardware de red: switches, servidores, ordenadores de
-      // torre y CCTV. Fuera TVs, altavoces, IoT y resto que no tenga sentido.
-      // #rack-mini: los `desconocido` fuera también - si no sabemos qué es,
-      // no se ofrece para el rack.
+      // #1804: el criterio es "cliente cableado que se puede atornillar", no
+      // una lista corta de tipos. El allowlist anterior (switch, servidor,
+      // ordenador, camara) dejaba fuera módems, placas SBC, impresoras y todo
+      // lo que el clasificador no supo etiquetar (`desconocido`), y el
+      // reportero veía 7 de sus 32 clientes. El tipo es una heurística, así
+      // que se excluye solo lo que no tiene sentido en una balda: equipos
+      // portátiles y electrodomésticos de sala.
       np.devices.filter(
         (d) =>
           !mountedMacs.has(d.mac.toLowerCase()) &&
           (d.band === 'cable' || d.band === '—') &&
           d.infra !== 'ct' &&
           d.infra !== 'vm' &&
-          ['switch', 'servidor', 'ordenador', 'camara'].includes(d.type),
+          !NOT_RACKABLE.has(d.type),
       ),
     [np.devices, mountedMacs],
   )
@@ -1268,18 +1338,18 @@ function RackCanvas() {
             </div>
             <div className="flex flex-col gap-1.5">
               <Label htmlFor="rack-u">{t('rack.createU')}</Label>
-              <Select value={addU} onValueChange={setAddU}>
-                <SelectTrigger id="rack-u" className="w-full">
-                  <SelectValue />
-                </SelectTrigger>
-                <SelectContent>
-                  {['6', '9', '12', '18', '24', '42'].map((u) => (
-                    <SelectItem key={u} value={u}>
-                      {u}U
-                    </SelectItem>
-                  ))}
-                </SelectContent>
-              </Select>
+              {/* #1804: la lista fija no cubre racks caseros. Un campo libre,
+                  acotado al rango que ya valida submitAddRack (1..45). */}
+              <Input
+                id="rack-u"
+                type="number"
+                inputMode="numeric"
+                min={1}
+                max={45}
+                value={addU}
+                onChange={(e) => setAddU(e.target.value.replace(/[^0-9]/g, ''))}
+                className="w-full"
+              />
             </div>
             <div className="flex flex-col gap-1.5">
               <Label htmlFor="rack-location">{t('rack.createLocation')}</Label>
@@ -1338,6 +1408,29 @@ function RackCanvas() {
                 </Select>
               </div>
             )}
+            {!mountAsk?.isPatch && (
+              <div className="flex flex-col gap-1.5">
+                <Label>{t('rack.askWidth')}</Label>
+                <div className="flex gap-1">
+                  {(['full', 'half', 'third'] as const).map((w) => (
+                    <button
+                      key={w}
+                      type="button"
+                      aria-pressed={askWidth === w}
+                      onClick={() => setAskWidth(w)}
+                      className={
+                        'inline-flex h-8 flex-1 items-center justify-center rounded-lg border px-2 text-xs font-medium transition-colors ' +
+                        (askWidth === w
+                          ? 'border-accent bg-accent/10 text-text-primary'
+                          : 'border-border bg-surface text-text-muted hover:bg-hover')
+                      }
+                    >
+                      {t(w === 'full' ? 'rack.widthFull' : w === 'half' ? 'rack.widthHalf' : 'rack.widthThird')}
+                    </button>
+                  ))}
+                </div>
+              </div>
+            )}
             <div className="flex flex-col gap-1.5">
               <Label htmlFor="ask-u">{t('rack.askHeight')}</Label>
               <Input
@@ -1383,18 +1476,16 @@ function RackCanvas() {
             </div>
             <div className="flex flex-col gap-1.5">
               <Label htmlFor="rack-edit-u">{t('rack.createU')}</Label>
-              <Select value={editU} onValueChange={setEditU}>
-                <SelectTrigger id="rack-edit-u" className="w-full">
-                  <SelectValue />
-                </SelectTrigger>
-                <SelectContent>
-                  {['6', '9', '12', '18', '24', '42'].map((u) => (
-                    <SelectItem key={u} value={u}>
-                      {u}U
-                    </SelectItem>
-                  ))}
-                </SelectContent>
-              </Select>
+              <Input
+                id="rack-edit-u"
+                type="number"
+                inputMode="numeric"
+                min={1}
+                max={45}
+                value={editU}
+                onChange={(e) => setEditU(e.target.value.replace(/[^0-9]/g, ''))}
+                className="w-full"
+              />
             </div>
             <div className="flex flex-col gap-1.5">
               <Label htmlFor="rack-edit-location">{t('rack.createLocation')}</Label>
@@ -1490,6 +1581,7 @@ function RackPicker({
         ))}
       </PickerGroup>
       <PickerGroup title={t('rack.pickDevice')}>
+        <p className="mb-1 text-[10.5px] leading-snug text-text-muted">{t('rack.pickDeviceHint')}</p>
         {unmountedDevices.length === 0 && <p className="text-[11px] text-text-muted">—</p>}
         {unmountedDevices.slice(0, 60).map((d) => (
           <PickerItem
@@ -1572,11 +1664,18 @@ function PickerItem({
       onDragStart={onDragStart}
       className="flex cursor-grab items-center justify-between gap-2 rounded-lg border border-border/60 px-2.5 py-1.5 text-left text-[13px] text-text-secondary transition-colors hover:border-accent/40 hover:text-accent active:cursor-grabbing disabled:opacity-50"
     >
-      <span className="flex min-w-0 items-center gap-1.5">
+      <span className="flex min-w-0 flex-1 items-center gap-1.5">
         {icon}
-        <span className="truncate">{label}</span>
+        <span className="truncate" title={label}>
+          {label}
+        </span>
+      </span>
+      {/* #1804: el nombre de la unidad manda. Antes el modelo era shrink-0 y
+          el hostname se truncaba primero; ahora el modelo se queda con un
+          maximo del 45% y es el que cede el sitio. */}
+      <span className="max-w-[45%] shrink-0 truncate text-[10px] uppercase text-text-muted" title={meta}>
+        {meta}
       </span>
-      <span className="shrink-0 text-[10px] uppercase text-text-muted">{meta}</span>
     </button>
   )
 }

+ 4 - 0
server-go/internal/rack/types.go

@@ -59,6 +59,10 @@ type Port struct {
 	Kind PortKind `json:"kind"`
 	X    float64  `json:"x"`
 	Y    float64  `json:"y"`
+	// Label: nombre legible de la boca (ifName/ifAlias de la unidad, "1" en un
+	// patch panel). El id sigue siendo la clave estable de cables y perfiles;
+	// esto es solo lo que se pinta. Vacio en perfiles antiguos (#1804).
+	Label string `json:"label,omitempty"`
 }
 
 // DeviceProfile es el modelo físico compartido del dispositivo: la misma