Skip to content
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

Visibility limits - The resolution option is not retained as Limits type #10391 #10598

Merged

Conversation

rowheat02
Copy link
Contributor

@rowheat02 rowheat02 commented Oct 4, 2024

Description

fixes #10391
Persist Visibility limit type after saving the map.

Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (check one with "x", remove the others)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

#10391

What is the current behavior?

#10391
Visibility limit type reset back to Scale even selecting Resolution

What is the new behavior?

Visibility Limit type persist even after saving map

Breaking change

Does this PR introduce a breaking change? (check one with "x", remove the other)

  • Yes, and I documented them in migration notes
  • No

Other useful information

@rowheat02 rowheat02 changed the title fix: persist visibility limit type Visibility limits - The resolution option is not retained as Limits type #10391 Oct 4, 2024
@rowheat02 rowheat02 self-assigned this Oct 7, 2024
@rowheat02 rowheat02 added Good first issue BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch bug Internal labels Oct 7, 2024
@rowheat02 rowheat02 added this to the 2024.02.01 milestone Oct 7, 2024
@rowheat02 rowheat02 linked an issue Oct 7, 2024 that may be closed by this pull request
1 task
@rowheat02 rowheat02 marked this pull request as ready for review October 7, 2024 05:54
@rowheat02 rowheat02 requested a review from offtherailz October 7, 2024 05:54
@tdipisa
Copy link
Member

tdipisa commented Oct 7, 2024

@rowheat02 Thank you for raising this. Can we close #10391 in favor of this?

@rowheat02
Copy link
Contributor Author

@tdipisa Yes, old PR #10391 can be closed as this PR is solving #10355

Copy link
Member

@offtherailz offtherailz left a comment

Choose a reason for hiding this comment

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

  • Missing unit test.
  • Does it make sense to save it in the map too? Actually this solution retains it only in local map, but when save or export, this value is not maintained. @tdipisa should we add also this?

@@ -707,7 +707,8 @@ export const saveLayer = (layer) => {
legendOptions: layer.legendOptions,
tileSize: layer.tileSize,
version: layer.version,
expanded: layer.expanded || false
expanded: layer.expanded || false,
...(layer.visibilityLimitType ? { ...layer.visibilityLimitType, ...layer.visibilityLimitType } : {})
Copy link
Member

Choose a reason for hiding this comment

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

Why an object to spread?
I think it is ok to make it undefined.

@@ -707,7 +707,8 @@ export const saveLayer = (layer) => {
legendOptions: layer.legendOptions,
tileSize: layer.tileSize,
version: layer.version,
expanded: layer.expanded || false
expanded: layer.expanded || false,
...(layer.visibilityLimitType ? { visibilityLimitType: layer.visibilityLimitType } : undefined)
Copy link
Member

Choose a reason for hiding this comment

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

Here I meant, why not ?

Suggested change
...(layer.visibilityLimitType ? { visibilityLimitType: layer.visibilityLimitType } : undefined)
visibilityLimitType: layer.visibilityLimitType

Copy link
Member

Choose a reason for hiding this comment

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

Tests were failing because the functionality checks the data that is effectively saved to be the one you want.
You can keep this implementation, but add a test that if visibilityLimitType is passed, then is persisted, otherwise it is not (it is a temporary variable, so it makes sense to have it.

Copy link
Contributor Author

@rowheat02 rowheat02 Oct 9, 2024

Choose a reason for hiding this comment

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

if we don't need to persist visibilityLimitType then this is unnecessary. So removing it. @offtherailz

@offtherailz
Copy link
Member

offtherailz commented Oct 8, 2024

@rowheat02 replying to your doubt:

I did not write new tests since there were already tests which were handling defaultLimitType . https://github.com/geosolutions-it/MapStore2/blob/master/web/client/components/TOC/fragments/settings/__tests__/VisibilityLimitsForm-test.jsx#L51, I only fixed in implementation by passing defaultLimitType while using Visibilitylimitform.

You can test on onChange , that has been added.

@rowheat02
Copy link
Contributor Author

@offtherailz

  • removed part to persist visibilityLimitType after saving map
  • unit test to check onChange added

@rowheat02 rowheat02 requested a review from offtherailz October 9, 2024 09:35
@offtherailz offtherailz merged commit 1e3365b into geosolutions-it:master Oct 11, 2024
6 checks passed
@offtherailz
Copy link
Member

@ElenaGallo, could you please test this on DEV ? Thank you

@ElenaGallo
Copy link
Contributor

@rowheat02 hte Limits type set to Resolution is still not saved correctly. See the video attached:

resolution.mp4

@rowheat02
Copy link
Contributor Author

@rowheat02 replying to your doubt:

I did not write new tests since there were already tests which were handling defaultLimitType . https://github.com/geosolutions-it/MapStore2/blob/master/web/client/components/TOC/fragments/settings/__tests__/VisibilityLimitsForm-test.jsx#L51, I only fixed in implementation by passing defaultLimitType while using Visibilitylimitform.

You can test on onChange , that has been added.

@ElenaGallo this setting(Resolution) remains the same only before saving the map. It's not saved on backend while saving the map, we avoided that. Agreed by @tdipisa, @offtherailz

@ElenaGallo
Copy link
Contributor

Thanks @rowheat02, please backport to 2024.02.xx.

jnewmoyer pushed a commit to ngsllc/MapStore2 that referenced this pull request Oct 17, 2024
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Visibility limits - The revolution option is not retained as Limits type
4 participants