feat(i18n): translate UI to English and German

Use English as source language for all user-visible strings, wrap them for
translation and ship a German catalog. Add a test that keeps the README's
NetBox range in sync with min_version/max_version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-10-26 21:25:38 +01:00
1 parent 133cb1d9fc
commit cce6e21a09
40 files changed
+1456 -244

No files matched your search

@@ -1,32 +1,33 @@
{% extends 'generic/object.html' %}
{% load i18n %}
{% load helpers %}
{% load plugins %}
{% block title %}Topology Views Coordinates{% endblock title %}
{% block title %}{% trans "Topology Views Coordinates" %}{% endblock title %}
{% block content %}
<div class="row mb-3">
<div class="col col-md-6">
<div class="card">
<h5 class="card-header">
Coordinates
{% trans "Coordinates" %}
</h5>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row">Group</th>
<th scope="row">{% trans "Group" %}</th>
<td>{{ object.group|linkify }}</td>
</tr>
<tr>
<th scope="row">Circuit</th>
<th scope="row">{% trans "Circuit" %}</th>
<td>{{ object.device|linkify }}</td>
</tr>
<tr>
<th scope="row">X-Coordinate</th>
<th scope="row">{% trans "X-Coordinate" %}</th>
<td>{{ object.x }}</td>
</tr>
<tr>
<th scope="row">Y-Coordinate</th>
<th scope="row">{% trans "Y-Coordinate" %}</th>
<td>{{ object.y }}</td>
</tr>
</table>
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Add new Circuit Coordinates{% endblock title %}
{% block title %}{% trans "Add new Circuit Coordinates" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Edit Circuit Coordinates{% endblock title %}
{% block title %}{% trans "Edit Circuit Coordinates" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_list.html' %}
{% load i18n %}
{% block title %}Circuit Coordinates{% endblock title %}
{% block title %}{% trans "Circuit Coordinates" %}{% endblock title %}
@@ -1,32 +1,33 @@
{% extends 'generic/object.html' %}
{% load i18n %}
{% load helpers %}
{% load plugins %}
{% block title %}Topology Views Coordinates{% endblock title %}
{% block title %}{% trans "Topology Views Coordinates" %}{% endblock title %}
{% block content %}
<div class="row mb-3">
<div class="col col-md-6">
<div class="card">
<h5 class="card-header">
Coordinates
{% trans "Coordinates" %}
</h5>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row">Group</th>
<th scope="row">{% trans "Group" %}</th>
<td>{{ object.group|linkify }}</td>
</tr>
<tr>
<th scope="row">Device</th>
<th scope="row">{% trans "Device" %}</th>
<td>{{ object.device|linkify }}</td>
</tr>
<tr>
<th scope="row">X-Coordinate</th>
<th scope="row">{% trans "X-Coordinate" %}</th>
<td>{{ object.x }}</td>
</tr>
<tr>
<th scope="row">Y-Coordinate</th>
<th scope="row">{% trans "Y-Coordinate" %}</th>
<td>{{ object.y }}</td>
</tr>
</table>
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Add new Device Coordinates{% endblock title %}
{% block title %}{% trans "Add new Device Coordinates" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Edit Device Coordinates{% endblock title %}
{% block title %}{% trans "Edit Device Coordinates" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_list.html' %}
{% load i18n %}
{% block title %}Device Coordinates{% endblock title %}
{% block title %}{% trans "Device Coordinates" %}{% endblock title %}
@@ -1,25 +1,26 @@
{% extends 'generic/object.html' %}
{% load i18n %}
{% load helpers %}
{% load plugins %}
{% load render_table from django_tables2 %}
{% block title %}Topology Views Coordinate Group{% endblock title %}
{% block title %}{% trans "Topology Views Coordinate Group" %}{% endblock title %}
{% block content %}
<div class="row mb-3">
<div class="col col-md-6">
<div class="card">
<h5 class="card-header">
Coordinate Group
{% trans "Coordinate Group" %}
</h5>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row">Name</th>
<th scope="row">{% trans "Name" %}</th>
<td>{{ object.name }}</td>
</tr>
<tr>
<th scope="row">Description</th>
<th scope="row">{% trans "Description" %}</th>
<td>{{ object.description|placeholder }}</td>
</tr>
</table>
@@ -35,7 +36,7 @@
<div class="row mb-3">
<div class="col col-md-12">
<div class="card">
<h5 class="card-header">Circuit Coordinates</h5>
<h5 class="card-header">{% trans "Circuit Coordinates" %}</h5>
<div class="card-body table-responsive">
{% render_table circuitcoordinates_table %}
</div>
@@ -43,7 +44,7 @@
</div>
<div class="col col-md-12">
<div class="card">
<h5 class="card-header">Power Panel Coordinates</h5>
<h5 class="card-header">{% trans "Power Panel Coordinates" %}</h5>
<div class="card-body table-responsive">
{% render_table powerpanelcoordinates_table %}
</div>
@@ -51,7 +52,7 @@
</div>
<div class="col col-md-12">
<div class="card">
<h5 class="card-header">Power Feed Coordinates</h5>
<h5 class="card-header">{% trans "Power Feed Coordinates" %}</h5>
<div class="card-body table-responsive">
{% render_table powerfeedcoordinates_table %}
</div>
@@ -59,7 +60,7 @@
</div>
<div class="col col-md-12">
<div class="card">
<h5 class="card-header">Device Coordinates</h5>
<h5 class="card-header">{% trans "Device Coordinates" %}</h5>
<div class="card-body table-responsive">
{% render_table coordinates_table %}
</div>
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Add a new Coordinate Group{% endblock title %}
{% block title %}{% trans "Add a new Coordinate Group" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Edit Coordinate Group{% endblock title %}
{% block title %}{% trans "Edit Coordinate Group" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_list.html' %}
{% load i18n %}
{% block title %}Coordinate Groups{% endblock title %}
{% block title %}{% trans "Coordinate Groups" %}{% endblock title %}
@@ -1,10 +1,11 @@
{% extends 'base/layout.html' %}
{% load i18n %}
{% load buttons %}
{% load render_table from django_tables2 %}
{% load helpers %}
{% load static %}
{% block title %}Topology Views Images{% endblock %}
{% block title %}{% trans "Topology Views Images" %}{% endblock %}
{% block head %}
<link rel="stylesheet" href="{% static 'netbox_topology_views/css/app.css' %}">
@@ -20,7 +21,7 @@
{% if role.image %}
<img src="{{ role.image }}" />
{% else %}
Image
{% trans "Image" %}
{% endif %}
</button>
<div class="dropdown-menu mt-2" aria-labelledby="dropdownMenuButton{{ role.id }}">
@@ -36,7 +37,7 @@
{% endfor %}
</div>
<button class="btn btn-primary" type="submit">Save</button>
<button class="btn btn-primary" type="submit">{% trans "Save" %}</button>
</form>
{% include 'netbox_topology_views/toasts.html' %}
{% endblock content %}
@@ -44,6 +45,7 @@
{% block javascript %}
<script type="text/javascript">
const basePath = '{{ basepath }}';
window.topologyI18n = {savedSettings: '{{ _("Saved settings")|escapejs }}'};
</script>
<script src="{% static 'netbox_topology_views/js/images.js' %}" defer></script>
{% endblock javascript %}
@@ -1,11 +1,12 @@
{% extends 'generic/_base.html' %}
{% load i18n %}
{% load buttons %}
{% load render_table from django_tables2 %}
{% load static %}
{% load perms %}
{% load helpers %}
{% block title %}Topology Views{% endblock %}
{% block title %}{% trans "Topology Views" %}{% endblock %}
{% block head %}
<link rel="stylesheet" href="{% static 'netbox_topology_views/css/vendor.css' %}">
@@ -18,11 +19,11 @@
{% block extra_controls %}{% endblock %}
<a id="btnDownloadXml" class="btn btn-info" href="#">
<i class="mdi mdi-download"></i>
Download XML
{% trans "Download XML" %}
</a>
<a id="btnDownloadImage" class="btn btn-info" href="#">
<i class="mdi mdi-download"></i>
Download PNG
{% trans "Download PNG" %}
</a>
</div>
</div>
@@ -33,13 +34,13 @@
{% block tab_items %}
<li class="nav-item" role="presentation">
<button class="nav-link active" id="network-tab" data-bs-toggle="tab" data-bs-target="#networks" type="button" role="tab" aria-controls="filters-form" aria-selected="true">
Network
{% trans "Network" %}
</button>
</li>
{% if filter_form %}
<li class="nav-item" role="presentation">
<button class="nav-link" id="filters-form-tab" data-bs-toggle="tab" data-bs-target="#filters-form" type="button" role="tab" aria-controls="object-list" aria-selected="false">
Filters
{% trans "Filters" %}
{% if filter_form %}{% badge filter_form.changed_data|length bg_color="blue" %}{% endif %}
</button>
</li>
@@ -62,11 +63,11 @@
<div class="tab-pane show active" id="networks" role="tabpanel" aria-labelledby="network-tab">
<div class="panel-body">
{% if filter_required %}
<div class="bg-warning text-white p-2">Nothing to display! Set filters and hit search button or set "Draw Default Layout" in your individual options.</div>
<div class="bg-warning text-white p-2">{% trans 'Nothing to display! Set filters and hit search button or set "Draw Default Layout" in your individual options.' %}</div>
{% endif %}
{% if empty_result %}
<div class="bg-warning text-white p-2">Empty result set! Please review your filter settings.</div>
<div class="bg-info text-white p-2">Hint: Some options may produce an empty result. Use at least "Show Unconnected/Cables/Logical Connections".</div>
<div class="bg-warning text-white p-2">{% trans "Empty result set! Please review your filter settings." %}</div>
<div class="bg-info text-white p-2">{% trans 'Hint: Some options may produce an empty result. Use at least "Show Unconnected/Cables/Logical Connections".' %}</div>
{% endif %}
<div id="visgraph"></div>
</div>
@@ -1,5 +1,6 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Topology Views Individual Options{% endblock %}
{% block title %}{% trans "Topology Views Individual Options" %}{% endblock %}
{% block tabs %} {% endblock tabs %}
@@ -1,4 +1,5 @@
<a role="button" class="btn btn-primary" title="Topology" href="#" hx-get="/plugins/netbox_topology_views/topology/?location_id={{ object.id }}&show_cables=True&show_unconnected=True" hx-target="#htmx-modal-content" data-bs-toggle="modal" data-bs-target="#htmx-modal">
{% load i18n %}
<a role="button" class="btn btn-primary" title="{% trans "Topology" %}" href="#" hx-get="/plugins/netbox_topology_views/topology/?location_id={{ object.id }}&show_cables=True&show_unconnected=True" hx-target="#htmx-modal-content" data-bs-toggle="modal" data-bs-target="#htmx-modal">
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
Topology
{% trans "Topology" %}
</a>
@@ -1,32 +1,33 @@
{% extends 'generic/object.html' %}
{% load i18n %}
{% load helpers %}
{% load plugins %}
{% block title %}Topology Views Coordinates{% endblock title %}
{% block title %}{% trans "Topology Views Coordinates" %}{% endblock title %}
{% block content %}
<div class="row mb-3">
<div class="col col-md-6">
<div class="card">
<h5 class="card-header">
Coordinates
{% trans "Coordinates" %}
</h5>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row">Group</th>
<th scope="row">{% trans "Group" %}</th>
<td>{{ object.group|linkify }}</td>
</tr>
<tr>
<th scope="row">Power Feed</th>
<th scope="row">{% trans "Power Feed" %}</th>
<td>{{ object.device|linkify }}</td>
</tr>
<tr>
<th scope="row">X-Coordinate</th>
<th scope="row">{% trans "X-Coordinate" %}</th>
<td>{{ object.x }}</td>
</tr>
<tr>
<th scope="row">Y-Coordinate</th>
<th scope="row">{% trans "Y-Coordinate" %}</th>
<td>{{ object.y }}</td>
</tr>
</table>
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Add new Power Feed Coordinates{% endblock title %}
{% block title %}{% trans "Add new Power Feed Coordinates" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Edit Power Feed Coordinates{% endblock title %}
{% block title %}{% trans "Edit Power Feed Coordinates" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_list.html' %}
{% load i18n %}
{% block title %}Power Feed Coordinates{% endblock title %}
{% block title %}{% trans "Power Feed Coordinates" %}{% endblock title %}
@@ -1,32 +1,33 @@
{% extends 'generic/object.html' %}
{% load i18n %}
{% load helpers %}
{% load plugins %}
{% block title %}Topology Views Coordinates{% endblock title %}
{% block title %}{% trans "Topology Views Coordinates" %}{% endblock title %}
{% block content %}
<div class="row mb-3">
<div class="col col-md-6">
<div class="card">
<h5 class="card-header">
Coordinates
{% trans "Coordinates" %}
</h5>
<div class="card-body">
<table class="table table-hover attr-table">
<tr>
<th scope="row">Group</th>
<th scope="row">{% trans "Group" %}</th>
<td>{{ object.group|linkify }}</td>
</tr>
<tr>
<th scope="row">Power Panel</th>
<th scope="row">{% trans "Power Panel" %}</th>
<td>{{ object.device|linkify }}</td>
</tr>
<tr>
<th scope="row">X-Coordinate</th>
<th scope="row">{% trans "X-Coordinate" %}</th>
<td>{{ object.x }}</td>
</tr>
<tr>
<th scope="row">Y-Coordinate</th>
<th scope="row">{% trans "Y-Coordinate" %}</th>
<td>{{ object.y }}</td>
</tr>
</table>
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Add new Power Panel Coordinates{% endblock title %}
{% block title %}{% trans "Add new Power Panel Coordinates" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_edit.html' %}
{% load i18n %}
{% block title %}Edit Power Panel Coordinates{% endblock title %}
{% block title %}{% trans "Edit Power Panel Coordinates" %}{% endblock title %}
@@ -1,3 +1,4 @@
{% extends 'generic/object_list.html' %}
{% load i18n %}
{% block title %}Power Panel Coordinates{% endblock title %}
{% block title %}{% trans "Power Panel Coordinates" %}{% endblock title %}
@@ -1,8 +1,9 @@
{% extends 'generic/_base.html' %}
{% load helpers %}
{% load i18n %}
{% load static %}
{% block title %}Rack-Ansicht{% endblock %}
{% block title %}{% trans "Rack view" %}{% endblock %}
{% block head %}
<link rel="stylesheet" href="{% static 'netbox_topology_views/css/app.css' %}">
@@ -11,7 +12,7 @@
{% block content %}
<div class="card mb-3">
<div class="card-header"><strong>Racks auswählen</strong></div>
<div class="card-header"><strong>{% trans "Select racks" %}</strong></div>
<div class="card-body">
<form method="get">
<div class="row g-3">
@@ -25,8 +26,8 @@
{% endfor %}
</div>
<div class="mt-3">
<button class="btn btn-primary" type="submit"><i class="mdi mdi-magnify"></i> Anzeigen</button>
<a class="btn btn-outline-secondary" href="{% url 'plugins:netbox_topology_views:rack_elevation' %}">Zurücksetzen</a>
<button class="btn btn-primary" type="submit"><i class="mdi mdi-magnify"></i> {% trans "Show" %}</button>
<a class="btn btn-outline-secondary" href="{% url 'plugins:netbox_topology_views:rack_elevation' %}">{% trans "Reset" %}</a>
</div>
</form>
</div>
@@ -34,7 +35,7 @@
{% if racks %}
<div class="d-flex justify-content-end align-items-center gap-2 mb-3 flex-wrap">
<strong class="me-2">Alle Racks exportieren:</strong>
<strong class="me-2">{% trans "Export all racks:" %}</strong>
<button class="btn btn-sm btn-outline-primary rack-export" data-format="svg" data-scope="all">SVG</button>
<button class="btn btn-sm btn-outline-primary rack-export" data-format="png" data-scope="all">PNG</button>
<button class="btn btn-sm btn-outline-primary rack-export" data-format="drawio" data-scope="all">draw.io</button>
@@ -45,7 +46,7 @@
<header>
<div><a href="{{ rack.get_absolute_url }}"><strong>{{ rack.name }}</strong></a><br>
<small>{{ rack.site }}{% if rack.location %} · {{ rack.location }}{% endif %} · {{ rack.u_height }}U</small></div>
<div class="btn-group" aria-label="{{ rack.name }} exportieren">
<div class="btn-group" aria-label="{% blocktrans with name=rack.name %}Export {{ name }}{% endblocktrans %}">
<button class="btn btn-sm btn-outline-secondary rack-export" data-format="svg" data-scope="{{ rack.pk }}">SVG</button>
<button class="btn btn-sm btn-outline-secondary rack-export" data-format="png" data-scope="{{ rack.pk }}">PNG</button>
<button class="btn btn-sm btn-outline-secondary rack-export" data-format="drawio" data-scope="{{ rack.pk }}">draw.io</button>
@@ -84,16 +85,16 @@
<div id="rack-topology-card" class="card mt-4">
<div class="card-header d-flex justify-content-between align-items-center">
<strong>Kabeltopologie</strong>
<strong>{% trans "Cable topology" %}</strong>
<div class="d-flex gap-2 align-items-center">
<div class="d-flex gap-3 align-items-center rack-topology-kind-toggles">
<div class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" id="rack-topology-show-wireless" checked>
<label class="form-check-label" for="rack-topology-show-wireless">Funk/WLAN</label>
<label class="form-check-label" for="rack-topology-show-wireless">{% trans "Wireless/WLAN" %}</label>
</div>
<div class="form-check form-check-inline mb-0">
<input class="form-check-input" type="checkbox" id="rack-topology-show-power" checked>
<label class="form-check-label" for="rack-topology-show-power">Strom</label>
<label class="form-check-label" for="rack-topology-show-power">{% trans "Power" %}</label>
</div>
</div>
<div class="btn-group">
@@ -101,21 +102,21 @@
<button class="btn btn-sm btn-outline-primary topology-export" data-format="png">PNG</button>
<button class="btn btn-sm btn-outline-primary topology-export" data-format="drawio">draw.io</button>
</div>
<div class="btn-group" aria-label="Topologie zoomen">
<button id="rack-topology-zoom-out" class="btn btn-sm btn-outline-secondary" type="button" title="Verkleinern"><i class="mdi mdi-minus"></i></button>
<button id="rack-topology-zoom-reset" class="btn btn-sm btn-outline-secondary" type="button" title="Zoom zurücksetzen"><span id="rack-topology-zoom-label">100%</span></button>
<button id="rack-topology-zoom-in" class="btn btn-sm btn-outline-secondary" type="button" title="Vergrößern"><i class="mdi mdi-plus"></i></button>
<div class="btn-group" aria-label="{% trans "Zoom topology" %}">
<button id="rack-topology-zoom-out" class="btn btn-sm btn-outline-secondary" type="button" title="{% trans "Zoom out" %}"><i class="mdi mdi-minus"></i></button>
<button id="rack-topology-zoom-reset" class="btn btn-sm btn-outline-secondary" type="button" title="{% trans "Reset zoom" %}"><span id="rack-topology-zoom-label">100%</span></button>
<button id="rack-topology-zoom-in" class="btn btn-sm btn-outline-secondary" type="button" title="{% trans "Zoom in" %}"><i class="mdi mdi-plus"></i></button>
</div>
<button id="rack-topology-reset" class="btn btn-sm btn-outline-secondary" type="button">
<i class="mdi mdi-restore"></i> Positionen zurücksetzen
<i class="mdi mdi-restore"></i> {% trans "Reset positions" %}
</button>
<button id="rack-topology-fullscreen" class="btn btn-sm btn-outline-secondary" type="button">
<i class="mdi mdi-fullscreen"></i> Vollbild
<i class="mdi mdi-fullscreen"></i> {% trans "Full screen" %}
</button>
</div>
</div>
<div class="card-body">
<div id="rack-topology" class="rack-topology" aria-label="Topologie der ausgewählten Racks">
<div id="rack-topology" class="rack-topology" aria-label="{% trans "Topology of the selected racks" %}">
<svg class="rack-topology-lines" aria-hidden="true"></svg>
<div class="rack-topology-columns"></div>
<div class="rack-topology-tooltip" role="tooltip"></div>
@@ -124,12 +125,13 @@
</div>
{{ rack_topology|json_script:"rack-topology-data" }}
{{ rack_export|json_script:"rack-export-data" }}
{{ i18n|json_script:"rack-i18n-data" }}
<div class="card mt-4">
<div class="card-header"><strong>Verkabelung der angezeigten Racks</strong> <span class="badge rack-cable-count">{{ cables|length }}</span></div>
<div class="card-header"><strong>{% trans "Cabling of the displayed racks" %}</strong> <span class="badge rack-cable-count">{{ cables|length }}</span></div>
<div class="table-responsive">
<table class="table table-hover mb-0">
<thead><tr><th>Kabel</th><th>A-Seite</th><th>B-Seite</th><th>Typ</th><th>Status</th></tr></thead>
<thead><tr><th>{% trans "Cable" %}</th><th>{% trans "A side" %}</th><th>{% trans "B side" %}</th><th>{% trans "Type" %}</th><th>{% trans "Status" %}</th></tr></thead>
<tbody>
{% for row in cables %}
<tr>
@@ -138,15 +140,15 @@
<td>{% if row.b %}<strong>{{ row.b.device_name }}</strong><br><small>{{ row.b.name }}</small>{% else %}—{% endif %}</td>
<td>{{ row.cable.type|default:'—' }}</td><td>{{ row.cable.get_status_display }}</td>
</tr>
{% empty %}<tr><td colspan="5" class="text-muted text-center py-4">Keine Verkabelung gefunden.</td></tr>{% endfor %}
{% empty %}<tr><td colspan="5" class="text-muted text-center py-4">{% trans "No cabling found." %}</td></tr>{% endfor %}
</tbody>
</table>
</div>
</div>
{% elif has_selection %}
<div class="alert alert-warning">Für diese Auswahl wurden keine belegten Racks gefunden. Aktiviere „Leere Racks einschließen“, um auch leere Racks zu sehen.</div>
<div class="alert alert-warning">{% trans "No occupied racks were found for this selection. Enable “Include empty racks” to show empty racks as well." %}</div>
{% else %}
<div class="alert alert-info">Wähle ein oder mehrere Racks oder grenze die Ansicht über Standort und Location ein.</div>
<div class="alert alert-info">{% trans "Select one or more racks, or narrow the view by site and location." %}</div>
{% endif %}
{% endblock %}
@@ -157,6 +159,7 @@
const source = document.getElementById('rack-topology-data');
if (!root || !source) return;
const data = JSON.parse(source.textContent);
const t = JSON.parse(document.getElementById('rack-i18n-data').textContent);
const isWirelessEdge = edge => edge.kind === 'wireless' || edge.kind === 'wireless-lan';
const isPowerEdge = edge => edge.kind === 'power';
const showWirelessCheckbox = document.getElementById('rack-topology-show-wireless');
@@ -218,9 +221,9 @@
const groups = new Map();
data.nodes.forEach(node => {
const groupKey = node.rack_id ? `rack-${node.rack_id}` : `external-${node.rack_name || 'Extern'}`;
const groupKey = node.rack_id ? `rack-${node.rack_id}` : `external-${node.rack_name || t.external}`;
if (!groups.has(groupKey)) groups.set(groupKey, {
name: node.rack_name || 'Extern',
name: node.rack_name || t.external,
rackUnits: node.rack_u_height || null,
descUnits: Boolean(node.rack_desc_units),
nodes: [],
@@ -323,7 +326,7 @@
path.addEventListener('mouseenter', event => {
setEdgeHighlighted(path, true);
showTooltip(
`<strong>${isWirelessEdge(edge) ? 'WLAN · ' : isPowerEdge(edge) ? 'Strom · ' : ''}${escapeHtml(edge.label)}</strong>` +
`<strong>${isWirelessEdge(edge) ? 'WLAN · ' : isPowerEdge(edge) ? `${t.power} · ` : ''}${escapeHtml(edge.label)}</strong>` +
`<span>${escapeHtml(edge.from_device)} · ${escapeHtml(edge.from_port)}</span>` +
`<span>↔ ${escapeHtml(edge.to_device)} · ${escapeHtml(edge.to_port)}</span>`,
event.target
@@ -352,9 +355,9 @@
const localPort = outgoing ? edge.from_port : edge.to_port;
const remoteDevice = outgoing ? edge.to_device : edge.from_device;
const remotePort = outgoing ? edge.to_port : edge.from_port;
return `<li><strong>${escapeHtml(localPort)}</strong><span>→ ${escapeHtml(remoteDevice)} · ${escapeHtml(remotePort)}</span><small>${isWirelessEdge(edge) ? 'WLAN · ' : isPowerEdge(edge) ? 'Strom · ' : ''}${escapeHtml(edge.label)}</small></li>`;
return `<li><strong>${escapeHtml(localPort)}</strong><span>→ ${escapeHtml(remoteDevice)} · ${escapeHtml(remotePort)}</span><small>${isWirelessEdge(edge) ? 'WLAN · ' : isPowerEdge(edge) ? `${t.power} · ` : ''}${escapeHtml(edge.label)}</small></li>`;
}).join('');
showTooltip(`<strong>Verbindungen (${connections.length})</strong><ul>${rows || '<li>Keine Verbindungen</li>'}</ul>`, node);
showTooltip(`<strong>${escapeHtml(t.connections)} (${connections.length})</strong><ul>${rows || `<li>${escapeHtml(t.noConnections)}</li>`}</ul>`, node);
});
node.addEventListener('mouseleave', () => {
svg.querySelectorAll('.rack-topology-edge').forEach(path => {
@@ -412,8 +415,8 @@
document.addEventListener('fullscreenchange', () => {
const active = document.fullscreenElement === topologyCard;
fullscreenButton.innerHTML = active
? '<i class="mdi mdi-fullscreen-exit"></i> Vollbild verlassen'
: '<i class="mdi mdi-fullscreen"></i> Vollbild';
? `<i class="mdi mdi-fullscreen-exit"></i> ${escapeHtml(t.exitFullScreen)}`
: `<i class="mdi mdi-fullscreen"></i> ${escapeHtml(t.fullScreen)}`;
requestAnimationFrame(drawEdges);
});
const setTopologyZoom = value => {
@@ -457,7 +460,7 @@
const bottomUnits = bottom / 100 * rackUnits;
const startingUnit = Number(rack.starting_unit) || 1;
return {
name: device.dataset.deviceName || device.querySelector('span')?.textContent || 'Gerät',
name: device.dataset.deviceName || device.querySelector('span')?.textContent || t.device,
type: device.dataset.deviceType || '',
position: rack.desc_units
? startingUnit + rackUnits - deviceHeight - bottomUnits
@@ -488,7 +491,7 @@
vertex(`${rack.site}${rack.location ? ` · ${rack.location}` : ''} · ${rack.u_height}U`, `text;html=1;strokeColor=none;fillColor=none;align=left;fontSize=10;fontColor=${palette.muted};`, baseX, 24, rackWidth, 20);
['front', 'rear'].forEach((face, faceIndex) => {
const x = baseX + labelWidth + faceIndex * (faceWidth + faceGap);
vertex(face === 'front' ? 'VORDERSEITE' : 'RÜCKSEITE', `text;html=1;strokeColor=none;fillColor=none;align=center;fontSize=10;fontColor=${palette.muted};`, x, 38, faceWidth, 17);
vertex(face === 'front' ? t.front.toUpperCase() : t.rear.toUpperCase(), `text;html=1;strokeColor=none;fillColor=none;align=center;fontSize=10;fontColor=${palette.muted};`, x, 38, faceWidth, 17);
vertex('', `rounded=0;html=1;fillColor=none;strokeColor=${palette.frame};strokeWidth=4;`, x, header, faceWidth, rackHeight);
for (let row = 0; row < rack.u_height; row++) {
const y = header + row * unit;
@@ -525,7 +528,7 @@
content += `<text x="${baseX}" y="39" fill="${palette.muted}" font-family="sans-serif" font-size="11">${xmlEscape(rack.site)}${rack.location ? ` · ${xmlEscape(rack.location)}` : ''} · ${rack.u_height}U</text>`;
['front', 'rear'].forEach((face, faceIndex) => {
const x = baseX + labelWidth + faceIndex * (faceWidth + faceGap);
content += `<text x="${x + faceWidth / 2}" y="51" text-anchor="middle" fill="${palette.muted}" font-family="sans-serif" font-size="10">${face === 'front' ? 'VORDERSEITE' : 'RÜCKSEITE'}</text>`;
content += `<text x="${x + faceWidth / 2}" y="51" text-anchor="middle" fill="${palette.muted}" font-family="sans-serif" font-size="10">${face === 'front' ? t.front.toUpperCase() : t.rear.toUpperCase()}</text>`;
content += `<rect x="${x}" y="${header}" width="${faceWidth}" height="${rackHeight}" fill="none" stroke="${palette.frame}" stroke-width="4"/>`;
for (let row = 0; row < rack.u_height; row++) {
const y = header + row * unit;
@@ -588,7 +591,7 @@
if (!a || !b) return;
const bend = Math.max(30, Math.abs(b.x - a.x) * .35);
const dashPattern = isWirelessEdge(edge) ? '7 7' : isPowerEdge(edge) ? '2 4' : null;
const edgeLabelPrefix = isWirelessEdge(edge) ? 'WLAN · ' : isPowerEdge(edge) ? 'Strom · ' : '';
const edgeLabelPrefix = isWirelessEdge(edge) ? 'WLAN · ' : isPowerEdge(edge) ? `${t.power} · ` : '';
edgeContent += `<path d="M ${a.x} ${a.y} C ${a.x + bend} ${a.y}, ${b.x - bend} ${b.y}, ${b.x} ${b.y}" fill="none" stroke="${xmlEscape(edge.color)}" stroke-width="3"${dashPattern ? ` stroke-dasharray="${dashPattern}"` : ''}/>`;
const sourceId = nodeCells.get(edge.from), targetId = nodeCells.get(edge.to);
if (sourceId && targetId) {
@@ -637,11 +640,11 @@
document.querySelectorAll('.rack-export').forEach(button => button.addEventListener('click', () => {
const selectedRacks = button.dataset.scope === 'all' ? rackData : rackData.filter(rack => String(rack.id) === button.dataset.scope);
const racks = renderedRackData(selectedRacks);
const name = button.dataset.scope === 'all' ? 'racks-gesamt' : `rack-${safeName(racks[0]?.name)}`;
const name = button.dataset.scope === 'all' ? 'racks-all' : `rack-${safeName(racks[0]?.name)}`;
exportGraphic(buildRackSvg(racks), button.dataset.format, name);
}));
document.querySelectorAll('.topology-export').forEach(button => button.addEventListener('click', () => {
exportGraphic(buildTopologySvg(), button.dataset.format, 'rack-topologie');
exportGraphic(buildTopologySvg(), button.dataset.format, 'rack-topology');
}));
showWirelessCheckbox?.addEventListener('change', applyKindVisibility);
showPowerCheckbox?.addEventListener('change', applyKindVisibility);
@@ -1,3 +1,4 @@
{% load i18n %}
<div id="django-messages" class="toast-container">
<div
id="topology-plugin-error-toast"
@@ -10,13 +11,13 @@
<div class="d-flex">
<div class="toast-body">
😢
<span>Error</span>
<span>{% trans "Error" %}</span>
</div>
<button
type="button"
class="btn-close me-2 m-auto"
data-bs-dismiss="toast"
aria-label="Close"
aria-label="{% trans "Close" %}"
></button>
</div>
</div>
@@ -31,13 +32,13 @@
<div class="d-flex">
<div class="toast-body">
👍
<span>Success</span>
<span>{% trans "Success" %}</span>
</div>
<button
type="button"
class="btn-close me-2 m-auto"
data-bs-dismiss="toast"
aria-label="Close"
aria-label="{% trans "Close" %}"
></button>
</div>
</div>