From 833c4fc3d27f04347017e7aa8ebedbe46aa1f6b0 Mon Sep 17 00:00:00 2001 From: Khalid MOUTAOUAKIL Date: Mon, 6 Apr 2026 15:44:22 +0200 Subject: [PATCH] Quick Win delete, UI planning/specifics reorganises, accents retires - Safe Patching: bouton supprimer campagne (admin only) - Safe Patching: boutons nouvelle campagne et planning en haut - Safe Patching: message suppression dans les notifications - Planning: formulaire ajouter deplace apres le Gantt (compact) - Planning: accents retires des messages flash - Specifics: formulaire ajouter deplace en haut avant le tableau - Specifics: colonne Wave retiree, colonnes Stop/Start renommees Co-Authored-By: Claude Opus 4.6 (1M context) --- app/routers/safe_patching.py | 15 ++++++ app/templates/planning.html | 66 +++++++++---------------- app/templates/safe_patching.html | 27 +++++----- app/templates/safe_patching_detail.html | 6 +++ app/templates/specifics.html | 41 ++++++--------- 5 files changed, 76 insertions(+), 79 deletions(-) diff --git a/app/routers/safe_patching.py b/app/routers/safe_patching.py index 7de97cb..3ea8f3f 100644 --- a/app/routers/safe_patching.py +++ b/app/routers/safe_patching.py @@ -127,6 +127,21 @@ async def safe_patching_detail(request: Request, campaign_id: int, db=Depends(ge return templates.TemplateResponse("safe_patching_detail.html", ctx) +@router.post("/safe-patching/{campaign_id}/delete") +async def safe_patching_delete(request: Request, campaign_id: int, db=Depends(get_db)): + user = get_current_user(request) + if not user: + return RedirectResponse(url="/login") + perms = get_user_perms(db, user) + if perms.get("campaigns") != "admin": + return RedirectResponse(url="/safe-patching", status_code=303) + db.execute(text("DELETE FROM campaign_operator_limits WHERE campaign_id = :cid"), {"cid": campaign_id}) + db.execute(text("DELETE FROM patch_sessions WHERE campaign_id = :cid"), {"cid": campaign_id}) + db.execute(text("DELETE FROM campaigns WHERE id = :cid"), {"cid": campaign_id}) + db.commit() + return RedirectResponse(url="/safe-patching?msg=deleted", status_code=303) + + @router.post("/safe-patching/{campaign_id}/check-prereqs") async def safe_patching_check_prereqs(request: Request, campaign_id: int, db=Depends(get_db), branch: str = Form("hprod")): diff --git a/app/templates/planning.html b/app/templates/planning.html index 46bf4b7..747f2e4 100644 --- a/app/templates/planning.html +++ b/app/templates/planning.html @@ -19,7 +19,7 @@ {% if msg %}
- {% if msg == 'add' %}Entrée ajoutée.{% elif msg == 'edit' %}Entrée modifiée.{% elif msg == 'delete' %}Entrée supprimée.{% elif msg == 'duplicate' %}Planning dupliqué avec succès.{% elif msg == 'exists' %}L'annee cible contient déjà des entrées. Supprimez-les d'abord.{% elif msg == 'err_week' %}Numéro de semaine invalide (1-53).{% elif msg == 'err_domain' %}Domaine requis pour une entrée ouverte.{% elif msg == 'err_past' %}Impossible d'ajouter dans le passé (semaine déjà écoulée).{% elif msg == 'err_past_wed' %}Semaine en cours : ajout possible uniquement lundi et mardi (MEP urgente).{% endif %} + {% if msg == 'add' %}Entree ajoutee.{% elif msg == 'edit' %}Entree modifiee.{% elif msg == 'delete' %}Entree supprimee.{% elif msg == 'duplicate' %}Planning duplique avec succes.{% elif msg == 'exists' %}L'annee cible contient deja des entrees. Supprimez-les d'abord.{% elif msg == 'err_week' %}Numero de semaine invalide (1-53).{% elif msg == 'err_domain' %}Domaine requis pour une entree ouverte.{% elif msg == 'err_past' %}Impossible d'ajouter dans le passe (semaine deja ecoulee).{% elif msg == 'err_past_wed' %}Semaine en cours : ajout possible uniquement lundi et mardi (MEP urgente).{% endif %}
{% endif %} @@ -94,6 +94,29 @@ +{% if perms.planning in ('edit', 'admin') %} +
+
+ + Ajouter : + + + + + + + +
+
+{% endif %} +
{% for cycle_num in [1, 2, 3] %} @@ -203,45 +226,4 @@
-{% if perms.planning in ('edit', 'admin') %} - -
-

Ajouter une entree

-
- -
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- -
-
-{% endif %} {% endblock %} diff --git a/app/templates/safe_patching.html b/app/templates/safe_patching.html index fa8f20f..dbfc6be 100644 --- a/app/templates/safe_patching.html +++ b/app/templates/safe_patching.html @@ -1,12 +1,22 @@ {% extends 'base.html' %} {% block title %}Safe Patching{% endblock %} {% block content %} -

Safe Patching — Quick Win

-

Patching sans interruption de service : exclut tout ce qui nécessite un reboot ou un restart de service.

+
+
+

Safe Patching — Quick Win

+

Patching sans interruption de service : exclut tout ce qui nécessite un reboot ou un restart.

+
+
+ {% if can_create %} + + {% endif %} + Planning +
+
{% if msg %}
- {% if msg == 'error' %}Erreur à la création (semaine déjà existante ?).{% endif %} + {% if msg == 'error' %}Erreur à la création (semaine déjà existante ?).{% elif msg == 'deleted' %}Campagne supprimée.{% endif %}
{% endif %} @@ -30,14 +40,10 @@ {% endif %} - + {% if can_create %} -
-
-

Nouvelle campagne Quick Win

- -
-
+
+ {% set p = perms if perms is defined else request.state.perms %} + {% if p.campaigns == 'admin' %} +
+ +
+ {% endif %}
{% if msg %} diff --git a/app/templates/specifics.html b/app/templates/specifics.html index 7691059..4de2986 100644 --- a/app/templates/specifics.html +++ b/app/templates/specifics.html @@ -24,6 +24,19 @@ + +
+
+ Ajouter : + + + +
+
+ @@ -36,9 +49,8 @@ Domaine Env Flags - Stop order - Start order - Wave + Stop + Start Auto-restart Note Actions @@ -65,7 +77,6 @@ {% if e.stop_order %}#{{ e.stop_order }}{% else %}-{% endif %} {% if e.reboot_order %}#{{ e.reboot_order }}{% if e.patch_order_group %} ({{ e.patch_order_group }}){% endif %}{% else %}-{% endif %} - {% if e.patch_wave %}V{{ e.patch_wave }} {{ e.patch_wave_group or "" }}{% else %}-{% endif %} {{ 'Oui' if e.auto_restart else 'Non' }} {{ (e.note or '')[:80] }}{% if e.note and e.note|length > 80 %}...{% endif %} @@ -81,26 +92,4 @@ - - -
- Waves : Les serveurs d'un même groupe (DNS, SMTP, HAProxy...) ne doivent pas être patchés le même jour. V1 = première vague (jour J), V2 = deuxième vague (J + délai). Le délai entre vagues est configurable (défaut : 1 jour). Exemple : DNS V1 (dns1+dns3 lundi) → DNS V2 (dns2+dns4 mardi). -
-
-

Ajouter un serveur specifique

-
-
- - -
-
- - -
- -
-
{% endblock %}