netbox-device-view 0.1.9__tar.gz → 0.1.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/PKG-INFO +2 -2
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/template_content.py +6 -1
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/templates/netbox_device_view/deviceview.html +1 -5
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/utils.py +23 -13
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view.egg-info/PKG-INFO +2 -2
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/setup.py +1 -1
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/MANIFEST.in +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/README.md +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/__init__.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/api/__init__.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/api/serializers.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/api/urls.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/api/views.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/filtersets.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/forms.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/migrations/0001_initial.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/migrations/__init__.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/models.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/navigation.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/static/netbox_device_view/css/device_view.css +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/tables.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/templates/netbox_device_view/ports.html +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/urls.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/views.py +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view.egg-info/SOURCES.txt +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view.egg-info/dependency_links.txt +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view.egg-info/not-zip-safe +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view.egg-info/top_level.txt +0 -0
- {netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/setup.cfg +0 -0
{netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/template_content.py
RENAMED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
from netbox.plugins import PluginTemplateExtension
|
|
2
2
|
from .utils import prepare
|
|
3
3
|
from django.conf import settings
|
|
4
|
+
from dcim.models import Device
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
class Ports(PluginTemplateExtension):
|
|
7
8
|
def page(self):
|
|
8
9
|
obj = self.context["object"]
|
|
10
|
+
|
|
11
|
+
if not isinstance(obj, Device):
|
|
12
|
+
return ""
|
|
13
|
+
|
|
9
14
|
request = self.context["request"]
|
|
10
15
|
url = request.build_absolute_uri(obj.get_absolute_url())
|
|
11
16
|
|
|
@@ -31,7 +36,7 @@ class DevicePorts(Ports):
|
|
|
31
36
|
model = "dcim.device"
|
|
32
37
|
|
|
33
38
|
def full_width_page(self):
|
|
34
|
-
if settings.PLUGINS_CONFIG["netbox_device_view"]["show_on_device_tab"]
|
|
39
|
+
if not settings.PLUGINS_CONFIG["netbox_device_view"]["show_on_device_tab"]:
|
|
35
40
|
return ""
|
|
36
41
|
return self.page()
|
|
37
42
|
|
|
@@ -60,11 +60,7 @@
|
|
|
60
60
|
{% endfor %}
|
|
61
61
|
{% endif %}
|
|
62
62
|
"
|
|
63
|
-
style="grid-area: {{ int.stylename }};
|
|
64
|
-
{% if cable_colors == "on" and int.cable.color != "" %}
|
|
65
|
-
background-color: #{{ int.cable.color }}
|
|
66
|
-
{% endif %}
|
|
67
|
-
"
|
|
63
|
+
style="grid-area: {{ int.stylename }}{% if cable_colors == 'on' and int.cable.color != '' %}; background-color: #{{ int.cable.color }}{% endif %}"
|
|
68
64
|
data-bs-toggle="tooltip"
|
|
69
65
|
data-bs-html="true"
|
|
70
66
|
data-bs-custom-class="device-view-tooltip"
|
|
@@ -10,19 +10,27 @@ def process_interfaces(interfaces, ports_chassis, dev):
|
|
|
10
10
|
for itf in interfaces:
|
|
11
11
|
if itf.type == "virtual" or itf.type == "lag":
|
|
12
12
|
continue
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
# Convert to lowercase and replace common separators with hyphens
|
|
14
|
+
# This replaces the original regex matching and if/else block
|
|
15
|
+
stylename = re.sub(r"[/\.\s\+]+", "-", itf.name.lower())
|
|
16
|
+
|
|
17
|
+
# Clean up multiple hyphens and leading/trailing hyphens
|
|
18
|
+
stylename = re.sub(r"-+", "-", stylename).strip("-")
|
|
19
|
+
|
|
20
|
+
# If the name becomes empty after cleaning, use a fallback
|
|
21
|
+
if not stylename:
|
|
22
|
+
stylename = f"iface-{itf.pk}" # Use a unique fallback
|
|
23
|
+
|
|
24
|
+
# Assign the generated stylename back to the object property
|
|
25
|
+
itf.stylename = stylename
|
|
26
|
+
|
|
27
|
+
# Check if the stylename exists and starts with a digit or a hyphen
|
|
28
|
+
# This replaces the original 'if itf.stylename.isdigit():' line
|
|
29
|
+
if itf.stylename and (
|
|
30
|
+
itf.stylename[0].isdigit() or itf.stylename[0] == "-"
|
|
31
|
+
):
|
|
25
32
|
itf.stylename = f"p{itf.stylename}"
|
|
33
|
+
|
|
26
34
|
if dev not in ports_chassis:
|
|
27
35
|
ports_chassis[dev] = []
|
|
28
36
|
ports_chassis[dev].append(itf)
|
|
@@ -55,7 +63,9 @@ def prepare(obj):
|
|
|
55
63
|
device_type=obj.device_type
|
|
56
64
|
).grid_template_area
|
|
57
65
|
modules[1] = obj.modules.all()
|
|
58
|
-
ports_chassis = process_interfaces(
|
|
66
|
+
ports_chassis = process_interfaces(
|
|
67
|
+
obj.interfaces.all(), ports_chassis, obj.name
|
|
68
|
+
)
|
|
59
69
|
ports_chassis = process_ports(obj.frontports.all(), ports_chassis, "Front")
|
|
60
70
|
ports_chassis = process_ports(obj.rearports.all(), ports_chassis, "Rear")
|
|
61
71
|
ports_chassis = process_ports(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/api/serializers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/migrations/0001_initial.py
RENAMED
|
File without changes
|
{netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view/migrations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{netbox_device_view-0.1.9 → netbox_device_view-0.1.11}/netbox_device_view.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|