feat: tidy topology layout, symbols for all device roles, drop draw.io
Topology: - Orthogonal routing: each parent drops to its own bus lane in the gap below it (interval coloring prevents overlaps), color-coded per parent; parallel links drawn thicker. Adjacent same-row links are straight, other same-row links use a lane above the row. - Port labels sit at the target device, stacked per uplink, instead of piling up at line midpoints. - Crossing reduction via repeated down/up barycenter sweeps; rows wrap at 12 devices. - Wide diagrams scale to page width in HTML/PDF instead of being cut off. Symbols: - New built-in symbols: modem/NTU (RAD), radio link, PoE injector, NAS, tape library, UPS/ATS and PBX. - Detection checks the device role first, then model/manufacturer, and covers the common typos "Acces Point", "Controler" and "Libary". Rooms and cable management are hidden; UPS devices are now shown. Removed the draw.io export format. Bump version to 0.5.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,20 +28,6 @@ class ScopeSelectView(LoginRequiredMixin, View):
|
||||
|
||||
|
||||
class ExportView(LoginRequiredMixin, View):
|
||||
def _drawio(self, request, scope, form, opts):
|
||||
"""Nur die Topologie – als editierbare draw.io-Datei (eine Seite je Standort)."""
|
||||
from .topology import build_graphs, render_drawio
|
||||
|
||||
graphs = build_graphs(scope, opts)
|
||||
if not graphs:
|
||||
messages.warning(request, "Keine verkabelten Geräte gefunden – es gibt keine Topologie zu exportieren.")
|
||||
return self._render_form(request, scope, form)
|
||||
content = render_drawio(graphs, show_ports="ports" in (opts.get("topo_details") or []))
|
||||
response = HttpResponse(content, content_type="application/xml")
|
||||
filename = f"topologie_{slugify(str(scope.obj)) or 'export'}_{timezone.localdate():%Y%m%d}.drawio"
|
||||
response["Content-Disposition"] = f'attachment; filename="{filename}"'
|
||||
return response
|
||||
|
||||
template_name = "netbox_customer_export/export.html"
|
||||
|
||||
def _scope(self, request, kind, pk):
|
||||
@@ -68,8 +54,6 @@ class ExportView(LoginRequiredMixin, View):
|
||||
return self._render_form(request, scope, form)
|
||||
|
||||
opts = form.cleaned_data
|
||||
if opts["format"] == "drawio":
|
||||
return self._drawio(request, scope, form, opts)
|
||||
blocks = []
|
||||
for key in opts["sections"]:
|
||||
blocks += SECTIONS[key].func(scope, opts)
|
||||
|
||||
Reference in New Issue
Block a user