From cfc562eae6fb1e92df3e1f0d6a9e4ba75f2f7fb0 Mon Sep 17 00:00:00 2001 From: slava Date: Fri, 5 Jun 2026 13:10:58 +0500 Subject: [PATCH] Support datetime input for filters, improve date parsing logic, and update UI labels and button states in monitoring app. --- monitoring/app.py | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/monitoring/app.py b/monitoring/app.py index 7652bfb..f3ee481 100644 --- a/monitoring/app.py +++ b/monitoring/app.py @@ -697,16 +697,22 @@ def _ts_str(ts: float) -> str: def _parse_date(s: str, end: bool = False) -> Optional[float]: - s = (s or "").strip() + s = (s or "").strip().replace("T", " ") if not s: return None - try: - d = datetime.strptime(s, "%Y-%m-%d").replace(tzinfo=timezone.utc) - except ValueError: - return None - if end: - d += timedelta(days=1) - return d.timestamp() + # Принимаем как дату, так и дату со временем (datetime-local), всё в UTC. + for fmt, has_time in (("%Y-%m-%d %H:%M:%S", True), + ("%Y-%m-%d %H:%M", True), + ("%Y-%m-%d", False)): + try: + d = datetime.strptime(s, fmt).replace(tzinfo=timezone.utc) + except ValueError: + continue + # Для верхней границы без времени берём весь день целиком. + if end and not has_time: + d += timedelta(days=1) + return d.timestamp() + return None def _opt(value: str, current: str, label: str = "") -> str: @@ -1127,11 +1133,11 @@ def admin_dashboard( - - + + - +
(function(){{ - var running = true; + var running = false; var timer = null; var btn = document.getElementById('arBtn'); var stat = document.getElementById('arStatus'); + stat.textContent='выключено'; function applyLocalTimes(scope){{ var pad=function(n){{return(n<10?'0':'')+n;}}; @@ -1199,8 +1206,6 @@ def admin_dashboard( stat.textContent='на паузе'; }} }}; - - tick(); }})(); """ @@ -1630,8 +1635,8 @@ def admin_desktops(request: Request, date_from: str = "", date_to: str = "") -> ARC monitoring — десктопы{_STYLE}{_DESK_STYLE} {_header('desktops')} - - + + @@ -1838,8 +1843,8 @@ def admin_screens(request: Request, device: str = "", {_header('screens')} - - + + история экрана · хранение {SCREENSHOT_RETENTION_HOURS} ч · время UTC @@ -1995,8 +2000,8 @@ def admin_dumps(request: Request, device: str = "", {_header('dumps')} - - + + XML + скриншот · хранение {SCREEN_DUMP_RETENTION_DAYS} сут · время UTC