From 87a1e02ff3cdcb0b757aa02081aca434ef957e22 Mon Sep 17 00:00:00 2001 From: Fabian Mendoza Date: Tue, 14 Jul 2026 13:59:42 -0400 Subject: [PATCH] feat(dashboard): version loading indicator + immediate first poll (#181) * feat(dashboard): show version loading indicator and fire poll immediately - Show "Verificando..." while /api/version resolves on first load - Fire first version poll immediately instead of waiting 15s - Fallback to "-" when version is unavailable * i18n: localize the version-check loading label The sidebar version indicator hard-coded the Spanish string 'Verificando...', shipping it to every user regardless of locale. Route it through i18n instead: new 'common.checking' key (en: 'Checking...', es: 'Verificando...'); all other locales fall back to the English canonical, matching the rest of the UI. Co-Authored-By: Claude Opus 4.8 --------- Co-authored-by: ScreenTinker Co-authored-by: Claude Opus 4.8 --- frontend/js/app.js | 13 ++++++++++--- frontend/js/i18n/en.js | 1 + frontend/js/i18n/es.js | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/frontend/js/app.js b/frontend/js/app.js index 8036cea..96c106f 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -570,10 +570,15 @@ let knownHash = null; export function updateVersionIndicator({ version, latest_version, update_available }) { const label = document.getElementById('versionLabel'); const badge = document.getElementById('versionBadge'); - if (label) label.textContent = version ? 'v' + version : ''; + if (label) label.textContent = version ? 'v' + version : '-'; if (badge) badge.hidden = !update_available; } -setInterval(async () => { + +// Show loading state while first poll resolves +const verLabel = document.getElementById('versionLabel'); +if (verLabel) verLabel.textContent = t('common.checking'); + +async function checkVersion() { try { const res = await fetch('/api/version'); const data = await res.json(); @@ -590,7 +595,9 @@ setInterval(async () => { } updateVersionIndicator(data); } catch {} -}, 15000); +} +checkVersion(); // Fire first poll immediately +setInterval(checkVersion, 15000); // Session timeout warning - check JWT expiry every minute if (isAuthenticated()) { diff --git a/frontend/js/i18n/en.js b/frontend/js/i18n/en.js index 1f5c799..4babdca 100644 --- a/frontend/js/i18n/en.js +++ b/frontend/js/i18n/en.js @@ -35,6 +35,7 @@ export default { 'common.saving': 'Saving...', 'common.deleting': 'Deleting...', 'common.loading': 'Loading...', + 'common.checking': 'Checking...', 'confirm_delete.type_label': 'Type "{name}" to confirm', 'confirm_delete.failed': 'Action failed', 'common.connected': 'Connected', diff --git a/frontend/js/i18n/es.js b/frontend/js/i18n/es.js index 560ac14..fd64d95 100644 --- a/frontend/js/i18n/es.js +++ b/frontend/js/i18n/es.js @@ -31,6 +31,7 @@ export default { 'common.edit': 'Editar', 'common.done': 'Listo', 'common.loading': 'Cargando...', + 'common.checking': 'Verificando...', 'common.connected': 'Conectado', 'common.disconnected': 'Desconectado', 'common.never': 'Nunca',