diff --git a/package.json b/package.json index 8098f54e6..6d712c787 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "@dhis2/d2-ui-interpretations": "5.2.10", "@dhis2/d2-ui-org-unit-dialog": "5.2.10", "@dhis2/d2-ui-org-unit-tree": "5.2.10", - "@dhis2/gis-api": "32.0.19", + "@dhis2/gis-api": "^32.0.20", "@dhis2/ui": "^1.0.0-beta.15", "@material-ui/core": "^3.9.3", "@material-ui/icons": "^3.0.2", diff --git a/src/components/map/EventLayer.js b/src/components/map/EventLayer.js index b1b5ff8b2..ed1c8dfbb 100644 --- a/src/components/map/EventLayer.js +++ b/src/components/map/EventLayer.js @@ -46,7 +46,7 @@ class EventLayer extends Layer { opacity, isVisible, data, - color: color || EVENT_COLOR, + fillColor: color || EVENT_COLOR, radius: eventPointRadius || EVENT_RADIUS, onClick: this.onEventClick.bind(this), }; diff --git a/src/components/map/plugin/PluginLegend.js b/src/components/map/plugin/PluginLegend.js index 873c37d75..ef3139c9d 100644 --- a/src/components/map/plugin/PluginLegend.js +++ b/src/components/map/plugin/PluginLegend.js @@ -88,7 +88,6 @@ class PluginLegend extends PureComponent { key={alert.id} className={classes.alert} > - {alert.title}:{' '} {alert.description} ))} diff --git a/src/loaders/eventLoader.js b/src/loaders/eventLoader.js index 453e9fde8..beac25de1 100644 --- a/src/loaders/eventLoader.js +++ b/src/loaders/eventLoader.js @@ -14,6 +14,7 @@ import { getBounds, } from '../util/geojson'; import { EVENT_COLOR, EVENT_RADIUS } from '../constants/layers'; +import { createAlert } from '../util/alerts'; import { formatLocaleDate } from '../util/time'; import { cssColor } from '../util/colors'; @@ -43,6 +44,7 @@ const eventLoader = async layerConfig => { const spatialSupport = d2.system.systemInfo.databaseInfo.spatialSupport; let analyticsRequest = await getAnalyticsRequest(config); + let alert; config.name = programStage.name; @@ -85,6 +87,8 @@ const eventLoader = async layerConfig => { if (areaRadius) { config.legend.explanation = `${areaRadius} ${'m'} ${'buffer'}`; } + } else { + alert = createAlert(config.name, i18n.t('No data found')); } // TODO: Add filters to legend when using server cluster @@ -97,6 +101,10 @@ const eventLoader = async layerConfig => { }); } + if (alert) { + config.alerts = [alert]; + } + config.isLoaded = true; config.isExpanded = true; config.isVisible = true; diff --git a/src/util/styleByDataItem.js b/src/util/styleByDataItem.js index 3d2e2c602..ecbd7e301 100644 --- a/src/util/styleByDataItem.js +++ b/src/util/styleByDataItem.js @@ -164,7 +164,7 @@ export const styleByOptionSet = async config => { // For easier and faster lookup below const optionsByCode = optionSet.options.reduce((obj, option) => { - obj[option.code] = option; + obj[option.code.toLowerCase()] = option; return obj; }, {}); diff --git a/yarn.lock b/yarn.lock index 385c74e95..8ddc5d021 100644 --- a/yarn.lock +++ b/yarn.lock @@ -374,10 +374,10 @@ recompose "^0.26.0" rxjs "^5.5.7" -"@dhis2/gis-api@32.0.19": - version "32.0.19" - resolved "https://registry.yarnpkg.com/@dhis2/gis-api/-/gis-api-32.0.19.tgz#c899d72293db95072699ad1b4ae3baa0b7de9f22" - integrity sha512-m5gMQaQ46Jr8V5+lDzJw5XVCMoVbMmXfUTsJEd0Wc9LGoPLU/LAgxE5AYI1HS/EMQ2pUYihbfUmMB0N5CMSe6w== +"@dhis2/gis-api@^32.0.20": + version "32.0.20" + resolved "https://registry.yarnpkg.com/@dhis2/gis-api/-/gis-api-32.0.20.tgz#75ec1263711e9102bd244faa5c24440bca758c8c" + integrity sha512-aXAJR5EDEXRydSnrX4MKr0UMpGJZL3qC7Z/2NI63eI40D8EaScFElO0EcifM2+YkzzFbr0Jl2kcpdPqukTkooQ== dependencies: "@google/earthengine" "^0.1.172" "@mapbox/geojson-area" "^0.2.2"