Repository navigation
feat: show layer alerts in the legend [DHIS2-16362] - #3787
Draft
BRaimbault wants to merge 5 commits into
Draft
BRaimbault wants to merge 5 commits into
BRaimbault wants to merge 5 commits into
Conversation
Contributor
|
🚀 Deployed on https://pr-3787.maps.netlify.dhis2.org |
BRaimbault
commented
Oct 6, 2026
Collaborator
Author
There was a problem hiding this comment.
The code comment need review, they should be minimal and cover only essential aspects the tests or the code itself do not clearly convey. Make sure they are timeless (not about development history). Here there is an exception, clearly mark areas that should be removed once all loaders/layers use the new model.
|
This branch was previously deployed
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.




Implements DHIS2-16362
Also prepares/implements:
Stacked on #3783 (Phase 1). Review that one first: this PR only adds the error handling.
Description
Layer errors, warnings and notes are shown in the legend instead of snackbars, in the same place in the app layer card and the dashboard plugin: title, alerts, then the legend.
Alert model
{ id, severity, title, description?, details? }. Severity iserror,warningorinfo.src/constants/layerAlerts.js. Loaders pick an alert id and never write user-facing text.src/util/layerAlerts.js.createLayerAlert(id, { params, details })builds an alert from the catalog.createLayerAlertFromError(error)turns any thrown error into one, using a single map of DHIS2 error codes shared by all loaders (ERROR_CODE_ALERTSin the catalog)..catch(throwWithRequest(resource)), so the details say which request failed.Tracked entity layer
Loading, shared by the app and the plugin
src/hooks/useLoadLayer.jsreturnsloadLayerandcanLoadLayer, without redux.loadLayerpicks the loader for the layer type and gives it what it needs. It never throws: any layer type that fails finishes loading with an error alert and no data, instead of spinning forever.useLoadLayerWithRedux(renamed fromuseLayersLoader) loads the store's layers that aren't loaded yet withuseLoadLayer, and stores the results.Map.jsxloads its layers withuseLoadLayer, andLayerLoader.jsxis removed. The fix: dashboard map fixes #3779 fixes are kept: each config loads once, and layers waiting for period types load later. Loads that finish after the views changed are ignored.Reload
loadLayeralso drops them from the config, so loaders that copy the config can't bring them back.Developer preview
alertPreviewto the URL hash (#/?alertPreviewor#/<mapId>?alertPreview) to show every alert on every layer. App only. It lives insrc/util/layerAlertsPreview.js, so it can be removed with that file and one call.Quality checklist
Add N/A to items that are not applicable.
ToDos
LEGACY-ALERTS(grep -rn LEGACY-ALERTS src), plususeLoaderAlerts.js,LegendAlert.jsx, the old alert codes andloadError.Known issues
LegendAlertin the plugin.Screenshots
supporting images