diff --git a/front/devices.php b/front/devices.php index 0c6bab74..d8855fea 100755 --- a/front/devices.php +++ b/front/devices.php @@ -577,11 +577,15 @@ var _nextScanTimeAnchor = null; var _currentStateAnchor = null; var _scanEtaTickerId = null; var _pluginsData = null; +var _wasImminent = false; // true once the countdown displayed "imminent"; gates the Scanning... label +var _imminentForTime = null; // the _nextScanTimeAnchor value that last set _wasImminent + // prevents re-arming on the same (already-consumed) timestamp // Returns true when the backend is actively scanning (not idle). -// States that indicate scanning: Process: Start, Check scan, Scan processed. +// Uses an exclusion approach — only "Process: Idle" and an empty/null state are non-scanning. +// This future-proofs against new states added to the scan pipeline (e.g. "Plugin: AVAHISCAN"). function isScanningState(state) { - return ['Process: Start', 'Check scan', 'Scan processed'].indexOf(state) !== -1; + return !!state && state !== 'Process: Idle'; } // Fetch plugins.json once on page load so we can guard ETA display to device_scanner plugins only. @@ -603,31 +607,37 @@ function updateScanEtaDisplay(nextScanTime, currentState) { _nextScanTimeAnchor = nextScanTime || _nextScanTimeAnchor; _currentStateAnchor = currentState || _currentStateAnchor; + // Reset the imminent gate when the scan finishes back to idle so the next cycle starts clean. + if (currentState === 'Process: Idle') { _wasImminent = false; } + // Restart the per-second title-bar ticker if (_scanEtaTickerId !== null) { clearInterval(_scanEtaTickerId); } + function getEtaLabel() { + if (!hasEnabledDeviceScanners()) return ''; + if (isScanningState(_currentStateAnchor) && _wasImminent) return getString('Device_Scanning'); + var label = computeNextScanLabel(_nextScanTimeAnchor); + // Arm _wasImminent only for a NEW next_scan_time anchor — not the already-consumed one. + // This prevents the ticker from re-arming immediately after "Process: Idle" resets the flag + // while _nextScanTimeAnchor still holds the now-past timestamp. + if (label === getString('Device_NextScan_Imminent') && _nextScanTimeAnchor !== _imminentForTime) { + _wasImminent = true; + _imminentForTime = _nextScanTimeAnchor; + } + return label; + } + function tickTitleBar() { var eta = document.getElementById('nextScanEta'); if (!eta) return; - if (!hasEnabledDeviceScanners()) { - eta.style.display = 'none'; - return; - } - // Show 'Scanning...' when the backend is actively scanning, countdown otherwise. - eta.textContent = isScanningState(_currentStateAnchor) - ? getString('Device_Scanning') - : computeNextScanLabel(_nextScanTimeAnchor); + var label = getEtaLabel(); + if (!label) { eta.style.display = 'none'; return; } + eta.textContent = label; eta.style.display = ''; } // Update DataTables empty message once per SSE event — avoids AJAX spam on server-side tables. - // Show 'Scanning...' when active, countdown when idle, nothing when no device_scanner enabled. - var label = ''; - if (hasEnabledDeviceScanners()) { - label = isScanningState(_currentStateAnchor) - ? getString('Device_Scanning') - : computeNextScanLabel(_nextScanTimeAnchor); - } + var label = getEtaLabel(); if ($.fn.DataTable.isDataTable('#tableDevices')) { var dt = $('#tableDevices').DataTable(); dt.settings()[0].oLanguage.sEmptyTable = buildEmptyDeviceTableMessage(label); diff --git a/front/php/templates/language/ar_ar.json b/front/php/templates/language/ar_ar.json index 17d8e876..98ec45a4 100644 --- a/front/php/templates/language/ar_ar.json +++ b/front/php/templates/language/ar_ar.json @@ -804,4 +804,4 @@ "settings_system_label": "نظام", "settings_update_item_warning": "قم بتحديث القيمة أدناه. احرص على اتباع التنسيق السابق. لم يتم إجراء التحقق.", "test_event_tooltip": "احفظ التغييرات أولاً قبل اختبار الإعدادات." -} +} \ No newline at end of file diff --git a/front/php/templates/language/ca_ca.json b/front/php/templates/language/ca_ca.json index d79950bb..67b4292b 100644 --- a/front/php/templates/language/ca_ca.json +++ b/front/php/templates/language/ca_ca.json @@ -804,4 +804,4 @@ "settings_system_label": "Sistema", "settings_update_item_warning": "Actualitza el valor sota. Sigues curós de seguir el format anterior. No hi ha validació.", "test_event_tooltip": "Deseu els canvis primer abans de comprovar la configuració." -} +} \ No newline at end of file diff --git a/front/php/templates/language/de_de.json b/front/php/templates/language/de_de.json index 4988cd77..77d4ca40 100644 --- a/front/php/templates/language/de_de.json +++ b/front/php/templates/language/de_de.json @@ -877,4 +877,4 @@ "settings_system_label": "System", "settings_update_item_warning": "", "test_event_tooltip": "Speichere die Änderungen, bevor Sie die Einstellungen testen." -} +} \ No newline at end of file diff --git a/front/php/templates/language/en_us.json b/front/php/templates/language/en_us.json index c83f074b..efad9975 100755 --- a/front/php/templates/language/en_us.json +++ b/front/php/templates/language/en_us.json @@ -203,7 +203,7 @@ "Device_MultiEdit_MassActions": "Mass actions:", "Device_MultiEdit_No_Devices": "No devices selected.", "Device_MultiEdit_Tooltip": "Careful. Clicking this will apply the value on the left to all devices selected above.", - "Device_NextScan_Imminent": "imminent", + "Device_NextScan_Imminent": "Imminent...", "Device_NextScan_In": "Next scan in ", "Device_NoData_Help": "If devices don't appear after the scan, check your SCAN_SUBNETS setting and documentation.", "Device_NoData_Scanning": "Waiting for the first scan - this may take several minutes after the initial setup.", diff --git a/front/php/templates/language/es_es.json b/front/php/templates/language/es_es.json index 2a72ab1c..577e1fda 100644 --- a/front/php/templates/language/es_es.json +++ b/front/php/templates/language/es_es.json @@ -875,4 +875,4 @@ "settings_system_label": "Sistema", "settings_update_item_warning": "Actualice el valor a continuación. Tenga cuidado de seguir el formato anterior. O la validación no se realiza.", "test_event_tooltip": "Guarda tus cambios antes de probar nuevos ajustes." -} +} \ No newline at end of file diff --git a/front/php/templates/language/fr_fr.json b/front/php/templates/language/fr_fr.json index 4adb756e..4fa8ee6e 100644 --- a/front/php/templates/language/fr_fr.json +++ b/front/php/templates/language/fr_fr.json @@ -804,4 +804,4 @@ "settings_system_label": "Système", "settings_update_item_warning": "Mettre à jour la valeur ci-dessous. Veillez à bien suivre le même format qu'auparavant. Il n'y a pas de pas de contrôle.", "test_event_tooltip": "Enregistrer d'abord vos modifications avant de tester vôtre paramétrage." -} +} \ No newline at end of file diff --git a/front/php/templates/language/ja_jp.json b/front/php/templates/language/ja_jp.json index a0da15be..a1fe40ac 100644 --- a/front/php/templates/language/ja_jp.json +++ b/front/php/templates/language/ja_jp.json @@ -804,4 +804,4 @@ "settings_system_label": "システム", "settings_update_item_warning": "以下の値を更新してください。以前のフォーマットに従うよう注意してください。検証は行われません。", "test_event_tooltip": "設定をテストする前に、まず変更を保存してください。" -} +} \ No newline at end of file diff --git a/front/php/templates/language/nb_no.json b/front/php/templates/language/nb_no.json index 8bbb9a05..3fc67966 100644 --- a/front/php/templates/language/nb_no.json +++ b/front/php/templates/language/nb_no.json @@ -804,4 +804,4 @@ "settings_system_label": "System", "settings_update_item_warning": "Oppdater verdien nedenfor. Pass på å følge forrige format. Validering etterpå utføres ikke.", "test_event_tooltip": "Lagre endringene først, før du tester innstillingene dine." -} +} \ No newline at end of file diff --git a/front/php/templates/language/pl_pl.json b/front/php/templates/language/pl_pl.json index fb25d082..1e46dc20 100644 --- a/front/php/templates/language/pl_pl.json +++ b/front/php/templates/language/pl_pl.json @@ -804,4 +804,4 @@ "settings_system_label": "System", "settings_update_item_warning": "Zaktualizuj wartość poniżej. Uważaj, aby zachować poprzedni format. Walidacja nie jest wykonywana.", "test_event_tooltip": "Najpierw zapisz swoje zmiany, zanim przetestujesz ustawienia." -} +} \ No newline at end of file diff --git a/front/php/templates/language/pt_br.json b/front/php/templates/language/pt_br.json index 89cff78b..2005b90e 100644 --- a/front/php/templates/language/pt_br.json +++ b/front/php/templates/language/pt_br.json @@ -804,4 +804,4 @@ "settings_system_label": "", "settings_update_item_warning": "", "test_event_tooltip": "Guarde as alterações antes de testar as definições." -} +} \ No newline at end of file diff --git a/front/php/templates/language/pt_pt.json b/front/php/templates/language/pt_pt.json index 045faf1b..b60aa27d 100644 --- a/front/php/templates/language/pt_pt.json +++ b/front/php/templates/language/pt_pt.json @@ -804,4 +804,4 @@ "settings_system_label": "", "settings_update_item_warning": "", "test_event_tooltip": "Guarde as alterações antes de testar as definições." -} +} \ No newline at end of file diff --git a/front/php/templates/language/ru_ru.json b/front/php/templates/language/ru_ru.json index c23f2c7a..6a8cb0df 100644 --- a/front/php/templates/language/ru_ru.json +++ b/front/php/templates/language/ru_ru.json @@ -804,4 +804,4 @@ "settings_system_label": "Система", "settings_update_item_warning": "Обновить значение ниже. Будьте осторожны, следуя предыдущему формату. Проверка не выполняется.", "test_event_tooltip": "Сначала сохраните изменения, прежде чем проверять настройки." -} +} \ No newline at end of file diff --git a/front/php/templates/language/tr_tr.json b/front/php/templates/language/tr_tr.json index 8621925e..e9e3d63c 100644 --- a/front/php/templates/language/tr_tr.json +++ b/front/php/templates/language/tr_tr.json @@ -804,4 +804,4 @@ "settings_system_label": "Sistem", "settings_update_item_warning": "", "test_event_tooltip": "" -} +} \ No newline at end of file diff --git a/front/php/templates/language/uk_ua.json b/front/php/templates/language/uk_ua.json index bd33374c..3fe7e7ca 100644 --- a/front/php/templates/language/uk_ua.json +++ b/front/php/templates/language/uk_ua.json @@ -804,4 +804,4 @@ "settings_system_label": "Система", "settings_update_item_warning": "Оновіть значення нижче. Слідкуйте за попереднім форматом. Перевірка не виконана.", "test_event_tooltip": "Перш ніж перевіряти налаштування, збережіть зміни." -} +} \ No newline at end of file diff --git a/front/php/templates/language/zh_cn.json b/front/php/templates/language/zh_cn.json index ca715ad6..17321914 100644 --- a/front/php/templates/language/zh_cn.json +++ b/front/php/templates/language/zh_cn.json @@ -804,4 +804,4 @@ "settings_system_label": "系统", "settings_update_item_warning": "更新下面的值。请注意遵循先前的格式。未执行验证。", "test_event_tooltip": "在测试设置之前,请先保存更改。" -} +} \ No newline at end of file