137 lines
4.8 KiB
HTML
137 lines
4.8 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}Admin Dashboard - {{ APP_TITLE }}{% endblock %}
|
|
|
|
{% block content %}
|
|
<h1>Administrator Dashboard</h1>
|
|
|
|
<nav>
|
|
<ul style="display: flex; gap: 1rem; flex-wrap: wrap; list-style: none; padding: 0;">
|
|
<li><a href="{{ url_for('admin.accounts', tenant=session.tenant_code) }}" role="button">Accountverwaltung</a></li>
|
|
<li><a href="{{ url_for('admin_gruppen.gruppen', tenant=session.tenant_code) }}" role="button" class="secondary">Gruppenverwaltung</a></li>
|
|
<li><a href="{{ url_for('admin_strassen.strassen', tenant=session.tenant_code) }}" role="button" class="secondary">Straßenverwaltung</a></li>
|
|
</ul>
|
|
</nav>
|
|
|
|
<section>
|
|
<h2>Datenbank-Backup</h2>
|
|
<p>
|
|
Das Backup enthält eine vollständige, konsistente Kopie der
|
|
SQLite-Datenbank. Es kann später über die Schaltfläche unten wieder
|
|
eingespielt werden. Während der Wiederherstellung sollten keine
|
|
anderen Benutzer aktiv arbeiten.
|
|
</p>
|
|
<p>
|
|
<a href="{{ url_for('admin_backup.download_backup', tenant=session.tenant_code) }}"
|
|
role="button">Backup herunterladen</a>
|
|
</p>
|
|
<form id="restoreBackupForm" method="post" enctype="multipart/form-data"
|
|
action="{{ url_for('admin_backup.restore_backup', tenant=session.tenant_code) }}">
|
|
<label for="backupFile">Backup-Datei auswählen</label>
|
|
<input type="file" id="backupFile" name="backup"
|
|
accept=".sqlite3,.sqlite,.db,application/vnd.sqlite3" required>
|
|
<button type="submit" class="secondary">Backup wiederherstellen</button>
|
|
</form>
|
|
<p>
|
|
<small>
|
|
Die Wiederherstellung ersetzt alle aktuellen Daten durch den
|
|
Inhalt der Backup-Datei. Die Datei wird vor dem Einspielen auf
|
|
Integrität und das CMBNet-Grundschema geprüft.
|
|
</small>
|
|
</p>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>Konfiguration</h2>
|
|
<p>
|
|
Alle Konfigurationsparameter als Key:Value-Liste. Geheimnisse wie
|
|
<code>SECRET_KEY</code> und Service-Account-Inhalte werden maskiert.
|
|
</p>
|
|
<p>
|
|
<a href="{{ url_for('admin_backup.export_config', tenant=session.tenant_code) }}"
|
|
role="button" class="secondary">Konfiguration herunterladen</a>
|
|
</p>
|
|
<div class="config-table-wrapper">
|
|
<table id="configTable">
|
|
<thead>
|
|
<tr>
|
|
<th>Key</th>
|
|
<th>Value</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for key, value in config_items %}
|
|
<tr>
|
|
<td><code>{{ key }}</code></td>
|
|
<td><code class="config-value">{{ value }}</code></td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>API-Zugriffstoken</h2>
|
|
<p>
|
|
Mit diesen Tokens können externe Systeme Gruppenpositionen über die
|
|
API melden. Tokens sind mandantenweit gültig und sollten geheim
|
|
gehalten werden.
|
|
</p>
|
|
{% if api_tokens %}
|
|
<table id="apiTokenTable">
|
|
<thead>
|
|
<tr>
|
|
<th>Token</th>
|
|
<th>Erstellt</th>
|
|
<th>Ersteller</th>
|
|
<th>Aktion</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for token in api_tokens %}
|
|
<tr>
|
|
<td><code class="api-token-value">{{ token.token }}</code></td>
|
|
<td>{{ token.created_at }}</td>
|
|
<td>{{ token.created_by_name or '-' }}</td>
|
|
<td>
|
|
<button type="button" class="secondary"
|
|
onclick="deleteApiToken({{ token.id }})">Löschen</button>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<p id="apiTokenEmpty">Noch keine API-Zugriffstoken vorhanden.</p>
|
|
{% endif %}
|
|
<button type="button" id="createApiTokenBtn">Neuen Token generieren</button>
|
|
</section>
|
|
|
|
<section>
|
|
<h2>Broker Status</h2>
|
|
<p>Aktive WebSocket-Verbindungen</p>
|
|
<table id="brokerStatusTable">
|
|
<thead>
|
|
<tr>
|
|
<th>Client-ID</th>
|
|
<th>Account-ID</th>
|
|
<th>Account</th>
|
|
<th>Rolle</th>
|
|
<th>Gruppe / Alias</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="brokerStatusBody">
|
|
<tr><td colspan="5">Lade...</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<p style="margin-top: 2rem;"><a href="{{ url_for('auth.logout', tenant=session.tenant_code) }}" role="button" class="contrast">Abmelden</a></p>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script>window.CMBNET_ADMIN_RELOAD_WATCH = true;</script>
|
|
<script src="{{ url_for('static', filename='js/views/admin_dashboard.js') }}"></script>
|
|
{% endblock %}
|