From a2edca2fecf78bad074d41c0d9291519bf83f1fb Mon Sep 17 00:00:00 2001 From: JiriUhlir <149317995+JiriUhlir@users.noreply.github.com> Date: Thu, 28 May 2026 10:08:59 +0200 Subject: [PATCH] deploz statuses css --- app/routes/deployments.py | 24 ++++++++++++++++++++---- app/static/styles.css | 25 ++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/app/routes/deployments.py b/app/routes/deployments.py index 329adfb..c203ce2 100644 --- a/app/routes/deployments.py +++ b/app/routes/deployments.py @@ -9,6 +9,22 @@ from app.templates.layout import page router = APIRouter() +def render_status_pill(status: str | None) -> str: + status_value = status or "" + normalized = status_value.strip().lower() + + if normalized in {"ok", "success", "succeeded", "done", "deployed", "completed"}: + class_name = "pill pill-success" + elif normalized in {"running", "pending", "queued", "in_progress", "starting"}: + class_name = "pill pill-warning" + elif normalized in {"failed", "failure", "error", "cancelled", "canceled"}: + class_name = "pill pill-danger" + else: + class_name = "pill pill-muted" + + return f'{html.escape(status_value)}' + + @router.get("/deployments", response_class=HTMLResponse) async def deployments_page(): deployments = get_deployments() @@ -18,7 +34,7 @@ async def deployments_page(): deployment_id = html.escape(str(deployment.get("id", ""))) app_id = html.escape(deployment.get("app_id", "") or "") kind = html.escape(deployment.get("kind", "") or "") - status = html.escape(deployment.get("status", "") or "") + status = render_status_pill(deployment.get("status")) started_at = html.escape(deployment.get("started_at", "") or "") finished_at = html.escape(deployment.get("finished_at", "") or "") returncode = deployment.get("returncode") @@ -32,7 +48,7 @@ async def deployments_page():
| Aplikace | {app_id} |
|---|---|
| Typ | {kind} |
| Status | {status} |
| Status | {status} |
| Návratový kód | {returncode_label} |
| Spuštěno | {started_at} |
| Dokončeno | {finished_at} |