Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/thirty-squids-remain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@getodk/web-forms': patch
---

Hide Entity special properties from the maps property dialog
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const RESERVED_MAP_PROPERTIES = [
'stroke',
'stroke-width',
'fill',
'__version',
'__trunkVersion',
'__branchId',
];

type Coordinates = [longitude: number, latitude: number];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,56 @@ describe('createFeatureCollectionAndProps', () => {
);
});

it('removes reserved properties of Entities in orderedExtraPropsMap', () => {
const odkFeatures: SelectItem[] = [
createSelectItem('point1', 'Point 1', '40.7128 -74.0060 100 5', [
['__version', 'v34.29.7'],
['clinic-name', 'New Hope Clinic'],
['__trunkVersion', 'v1.1.1'],
['__clinic-id', '123456'],
['__branchId', 'id-abc'],
['another-prop', 'value2'],
]),
];

const { featureCollection, orderedExtraPropsMap } =
createFeatureCollectionAndProps(odkFeatures);

expect(featureCollection).toEqual({
type: 'FeatureCollection',
features: [
{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [-74.006, 40.7128],
},
properties: {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are ODK reserved and for internal use only (never displayed to the user)

odk___branchId: 'id-abc',
odk___trunkVersion: 'v1.1.1',
odk___version: 'v34.29.7',
odk_geometry: '40.7128 -74.0060 100 5',
odk_label: 'Point 1',
odk_value: 'point1',
},
},
],
});

expect(orderedExtraPropsMap).toEqual(
new Map([
[
'point1',
[
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the properties displayed to the user.

['clinic-name', 'New Hope Clinic'],
['__clinic-id', '123456'],
['another-prop', 'value2'],
],
],
])
);
});

it('handles null label in ODK features', () => {
const odkFeatures: SelectItem[] = [
createSelectItem('point1', null, '40.7128 -74.0060 100 5', [['marker-color', '#ff0000']]),
Expand Down