Esri / solutions-components

A collection of UI components for constructing webapps.
Apache License 2.0
11 stars 5 forks source link

Update check box behavior #649

Closed skrishn closed 3 months ago

skrishn commented 4 months ago

@sumitzarkar please take note of this and make necessary changes.

https://devtopia.esri.com/WebGIS/arcgis-template-configuration/issues/4619

Issue:

"Two issues related to the enabling data collection:

Disabling the checkbox does not remove the layer from the side panel. The expected behavior is when the layer is unchecked, all the data collection options and the layer is removed from the panel. The checkboxes set "reportLayers". The settings for reporting, commenting, and like are in "reportingOptions". The crowdsource component switched from using "reportLayers" to set the layers in the component to using "reportingOptions". Brandon can add a new prop to "reportingOptions" like "active" or something that they can use to differentiate the main layers and the reporting layers. @john4818 would this approach work for you?

Toggling reporting off removes the layer from the side panel. If a comment, like, or dislike is on, it should remain in the side panel but be removed when "report an incident" is clicked."

Changes "I updated "reportingOptions" to have a prop named "visible". The "visible" prop is tied to the checkboxes and should control the overall visibility of the layer in the crowdsource-reporter component, while the "reporting" prop controls the reporting layers.

For backwards compatibility, I'm trying to think of all the scenarios:

If "reportingOptions" is present:

use the "visible" prop to control the main layers used and use the "reporting" prop to refine that list. If "reportingOptions" isn't but "reportLayers" is:

use "reportLayers" to get the main layers, which would be the same as the report layers. If neither is present or "reportingOptions" is undefined/null or it's layers prop is an empty array:

get all editable layers and use that as the main and report layers FYI, If you have an app on dev that has "reportingOptions" in it already you would have to go back into it and recheck them so they have this update. For users, it will automatically convert "reportLayers" into "reportingOptions" with the proper visible prop."