diff --git a/.gitignore b/.gitignore index 2782b637..391b662a 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,4 @@ scripts/Deployment/build_and_upload_release_agent_build.ps1 .dotnet-home/ .vscode/ +TODO.txt diff --git a/src/Web/autopilot-monitor-web/app/progress/page.tsx b/src/Web/autopilot-monitor-web/app/progress/page.tsx index 2a061c52..6ab70518 100644 --- a/src/Web/autopilot-monitor-web/app/progress/page.tsx +++ b/src/Web/autopilot-monitor-web/app/progress/page.tsx @@ -261,39 +261,37 @@ export default function ProgressPortalPage() { if (e.key === "Enter") searchBySerial(); }; - // Derive app installation progress from events - const appProgress = useMemo(() => { - // Check esp_ui_state events for app progress + // Derive app installation summary from events + const appSummary = useMemo(() => { + // Best source: app_tracking_summary (real-time aggregate from agent) + const summaryEvents = events.filter((e) => e.eventType === "app_tracking_summary"); + if (summaryEvents.length > 0) { + const latest = summaryEvents[summaryEvents.length - 1]; + const d = latest.data; + if (d) { + const total = parseInt(d.totalApps ?? d.total_apps ?? "0", 10); + if (total > 0) { + return { + total, + installed: parseInt(d.installed ?? "0", 10), + failed: parseInt(d.failed ?? "0", 10), + installing: parseInt(d.installing ?? "0", 10), + downloading: parseInt(d.downloading ?? "0", 10), + }; + } + } + } + + // Fallback: esp_ui_state (ESP blocking app counts) const espEvents = events.filter((e) => e.eventType === "esp_ui_state"); if (espEvents.length > 0) { const latest = espEvents[espEvents.length - 1]; const d = latest.data; if (d) { - const completed = parseInt( - d.blocking_apps_completed ?? d.blockingAppsCompleted ?? "0", - 10 - ); - const total = parseInt( - d.blocking_apps_total ?? d.blockingAppsTotal ?? "0", - 10 - ); - const currentItem = - d.current_item ?? d.currentItem ?? d.status_text ?? d.statusText ?? null; - if (total > 0) return { completed, total, currentItem }; - } - } - - // Check download_progress events for current app name - const downloadEvents = events.filter((e) => e.eventType === "download_progress"); - if (downloadEvents.length > 0) { - const latest = downloadEvents[downloadEvents.length - 1]; - const d = latest.data; - if (d) { - const appName = d.app_name ?? d.appName ?? null; - const status = d.status ?? ""; - const isComplete = status === "completed" || status === "failed" || d.isCompleted === true || d.is_completed === true; - if (appName && !isComplete) { - return { completed: 0, total: 0, currentItem: appName }; + const total = parseInt(d.blocking_apps_total ?? d.blockingAppsTotal ?? "0", 10); + const installed = parseInt(d.blocking_apps_completed ?? d.blockingAppsCompleted ?? "0", 10); + if (total > 0) { + return { total, installed, failed: 0, installing: 0, downloading: 0 }; } } } @@ -727,19 +725,20 @@ export default function ProgressPortalPage() { {step.label} {isCurrent && (step.id === 3 || step.id === 5) && - appProgress && - appProgress.total > 0 && - appProgress.completed > 0 && - ` (${appProgress.completed}/${appProgress.total})`} + appSummary && + appSummary.total > 0 && + ` (${appSummary.installed}/${appSummary.total})`} - {/* App install detail below the "Installing apps" steps */} + {/* Current activity detail below the active step */} {isCurrent && (step.id === 3 || step.id === 5) && (
Installing
+