From 9b3910841b35456415d09c57529469d387423590 Mon Sep 17 00:00:00 2001 From: Bruno Raimbault Date: Fri, 29 Nov 2024 16:23:42 +0100 Subject: [PATCH] fix: update 'No data' handling [v39] (#3415) Fix: https://dhis2.atlassian.net/browse/DHIS2-18427 Update maps-gl dependency. Update getLabelStyle to return labelNoData for labelSource in maps-gl. Update ThematicLayer pop-up 'No data' logic. --- package.json | 2 +- src/components/map/layers/ThematicLayer.js | 5 ++++- src/util/labels.js | 2 ++ yarn.lock | 8 ++++---- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 573226b2c..5b0c75aaf 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@dhis2/d2-ui-core": "^7.4.0", "@dhis2/d2-ui-org-unit-dialog": "^7.4.0", "@dhis2/d2-ui-org-unit-tree": "^7.4.0", - "@dhis2/maps-gl": "^4.0.0", + "@dhis2/maps-gl": "^4.0.1", "@dhis2/ui": "^8.4.13", "abortcontroller-polyfill": "^1.7.3", "array-move": "^4.0.0", diff --git a/src/components/map/layers/ThematicLayer.js b/src/components/map/layers/ThematicLayer.js index 9e1552f04..9d9cda05f 100644 --- a/src/components/map/layers/ThematicLayer.js +++ b/src/components/map/layers/ThematicLayer.js @@ -168,7 +168,10 @@ class ThematicLayer extends Layer {
{indicator}
{periodName}
- {i18n.t('Value')}: {value ? value : i18n.t('No data')} + {i18n.t('Value')}:{' '} + {value !== null && value !== undefined + ? value + : i18n.t('No data')}
{aggregationType && aggregationType !== 'DEFAULT' && (
{aggregationType}
diff --git a/src/util/labels.js b/src/util/labels.js index 94feff4f0..12a591745 100644 --- a/src/util/labels.js +++ b/src/util/labels.js @@ -1,3 +1,4 @@ +import i18n from '@dhis2/d2-i18n'; import { cssColor } from './colors'; import { LABEL_FONT_SIZE, @@ -20,5 +21,6 @@ export const getLabelStyle = ({ lineHeight: parseInt(fontSize, 10) * 1.2 + 'px', color: cssColor(labelFontColor) || LABEL_FONT_COLOR, paddingTop: '10px', + labelNoData: i18n.t('No data'), }; }; diff --git a/yarn.lock b/yarn.lock index 607e556a1..43b604994 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2092,10 +2092,10 @@ markdown-it "^8.4.2" prop-types "^15.6.2" -"@dhis2/maps-gl@^4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@dhis2/maps-gl/-/maps-gl-4.0.0.tgz#e97df2fbc78f787a0916224d7d54fb96b9c376db" - integrity sha512-TDEIBT6rFuEZGXnBxAqKhSmCXk3wtuCf/OrVZBKxT1qk0kHau71f3lzAXbWhYAuop8t6/DyJaIcQrUYMi1Xy3w== +"@dhis2/maps-gl@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@dhis2/maps-gl/-/maps-gl-4.0.1.tgz#227a856c9a5dd0a38a8a3ea0ebd6327872850f3e" + integrity sha512-4Q9zxzPhV81zSZyWYyX7iOufUvSfqHWjXkpYUqgPq8uxhpCNj9vVwb6l5FaU/0ZbWC+wusiYeMAkLvsUpoR51g== dependencies: "@mapbox/sphericalmercator" "^1.2.0" "@turf/area" "^6.5.0"