Initial commit: Debian Manager — управление Debian-серверами
- SSH/SFTP управление без агентов - Пакеты (apt), Docker, файлы, systemd, ufw, cron - Плейбуки, групповые операции, планировщик - Бэкапы, отчёты, Portainer, Proxmox VE, Gitea Deploy - Терминал, Telegram-уведомления, тёмная/светлая тема
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
"""Журнал задач."""
|
||||
import flet as ft
|
||||
|
||||
from app.core.tasks import tasks
|
||||
from app.core import servers as servers_core
|
||||
|
||||
|
||||
class TasksPage(ft.Column):
|
||||
def __init__(self, page: ft.Page, go):
|
||||
super().__init__(expand=True, scroll=ft.ScrollMode.AUTO, spacing=8)
|
||||
self._page = page
|
||||
self.col = ft.Column(spacing=6)
|
||||
self.controls = [
|
||||
ft.Row([
|
||||
ft.Text("Журнал задач", size=28, weight=ft.FontWeight.BOLD),
|
||||
ft.IconButton(ft.Icons.REFRESH, on_click=lambda e: self._load()),
|
||||
]),
|
||||
self.col,
|
||||
]
|
||||
self._load()
|
||||
|
||||
def _load(self):
|
||||
self.col.controls = []
|
||||
servers = {s.id: s.name for s in servers_core.list_servers()}
|
||||
for t in tasks.list_recent(50):
|
||||
color = {"success": ft.Colors.GREEN_400, "error": ft.Colors.RED_400,
|
||||
"running": ft.Colors.BLUE_300, "cancelled": ft.Colors.ORANGE_300,
|
||||
}.get(t.status, ft.Colors.GREY_500)
|
||||
self.col.controls.append(
|
||||
ft.ExpansionTile(
|
||||
title=ft.Text(f"{t.title} — {servers.get(t.server_id, '?')}", size=14),
|
||||
subtitle=ft.Text(f"{t.created_at:%Y-%m-%d %H:%M} • {t.kind}",
|
||||
size=11),
|
||||
leading=ft.Icon(ft.Icons.CIRCLE, color=color, size=14),
|
||||
controls=[
|
||||
ft.Container(
|
||||
padding=10,
|
||||
content=ft.Text(t.log[-5000:] or "(нет лога)",
|
||||
size=11, font_family="Consolas",
|
||||
selectable=True),
|
||||
)
|
||||
],
|
||||
)
|
||||
)
|
||||
if not self.col.controls:
|
||||
self.col.controls.append(ft.Text("задач пока не было", color=ft.Colors.GREY_500))
|
||||
self._page.update()
|
||||
Reference in New Issue
Block a user