-
Notifications
You must be signed in to change notification settings - Fork 401
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
#10545: Option to disable identify popup in case of no results #10557
Conversation
… results Description: - handle adding an option called 'hidePopupIfNoResults' to hide the identify popup - add unit tests - add jsdoc
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 something unclear to me with the current implementation as i have not yet tested it.
will do another set of review later on, for now i leave some comments as a reminder
@@ -91,6 +93,9 @@ export const identifyLifecycle = compose( | |||
showAllResponses, | |||
highlight: pluginCfg?.highlightEnabledFromTheStart || false | |||
}); | |||
if (hidePopupIfNoResults) { | |||
enableHideEmptyPopupOption(true); |
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.
can't you just use the hidePopupIfNoResults prop instead of calling enableHideEmptyPopupOption and updating state?
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.
@MV88 the point is the cfg 'hidePopupIfNoResults ' is for identify plugin and I used it in map plugin
web/client/plugins/map/index.js
Outdated
(state) => state.mapPopups && state.mapPopups.hideEmptyPopupOption || false, | ||
isMouseMoveActiveSelector, | ||
mapInfoRequestsSelector, | ||
responsesSelector, | ||
(popups, hideEmptyPopupOption, isMouseMoveActive, mapInfoRequests, mapInfoResponses) => { | ||
// create a flag for hide the identify popup in case no results in hover mode | ||
let identifyPopupHidden = false; | ||
if (isMouseMoveActive && mapInfoRequests?.length && mapInfoResponses?.length && hideEmptyPopupOption) { | ||
const format = getDefaultInfoFormatValue(); | ||
const invalidResponses = getValidator(format).getNoValidResponses(mapInfoResponses); | ||
const emptyResponses = mapInfoRequests?.length === invalidResponses?.length; | ||
const missingResponses = (mapInfoRequests || []).length - (mapInfoResponses || []).length; | ||
identifyPopupHidden = missingResponses === 0 && emptyResponses && isMouseMoveActive && hideEmptyPopupOption; | ||
} | ||
return { | ||
popups, | ||
identifyPopupHidden |
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.
I have also some doubts here tbh, i will deeply check this
web/client/plugins/map/index.js
Outdated
(popups) => ({ | ||
popups | ||
})), { | ||
(state) => state.mapPopups && state.mapPopups.hideEmptyPopupOption || false, |
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.
a dedicated selector must be created when you add a new one
const {identifyPopupHidden} = this.props; | ||
if (identifyPopupHidden) { | ||
(this._popups || []).forEach(({popup}) => { | ||
popup.off('remove', this.popupClose); | ||
popup && this.props.map.removeLayer(popup); | ||
}); | ||
return []; | ||
} | ||
return this.preparePopups() |
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.
i have some doubts about this implementation too.
@@ -59,6 +61,14 @@ export default class PopupSupport extends React.Component { | |||
this.props.onPopupClose(id); | |||
} | |||
renderPopups = () => { | |||
const {identifyPopupHidden, map} = this.props; | |||
if (identifyPopupHidden) { |
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.
maybe the flag hidePopupIfNoResults could have been used to filter out elements?
i have to debug this tbh
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.
i tested a different approach and using css you can achieve this goal an avoid all the changes you did
.map-popup-ol:has(.hidePopupIfNoResults) {
display: none;
}
in DefaultViewer add this
renderEmptyPages = () => {
const {emptyResponses} = this.getResponseProperties();
if (this.props.missingResponses === 0 && emptyResponses) {
if (this.props.hidePopupIfNoResults) {
return <span className="hidePopupIfNoResults"/>;
}
return (
<Alert bsStyle={"danger"}>
<h4><HTML msgId="noFeatureInfo"/></h4>
</Alert>
);
}
return null;
}
Then you just have to make sure that the Identify plugin passes down the hidePopupIfNoResults prop
so please redo from scratch the implementation by providing a new pr and closing this
… results Description: - revert changes in popupSupport files for ol and leaflet + related tests files - handle hide popup for map viewer with css for openlayers and leaflet approach - add unit tests - edit map-popup.less file to handle hide the popup
@ElenaGallo please test this on master and let us know if we can backport. |
@tdipisa @mahmoudadel54 is it correct that when 'hidePopupIfNoResults' is set as true, the marker appears instead of the popup? Use this map and see the video attached: identify.mp4 |
Yes correct @ElenaGallo |
I'm sorry @mahmoudadel54 Where we agreed for this? I don't think it is correct. Why should we show a marked alone? Indeed, when the popup is visible the marked is not needed and it is not displayed, of course Why should we forcibly display it when 'hidePopupIfNoResults' is set as true? @ElenaGallo remember to cover also the embedded map test. |
* Update Changelog for version 2024.02.00 (geosolutions-it#10602) Co-authored-by: github-actions <[email protected]> * Bump commons-io:commons-io from 2.7 to 2.14.0 (geosolutions-it#10593) * Removed react-confirm-button unused dependency (geosolutions-it#10495) * Update release_steps.md (geosolutions-it#10568) * Remove istambul loader (geosolutions-it#10491) * Attempt to remove instambul loader * removed also package dependency * Apply suggestions from code review clean * Remove jsonpath (geosolutions-it#10494) jsonpath is not needed. It is a dependency of geosolutions-it/patcher actually. Having this dependency here is only confusing for dependency analyisis * Fix geosolutions-it#10595 add missing 'FORMAT' parameter to WMTS GetFeatureInfo requests (geosolutions-it#10596) * add missing 'FORMAT' parameter to WMTS GetFeatureInfo requests this is required by the WMTS spec to be the same format as would be used for a GetTile request, and this allows GFI requests to succeed on https://data.geopf.fr/wmts. * fix mapinfo wmts utils test * Fix geosolutions-it#10505 Allow to specify use of proxy or cors at layer level (geosolutions-it#10526) * fix: remove ui element for force proxy and Allow not secure layers * fix: ajax logic changed, autoDetectCORS is set to true by default * new central CORS util file created and used in ajax * checking CORS before adding in common layer file * null check on getProxyUrl * updated individual layer considring to use proxy if needed * avoid proxy cache to update if response is not okey * enable user to add http url, show warning instead of error, warning text updated * test cases updated * fix: resolve conflicts with url check * fixed the failed test * review cesium layers * include add method in model layer * improve http check for openlayers wms layer * fix tests --------- Co-authored-by: allyoucanmap <[email protected]> * Update openId.md (geosolutions-it#10610) * Bump spring-security version to 5.7.12 (fixes geosolutions-it#10611) (geosolutions-it#10612) somehow something in the build already drags this version, and we end up with two conflicting versions of spring-security in the war which results in at least failure to authenticate with basic auth. * Visibility limits - The resolution option is not retained as Limits type geosolutions-it#10391 (geosolutions-it#10598) * Add lib check release step (geosolutions-it#10614) * geosolutions-it#4675 Remove unused code (geosolutions-it#10442) * geosolutions-it#4675 Remove unused code * remove additional code from review * fix tests folder * remove additional unused files * geosolutions-it#10545: Option to disable identify popup in case of no results (geosolutions-it#10557) * geosolutions-it#10545: Option to disable identify popup in case of no results Description: - handle adding an option called 'hidePopupIfNoResults' to hide the identify popup - add unit tests - add jsdoc * geosolutions-it#10545: Option to disable identify popup in case of no results Description: - revert changes in popupSupport files for ol and leaflet + related tests files - handle hide popup for map viewer with css for openlayers and leaflet approach - add unit tests - edit map-popup.less file to handle hide the popup * geosolutions-it#10545: revert unnecessary changes * Fix geosolutions-it#10615 removed eval from marker utils (geosolutions-it#10616) * geosolutions-it#10545: remove marker in case no results + hover identify mode active and hideEmptyPopupOption with true (geosolutions-it#10619) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Lorenzo Natali <[email protected]> Co-authored-by: Landry Breuil <[email protected]> Co-authored-by: RowHeat <[email protected]> Co-authored-by: allyoucanmap <[email protected]> Co-authored-by: mahmoud adel <[email protected]> Co-authored-by: Matteo V. <[email protected]>
* #10545: Option to disable identify popup in case of no results Description: - handle adding an option called 'hidePopupIfNoResults' to hide the identify popup - add unit tests - add jsdoc * #10545: Option to disable identify popup in case of no results Description: - revert changes in popupSupport files for ol and leaflet + related tests files - handle hide popup for map viewer with css for openlayers and leaflet approach - add unit tests - edit map-popup.less file to handle hide the popup * #10545: revert unnecessary changes
Test passed, @mahmoudadel54 please backport to 2024.02.xx. Thanks |
… results (geosolutions-it#10557) * geosolutions-it#10545: Option to disable identify popup in case of no results Description: - handle adding an option called 'hidePopupIfNoResults' to hide the identify popup - add unit tests - add jsdoc * geosolutions-it#10545: Option to disable identify popup in case of no results Description: - revert changes in popupSupport files for ol and leaflet + related tests files - handle hide popup for map viewer with css for openlayers and leaflet approach - add unit tests - edit map-popup.less file to handle hide the popup * geosolutions-it#10545: revert unnecessary changes
@ElenaGallo |
…ase of no results (#10624) * #10545: Option to disable identify popup in case of no results (#10557) * #10545: Option to disable identify popup in case of no results Description: - handle adding an option called 'hidePopupIfNoResults' to hide the identify popup - add unit tests - add jsdoc * #10545: Option to disable identify popup in case of no results Description: - revert changes in popupSupport files for ol and leaflet + related tests files - handle hide popup for map viewer with css for openlayers and leaflet approach - add unit tests - edit map-popup.less file to handle hide the popup * #10545: revert unnecessary changes * #10545: remove marker in case no results + hover identify mode active and hideEmptyPopupOption with true (#10619)
Description
In this PR, it is implemented adding an option for identify plugin called 'hidePopupIfNoResults' = true to handle hide identify popup in case of no results for 'openlayers' and 'leaflet' for 2D maps.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
#10545
What is the current behavior?
#10545
What is the new behavior?
If 'hidePopupIfNoResults' is added to cfg in identify plugin by true ---> the identify popup will be hidden if there is no results.
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information
To test it, for desktop add 'hidePopupIfNoResults' with true for cfg in identify plugin.
For mobile, you need to add the identify plugin option 'hidePopupIfNoResults' with true for cfg and edit ---> DEFAULT_VISUALIZATION_MODES_CONFIG.[VisualizationModes._2D].mobile to
MapLibraries.LEAFLET
in this part belowMapStore2/web/client/utils/MapTypeUtils.js
Lines 27 to 36 in 6c8e852