Fix rear-face image-only labels, click-to-add units, cable concept devices

- Fix "images only" leaving plain labels visible on faces where a
  device has no image for that side (e.g. no rear_image set): the
  view selector now hides every plain label outright in that mode,
  not just the ones an image happens to sit on top of.
- Remove the "Add planned device" button from the elevation card.
  Empty units are now click targets themselves - clicking one opens
  the add-device form pre-filled with that position and face, exactly
  like a real rack's elevation. Occupancy is computed per unit per
  face from the existing device blocks.
- Add cabling for concept devices: ConceptComponent (interfaces,
  front/rear ports, power ports/outlets, console ports) and
  ConceptCable (a connection between two components, restricted to
  devices in the same concept). components.sync_components()
  populates a device's components from its device type's templates,
  including the front/rear port pass-through mapping copied from
  DeviceType.port_mappings - so a device with front/rear port
  templates (a patch panel being the common case) behaves exactly
  like a real one, without hardcoding anything role-specific.
  Placeholder devices without a device type get components added by
  hand. Full CRUD views, tables, filtersets, API endpoints and a
  "Connect" action wired in from the device detail page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-16 10:18:50 +02:00
co-authored by Claude Sonnet 5
parent e4817ea83b
commit 63538c2efe
24 changed files with 1293 additions and 33 deletions
+34
View File
@@ -32,9 +32,41 @@ Dazu:
Teilbreiten-Feature von `netbox_utilities`.
* **Mandant und Mandantengruppe** an Konzept und an jedem geplanten Gerät.
* **Platzhalter ohne Gerätetyp** – reservierter Bauraum, nur mit Höhenangabe.
* **Klick auf eine leere HE** öffnet direkt „Add planned device", vorausgefüllt mit
Position und Seite — genau wie bei einer echten Rack-Elevation. Den separaten
„Add planned device"-Knopf gibt es dafür nicht mehr.
* **Verkabelung von Konzept-Geräten** – Interfaces, Front-/Rear-Ports, Power-Ports/
-Outlets und Console-Ports lassen sich mit „Sync components" aus dem Gerätetyp
übernehmen (inkl. Front-↔Rear-Zuordnung von Patchpanels, 1:1 wie beim echten
Gerätetyp) und über „Connect" mit einem Concept Cable verbinden. Platzhalter ohne
Gerätetyp bekommen ihre Komponenten per Hand über „Add component".
* Vollständige REST-API, Filter, CSV-Import/-Export, Bulk-Edit, Changelog, Journal,
Tags, Custom Fields und globale Suche — wie bei jedem Core-Objekt.
## Verkabelung
Konzept-Geräte lassen sich verkabeln, aber **nicht** über NetBox' echtes `dcim.Cable` —
das kann nur echte `dcim`-Komponenten verbinden. Stattdessen bringt das Plugin ein
eigenes, schlankes Modellpaar mit:
* **ConceptComponent** — ein Interface, Front-/Rear-Port, Power-Port/-Outlet oder
Console-Port an einem geplanten Gerät. Über **„Sync components"** auf der
Geräte-Seite werden sie 1:1 aus den Component-Templates des Gerätetyps erzeugt
(Name, Label, Typ, Positionen) — wiederholbar, ohne Duplikate oder Datenverlust an
bereits verkabelten Komponenten. Ein Gerät ohne Gerätetyp (Platzhalter) hat keine
Templates zum Syncen; seine Komponenten legt man über **„Add component"** von Hand an.
* **ConceptCable** — verbindet zwei `ConceptComponent`s. Beide Enden müssen zu Geräten
im selben Rack-Konzept gehören; eine Komponente kann nur in einem Kabel gleichzeitig
stecken. Erreichbar über **„Connect"** an jeder unverkabelten Komponente.
**Patchpanels funktionieren genauso wie bei echten Geräten**, weil das Plugin exakt
dieselbe Front-↔Rear-Zuordnung ausliest, die NetBox selbst am Gerätetyp pflegt (über
`PortTemplateMapping`, dieselbe Tabelle, die auch echte `FrontPort`/`RearPort`-Objekte
verknüpft). Das hängt also nicht an der Rollenbezeichnung „Patchpanel", sondern schlicht
daran, ob der Gerätetyp Front-/Rear-Ports mit Zuordnung definiert — Kabel an der
Vorderseite eines synchronisierten Patchpanel-Gerätetyps zeigen auf der Detailseite der
Komponente sofort den passenden Rear-Port samt Position an.
## Zusammenspiel mit den anderen Plugins
**netbox-reorder-rack (rackorder)** arbeitet auf `dcim.Device`-Querysets. Ein Konzept hat
@@ -172,6 +204,8 @@ Basis-Pfad: `/api/plugins/rack-concepts/`
| `POST` | `concepts/{id}/deploy/` | Konzept ausrollen (`dry_run` möglich) |
| `GET` | `concepts/{id}/elevation/` | Berechnete Elevation als JSON |
| `GET/POST` | `devices/` | Geplante Geräte |
| `GET/POST` | `components/` | Komponenten der geplanten Geräte |
| `GET/POST` | `cables/` | Concept Cables |
Beispiel — zehn Racks aus einem Konzept, erst als Trockenlauf: