-
Notifications
You must be signed in to change notification settings - Fork 110
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
Added table of content to open layer details in map view. #1661
Conversation
@ahmdthr the PR still is marked as draft .. if this is intended, though, please ignore my comment |
@ahmdthr this one would have to be aligned to the latest changes of linked resources |
@ahmdthr Kindly resolve the conflicts and align the code changes with the latest changes in master. Thanks! |
I've tested the PR locally. The idea is good and it's really useful, but I have a few concerns:
I think this could be improved if the following is implemented:
@gannebamm @ahmdthr if you agree I would consider these improvements before merging it. In that case the PR should be marked as |
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.
see #1661 (comment)
@giohappy Thank you very much for your comments. The only reason a new request was being made was because the linked resources were not included in the batch request. Now with recent changes, it is no longer necessary to sent a request to fetch linked resources. I am currently working on it and expect the final version of the PR shortly. |
…er of requests for info button on maps page.
…resources for info button on TOC.
The info button for layers on the maps page now fetches all data including linked resources with a single call. Additionally, the linked resources are stored in state such that re-fetching is not necessary when re selecting one layer again. |
…ready included for 'viewer_common' api_preset.
@dsuren1 please do a new review. |
const state = getState() || {}; | ||
const layer = getSelectedLayer(state); | ||
const layerResourceId = layer?.extendedParams?.pk; | ||
const layerResourceDataset = state.gnresource.data.maplayers.find(mapLayer => mapLayer.dataset.pk === parseInt(layerResourceId, 10)).dataset; |
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.
const layerResourceDataset = state.gnresource.data.maplayers.find(mapLayer => mapLayer.dataset.pk === parseInt(layerResourceId, 10)).dataset; | |
const layerResourceDataset = get(state, 'gnresource.data.maplayers', []).find(mapLayer => get(mapLayer, 'dataset.pk', '') === parseInt(layerResourceId, 10))?.dataset |
-
Error when
state.gnresource.data
is empty. Happens probably when selecting a layer while it is still loading. Kindly check all it's references in the code -
I see there are cases when dataset in the mapLayers is empty causing another failure even when
state.gnresource.data.maplayers
is not empty (ex: /map/44)
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.
-
It seems in some cases, an error is being generated in
gnFetchMissingLayerData
when selecting a layer, which is impacting further testing and review of this PR. -
Could you also please check if there is a race condition in loading the plugin? At times, the button doesn't appear on the TOC toolbar even when the required data is present.
Kindly check these comments and provide an update to the PR. Thank you!
@dsuren1 Thank you very much for your review. All the problems stemmed from non-existent referencing of properties, and I have fixed it in the latest commit. Please have a look at it again and let me know. Thank you. |
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.
@ahmdthr
Overall the changes looks good. But I see some minor issues as mentioned below. Kindly check it out
-
Layer detail doesn't always reflect correct layer name on the detail panel
layer_detail_sync.mp4
@@ -2330,6 +2330,150 @@ | |||
"cfg": { | |||
"wrap": true | |||
} | |||
}, | |||
{ | |||
"name": "LayerDetailViewer", |
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.
"name": "LayerDetailViewer", | |
"mandatory": true, | |
"name": "LayerDetailViewer", |
In order to make the plugin available by default add mandatory: true
, or add it to pluginsConfig under TOC
as children
, so the user can select the plugin when adding viewer
to map.
Currently, the plugin is not available on map with viewer existing already.
This bug where the title of the dataset on the detail layer was not being changed was due to the fact that the "EditTtile" component was using its own state for the title, thus changing the "resource" did not update the title if the "DetailsPanel" was already inflated. It is fixed now. |
@dsuren1 great to see you approved the PR .. any chance to see this PR backported to |
* Added table of content to open layer details in map view. Fixes issue#1660. * Updated to the newer version. * Code refactor * Fixed instability issues for info button on TOC. * Fixed linked resources for info button on TOC and code cleanup. * Avoided repeating calls to get layer dataset fields including linked resources for info button on TOC. * Fixed localConfig json file for the info button. * Reverted api changes to include linked resources, because they are already included for 'viewer_common' api_preset. * Fixed getDatasetByPk definition. * Fixed linting issues. * Fixed bug where info button was misbehaving when any maplayer had no dataset. * Fixed a bug where the title of the dataset was not changing on the details panel. --------- Co-authored-by: Suren <[email protected]> (cherry picked from commit 9b1dcb4)
) * Added table of content to open layer details in map view. Fixes issue#1660. * Updated to the newer version. * Code refactor * Fixed instability issues for info button on TOC. * Fixed linked resources for info button on TOC and code cleanup. * Avoided repeating calls to get layer dataset fields including linked resources for info button on TOC. * Fixed localConfig json file for the info button. * Reverted api changes to include linked resources, because they are already included for 'viewer_common' api_preset. * Fixed getDatasetByPk definition. * Fixed linting issues. * Fixed bug where info button was misbehaving when any maplayer had no dataset. * Fixed a bug where the title of the dataset was not changing on the details panel. --------- Co-authored-by: Suren <[email protected]> (cherry picked from commit 9b1dcb4) Co-authored-by: ahmdthr <[email protected]>
…) (GeoNode#1917) * Added table of content to open layer details in map view. Fixes issue#1660. * Updated to the newer version. * Code refactor * Fixed instability issues for info button on TOC. * Fixed linked resources for info button on TOC and code cleanup. * Avoided repeating calls to get layer dataset fields including linked resources for info button on TOC. * Fixed localConfig json file for the info button. * Reverted api changes to include linked resources, because they are already included for 'viewer_common' api_preset. * Fixed getDatasetByPk definition. * Fixed linting issues. * Fixed bug where info button was misbehaving when any maplayer had no dataset. * Fixed a bug where the title of the dataset was not changing on the details panel. --------- Co-authored-by: Suren <[email protected]> (cherry picked from commit 9b1dcb4) Co-authored-by: ahmdthr <[email protected]>
…) (GeoNode#1917) * Added table of content to open layer details in map view. Fixes issue#1660. * Updated to the newer version. * Code refactor * Fixed instability issues for info button on TOC. * Fixed linked resources for info button on TOC and code cleanup. * Avoided repeating calls to get layer dataset fields including linked resources for info button on TOC. * Fixed localConfig json file for the info button. * Reverted api changes to include linked resources, because they are already included for 'viewer_common' api_preset. * Fixed getDatasetByPk definition. * Fixed linting issues. * Fixed bug where info button was misbehaving when any maplayer had no dataset. * Fixed a bug where the title of the dataset was not changing on the details panel. --------- Co-authored-by: Suren <[email protected]> (cherry picked from commit 9b1dcb4) Co-authored-by: ahmdthr <[email protected]>
Resolves #1660
Resolves #1616
A new button to view layer details is added on the map view.