From 4b2a4cb8f29258f2448c6bca4ee496f5c51a416b Mon Sep 17 00:00:00 2001 From: Admin MPCZ Date: Tue, 5 May 2026 15:47:12 +0200 Subject: [PATCH] fix(servers/edit): timeout iTop reduit (3s connect / 10s read au lieu de 30s) + indicateur de chargement htmx visible (bouton change en 'Sauvegarde...' + message en bas du form) --- app/services/itop_service.py | 5 ++++- app/templates/base.html | 3 +++ app/templates/partials/server_edit.html | 15 ++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/app/services/itop_service.py b/app/services/itop_service.py index f90fcdc..f8f20a2 100644 --- a/app/services/itop_service.py +++ b/app/services/itop_service.py @@ -24,7 +24,10 @@ class ITopClient: data={"json_data": json.dumps(data), "auth_user": self.user, "auth_pwd": self.password}, - verify=False, timeout=30) + verify=False, timeout=(3, 10)) + # tuple (connect_timeout, read_timeout) : + # 3s pour TCP-connect (échoue vite si iTop injoignable) + # 10s pour la réponse une fois connecté return r.json() except Exception as e: log.error(f"iTop error: {e}") diff --git a/app/templates/base.html b/app/templates/base.html index 5a26327..2facf18 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -31,6 +31,9 @@ .panel-slide { transition: transform 0.3s ease, opacity 0.3s ease; } .htmx-indicator { opacity: 0; transition: opacity 200ms; } .htmx-request .htmx-indicator { opacity: 1; } + .htmx-only-request { display: none; } + .htmx-request .htmx-no-request { display: none; } + .htmx-request .htmx-only-request { display: inline; } .inline-edit { background: transparent; border: 1px solid transparent; padding: 2px 4px; } .inline-edit:hover { border-color: #1e3a5f; } .inline-edit:focus { background: #0a0e17; border-color: #00d4ff; } diff --git a/app/templates/partials/server_edit.html b/app/templates/partials/server_edit.html index f530c08..c03b65f 100644 --- a/app/templates/partials/server_edit.html +++ b/app/templates/partials/server_edit.html @@ -4,7 +4,10 @@ -
+
@@ -103,9 +106,15 @@
-
- +
+
+
+ ⏳ Sauvegarde en cours… (push iTop possible jusqu'à ~10s si réseau lent) +