-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: allow admins to select earth engine layers to show in the app (DHIS2-16098) [ee-dev] #3198
Conversation
🚀 Deployed on https://pr-3198--dhis2-maps.netlify.app |
import { Checkbox } from '../core/index.js' | ||
import styles from './styles/EarthEngineLayer.module.css' | ||
|
||
const EarthEngineLayer = ({ layer, isAdded, onShow, onHide }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already a component named EarthEngineLayer (in src/components/map/layers). Is there a different name that could be used that would better represent what this component is?
Something like "AdditionalLayerOption". (this could be improved upon)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LayerTypeOption / LayerSourceOption ?
Tag: Renaming
.filter((l) => !l.legacy) | ||
.sort((a, b) => a.name.localeCompare(b.name)) | ||
|
||
const EarthEngineModal = ({ onClose }) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this component future proof, rename it. Perhaps "AdditionalLayersModal". Or some other name that reflects this modal is where the manager is choosing layers to make available in addition to the default layers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LayerTypesModal / LayerSourcesManagementModal?
Tag: Renaming
editLayer, | ||
onClose, | ||
}) => { | ||
const includeEarthEngineLayers = (layerTypes, addedLayers) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider more generic naming here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
includeMoreLayerTypes / includeMoreLayerSources / includeManagedLayerSources ?
Tag: Renaming
getLayers() | ||
}, [engine, getLayers]) | ||
|
||
return { addedLayers, loading, addLayer, removeLayer, error } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error is returned but I can't see that it is used anywhere. Maybe there should be some error handling, like showing a notice in the case that an add/remove operation failed.
This is also a good cypress test scenario. I can point you to some examples.
Add data-test tags where required. Add cypress tests for layer types toggling logic: - The modal is behaving as expected - Showing and hiding layer types - Viewing selection without maps app admin authority - Behaviour with "broken" dataStore namespace/key
Reserve DHIS_WEB_APP namespace in app config Use redux store to keep track of layer types visibility setting Add initial step to check data store integrity and restore if needed
1 flaky test on run #3275 ↗︎
Details:
cypress/integration/systemsettings.cy.js • 1 flaky test • e2e-chrome-parallel-2.40-5
Review all test suite changes for PR #3198 ↗︎ |
Implements: https://dhis2.atlassian.net/browse/DHIS2-16098
As we plan add support for additional layers from Google Earth Engine, we should allow system administrators to select which layers that should be visible on their DHIS2 instance. Instead of showing all EE layers in the Add layer dialog, system administrators can select the layers that should be visible from a predefined collection.
TODO:
With this PR we will show no EE layers in the Add layer dialog by default. Admins having the right authority will see a "Manage available layers"-button:
When the user clicks this dialog, the supported EE layers will be shown in a modal:
The visibility of the individual layers can be toggled on and off. The checked layers will now show in the Add layer dialog for all users of the app: