Explain search outcomes and provide a direct version selection action
Magent CI/CD / verify (push) Successful in 1m50s
Magent CI/CD / deploy-prod (push) Skipped
Magent CI/CD / deploy-beta (push) Skipped

This commit is contained in:
2026-09-13 12:16:28 +12:00
parent f57058eb26
commit e3332bec1f
4 changed files with 65 additions and 11 deletions
+16 -1
View File
@@ -148,6 +148,7 @@ type OperationEvent = {
}
type OperationProgress = {
summary?: { title: string; message: string; next: string; action?: string }
id: string
label: string
status: 'running' | 'complete' | 'error' | string
@@ -601,8 +602,22 @@ export default function RequestTimelinePage() {
try { result = await response.clone().json() } catch { /* Non-JSON error is handled below. */ }
const needsAttention = !response.ok || result?.status === 'attention' || result?.outcome === 'attention'
const finalState = needsAttention ? 'error' : result?.status === 'searching' ? 'searching' : 'complete'
const interactiveSearch = /\/actions\/search(?:\?|$)/.test(url)
const items = Array.isArray(result?.releases) ? result.releases : []
const available = items.some((item: ReleaseOption) => item.selectable && !item.requiresOverride)
const outside = items.some((item: ReleaseOption) => item.selectable && item.requiresOverride)
const canChoose = available || (outside && result?.canIgnoreProfileLimits === true)
const summary = interactiveSearch
? !response.ok
? { title: 'Search could not finish', message: 'We could not complete the search.', next: 'Try again shortly. If it keeps happening, contact an admin.' }
: canChoose
? { title: available ? 'Downloads found' : 'Other versions are available', message: available ? 'Choose the version you want to download.' : 'These versions are outside your usual download settings.', next: available ? 'Your download starts after you choose a version.' : 'You can review them and confirm a download outside your profile.', action: 'Choose a version' }
: { title: items.length ? 'No suitable downloads' : 'Nothing available yet', message: items.length ? 'The versions found cannot be downloaded with your current settings.' : 'No downloads were found in this search.', next: result?.nextOffset != null ? 'You can check the next group of missing episodes.' : 'You can try again later.', action: result?.nextOffset != null ? 'View search results' : undefined }
: response.ok && /\/actions\/grab$/.test(url)
? { title: 'Waiting to start', message: 'Your download has been sent.', next: 'Close this box to follow its progress. It may take a moment to start.' }
: undefined
setOperationProgress((current) => current?.id === operationId ? {
...current, status: finalState,
...current, status: finalState, summary,
events: [...current.events.map(event => event.state === 'active' ? { ...event, state: 'complete' as const } : event), { id: 'result', service: 'Magent', state: needsAttention ? 'error' : 'complete',
message: result?.message || (typeof result?.detail === 'string' ? result.detail : response.ok ? 'Action completed. The pipeline will update as the media services report progress.' : 'The action failed. Recheck the request before trying again.') }],
} : current)