fix: run GML import async and track it under the METADATA_IMPORT job [DHIS2-21758]#2250
Open
karolinelien wants to merge 3 commits into
Open
fix: run GML import async and track it under the METADATA_IMPORT job [DHIS2-21758]#2250karolinelien wants to merge 3 commits into
karolinelien wants to merge 3 commits into
Conversation
…IS2-21758]
The GML org unit geometry import (POST /api/metadata/gml) is executed by the
backend as a METADATA_IMPORT job, so its progress events and summary are
published under the METADATA_IMPORT notifier category. The app polled
system/tasks/GML_IMPORT/<uid> (and taskSummaries) instead, which always returns
an empty result, so the job appeared to start ("Job started.") but never
reported progress or completion and the view hung.
Map the UI import category to the backend notifier category when polling only,
keeping GML_IMPORT as the UI category used for grouping, filtering and job
recreation.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The GML helper passed isAsync=true to uploadFile but omitted async from the request URL, so the backend ran the import synchronously and returned the report inline with no job id. The app then treated the synchronous response as an async job (task left completed=false, no id), so the UI showed "Job started" and then hung indefinitely -- even when the backend import had succeeded. Add async to the request params (matching the metadata and geojson helpers) so a real async job is created and its id is returned. Combined with the notifier category fix in useTasks (the backend runs the GML job as METADATA_IMPORT), the import now reports progress through to completion. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
🚀 Deployed on https://pr-2250--dhis2-import-export.netlify.app |
karolinelien
marked this pull request as ready for review
July 16, 2026 17:59
Move toNotifierCategory from useTasks into tasks.jsx next to the category definitions it keys off, export it, and add a unit test asserting GML_IMPORT maps to METADATA_IMPORT while every other category passes through unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Jira
DHIS2-21758 — Import/export app UI crash / hang when GML is imported
Symptom
Starting an org-unit-geometry GML import shows "Job started." and then hangs — no progress, no summary — even when the backend import actually succeeds.
Root cause (two issues on the GML path)
gml-helper.jspassedisAsync: truetouploadFilebut leftasyncout of the request URL (params = \dryRun=${dryRun}`). So the backend ran the import **synchronously** and returned the report inline with no jobid.uploadFile, told it was async, then stored the task withid: undefined, completed: falseand waited for a job that never existed — hence the perpetual "Job started" hang. (The metadata and geojson helpers correctly includeasync=${isAsync}` in the URL.)POST /api/metadata/gmlruns as aMETADATA_IMPORTjob (there is a declared-but-unusedGML_IMPORTjob type). The app polledsystem/tasks/GML_IMPORT/<id>/taskSummaries/GML_IMPORT/<id>, which return nothing, so progress/summary would still never appear.Fix
gml-helper.js: addasync=${isAsync}to the request params so a real async job is created and itsidis returned.useTasks.js: map the GML task's poll categoryGML_IMPORT → METADATA_IMPORT(backend job type) for the event/summary queries only.GML_IMPORTstays as the UI category, so job grouping, the filter chips and "Recreate job" (/import/gml) are unchanged.Verified against play/dev (2.44) and dev-2-43 (2.43)
With an org unit whose code matches the GML feature:
POST /api/metadata/gml.json?dryRun=false&async=true→200, returns a jobidwithjobType: METADATA_IMPORT.system/tasks/METADATA_IMPORT/<id>→ streams progress →"Import complete with status OK … 1 updated",completed: true.Note: a
409/E5001("No matching object for reference") on this endpoint is expected and correct when no org unit matches the GML feature's uid/code/name — it is not part of this bug.AI Assisted