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
@@ -22,6 +22,27 @@
fill: var(--tblr-primary-lt, #d7e7fb);
}
.concept-elevation .unit-slot.free {
cursor: pointer;
}
.concept-elevation .unit-slot.free:hover {
fill: var(--tblr-primary-lt, #d7e7fb);
}
/* "+ Add device" hint, shown only while hovering an empty unit - same trick as
NetBox's own rack elevation. */
.concept-elevation .add-device-hint {
font-size: 10px;
fill: var(--tblr-primary, #206bc4);
opacity: 0;
pointer-events: none;
}
.concept-elevation a:hover .add-device-hint {
opacity: 1;
}
.concept-elevation .unit-label {
font-size: 10px;
fill: var(--tblr-secondary, #808f9c);
@@ -18,12 +18,21 @@
function applyView(view) {
const showImages = view !== 'labels-only';
const showImageLabels = view === 'images-and-labels';
// "Images only" hides every plain label outright, not just the ones sitting
// under an image: a device without an image for this face has nothing to
// visually cover its label otherwise, which would leave text showing (e.g. on
// a rear face where only the front image is set) even though the user picked
// "images only".
const hidePlainLabels = view === 'images-only';
container.querySelectorAll('image.device-image').forEach(function (el) {
el.classList.toggle('hidden', !showImages);
});
container.querySelectorAll('.device-image-label').forEach(function (el) {
el.classList.toggle('hidden', !showImageLabels);
});
container.querySelectorAll('.device-label').forEach(function (el) {
el.classList.toggle('hidden', hidePlainLabels);
});
}
let initial = 'images-and-labels';