From 2a10ec55ab8e5a97860ee9ef1824962da7366a40 Mon Sep 17 00:00:00 2001 From: Admin MPCZ Date: Wed, 15 Apr 2026 00:22:22 +0200 Subject: [PATCH] Page /audit: liste les audits en cours avec bouton Reprendre --- app/routers/audit.py | 10 ++++++++++ app/templates/audit.html | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/app/routers/audit.py b/app/routers/audit.py index 78c3a6d..5b8df9a 100644 --- a/app/routers/audit.py +++ b/app/routers/audit.py @@ -76,11 +76,21 @@ async def audit_page(request: Request, db=Depends(get_db), domains = db.execute(text("SELECT code, name FROM domains ORDER BY display_order")).fetchall() zones = db.execute(text("SELECT DISTINCT name FROM zones ORDER BY name")).fetchall() + # Jobs audit en cours (RAM) + from ..services.realtime_audit_service import _audit_jobs + active_jobs = [ + {"id": j["id"], "total": j["total"], "done": j["done"], + "parallel": j.get("parallel", "?"), "started_at": j.get("started_at", 0)} + for j in _audit_jobs.values() if not j.get("finished") + ] + active_jobs.sort(key=lambda x: -x["started_at"]) + ctx = base_context(request, db, user) ctx.update({ "app_name": APP_NAME, "entries": entries, "stats": stats, "filter": filter, "search": search, "last_audit": last_audit, "domains": domains, "zones": zones, + "active_jobs": active_jobs, }) return templates.TemplateResponse("audit.html", ctx) diff --git a/app/templates/audit.html b/app/templates/audit.html index 95d53f1..c609089 100644 --- a/app/templates/audit.html +++ b/app/templates/audit.html @@ -15,6 +15,18 @@ +{% if active_jobs %} +
+
⏳ Audits en cours
+ {% for j in active_jobs %} +
+ {{ j.id }} + {{ j.done }}/{{ j.total }} — {{ j.parallel }} en parallèle + Reprendre +
+ {% endfor %} +
+ {% set p = perms if perms is defined else request.state.perms %} {% if p.audit in ('edit', 'admin') %}