Debug-Modus-Toggle, Health-Anzeige, letzter Checkin im Log
Neue Sektion 'Debug-Modus' auf der Auftragskatalog-Seite (Kunden- und Admin-Bereich, gleiches zurueck_url-Praefix-Muster wie die bestehenden select/deselect-Formulare) mit Aktivieren/Beenden-Toggle. Geräteliste zeigt jetzt ein kleines Debug-Badge. Hardware-Seite bekommt eine neue Sektion 'Aktueller Zustand (letzter Checkin)' mit den Health-Metriken, nur sichtbar wenn device.health vorhanden ist. Log-Seite zeigt jetzt 'Zuletzt gemeldet' oberhalb der Ereignistabelle - vorher nur in der Geräteliste sichtbar, nicht in der Detail-Historie. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
4dec7645a6
commit
5b66974024
@ -114,3 +114,23 @@ def auftrag_deselect(device_id: str, merkmal_key: str, user: dict = Depends(requ
|
|||||||
)
|
)
|
||||||
|
|
||||||
return RedirectResponse(f"/admin/geraete/{device_id}", status_code=303)
|
return RedirectResponse(f"/admin/geraete/{device_id}", status_code=303)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/{device_id}/debug-modus/aktivieren")
|
||||||
|
def debug_modus_aktivieren(device_id: str, user: dict = Depends(require_admin)):
|
||||||
|
if find_device(device_id) is None:
|
||||||
|
raise HTTPException(status_code=404, detail="Gerät wurde nicht gefunden.")
|
||||||
|
|
||||||
|
anode_request("POST", f"/api/v1/devices/{device_id}/debug-mode")
|
||||||
|
|
||||||
|
return RedirectResponse(f"/admin/geraete/{device_id}", status_code=303)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/{device_id}/debug-modus/deaktivieren")
|
||||||
|
def debug_modus_deaktivieren(device_id: str, user: dict = Depends(require_admin)):
|
||||||
|
if find_device(device_id) is None:
|
||||||
|
raise HTTPException(status_code=404, detail="Gerät wurde nicht gefunden.")
|
||||||
|
|
||||||
|
anode_request("DELETE", f"/api/v1/devices/{device_id}/debug-mode")
|
||||||
|
|
||||||
|
return RedirectResponse(f"/admin/geraete/{device_id}", status_code=303)
|
||||||
|
|||||||
@ -203,6 +203,26 @@ def auftrag_deselect(device_id: str, merkmal_key: str, user: dict = Depends(get_
|
|||||||
return RedirectResponse(f"/geraete/{device_id}", status_code=303)
|
return RedirectResponse(f"/geraete/{device_id}", status_code=303)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/geraete/{device_id}/debug-modus/aktivieren")
|
||||||
|
def debug_modus_aktivieren(device_id: str, user: dict = Depends(get_current_user)):
|
||||||
|
if find_device_in_organization(device_id, user.organization_id) is None:
|
||||||
|
raise HTTPException(status_code=404, detail="Gerät wurde nicht gefunden.")
|
||||||
|
|
||||||
|
anode_request("POST", f"/api/v1/devices/{device_id}/debug-mode")
|
||||||
|
|
||||||
|
return RedirectResponse(f"/geraete/{device_id}", status_code=303)
|
||||||
|
|
||||||
|
|
||||||
|
@router.post("/geraete/{device_id}/debug-modus/deaktivieren")
|
||||||
|
def debug_modus_deaktivieren(device_id: str, user: dict = Depends(get_current_user)):
|
||||||
|
if find_device_in_organization(device_id, user.organization_id) is None:
|
||||||
|
raise HTTPException(status_code=404, detail="Gerät wurde nicht gefunden.")
|
||||||
|
|
||||||
|
anode_request("DELETE", f"/api/v1/devices/{device_id}/debug-mode")
|
||||||
|
|
||||||
|
return RedirectResponse(f"/geraete/{device_id}", status_code=303)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/geraete/{device_id}/hardware")
|
@router.get("/geraete/{device_id}/hardware")
|
||||||
def hardware_ansicht(request: Request, device_id: str, user: dict = Depends(get_current_user)):
|
def hardware_ansicht(request: Request, device_id: str, user: dict = Depends(get_current_user)):
|
||||||
device = find_device_in_organization(device_id, user.organization_id)
|
device = find_device_in_organization(device_id, user.organization_id)
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
<td>{{ device.hostname or "—" }}</td>
|
<td>{{ device.hostname or "—" }}</td>
|
||||||
<td><code>{{ device.device_fingerprint }}</code></td>
|
<td><code>{{ device.device_fingerprint }}</code></td>
|
||||||
<td>{{ device.oe_name or "—" }}</td>
|
<td>{{ device.oe_name or "—" }}</td>
|
||||||
<td>{{ device.agent_last_checkin or "noch nie" }}</td>
|
<td>{{ device.agent_last_checkin or "noch nie" }}{% if device.debug_mode_until %}<br><small>🐞 Debug-Modus aktiv</small>{% endif %}</td>
|
||||||
<td><a href="/admin/geraete/{{ device.id }}" role="button" class="outline">Auftragskatalog →</a></td>
|
<td><a href="/admin/geraete/{{ device.id }}" role="button" class="outline">Auftragskatalog →</a></td>
|
||||||
<td>
|
<td>
|
||||||
<form method="post" action="/admin/geraete/{{ device.id }}/oe">
|
<form method="post" action="/admin/geraete/{{ device.id }}/oe">
|
||||||
|
|||||||
@ -4,6 +4,20 @@
|
|||||||
<p><a href="{{ zurueck_url }}">← Geräteliste</a></p>
|
<p><a href="{{ zurueck_url }}">← Geräteliste</a></p>
|
||||||
<h2>Auftragskatalog: {{ device.hostname or device.device_fingerprint }}</h2>
|
<h2>Auftragskatalog: {{ device.hostname or device.device_fingerprint }}</h2>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h3>Debug-Modus</h3>
|
||||||
|
{% if device.debug_mode_until %}
|
||||||
|
<p>Aktiv bis {{ device.debug_mode_until }} (kurzes Poll-Intervall, fällt danach automatisch auf den Standard zurück).</p>
|
||||||
|
<form method="post" action="{{ zurueck_url }}/{{ device.id }}/debug-modus/deaktivieren">
|
||||||
|
<button type="submit" class="secondary outline">Debug-Modus jetzt beenden</button>
|
||||||
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<form method="post" action="{{ zurueck_url }}/{{ device.id }}/debug-modus/aktivieren">
|
||||||
|
<button type="submit" class="secondary outline">Debug-Modus aktivieren (6 Stunden)</button>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
|
|
||||||
{% if fehler %}
|
{% if fehler %}
|
||||||
<p><mark>{{ fehler }}</mark></p>
|
<p><mark>{{ fehler }}</mark></p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
@ -4,6 +4,23 @@
|
|||||||
<p><a href="/geraete">← Geräteliste</a></p>
|
<p><a href="/geraete">← Geräteliste</a></p>
|
||||||
<h2>Hardware-Informationen: {{ device.hostname or device.device_fingerprint }}</h2>
|
<h2>Hardware-Informationen: {{ device.hostname or device.device_fingerprint }}</h2>
|
||||||
|
|
||||||
|
{% if device.health %}
|
||||||
|
<section>
|
||||||
|
<h3>Aktueller Zustand (letzter Checkin)</h3>
|
||||||
|
<figure>
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>Diskbelegung (/)</td><td>{{ device.health.disk_used_percent ~ "%" if device.health.disk_used_percent is not none else "—" }}</td></tr>
|
||||||
|
<tr><td>RAM-Auslastung</td><td>{{ device.health.ram_used_percent ~ "%" if device.health.ram_used_percent is not none else "—" }}</td></tr>
|
||||||
|
<tr><td>Uptime</td><td>{{ (device.health.uptime_seconds / 3600) | round(1) ~ " h" if device.health.uptime_seconds is not none else "—" }}</td></tr>
|
||||||
|
<tr><td>Load Average (1/5/15 Min)</td><td>{{ device.health.load_1m ~ " / " ~ device.health.load_5m ~ " / " ~ device.health.load_15m if device.health.load_1m is not none else "—" }}</td></tr>
|
||||||
|
<tr><td>Stand</td><td>{{ device.health.collected_at }}</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</figure>
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if fehler %}
|
{% if fehler %}
|
||||||
<p><mark>{{ fehler }}</mark></p>
|
<p><mark>{{ fehler }}</mark></p>
|
||||||
{% elif not hardware %}
|
{% elif not hardware %}
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<span class="state-present">aktiv</span>
|
<span class="state-present">aktiv</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if device.debug_mode_until %}<br><small>🐞 Debug-Modus aktiv</small>{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td><a href="/geraete/{{ device.id }}" role="button" class="outline">Auftragskatalog →</a></td>
|
<td><a href="/geraete/{{ device.id }}" role="button" class="outline">Auftragskatalog →</a></td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@ -4,6 +4,8 @@
|
|||||||
<p><a href="/geraete">← Geräteliste</a></p>
|
<p><a href="/geraete">← Geräteliste</a></p>
|
||||||
<h2>Installations-/Aktions-Log: {{ device.hostname or device.device_fingerprint }}</h2>
|
<h2>Installations-/Aktions-Log: {{ device.hostname or device.device_fingerprint }}</h2>
|
||||||
|
|
||||||
|
<p>Zuletzt gemeldet: {{ device.agent_last_checkin or "noch nie" }}</p>
|
||||||
|
|
||||||
{% if not events %}
|
{% if not events %}
|
||||||
<p>Für dieses Gerät liegen noch keine Einträge vor.</p>
|
<p>Für dieses Gerät liegen noch keine Einträge vor.</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user