Closes #436 (and #122?): Add options to disable smooth cables and physics (#488)

* allow disabling smooth cables and render them as straight lines instead

* rename 'disable_smooth_cables' to 'straight_cables'

* missed one in renaming

* fix inverted logic

* add GET param and option to DeviceFilterForm

* fix syntax error

* rename var

* add missing query field

* netbox v4 support

---------

Co-authored-by: Daniel Bremer <daniel.bremer@mpsd.mpg.de>
Co-authored-by: mvanhaverbeke <mattijs.vanhaverbeke@ebo-enterprises.com>
This commit is contained in:
dremerb
2024-07-08 15:37:18 +02:00
committed by GitHub
co-authored by Daniel Bremer mvanhaverbeke
parent 142de460b9
commit aba0598947
7 changed files with 65 additions and 9 deletions
+3 -1
View File
@@ -109,7 +109,7 @@ class ExportTopoToXML(PermissionRequiredMixin, ViewSet):
if request.GET:
filter_id, save_coords, show_unconnected, show_power, show_circuit, show_logical_connections, show_single_cable_logical_conns, show_cables, show_wireless, group_sites, group_locations, group_racks,show_neighbors = get_query_settings(request)
filter_id, save_coords, show_unconnected, show_power, show_circuit, show_logical_connections, show_single_cable_logical_conns, show_cables, show_wireless, group_sites, group_locations, group_racks, show_neighbors, straight_cables = get_query_settings(request)
# Read options from saved filters as NetBox does not handle custom plugin filters
if "filter_id" in request.GET and request.GET["filter_id"] != '':
@@ -128,6 +128,7 @@ class ExportTopoToXML(PermissionRequiredMixin, ViewSet):
if group_locations == False and 'group_locations' in saved_filter_params: group_locations = saved_filter_params['group_locations']
if group_racks == False and 'group_racks' in saved_filter_params: group_racks = saved_filter_params['group_racks']
if show_neighbors == False and 'show_neighbors' in saved_filter_params: show_neighbors = saved_filter_params['show_neighbors']
if straight_cables == False and 'straight_cables' in saved_filter_params: show_neighbors = saved_filter_params['straight_cables']
except SavedFilter.DoesNotExist: # filter_id not found
pass
except Exception as inst:
@@ -153,6 +154,7 @@ class ExportTopoToXML(PermissionRequiredMixin, ViewSet):
group_locations=group_locations,
group_racks=group_racks,
group_id=group_id,
straight_cables=straight_cables,
)
xml_data = export_data_to_xml(topo_data).decode('utf-8')