netbox-device-view 0.1.7__tar.gz → 0.1.10a0__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.7 → netbox_device_view-0.1.10a0}/PKG-INFO +9 -2
- netbox_device_view-0.1.10a0/netbox_device_view/forms.py +23 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/navigation.py +6 -1
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/templates/netbox_device_view/deviceview.html +1 -5
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/urls.py +5 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/utils.py +24 -14
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/views.py +8 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view.egg-info/PKG-INFO +9 -2
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/setup.py +1 -1
- netbox_device_view-0.1.7/netbox_device_view/forms.py +0 -8
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/MANIFEST.in +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/README.md +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/__init__.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/api/__init__.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/api/serializers.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/api/urls.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/api/views.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/filtersets.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/migrations/0001_initial.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/migrations/__init__.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/models.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/static/netbox_device_view/css/device_view.css +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/tables.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/template_content.py +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/templates/netbox_device_view/ports.html +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view.egg-info/SOURCES.txt +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view.egg-info/dependency_links.txt +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view.egg-info/not-zip-safe +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view.egg-info/top_level.txt +0 -0
- {netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: netbox-device-view
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.10a0
|
|
4
4
|
Summary: NetBox Device View plugin
|
|
5
5
|
Home-page: https://github.com/peterbaumert/netbox-device-view
|
|
6
6
|
Author: Peter Baumert
|
|
@@ -8,6 +8,13 @@ Keywords: netbox,netbox-plugin
|
|
|
8
8
|
Classifier: Framework :: Django
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: classifier
|
|
13
|
+
Dynamic: description
|
|
14
|
+
Dynamic: description-content-type
|
|
15
|
+
Dynamic: home-page
|
|
16
|
+
Dynamic: keywords
|
|
17
|
+
Dynamic: summary
|
|
11
18
|
|
|
12
19
|
# Netbox Device View Plugin
|
|
13
20
|
 
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from netbox.forms import NetBoxModelForm, NetBoxModelImportForm
|
|
2
|
+
from django.utils.translation import gettext_lazy as _
|
|
3
|
+
from .models import DeviceView
|
|
4
|
+
from dcim.models import DeviceType
|
|
5
|
+
from utilities.forms.fields import CSVModelChoiceField
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class DeviceViewForm(NetBoxModelForm):
|
|
9
|
+
class Meta:
|
|
10
|
+
model = DeviceView
|
|
11
|
+
fields = ("device_type", "grid_template_area")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class DeviceViewImportForm(NetBoxModelImportForm):
|
|
15
|
+
device_type = CSVModelChoiceField(
|
|
16
|
+
queryset=DeviceType.objects.all(),
|
|
17
|
+
to_field_name="model",
|
|
18
|
+
help_text=_("Device Model Name"),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
class Meta:
|
|
22
|
+
model = DeviceView
|
|
23
|
+
fields = ("device_type", "grid_template_area")
|
|
@@ -7,7 +7,12 @@ deviceview_buttons = [
|
|
|
7
7
|
title="Add",
|
|
8
8
|
icon_class="mdi mdi-plus-thick",
|
|
9
9
|
color=ButtonColorChoices.GREEN,
|
|
10
|
-
)
|
|
10
|
+
),
|
|
11
|
+
PluginMenuButton(
|
|
12
|
+
link="plugins:netbox_device_view:deviceview_import",
|
|
13
|
+
title="Import",
|
|
14
|
+
icon_class="mdi mdi-upload",
|
|
15
|
+
),
|
|
11
16
|
]
|
|
12
17
|
|
|
13
18
|
menu_items = (
|
|
@@ -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"
|
|
@@ -5,6 +5,11 @@ from netbox.views.generic import ObjectChangeLogView
|
|
|
5
5
|
urlpatterns = (
|
|
6
6
|
path("device-view/", views.DeviceViewListView.as_view(), name="deviceview_list"),
|
|
7
7
|
path("device-view/add/", views.DeviceViewEditView.as_view(), name="deviceview_add"),
|
|
8
|
+
path(
|
|
9
|
+
"device-view/import/",
|
|
10
|
+
views.DeviceViewBulkImportView.as_view(),
|
|
11
|
+
name="deviceview_import",
|
|
12
|
+
),
|
|
8
13
|
path("device-view/<int:pk>/", views.DeviceViewView.as_view(), name="deviceview"),
|
|
9
14
|
path(
|
|
10
15
|
"device-view/<int:pk>/edit/",
|
|
@@ -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,13 +63,15 @@ 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(
|
|
62
72
|
ConsolePort.objects.filter(device_id=obj.id),
|
|
63
73
|
ports_chassis,
|
|
64
|
-
|
|
74
|
+
obj.name,
|
|
65
75
|
)
|
|
66
76
|
else:
|
|
67
77
|
for member in obj.virtual_chassis.members.all():
|
|
@@ -6,6 +6,9 @@ from .utils import prepare
|
|
|
6
6
|
from django.http import HttpResponse
|
|
7
7
|
import pprint
|
|
8
8
|
|
|
9
|
+
from netbox.views.generic import BulkImportView
|
|
10
|
+
from netbox_device_view.forms import DeviceViewImportForm
|
|
11
|
+
|
|
9
12
|
|
|
10
13
|
class DeviceViewView(generic.ObjectView):
|
|
11
14
|
queryset = models.DeviceView.objects
|
|
@@ -21,6 +24,11 @@ class DeviceViewEditView(generic.ObjectEditView):
|
|
|
21
24
|
form = forms.DeviceViewForm
|
|
22
25
|
|
|
23
26
|
|
|
27
|
+
class DeviceViewBulkImportView(BulkImportView):
|
|
28
|
+
queryset = models.DeviceView.objects.all()
|
|
29
|
+
model_form = DeviceViewImportForm
|
|
30
|
+
|
|
31
|
+
|
|
24
32
|
class DeviceViewDeleteView(generic.ObjectDeleteView):
|
|
25
33
|
queryset = models.DeviceView.objects
|
|
26
34
|
|
{netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: netbox-device-view
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.10a0
|
|
4
4
|
Summary: NetBox Device View plugin
|
|
5
5
|
Home-page: https://github.com/peterbaumert/netbox-device-view
|
|
6
6
|
Author: Peter Baumert
|
|
@@ -8,6 +8,13 @@ Keywords: netbox,netbox-plugin
|
|
|
8
8
|
Classifier: Framework :: Django
|
|
9
9
|
Classifier: Programming Language :: Python :: 3
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
|
+
Dynamic: author
|
|
12
|
+
Dynamic: classifier
|
|
13
|
+
Dynamic: description
|
|
14
|
+
Dynamic: description-content-type
|
|
15
|
+
Dynamic: home-page
|
|
16
|
+
Dynamic: keywords
|
|
17
|
+
Dynamic: summary
|
|
11
18
|
|
|
12
19
|
# Netbox Device View Plugin
|
|
13
20
|
 
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/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.7 → netbox_device_view-0.1.10a0}/netbox_device_view/migrations/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view/template_content.py
RENAMED
|
File without changes
|
|
File without changes
|
{netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view.egg-info/not-zip-safe
RENAMED
|
File without changes
|
{netbox_device_view-0.1.7 → netbox_device_view-0.1.10a0}/netbox_device_view.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|