opensearch-project / dashboards-maps

:globe_with_meridians: User interface for the backend geospatial plugin which can be integrated with OpenSearch Dashboards and a home for all other map related features.
https://opensearch.org/docs/latest/dashboards/geojson-regionmaps/#custom-vector-maps-with-geojson
Apache License 2.0
17 stars 44 forks source link

Refresh custom wms layer+source on update (issue 601) #631

Closed qugu2427 closed 1 month ago

qugu2427 commented 1 month ago

Description

UpdateLayerConfig() is broken as per https://github.com/opensearch-project/dashboards-maps/issues/601. Specifically, line 36 maplibreInstance.style.sourceCaches[layerConfig.id].update(maplibreInstance.transform) throws a object reference error. I suspect maplibreInstance.transform is gone by the time it's used. Additionally, there are alot of what seem to be workarounds in the function, namely calling seemingly private methods of MaplibreGL and a spelling mistake. While I am by no means familiar with this codebase, it seems that simply deleting and refreshing the layer+source would be a better option. Especially, since updating wms fields would require a full refresh of tiles anyway.

Issues Resolved

https://github.com/opensearch-project/dashboards-maps/issues/601

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

junqiu-lei commented 1 month ago

Thank you @qugu2427 for raising the PR, could you please add some test screenshot/video in this PR?

qugu2427 commented 1 month ago

@junqiu-lei sure, here is a video of the issue currently and with the refresh method with_current_update_func.webm with_refresh_func.webm

junqiu-lei commented 1 month ago

The cypress failure of documentsLayer is due to CI runner capacity.