fix coordinate group in saved filter (#536)
This commit is contained in:
@@ -50,4 +50,4 @@ class PowerFeedCoordinateSerializer(NetBoxModelSerializer):
|
||||
class IndividualOptionsSerializer(NetBoxModelSerializer):
|
||||
class Meta:
|
||||
model = IndividualOptions
|
||||
fields = ("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", "group_sites", "group_locations", "group_racks", "draw_default_layout", "straight_cables")
|
||||
fields = ("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", "group_sites", "group_locations", "group_racks", "group", "draw_default_layout", "straight_cables")
|
||||
|
||||
@@ -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, straight_cables = 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, group, 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"] != '':
|
||||
@@ -135,7 +135,10 @@ class ExportTopoToXML(PermissionRequiredMixin, ViewSet):
|
||||
print(type(inst))
|
||||
|
||||
if 'group' not in request.query_params:
|
||||
group_id = "default"
|
||||
if 'group' in saved_filter_params:
|
||||
group_id = saved_filter_params['group'][0]
|
||||
else:
|
||||
group_id = "default"
|
||||
else:
|
||||
group_id = request.query_params["group"]
|
||||
topo_data = get_topology_data(
|
||||
|
||||
@@ -173,6 +173,10 @@ def get_query_settings(request):
|
||||
if request.GET["group_racks"] == "True" :
|
||||
group_racks = True
|
||||
|
||||
group = False
|
||||
if "group" in request.GET:
|
||||
group = request.GET["group"]
|
||||
|
||||
show_neighbors = False
|
||||
if "show_neighbors" in request.GET:
|
||||
if request.GET["show_neighbors"] == "True" :
|
||||
@@ -183,7 +187,7 @@ def get_query_settings(request):
|
||||
if request.GET["straight_cables"] == "True":
|
||||
straight_cables = True
|
||||
|
||||
return 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
|
||||
return 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, group, show_neighbors, straight_cables
|
||||
|
||||
class LinePattern():
|
||||
wireless = [2, 10, 2, 10]
|
||||
|
||||
@@ -719,7 +719,7 @@ class TopologyHomeView(PermissionRequiredMixin, View):
|
||||
|
||||
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, straight_cables = 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, group, 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"] != '':
|
||||
@@ -745,7 +745,10 @@ class TopologyHomeView(PermissionRequiredMixin, View):
|
||||
print(type(inst))
|
||||
|
||||
if "group" not in request.GET:
|
||||
group_id = "default"
|
||||
if 'group' in saved_filter_params:
|
||||
group_id = saved_filter_params['group'][0]
|
||||
else:
|
||||
group_id = "default"
|
||||
else:
|
||||
group_id = request.GET["group"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user