geonode
geonode copied to clipboard
Saving a map from add_layer view doesn't redirect correctly
Expected Behavior
When a new layer is added to an existing map, the /add_layer
view is used.
When the map is saved user is redirected to the /edit
view
Actual Behaviour
When a new layer is added to an existing map, the /add_layer
view is used.
When the map is saved user is redirected again to /add_layer
Steps to Reproduce the Problem
- Go to layer detail page on https://development.demo.geonode.org
- Click "Add to Map"
- You are redirected to
/maps/add_layer/
view - Save the map
- You are redirected to
/maps/add_layer/
view
@giohappy This is happening because the save
is called on the mapstore url eg http://localhost:8000/mapstore/rest/resources/6/?full=true
and in mapstore the update API returns json response
Also, the page rendered is the map_edit
because add_layer
calls map_edit
which calls map_view
and renders the map_edit.html
here. the issue is the url in the browser is not updated
so why the page redirection works when a new map is created? Doesn't MapStore behave the same on Save in that case?
@marthamareal you're right. It's the client that is managing the redirect, and it's only triggered with a Save As (new map).
We could ask the client to implement a specific behaviour on Save when inside an "add layer" page, but in this moment I don't think it has any means to sicern if it's an add layer page or a normal map edit. We should add this information inside the context info that we send to the client. We should already have a property that we set to distinguish a map view, from a map edit... @marthamareal do you see a simple solution to ditinguish also an "add layer"?
We could pass that config from add_layer
to map_edit
to map_view
then to the edit_map template. From there, the FE/client can use it to redirect after save.
I will block this issue, since it's an edge case taht would need some deep changes both to geonode and mapstore.