Skip to content

Commit

Permalink
fix: force overlay for geojson layers
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Jun 6, 2024
1 parent 3e65cfb commit 45c2008
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
46 changes: 45 additions & 1 deletion src/config/field-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defaultAnalyticsPeriodBoundaries, createDefaultRuleForField } from './f

/**
* Rule functions in EditModel/form-rules
*
*
* Rules for the form fields.
* If multiple `when` objects are specified these are evaluated as an OR.
* The following would result check if either of the statements return true
Expand Down Expand Up @@ -388,6 +388,50 @@ export default new Map([
elseValue: false,
}],
},
{
// When mapService is geojson or arcgis, then mapLayerPosition must be OVERLAY
field: 'mapLayerPosition',
when: [
{
field: 'mapService',
operator: 'ONEOF',
value: ['GEOJSON_URL', 'ARCGIS_FEATURE'],
},
],
operations: [
{
field: 'mapLayerPosition',
type: 'CHANGE_VALUE',

setValue: (model, fieldConfig) => {
fieldConfig.value = 'OVERLAY';
model[fieldConfig.name] = 'OVERLAY';
},
},
],
},
{
// When mapService is Vector style, then mapLayerPosition must be BASEMAP
field: 'mapLayerPosition',
when: [
{
field: 'mapService',
operator: 'EQUALS',
value: 'VECTOR_STYLE',
},
],
operations: [
{
field: 'mapLayerPosition',
type: 'CHANGE_VALUE',

setValue: (model, fieldConfig) => {
fieldConfig.value = 'BASEMAP';
model[fieldConfig.name] = 'BASEMAP';
},
},
],
},
]],
['organisationUnit', [
{
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/i18n_module_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1736,6 +1736,8 @@ basemap=Bottom - basemap
overlay=Top - overlay
before_layer_id=Before layer id
legend_set_url=Legend image URL
geojson_url=GeoJSON URL
arcgis_feature=ArcGIS feature
confirm_delete_external_map_layer=Are you sure you want to delete this external map layer?
sharing_settings=Sharing settings
created_by=Created by
Expand Down

0 comments on commit 45c2008

Please sign in to comment.