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

Update of a GeoApp metadata returns a JSON message instead of redirecting to the GeoApp page #7456

Closed
giohappy opened this issue May 3, 2021 · 9 comments
Assignees
Labels
backport 3.2.x PR should be backported to target version minor A low priority issue which might affect only some users and /or not the main functionality
Milestone

Comments

@giohappy
Copy link
Contributor

giohappy commented May 3, 2021

Expected Behavior

When hitting the "Update" button either from a GeoAppsì Advanced Metadata edit or the Metadata Wizard page the user is redirected to the GepApp detail page.

Actual Behavior

A JSON string is retrurned. E.g.:

{"message": 1739}

Steps to Reproduce the Problem

  1. Open any GeoApp (GeoStory)
  2. Click Editing Tools -> (Metadata) Advanced Edit
  3. Change a value
  4. Click the Update button
  5. The JSON string is returned

Specifications

  • GeoNode version: 3.2.x, master
  • Installation method (manual, GeoNode Docker)
@giohappy giohappy added minor A low priority issue which might affect only some users and /or not the main functionality backport 3.2.x PR should be backported to target version labels May 3, 2021
@giohappy giohappy added this to the 3.2.1 milestone May 3, 2021
@giohappy giohappy changed the title Update of GeoApps metadata returns a JSON message instead of returning to the GeoApp page Update of GeoApps metadata returns a JSON message instead of redirecting to the GeoApp page May 3, 2021
@giohappy giohappy changed the title Update of GeoApps metadata returns a JSON message instead of redirecting to the GeoApp page Update of a GeoApp metadata returns a JSON message instead of redirecting to the GeoApp page May 3, 2021
@marthamareal
Copy link
Contributor

marthamareal commented May 3, 2021

@giohappy, The update on this form makes a POST request, should we also consider changing it to make a PATCH?
or we just change the response here

@giohappy
Copy link
Contributor Author

giohappy commented May 3, 2021

@afabiani do you know if we're returning a JSON for the MapStore client purposes?
Anyway @marthamareal we chould change the response type depending if the request is an ajax request or not (request.is_ajax())

@marthamareal
Copy link
Contributor

@giohappy this is already dome here

@giohappy
Copy link
Contributor Author

giohappy commented May 3, 2021

That's curious. So why the request from the browser is treated as ajax? A flow in Django?

@marthamareal
Copy link
Contributor

That's curious. So why the request from the browser is treated as ajax? A flow in Django?

It's True by default, here

@giohappy
Copy link
Contributor Author

giohappy commented May 3, 2021

why is it set as a parameter on that request? Shouldn't it be set by Django as a request property???

@giohappy
Copy link
Contributor Author

giohappy commented May 3, 2021

@allyoucanmap is the mapstore client using this view somehow and set this property explicitely?

@marthamareal
Copy link
Contributor

marthamareal commented May 3, 2021

The js is supposed to handle the response and then display the detail page.
However checking with my local and console, this line throws an error https://github.com/GeoNode/geonode/blob/master/geonode/templates/metadata_form_js.html#L26 and then wrong display.

@marthamareal
Copy link
Contributor

@giohappy passing the UI_MANDATORY_FIELDS context here solves the issue. should i continue with it?

This is also done for layers maps and documents eg here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 3.2.x PR should be backported to target version minor A low priority issue which might affect only some users and /or not the main functionality
Projects
None yet
Development

No branches or pull requests

3 participants