Real-time job progress tracking via Server-Sent Events.
Source: web/frontend/src/hooks/useJobProgress.ts
useJobProgress(jobId: string | undefined, enabled: boolean): ProgressEvent | null
Parameters:
| Param | Type | Description |
|---|---|---|
jobId |
string \| undefined |
Job to track |
enabled |
boolean |
Whether to open the SSE connection |
Returns: Current ProgressEvent or null
enabled is true and jobId is set, opens an EventSource to /api/jobs/{jobId}/eventsprogress events — parses JSON and updates statedone events — final update, then closes connection| SSE Event | Action |
|---|---|
progress |
Update ProgressEvent state |
done |
Update state + close connection |
error |
Close connection |
{
job_id: string
status: string
phase: string
current: number
total: number
message: string
data?: {
event: "page_start" | "page_progress" | "page_done"
page: number
completed: number
total: number
elapsed?: number
seconds?: number
page_times?: Array<{ page: number; seconds: number }>
} | null
}
Used by JobDetail Page to show real-time progress.
Connects to Events Router SSE endpoint.