fix(settings): show external live sync progress

Read source sync status when projection analysis is idle so Settings can keep Channel Analysis progress visible during startup or externally-triggered live source refreshes.

Refs #47

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
blomios
2026-10-08 22:16:00 +02:00
parent 266ff5d4ea
commit 92f3d22d2f
2 changed files with 153 additions and 1 deletions

View File

@ -129,6 +129,24 @@ class SettingsPage {
} catch (err) {
this.liveAnalysisStatus = { status: 'error', error: err.message };
}
const projectionPresentation = LiveAnalysisPresentation.present(this.liveAnalysisStatus);
if (!projectionPresentation.busy && API.sources?.getStatus) {
try {
const sourceStatuses = await API.sources.getStatus();
const liveSourceSyncing = Array.isArray(sourceStatuses) && sourceStatuses.some(source =>
source?.status === 'syncing' && ['live', 'all'].includes(source?.type)
);
if (liveSourceSyncing) {
this.liveAnalysisStatus = {
status: 'building',
phase: 'refreshing_live_sources',
externalSourceSync: true
};
}
} catch (err) {
// Source status is supplementary; projection status remains authoritative.
}
}
this.renderLiveAnalysisStatus(this.liveAnalysisStatus);
const presentation = LiveAnalysisPresentation.present(this.liveAnalysisStatus);
if (presentation.busy) this.startLiveAnalysisPolling();
@ -154,7 +172,7 @@ class SettingsPage {
const presentation = LiveAnalysisPresentation.present(status);
buttons.forEach(button => { button.disabled = presentation.busy; });
const rebuildButton = document.getElementById('live-rebuild-catalog-button');
const fullRefreshBusy = presentation.busy &&
const fullRefreshBusy = presentation.busy && !status.externalSourceSync &&
(this.currentLiveAnalysisAction === 'rebuild' ||
LiveAnalysisPresentation.isFullRefreshPhase(presentation.phase));
if (rebuildButton) rebuildButton.textContent = fullRefreshBusy ? 'Refreshing…' : 'Run full refresh';