Refactor bot and integrate services

This commit is contained in:
2026-02-07 22:10:08 +03:00
parent 492e3bd3cf
commit 588127c076
31 changed files with 1061 additions and 849 deletions

68
keyboards.py Normal file
View File

@@ -0,0 +1,68 @@
from aiogram.types import (
ReplyKeyboardMarkup,
KeyboardButton,
InlineKeyboardMarkup,
InlineKeyboardButton,
)
from state import DOCKER_MAP
menu_kb = ReplyKeyboardMarkup(
keyboard=[
[KeyboardButton(text="🩺 Health"), KeyboardButton(text="📊 Статус")],
[KeyboardButton(text="🐳 Docker"), KeyboardButton(text="📦 Backup")],
[KeyboardButton(text="🧉 Artifacts"), KeyboardButton(text="⚙️ System")],
[KeyboardButton(text=" Help")],
],
resize_keyboard=True,
)
docker_kb = ReplyKeyboardMarkup(
keyboard=[
[KeyboardButton(text="🐳 Status")],
[KeyboardButton(text="🔄 Restart"), KeyboardButton(text="📜 Logs")],
[KeyboardButton(text="⬅️ Назад")],
],
resize_keyboard=True,
)
backup_kb = ReplyKeyboardMarkup(
keyboard=[
[KeyboardButton(text="📦 Status")],
[KeyboardButton(text="📦 Last backup")],
[KeyboardButton(text="📊 Repo stats")],
[KeyboardButton(text="▶️ Run backup")],
[KeyboardButton(text="🧯 Restore help")],
[KeyboardButton(text="⬅️ Назад")],
],
resize_keyboard=True,
)
artifacts_kb = ReplyKeyboardMarkup(
keyboard=[
[KeyboardButton(text="🧉 Status"), KeyboardButton(text="🧉 Last artifact")],
[KeyboardButton(text="📤 Upload")],
[KeyboardButton(text="⬅️ Назад")],
],
resize_keyboard=True,
)
system_kb = ReplyKeyboardMarkup(
keyboard=[
[KeyboardButton(text="💽 Disks"), KeyboardButton(text="🔐 Security")],
[KeyboardButton(text="🔄 Reboot")],
[KeyboardButton(text="⬅️ Назад")],
],
resize_keyboard=True,
)
def docker_inline_kb(action: str) -> InlineKeyboardMarkup:
rows = []
for alias in DOCKER_MAP.keys():
rows.append([
InlineKeyboardButton(
text=alias,
callback_data=f"docker:{action}:{alias}"
)
])
return InlineKeyboardMarkup(inline_keyboard=rows)