fix: technician topology for all sites, per location and combined
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
677590f52c
commit
daf8bc671b
9 files changed
+51
-7
No files matched your search
@@ -85,7 +85,7 @@ def _device_sub(device, opts):
|
||||
|
||||
|
||||
def build_graphs(scope, opts, per="site"):
|
||||
"""Ein Graph je Standort (per="site") oder je Rack (per="rack").
|
||||
"""Ein Graph je Standort (per="site"), Lokation (per="location"), Rack (per="rack") oder einer für alles (per="all").
|
||||
|
||||
Verbundene Geräte außerhalb der Gruppe (anderer Standort/anderes Rack) und Provider-Leitungen erscheinen
|
||||
als externe, gestrichelte Knoten – so sieht man auch in der Rack-Ansicht, wohin die Uplinks gehen.
|
||||
@@ -98,7 +98,12 @@ def build_graphs(scope, opts, per="site"):
|
||||
groups = OrderedDict()
|
||||
for pk in drawn:
|
||||
d = by_pk[pk]
|
||||
key = d.site if per == "site" else d.rack
|
||||
if per == "all":
|
||||
key = "all"
|
||||
elif per == "location":
|
||||
key = d.location or d.site
|
||||
else:
|
||||
key = d.site if per == "site" else d.rack
|
||||
if key is not None:
|
||||
groups.setdefault(key, []).append(pk)
|
||||
if per == "rack":
|
||||
@@ -110,6 +115,8 @@ def build_graphs(scope, opts, per="site"):
|
||||
"""Untertitel eines externen Geräts: wo es steht."""
|
||||
if per == "rack":
|
||||
return [_("Rack %(name)s") % {"name": d.rack} if d.rack else str(d.site)]
|
||||
if per == "location" and d.location:
|
||||
return [f"{d.site} / {d.location}"]
|
||||
return [str(d.site)]
|
||||
|
||||
graphs = []
|
||||
@@ -139,8 +146,12 @@ def build_graphs(scope, opts, per="site"):
|
||||
nodes = OrderedDict((k, v) for k, v in nodes.items() if k in linked)
|
||||
if nodes:
|
||||
_layout(nodes, edges)
|
||||
if per == "site":
|
||||
if per == "all":
|
||||
title = _("All sites")
|
||||
elif per == "site" or (per == "location" and not hasattr(group, "site")):
|
||||
title = _("Site %(name)s") % {"name": group}
|
||||
elif per == "location":
|
||||
title = _("Location %(name)s (%(site)s)") % {"name": group, "site": group.site}
|
||||
else:
|
||||
where = " / ".join(str(x) for x in (group.site, group.location) if x)
|
||||
title = _("Rack %(name)s (%(where)s)") % {"name": group.name, "where": where}
|
||||
|
||||
Reference in new issue
Block a user