Přidáno:

nová stránka /portal/incidents s title CSBot Services Portal - Incidenty
menu Provoz -> Incidenty
aktivní incidenty a historie posledních 100 incidentů
barevné stavy: open červeně, resolved zeleně
karta Aktivní incidenty a seznam Poslední incidenty na přehledu
realtime napojení přes existující operations-live.js a snapshot
sekce Incidenty služby v detailu služby, posledních 20 incidentů
DB helpery pro service_incidents
migrace/indexy pro lokální prostředí, kde tabulka ještě neexistuje
This commit is contained in:
JiriUhlir
2026-06-01 13:38:06 +02:00
parent 994171be1a
commit 6aa5e69ee4
9 changed files with 374 additions and 9 deletions
+26 -8
View File
@@ -11,6 +11,7 @@ from app.db.operations import (
get_operations_snapshot,
)
from app.routes.deployments import render_status_pill
from app.routes.incidents import render_incident_history_rows, render_open_incident_rows
from app.routes.jobs import render_job_status
from app.templates.layout import page
@@ -171,6 +172,9 @@ def operations_dashboard(request: Request, user=Depends(require_user)):
"running": snapshot["deployments"]["running"],
"failed_24h": snapshot["deployments"]["failed_24h"],
},
"incidents": {
"open": snapshot["incidents"]["open"],
},
},
)
@@ -188,6 +192,7 @@ def operations_dashboard(request: Request, user=Depends(require_user)):
<div class="stat-card stat-success"><span>Zdravé služby</span><strong data-live-count="health.healthy">{snapshot["health"]["healthy"]}</strong></div>
<div class="stat-card stat-warning"><span>Nezdravé služby</span><strong data-live-count="health.unhealthy">{snapshot["health"]["unhealthy"]}</strong></div>
<div class="stat-card stat-danger"><span>Nedostupné služby</span><strong data-live-count="health.unreachable">{snapshot["health"]["unreachable"]}</strong></div>
<div class="stat-card stat-danger"><span>Aktivní incidenty</span><strong data-live-count="incidents.open">{snapshot["incidents"]["open"]}</strong></div>
<div class="stat-card stat-warning"><span>Aktivní úlohy</span><strong data-live-count="jobs.running">{snapshot["jobs"]["running"]}</strong></div>
<div class="stat-card stat-total"><span>Nasazení dnes</span><strong data-live-count="deployments.today">{snapshot["deployments"]["today"]}</strong></div>
<div class="stat-card stat-success"><span>Online workery</span><strong data-live-count="workers.online">{snapshot["workers"]["online"]}</strong></div>
@@ -209,17 +214,15 @@ def operations_dashboard(request: Request, user=Depends(require_user)):
</div>
<div class="card">
<h2>Poslední incidenty</h2>
<h2>Aktivní incidenty</h2>
<table>
<tr>
<th>ID</th>
<th>Status</th>
<th>Typ</th>
<th>Cíl</th>
<th>Zdroj</th>
<th>Vytvořeno</th>
<th>Služba</th>
<th>Název</th>
<th>Začátek</th>
<th>Trvání</th>
</tr>
<tbody data-live-table="jobs.failed">{render_recent_jobs(snapshot["jobs"]["recent_failed"])}</tbody>
<tbody data-live-table="incidents.active">{render_open_incident_rows(snapshot["incidents"]["active"])}</tbody>
</table>
</div>
@@ -239,6 +242,21 @@ def operations_dashboard(request: Request, user=Depends(require_user)):
</table>
</div>
<div class="card">
<h2>Poslední incidenty</h2>
<table>
<tr>
<th>Služba</th>
<th>Název</th>
<th>Začátek</th>
<th>Konec</th>
<th>Trvání</th>
<th>Stav</th>
</tr>
<tbody data-live-table="incidents.recent">{render_incident_history_rows(snapshot["incidents"]["recent"])}</tbody>
</table>
</div>
<div class="card">
<h2>Poslední auditní události</h2>
<table>