From 9e683a04e9a3bc85fc8c6b95a0d69b17769605b6 Mon Sep 17 00:00:00 2001 From: Pierre Marx Date: Wed, 18 Mar 2026 20:33:22 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20d=C3=A9sactiver=20le=20formulaire=20de?= =?UTF-8?q?=20login=20quand=20le=20serveur=20est=20injoignable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Bouton et select disabled par défaut au démarrage - Réactivés uniquement quand le health check confirme la connexion - Pastille orange pulsante + "Reconnexion en cours..." au lieu de rouge fixe - Style disabled grisé pour le bouton et le select - resetLoginForm ne force plus disabled=false --- index.html | 6 +++--- renderer.js | 29 +++++++++++++++++++++-------- styles-modern.css | 16 ++++++++++++++-- 3 files changed, 38 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index f33f655..03ec5a9 100644 --- a/index.html +++ b/index.html @@ -34,8 +34,8 @@ placeholder="Mot de passe" required /> - + @@ -50,7 +50,7 @@ > - +
diff --git a/renderer.js b/renderer.js index 8c5e3d1..7f86680 100644 --- a/renderer.js +++ b/renderer.js @@ -440,9 +440,8 @@ function resetLoginForm() { // Vider les messages d'erreur if (loginError) loginError.textContent = ''; - // Réactiver le bouton et remettre le texte par défaut + // Remettre le texte par défaut — l'état disabled depend du statut serveur if (loginBtn) { - loginBtn.disabled = false; loginBtn.textContent = 'Se connecter'; } } @@ -1240,12 +1239,29 @@ function refreshCurrentWebview() { function updateServerIndicator(status) { const indicator = document.getElementById('signalrIndicator'); const text = document.getElementById('signalrText'); + const loginBtn = document.querySelector('#loginForm button[type="submit"]'); + const terminalSelect = document.getElementById('terminal'); if (!indicator || !text) return; // Reinitialiser les classes indicator.className = 'signalr-indicator'; + const serverReady = (status === 'connected'); + + // Activer/desactiver le formulaire de login + if (loginBtn) { + loginBtn.disabled = !serverReady; + loginBtn.textContent = serverReady ? 'Se connecter' : 'Se connecter'; + } + if (terminalSelect) { + terminalSelect.disabled = !serverReady; + } + // Mettre a jour Choices.js si present + if (terminalChoices) { + serverReady ? terminalChoices.enable() : terminalChoices.disable(); + } + switch(status) { case 'connected': indicator.classList.add('connected'); @@ -1256,18 +1272,15 @@ function updateServerIndicator(status) { text.textContent = 'Connexion en cours...'; break; case 'disconnected': - indicator.classList.add('disconnected'); - text.textContent = 'Serveur déconnecté'; - break; case 'error': - indicator.classList.add('error'); - text.textContent = 'Serveur injoignable'; + indicator.classList.add('reconnecting'); + text.textContent = 'Reconnexion en cours...'; break; case 'disabled': indicator.classList.add('disabled'); text.textContent = 'Non configuré'; break; default: - text.textContent = 'Etat inconnu'; + text.textContent = 'État inconnu'; } } \ No newline at end of file diff --git a/styles-modern.css b/styles-modern.css index e2b299a..638a49a 100644 --- a/styles-modern.css +++ b/styles-modern.css @@ -157,6 +157,11 @@ body { background: #F44336; } +.signalr-indicator.reconnecting { + background: #FFC107; + animation: pulse 1.5s infinite; +} + .signalr-indicator.disabled { background: #9E9E9E; } @@ -190,12 +195,19 @@ body { transition: background 0.3s; } -#loginForm button:hover { +#loginForm button:hover:not(:disabled) { background: #5a6fd8; } #loginForm button:disabled { - background: #a8b0e8; + background: #ccc; + color: #999; + cursor: not-allowed; +} + +#loginForm select:disabled { + background: #f0f0f0; + color: #999; cursor: not-allowed; }