Compare commits

...
4 Commits
Author SHA1 Message Date
Mario 89c56c8d1c v4.5.0 2026-01-07 11:08:58 +01:00
Go RayandMario 619e959a8e Fixes #683: Fix crash when rendering WirelessLink without label (#690)
* Fix crash when rendering WirelessLink without label

* removes the unnecessary str()

* Update views.py

---------

Co-authored-by: Mario <github@franzbonenkamp.de>
2025-12-30 22:31:14 +01:00
Mario 10f545b509 Reorganize non-device filters (#694) 2025-12-30 17:20:14 +01:00
Mario 3810e9567f Fix error for zero results (#692) 2025-12-30 15:00:01 +01:00
7 changed files with 72 additions and 52 deletions
+1
View File
@@ -57,6 +57,7 @@ systemctl restart netbox
| netbox version | netbox-topology-views version | | netbox version | netbox-topology-views version |
| -------------- | ----------------------------- | | -------------- | ----------------------------- |
| = 4.5.X | = v4.5.0 |
| = 4.4.X | = v4.4.0 | | = 4.4.X | = v4.4.0 |
| = 4.3.X | = v4.3.0 | | = 4.3.X | = v4.3.0 |
| = 4.2.1 | = v4.2.1 | | = 4.2.1 | = v4.2.1 |
+3
View File
@@ -1,6 +1,9 @@
version: 0.1 version: 0.1
package_name: netbox-topology-views package_name: netbox-topology-views
compatibility: compatibility:
- release: 4.5.0
netbox_min: 4.5.0
netbox_max: 4.5.1
- release: 4.4.0 - release: 4.4.0
netbox_min: 4.4.0 netbox_min: 4.4.0
netbox_max: 4.4.3 netbox_max: 4.4.3
+1 -1
View File
@@ -5,7 +5,7 @@ class TopologyViewsConfig(PluginConfig):
name = "netbox_topology_views" name = "netbox_topology_views"
verbose_name = "Topology views" verbose_name = "Topology views"
description = "An plugin to render topology maps" description = "An plugin to render topology maps"
version = "4.4.0" version = "4.5.0"
author = "Mattijs Vanhaverbeke" author = "Mattijs Vanhaverbeke"
author_email = "author@example.com" author_email = "author@example.com"
base_url = "netbox_topology_views" base_url = "netbox_topology_views"
+63 -47
View File
@@ -36,9 +36,12 @@ class DeviceFilterForm(
FieldSet('q', 'filter_id', 'tag'), FieldSet('q', 'filter_id', 'tag'),
FieldSet( FieldSet(
'group', 'ignore_cable_type', 'save_coords', 'show_unconnected', 'show_cables', 'show_logical_connections', 'group', 'ignore_cable_type', 'save_coords', 'show_unconnected', 'show_cables', 'show_logical_connections',
'show_single_cable_logical_conns', 'show_neighbors', 'show_circuit', 'show_power', 'show_wireless', 'show_single_cable_logical_conns', 'show_neighbors',
'group_sites', 'group_locations', 'group_racks', 'group_virtualchassis', 'straight_cables', 'grid_size', 'node_label_items', name=_("Options") 'group_sites', 'group_locations', 'group_racks', 'group_virtualchassis', 'straight_cables', 'grid_size', 'node_label_items', name=_("Options")
), ),
FieldSet(
'show_circuit', 'show_power', 'show_wireless', name=_("Additional filter-independent types (non-devices)")
),
FieldSet('id', name=_("Device")), FieldSet('id', name=_("Device")),
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_("Location")), FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', 'rack_id', name=_("Location")),
FieldSet('status', 'role_id', 'airflow', 'serial', 'asset_tag', 'mac_address', name=_("Operation")), FieldSet('status', 'role_id', 'airflow', 'serial', 'asset_tag', 'mac_address', name=_("Operation")),
@@ -280,24 +283,6 @@ class DeviceFilterForm(
choices=BOOLEAN_WITH_BLANK_CHOICES choices=BOOLEAN_WITH_BLANK_CHOICES
) )
) )
show_circuit = forms.NullBooleanField(
label=_('Show Circuit Terminations'), required=False, initial=False,
widget=forms.Select(
choices=BOOLEAN_WITH_BLANK_CHOICES
)
)
show_power = forms.NullBooleanField(
label=_('Show Power Feeds'), required=False, initial=False,
widget=forms.Select(
choices=BOOLEAN_WITH_BLANK_CHOICES
)
)
show_wireless = forms.NullBooleanField(
label =_('Show Wireless Links'), required=False, initial=False,
widget=forms.Select(
choices=BOOLEAN_WITH_BLANK_CHOICES
)
)
group_sites = forms.NullBooleanField( group_sites = forms.NullBooleanField(
label =_('Group Sites'), required=False, initial=False, label =_('Group Sites'), required=False, initial=False,
widget=forms.Select( widget=forms.Select(
@@ -342,6 +327,29 @@ class DeviceFilterForm(
choices=NodeLabelItems choices=NodeLabelItems
) )
# Additional types (non-devices)
show_circuit = forms.NullBooleanField(
label=_('Show Circuit Terminations'), required=False, initial=False,
help_text=_('All Circuits will be displayed. Circuits cannot be filtered.'),
widget=forms.Select(
choices=BOOLEAN_WITH_BLANK_CHOICES
)
)
show_power = forms.NullBooleanField(
label=_('Show Power Feeds'), required=False, initial=False,
help_text=_('All Power Feeds will be displayed. Power Feeds cannot be filtered.'),
widget=forms.Select(
choices=BOOLEAN_WITH_BLANK_CHOICES
)
)
show_wireless = forms.NullBooleanField(
label =_('Show Wireless Links'), required=False, initial=False,
help_text=_('All Wireless Links will be displayed. Wireless Links cannot be filtered.'),
widget=forms.Select(
choices=BOOLEAN_WITH_BLANK_CHOICES
)
)
class CoordinateGroupsForm(NetBoxModelForm): class CoordinateGroupsForm(NetBoxModelForm):
fieldsets = ( fieldsets = (
FieldSet('name', 'description', name=_("Group Details")), FieldSet('name', 'description', name=_("Group Details")),
@@ -525,9 +533,6 @@ class IndividualOptionsForm(NetBoxModelForm):
'show_logical_connections', 'show_logical_connections',
'show_single_cable_logical_conns', 'show_single_cable_logical_conns',
'show_neighbors', 'show_neighbors',
'show_circuit',
'show_power',
'show_wireless',
'group_sites', 'group_sites',
'group_locations', 'group_locations',
'group_racks', 'group_racks',
@@ -537,6 +542,13 @@ class IndividualOptionsForm(NetBoxModelForm):
'grid_size', 'grid_size',
'node_label_items', 'node_label_items',
), ),
FieldSet
(
'show_circuit',
'show_power',
'show_wireless',
name=_("Additional filter-independent types (non-devices)")
),
) )
user_id = forms.CharField(widget=forms.HiddenInput()) user_id = forms.CharField(widget=forms.HiddenInput())
@@ -613,28 +625,6 @@ class IndividualOptionsForm(NetBoxModelForm):
'Link peers will be added if \'Show Cables\' is ticked, far-end ' 'Link peers will be added if \'Show Cables\' is ticked, far-end '
'terminations will be added if \'Show Logical Connections\' is ticked.') 'terminations will be added if \'Show Logical Connections\' is ticked.')
) )
show_circuit = forms.BooleanField(
label=_('Show Circuit Terminations'),
required=False,
initial=False,
help_text=_('Displays connections between circuit terminations. '
'These connections are displayed as blue dashed lines.')
)
show_power = forms.BooleanField(
label=_('Show Power Feeds'),
required=False,
initial=False,
help_text=_('Displays connections between power outlets and power '
'ports. These connections are displayed as solid lines in the '
'color of the cable. This option depends on \'Show Cables\'.')
)
show_wireless = forms.BooleanField(
label =_('Show Wireless Links'),
required=False,
initial=False,
help_text=_('Displays wireless connections. These connections are '
'displayed as blue dotted lines.')
)
group_sites = forms.BooleanField( group_sites = forms.BooleanField(
label =_('Group Sites'), label =_('Group Sites'),
required=False, required=False,
@@ -693,13 +683,39 @@ class IndividualOptionsForm(NetBoxModelForm):
choices=NodeLabelItems, choices=NodeLabelItems,
help_text=_('Choose Label Items that you want to be displayed.') help_text=_('Choose Label Items that you want to be displayed.')
) )
show_circuit = forms.BooleanField(
label=_('Show Circuit Terminations'),
required=False,
initial=False,
help_text=_('Displays connections between circuit terminations. '
'These connections are displayed as blue dashed lines. '
'Be aware that Circuits cannot be filtered.')
)
show_power = forms.BooleanField(
label=_('Show Power Feeds'),
required=False,
initial=False,
help_text=_('Displays connections between power outlets and power '
'ports. These connections are displayed as solid lines in the '
'color of the cable. This option depends on \'Show Cables\'. '
'Be aware that Power Feeds cannot be filtered.')
)
show_wireless = forms.BooleanField(
label =_('Show Wireless Links'),
required=False,
initial=False,
help_text=_('Displays wireless connections. These connections are '
'displayed as blue dotted lines. '
'Be aware that Wireless Links cannot be filtered.')
)
class Meta: class Meta:
model = IndividualOptions model = IndividualOptions
fields = [ fields = [
'user_id', 'ignore_cable_type', 'preselected_device_roles', 'preselected_tags', 'user_id', 'ignore_cable_type', 'preselected_device_roles', 'preselected_tags',
'save_coords', 'show_unconnected', 'show_cables', 'show_logical_connections', 'save_coords', 'show_unconnected', 'show_cables', 'show_logical_connections',
'show_single_cable_logical_conns', 'show_neighbors', 'show_circuit', 'show_power', 'show_single_cable_logical_conns', 'show_neighbors',
'show_wireless', 'group_sites', 'group_locations', 'group_racks', 'group_virtualchassis', 'draw_default_layout', 'group_sites', 'group_locations', 'group_racks', 'group_virtualchassis',
'straight_cables', 'grid_size', 'node_label_items' 'draw_default_layout', 'straight_cables', 'grid_size', 'node_label_items',
'show_circuit', 'show_power', 'show_wireless'
] ]
@@ -1,7 +1,7 @@
{ {
"private": true, "private": true,
"name": "netbox_topology_views", "name": "netbox_topology_views",
"version": "4.4.0", "version": "4.5.0",
"scripts": { "scripts": {
"bundle": "node bundle.js", "bundle": "node bundle.js",
"bundle:styles": "node bundle.js --styles", "bundle:styles": "node bundle.js --styles",
+2 -2
View File
@@ -322,7 +322,7 @@ def create_edge(
edge["color"] = '#f1c232' edge["color"] = '#f1c232'
edge["href"] = interface.get_absolute_url() + "trace" edge["href"] = interface.get_absolute_url() + "trace"
if cable is not None and cable.label: if cable is not None and hasattr(cable, "label") and cable.label:
cable_label = "<br>Label: " + cable.label cable_label = "<br>Label: " + cable.label
else: else:
cable_label = "" cable_label = ""
@@ -829,7 +829,7 @@ class TopologyHomeView(PermissionRequiredMixin, View):
node_label_items=node_label_items, node_label_items=node_label_items,
) )
if not topo_data["nodes"]: if topo_data is None or not topo_data["nodes"]:
empty_result = True empty_result = True
else: else:
+1 -1
View File
@@ -7,7 +7,7 @@ long_description = readme.read_text()
setup( setup(
name="netbox-topology-views", name="netbox-topology-views",
version="4.4.0", version="4.5.0",
description="An NetBox plugin to create Topology maps", description="An NetBox plugin to create Topology maps",
long_description=long_description, long_description=long_description,
long_description_content_type="text/markdown", long_description_content_type="text/markdown",