fix: MGMT label for management ports and light/dark theme for the switch panel

Management ports (management only, or named mgmt/management/oobm/me0 ...)
show "MGMT" instead of the overflowing full name and form their own group
at the end; other ports without a number are shortened. The faceplate,
jacks, notches and frames use theme variables for NetBox's light and dark
mode instead of a fixed dark design.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-30 10:12:13 +01:00
1 parent b1ecbbbb75
commit e9c00f2b11
7 files changed
+86 -22

No files matched your search

@@ -145,3 +145,15 @@ class InkTest(SimpleTestCase):
self.assertEqual(switch_ports.ink_for("#1f77b4"), "#ffffff")
self.assertEqual(port("1", label="10", assigned_color="#2ca02c").ink, "#000000")
self.assertEqual(port("2").ink, "")
class ManagementTest(SimpleTestCase):
def test_management_ports_are_abbreviated_and_grouped_last(self):
ports = [port("Management"), port("Gi1/0/1"), port("mgmt0"), port("oobm"), port("eth0", mgmt_only=True)]
self.assertEqual([p.short for p in ports], ["MGMT", "1", "MGMT", "MGMT", "MGMT"])
groups = switch_ports.build_groups(ports)
self.assertEqual([group.title for group in groups], ["Gi1/0", "Management"])
self.assertEqual(len(groups[-1].ports), 4)
def test_other_ports_without_number_are_shortened(self):
self.assertEqual(port("console").short, "conso")