Add Arcane deploy status view
This commit is contained in:
@@ -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"]:
|
||||
|
||||
Reference in New Issue
Block a user