Frontend Modules / mt-progress-poll
mt-progress-poll
Polls the progress of machine translation batches shown as a spinner icon in a content list view (e.g. the page tree).
Attached to a stable ancestor of the list (root element) via
data-js-mt-progress-poll, not to individual rows - rows can be inserted
dynamically later (e.g. async page tree loading, see fetch-subpages.ts),
and no longer trigger the usual per-element bootstrap once inserted.
Instead, this re-scans root for new [data-mt-task-id] elements once the
subpages-loaded event fires (mirrors the pattern in bulk-actions.ts).
Every object/language pair that a single triggered translation covers
shares one Celery task id, so rather than polling per row, all elements
sharing a data-mt-task-id are grouped and only one poll runs per task.
Once a task’s poll resolves, a one-off aggregate banner for that task’s
report is also shown (not the per-page report) via the shared
utils/mt-report-banner module - also used by content-edit-lock.ts for
the same banners, discovered through the heartbeat instead of a dedicated
poll there. Reports of runs that finished while nobody was watching them
are shown once when the list loads.