Skip to content

Commit

Permalink
Fix #17 numeric ports only
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbaumert committed Aug 30, 2023
1 parent ac28812 commit 483f907
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions examples/SC-24-port_Fiber_Patch_Panel.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* Ports are named "1", "2" and so on for front and rear */
.deviceview.area.dFront {
/* both set to auto to overwrite the 32 columns 2 rows design */
grid-auto-rows: auto;
grid-auto-columns: auto;
grid-template-areas: "p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24";
}
.deviceview.area.dRear {
/* both set to auto to overwrite the 32 columns 2 rows design */
grid-auto-rows: auto;
grid-auto-columns: auto;
grid-template-areas: "p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24";
}
4 changes: 4 additions & 0 deletions netbox_device_view/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def process_interfaces(interfaces, ports_chassis, dev):
)
else:
itf.stylename = re.sub(r"[^.a-zA-Z\d]", "-", itf.name.lower())
if itf.stylename.isdigit():
itf.stylename = f"p{itf.stylename}"
if dev not in ports_chassis:
ports_chassis[dev] = []
ports_chassis[dev].append(itf)
Expand All @@ -34,6 +36,8 @@ def process_ports(ports, ports_chassis, dev):
continue
port.is_port = True
port.stylename = re.sub(r"[^.a-zA-Z\d]", "-", port.name.lower())
if port.stylename.isdigit():
port.stylename = f"p{port.stylename}"
if dev not in ports_chassis:
ports_chassis[dev] = []
ports_chassis[dev].append(port)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="netbox-device-view",
version="0.1.3",
version="0.1.4",
description="NetBox Device View plugin",
packages=find_packages(),
author="Peter Baumert",
Expand Down

0 comments on commit 483f907

Please sign in to comment.