feat: export switch port usage as PDF instead of a Ports tab

Switches get an "Export switch port usage" button that downloads an A4
landscape PDF: key figures, a front panel with one colour per VLAN label
(full colour = connected, pale = free, dashed with a cross = disabled,
text colour chosen for contrast), a VLAN legend and the full port list
with peers. The PDF follows the language of the user's NetBox
preferences (German or English). The Ports tab with its script and
styles is removed. ReportLab becomes a dependency.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-30 09:25:29 +01:00
1 parent 8f2cc22f88
commit 8eb075db9f
13 files changed
+611 -452

No files matched your search

+6 -1
View File
@@ -1,7 +1,7 @@
from django.urls import include, path
from utilities.urls import get_model_urls
from . import disk_views, hardware_views, views # noqa: F401 - hardware_views registers its model views
from . import disk_views, hardware_views, switch_port_views, views # noqa: F401 - hardware_views registers its model views
app_name = "netbox_utilities"
@@ -32,6 +32,11 @@ urlpatterns = [
path("cpu-models/<int:pk>/", include(get_model_urls("netbox_utilities", "cpumodel"))),
path("hardware/", include(get_model_urls("netbox_utilities", "devicehardware", detail=False))),
path("hardware/<int:pk>/", include(get_model_urls("netbox_utilities", "devicehardware"))),
path(
"devices/<int:pk>/switch-ports.pdf",
switch_port_views.SwitchPortsPDFView.as_view(),
name="device_switch_ports_pdf",
),
path("devices/<int:pk>/disks/setup/", disk_views.DeviceDiskSetupView.as_view(), name="device_disk_setup"),
path("devices/<int:pk>/disks/fill/", disk_views.DeviceDiskBulkFillView.as_view(), name="device_disk_fill"),
path("devices/<int:pk>/disks/move/", disk_views.DeviceDiskMoveView.as_view(), name="device_disk_move"),