Phase 5: Audit-Spur pro Quelle (ausklappbares Modal)

Backend
- routers/audit.py: GET /api/audit-log nimmt jetzt resource_id als Filter
  (zusätzlich zu resource_type, action, admin_id, from_ts/to_ts).

Frontend
- dashboard.html: modalAudit (Modal) für die Audit-Spur einer Ressource.
- style.css: audit-entry Styles (action-Badge mit Farbcode pro Action-Typ,
  Diff als <details>-Block mit JSON-Pre).
- sources.js:
  - showSourceAudit(id, name) öffnet Modal, lädt /audit-log?resource_type=source&resource_id=...
  - renderAuditEntries: pro Eintrag Action-Badge + Meta (ts/admin/ip) +
    optional ausklappbarer Diff (before/after-JSON)
  - formatDateTime Helper
  - Audit-Button in der Aktionen-Spalte der Grundquellen-Tabelle
Dieser Commit ist enthalten in:
claude-dev
2026-05-09 03:19:32 +00:00
Ursprung 2001815e19
Commit 6b70a7195e
4 geänderte Dateien mit 131 neuen und 0 gelöschten Zeilen

Datei anzeigen

@@ -872,3 +872,65 @@ input[type="date"].filter-select { padding: 6px 10px; }
.health-badge-ok { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.health-badge-unknown { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }
/* === Audit-Spur (Phase 5) === */
.modal.modal-large {
max-width: 720px;
}
.audit-content {
max-height: 60vh;
overflow-y: auto;
}
.audit-entry {
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 8px;
padding: 10px 12px;
margin-bottom: 8px;
background: rgba(255, 255, 255, 0.02);
}
.audit-entry-head {
display: flex;
align-items: center;
gap: 10px;
flex-wrap: wrap;
font-size: 13px;
}
.audit-entry-action {
display: inline-block;
padding: 2px 8px;
border-radius: 10px;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.audit-action-create { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.audit-action-update { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.audit-action-delete { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.audit-action-login_success { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.audit-action-login_failed { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.audit-action-login_blocked { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.audit-entry-meta {
color: #94a3b8;
font-size: 12px;
}
.audit-entry-detail {
margin-top: 8px;
}
.audit-entry-detail summary {
cursor: pointer;
font-size: 12px;
color: #94a3b8;
user-select: none;
}
.audit-entry-detail pre {
margin: 6px 0 0 0;
padding: 8px 10px;
background: rgba(0, 0, 0, 0.3);
border-radius: 4px;
font-size: 11px;
line-height: 1.4;
overflow-x: auto;
color: #e2e8f0;
max-height: 240px;
}