fix: sort topology devices without rendering rack elevations

This commit is contained in:
2026-07-28 14:32:34 +02:00
parent 1de5ed0565
commit bb0693bef7
5 changed files with 11 additions and 102 deletions
+2 -16
View File
@@ -992,21 +992,7 @@ class RackElevationView(PermissionRequiredMixin, View):
})
cable_rows = []
topology_nodes = {
f"device-{device.pk}": {
"node_id": f"device-{device.pk}", "device_id": device.pk,
"device_name": device.name or str(device.device_type),
"name": "", "subtitle": str(device.device_type),
"rack_id": device.rack_id, "rack_name": device.rack.name,
"url": device.get_absolute_url(),
"color": str(device.role.color or "1685fc"),
"position": float(device.position or 1),
"height": max(device.device_type.u_height or 1, 1),
"face": device.elevation_face,
"rack_u_height": device.rack.u_height,
}
for rack in rack_list for device in rack.elevation_devices
}
topology_nodes = {}
topology_edges = []
if device_ids:
cable_ids = CableTermination.objects.filter(
@@ -1022,7 +1008,7 @@ class RackElevationView(PermissionRequiredMixin, View):
cable_rows.append({"cable": cable, "a": a, "b": b})
for endpoint in (a, b):
if endpoint:
topology_nodes.setdefault(endpoint["node_id"], endpoint)
topology_nodes[endpoint["node_id"]] = endpoint
if a and b:
topology_edges.append({
"from": a["node_id"], "to": b["node_id"],