Show actual collector search activity in request pipeline
Magent CI/CD / verify (push) Successful in 10m55s
Magent CI/CD / deploy-prod (push) Skipped
Magent CI/CD / deploy-beta (push) Successful in 2m4s

This commit is contained in:
2026-09-06 21:14:42 +12:00
parent dec1dd902c
commit 1851fa9753
6 changed files with 386 additions and 28 deletions
+14 -4
View File
@@ -26,6 +26,7 @@ type PipelineStage = {
label: string
state: 'complete' | 'active' | 'partial' | 'attention' | 'waiting' | string
stateLabel?: string
searchStatus?: 'searching' | 'queued' | 'idle' | 'unavailable'
summary: string
available?: number
missing?: number
@@ -320,6 +321,11 @@ export default function RequestTimelinePage() {
snapshot?.presentation?.repairActivity?.visible &&
!['complete', 'attention'].includes(snapshot.presentation.repairActivity.state ?? '')
)
const searchIsActive = Boolean(
snapshot?.presentation?.pipeline?.some(
(stage) => stage.id === 'library' && ['searching', 'queued'].includes(stage.searchStatus ?? '')
)
)
const closeReleasePicker = () => {
if (busyAction?.startsWith('grab:')) return
@@ -404,8 +410,10 @@ export default function RequestTimelinePage() {
useEffect(() => {
if (!getToken() || !requestId) return
let stopped = false
let refreshing = false
const refresh = async () => {
if (document.visibilityState === 'hidden') return
if (document.visibilityState === 'hidden' || refreshing) return
refreshing = true
try {
const response = await authFetch(`${getApiBase()}/requests/${requestId}/snapshot`)
if (response.status === 401) {
@@ -418,17 +426,19 @@ export default function RequestTimelinePage() {
if (!stopped && isSnapshotPayload(payload)) setSnapshot(payload)
} catch (error) {
if (!stopped) console.error(error)
} finally {
refreshing = false
}
}
const timer = window.setInterval(
() => void refresh(),
awaitingMediaIndex || repairIsActive ? 5_000 : 15_000,
awaitingMediaIndex || repairIsActive || searchIsActive ? 5_000 : 15_000,
)
return () => {
stopped = true
window.clearInterval(timer)
}
}, [awaitingMediaIndex, repairIsActive, requestId, router])
}, [awaitingMediaIndex, repairIsActive, searchIsActive, requestId, router])
const liveDownloadKey = useMemo(() => {
const downloadStage = snapshot?.presentation?.pipeline?.find((stage) => stage.id === 'download')
@@ -864,7 +874,7 @@ export default function RequestTimelinePage() {
<span className={`request-stage-state state-${stage.state}`}>{stage.stateLabel ?? stage.state}</span>
</div>
<h3>{stage.label}</h3>
<p>{stage.summary}</p>
<p aria-live={stage.id === 'library' ? 'polite' : undefined} aria-atomic={stage.id === 'library' ? true : undefined}>{stage.summary}</p>
{stage.id === 'library' && Boolean(stage.total) && (
<div className="request-availability-meter">