Skip to content

Commit 483f907

Browse files
committed
Fix #17 numeric ports only
1 parent ac28812 commit 483f907

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* Ports are named "1", "2" and so on for front and rear */
2+
.deviceview.area.dFront {
3+
/* both set to auto to overwrite the 32 columns 2 rows design */
4+
grid-auto-rows: auto;
5+
grid-auto-columns: auto;
6+
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";
7+
}
8+
.deviceview.area.dRear {
9+
/* both set to auto to overwrite the 32 columns 2 rows design */
10+
grid-auto-rows: auto;
11+
grid-auto-columns: auto;
12+
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";
13+
}

netbox_device_view/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ def process_interfaces(interfaces, ports_chassis, dev):
2121
)
2222
else:
2323
itf.stylename = re.sub(r"[^.a-zA-Z\d]", "-", itf.name.lower())
24+
if itf.stylename.isdigit():
25+
itf.stylename = f"p{itf.stylename}"
2426
if dev not in ports_chassis:
2527
ports_chassis[dev] = []
2628
ports_chassis[dev].append(itf)
@@ -34,6 +36,8 @@ def process_ports(ports, ports_chassis, dev):
3436
continue
3537
port.is_port = True
3638
port.stylename = re.sub(r"[^.a-zA-Z\d]", "-", port.name.lower())
39+
if port.stylename.isdigit():
40+
port.stylename = f"p{port.stylename}"
3741
if dev not in ports_chassis:
3842
ports_chassis[dev] = []
3943
ports_chassis[dev].append(port)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="netbox-device-view",
8-
version="0.1.3",
8+
version="0.1.4",
99
description="NetBox Device View plugin",
1010
packages=find_packages(),
1111
author="Peter Baumert",

0 commit comments

Comments
 (0)