feat: several slot areas per device, e.g. front bays and a PCIe card

Disks that are not in the front bays, such as NVMe SSDs on a PCIe card or
M.2 SSDs on a boot card, can now be documented in their own slot area.

- A device can have several areas, each with name, order, slot count,
  rows, first slot, numbering and form factor; the tab shows one grid per
  area with its own fill, select and edit actions.
- Add area, edit area and delete empty areas on the Disks tab.
- Slot numbers are unique per area; drag and drop also moves or swaps
  disks between areas.
- Device type templates store all areas; Apply template creates the
  missing ones.
- Disks get a bay field in forms, CSV import (bay column, optional when
  the device has one area), REST API, GraphQL, filters and tables.
- Migration 0010 turns every existing layout into the area "Front" and
  assigns the existing disks to it.
- The grouped disk overview shows the area in its own column and centres
  the slot number.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-19 14:46:48 +02:00
1 parent 14cb5d5829
commit d45afa5e54
19 files changed
+644 -238

No files matched your search

+9 -1
View File
@@ -34,6 +34,7 @@ class DiskWarningsColumn(tables.Column):
class DiskTable(NetBoxTable):
device = tables.Column(linkify=True, verbose_name="Gerät")
bay = tables.Column(accessor=tables.A("bay__name"), verbose_name="Bereich")
slot = tables.Column(linkify=True, verbose_name="Slot")
status = columns.ChoiceFieldColumn(verbose_name="Status")
disk_type = columns.ChoiceFieldColumn(verbose_name="Typ")
@@ -53,6 +54,7 @@ class DiskTable(NetBoxTable):
"pk",
"id",
"device",
"bay",
"slot",
"status",
"disk_type",
@@ -79,6 +81,7 @@ class DiskTable(NetBoxTable):
default_columns = (
"pk",
"device",
"bay",
"slot",
"status",
"disk_type",
@@ -95,6 +98,7 @@ class DiskTable(NetBoxTable):
class DeviceDiskHistoryTable(NetBoxTable):
"""Removed and replaced disks on the device tab."""
bay = tables.Column(accessor=tables.A("bay__name"), verbose_name="Bereich")
slot = tables.Column(verbose_name="Slot")
serial = tables.Column(linkify=True, verbose_name="Seriennummer")
capacity_gb = CapacityColumn(verbose_name="Größe")
@@ -103,6 +107,7 @@ class DeviceDiskHistoryTable(NetBoxTable):
class Meta(NetBoxTable.Meta):
model = Disk
fields = (
"bay",
"slot",
"manufacturer",
"model",
@@ -163,6 +168,7 @@ class RAIDGroupTable(NetBoxTable):
class DiskBayTemplateTable(NetBoxTable):
device_type = tables.Column(linkify=True, verbose_name="Gerätetyp")
name = tables.Column(linkify=True, verbose_name="Bereich")
numbering = columns.ChoiceFieldColumn(verbose_name="Nummerierung")
form_factor = columns.ChoiceFieldColumn(verbose_name="Bauform")
@@ -172,6 +178,8 @@ class DiskBayTemplateTable(NetBoxTable):
"pk",
"id",
"device_type",
"name",
"weight",
"slot_count",
"rows",
"first_slot",
@@ -180,4 +188,4 @@ class DiskBayTemplateTable(NetBoxTable):
"created",
"last_updated",
)
default_columns = ("pk", "device_type", "slot_count", "rows", "first_slot", "numbering", "form_factor")
default_columns = ("pk", "device_type", "name", "slot_count", "rows", "first_slot", "numbering", "form_factor")