From e7a120657b19591a2548c760f92dbc9c6d9e046b Mon Sep 17 00:00:00 2001 From: benya Date: Sun, 8 Feb 2026 02:23:26 +0300 Subject: [PATCH] Add Arcane deploy status view --- handlers/arcane.py | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/handlers/arcane.py b/handlers/arcane.py index a4d7f9b..daf0a07 100644 --- a/handlers/arcane.py +++ b/handlers/arcane.py @@ -27,6 +27,7 @@ def _arcane_kb(page: int, total_pages: int, items: list[dict]) -> InlineKeyboard rows.append([ InlineKeyboardButton(text=f"πŸ”„ {name}", callback_data=f"arcane:restart:{pid}"), InlineKeyboardButton(text="ℹ️", callback_data=f"arcane:details:{pid}"), + InlineKeyboardButton(text="πŸ“¦", callback_data=f"arcane:deploy:{pid}"), InlineKeyboardButton(text=action_text, callback_data=f"arcane:{action}:{pid}"), ]) @@ -205,6 +206,52 @@ async def arcane_details(cb: CallbackQuery): await cb.message.answer("\n".join(lines), parse_mode="Markdown", reply_markup=arcane_kb) +@dp.callback_query(F.data.startswith("arcane:deploy:")) +async def arcane_deploy_status(cb: CallbackQuery): + if cb.from_user.id != cfg["telegram"]["admin_id"]: + return + + _, _, pid = cb.data.split(":", 2) + base_url, api_key, env_id = _arcane_cfg() + if not base_url or not api_key: + await cb.answer("Arcane config missing") + return + + await cb.answer("Loading…") + ok, info, data = await asyncio.to_thread(get_project_details, base_url, api_key, env_id, pid) + if not ok: + await cb.message.answer(f"❌ Arcane deploy status failed: {info}", reply_markup=arcane_kb) + return + + name = data.get("name", "?") + status = data.get("status", "unknown") + status_reason = data.get("statusReason") + updated = data.get("updatedAt") + path = data.get("path") + repo = data.get("gitRepositoryURL") + commit = data.get("lastSyncCommit") + running = data.get("runningCount", 0) + total = data.get("serviceCount", 0) + icon = "🟒" if status == "running" else "🟑" + + lines = [ + f"πŸ“¦ **Deploy status: {name}**", + f"{icon} Status: {status} ({running}/{total})", + ] + if status_reason: + lines.append(f"⚠️ {status_reason}") + if updated: + lines.append(f"πŸ•’ Updated: {updated}") + if path: + lines.append(f"πŸ“ Path: {path}") + if repo: + lines.append(f"πŸ”— Repo: {repo}") + if commit: + lines.append(f"🧾 Commit: {commit}") + + await cb.message.answer("\n".join(lines), parse_mode="Markdown", reply_markup=arcane_kb) + + @dp.callback_query(F.data.startswith("arcane:up:")) async def arcane_up(cb: CallbackQuery): if cb.from_user.id != cfg["telegram"]["admin_id"]: