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(): {app_id} {kind} - {status} + {status} {returncode_label} {finished_at} @@ -84,7 +100,7 @@ async def deployment_detail_page( title = f"Nasazení #{html.escape(str(deployment.get('id', deployment_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") @@ -109,7 +125,7 @@ async def deployment_detail_page( - + diff --git a/app/static/styles.css b/app/static/styles.css index 6a4497b..42e85c2 100644 --- a/app/static/styles.css +++ b/app/static/styles.css @@ -10,6 +10,9 @@ --secondary-dark: #173d51; --danger: #b8223e; --danger-dark: #941a31; + --danger-bg: #fdecef; + --warning: #9a5b00; + --warning-bg: #fff4d8; --success: #188654; --success-bg: #e7f5ee; } @@ -179,9 +182,29 @@ button:hover, border-radius: 999px; padding: 4px 10px; font-size: 12px; + background: #eef6f9; + color: var(--secondary); + font-weight: 700; +} + +.pill-success { background: var(--success-bg); color: var(--success); - font-weight: 700; +} + +.pill-warning { + background: var(--warning-bg); + color: var(--warning); +} + +.pill-danger { + background: var(--danger-bg); + color: var(--danger); +} + +.pill-muted { + background: #eef6f9; + color: var(--muted); } input,
Aplikace{app_id}
Typ{kind}
Status{status}
Status{status}
Návratový kód{returncode_label}
Spuštěno{started_at}
Dokončeno{finished_at}