cestina, UI, UX

This commit is contained in:
JiriUhlir
2026-05-29 11:34:07 +02:00
parent d145161e4e
commit 6109bdfe61
11 changed files with 354 additions and 131 deletions
+19 -19
View File
@@ -17,8 +17,8 @@ DEFAULT_PAGE_SIZE = 20
def render_worker_badge(online: bool) -> str:
if online:
return '<span class="pill pill-success">ONLINE</span>'
return '<span class="pill pill-danger">OFFLINE</span>'
return '<span class="pill pill-success">online</span>'
return '<span class="pill pill-danger">offline</span>'
def pretty_json(value: str | None) -> str:
@@ -131,24 +131,24 @@ def workers_page(
)
return page(
"Workers",
"Workery",
f"""
<div class="card">
<h2>Workers</h2>
<p class="muted">Přehled worker procesů obsluhujících AppFactory joby.</p>
<h2>Workery</h2>
<p class="muted">Přehled worker procesů obsluhujících úlohy portálu.</p>
</div>
<div class="stats-grid">
<div class="stat-card stat-success"><span>Online Workers</span><strong data-live-count="workers.online">{online_count}</strong></div>
<div class="stat-card stat-danger"><span>Offline Workers</span><strong data-live-count="workers.offline">{offline_count}</strong></div>
<div class="stat-card stat-total"><span>Total Workers</span><strong data-live-count="workers.total">{total_count}</strong></div>
<div class="stat-card stat-success"><span>Online workery</span><strong data-live-count="workers.online">{online_count}</strong></div>
<div class="stat-card stat-danger"><span>Offline workery</span><strong data-live-count="workers.offline">{offline_count}</strong></div>
<div class="stat-card stat-total"><span>Celkem workerů</span><strong data-live-count="workers.total">{total_count}</strong></div>
</div>
<div class="card">
<h2>Filtry</h2>
<form method="get" action="/portal/workers" class="filter-form">
<select name="status">{status_options}</select>
<input name="q" value="{html.escape(query)}" placeholder="Worker ID">
<input name="q" value="{html.escape(query)}" placeholder="ID workeru">
<input type="hidden" name="page" value="1">
<button type="submit">Filtrovat</button>
<a class="btn btn-secondary" href="/portal/workers">Reset</a>
@@ -156,15 +156,15 @@ def workers_page(
</div>
<div class="card">
<h2>Workers</h2>
<h2>Workery</h2>
{pagination}
<table>
<tr>
<th>Worker ID</th>
<th>ID workeru</th>
<th>Status</th>
<th>Last Seen</th>
<th>Current Job</th>
<th>Started At</th>
<th>Naposledy viděn</th>
<th>Aktuální úloha</th>
<th>Spuštěn</th>
<th>Akce</th>
</tr>
<tbody{live_table_attr}>{rows}</tbody>
@@ -217,18 +217,18 @@ def worker_detail_page(worker_id: str, request: Request, user=Depends(require_us
<div class="card">
<h2>Worker {worker_id_html}</h2>
<p>
<a class="btn" href="/portal/workers">&larr; Zpět na workers</a>
<a class="btn" href="/portal/workers">&larr; Zpět na workery</a>
</p>
</div>
<div class="card">
<h2>Souhrn</h2>
<table>
<tr><th>Worker ID</th><td>{worker_id_html}</td></tr>
<tr><th>ID workeru</th><td>{worker_id_html}</td></tr>
<tr><th>Status</th><td>{badge}<br><span class="muted">{status}</span></td></tr>
<tr><th>Last Seen</th><td>{last_seen_at}</td></tr>
<tr><th>Current Job</th><td>{current_job}</td></tr>
<tr><th>Started At</th><td>{started_at}</td></tr>
<tr><th>Naposledy viděn</th><td>{last_seen_at}</td></tr>
<tr><th>Aktuální úloha</th><td>{current_job}</td></tr>
<tr><th>Spuštěn</th><td>{started_at}</td></tr>
</table>
</div>