File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -624,6 +624,10 @@ function hasEnabledDeviceScanners() {
624624// Update the title-bar ETA subtitle and the DataTables empty-state message.
625625// Called on every nax:scanEtaUpdate; the inner ticker keeps the title bar live between events.
626626function updateScanEtaDisplay(nextScanTime, currentState) {
627+ // Detect scan-finished transition BEFORE updating _currentStateAnchor.
628+ // justFinishedScanning is true only when the backend transitions scanning → idle.
629+ var justFinishedScanning = (currentState === 'Process: Idle') && isScanningState(_currentStateAnchor);
630+
627631 // Prefer the backend-computed values; keep previous anchors if not yet received.
628632 _nextScanTimeAnchor = nextScanTime || _nextScanTimeAnchor;
629633 _currentStateAnchor = currentState || _currentStateAnchor;
@@ -670,6 +674,13 @@ function tickTitleBar() {
670674 // Patch the visible cell text without triggering a server-side AJAX reload.
671675 $('#tableDevices tbody .dataTables_empty').html(newEmptyMsg);
672676 }
677+
678+ // When scanning just finished and the table is still empty, reload data so
679+ // newly discovered devices appear automatically. Skip reload if there are
680+ // already rows — no need to disturb the user's current view.
681+ if (justFinishedScanning && dt.page.info().recordsTotal === 0) {
682+ dt.ajax.reload(null, false); // false = keep current page position
683+ }
673684 }
674685
675686 tickTitleBar();
You can’t perform that action at this time.
0 commit comments