Skip to content

updates to web forms submission #2292

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

Merged
merged 7 commits into from
Apr 1, 2025

Conversation

DanielJDufour
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • πŸ• Feature
  • πŸ› Bug Fix
  • πŸ“ Documentation
  • πŸ§‘β€πŸ’» Refactor
  • βœ… Test
  • πŸ€– Build or CI
  • ❓ Other (please specify)

Related Issue

Improves web forms submission.

Describe this PR

  • adds following to submission, start tim, end time, username, and email address
  • adds support for image file upload via mutation observer

Screenshots

Screenshot 2025-03-23 at 5 10 44β€―PM

Alternative Approaches Considered

Considered adding this functionality to the getodk/web-forms fork, but I think that it would be more difficult to maintain (although that's debatable).

Review Guide

Notes for the reviewer. How to test this change?

  • go mapper view
  • click on a building
  • click map in web forms
  • fill out the form including uploading a picture
  • click send
  • go to manager view
  • review submissions
  • see that image name is displayed

Checklist before requesting a review

[optional] What gif best describes this PR or how it makes you feel?

@DanielJDufour DanielJDufour marked this pull request as ready for review March 23, 2025 21:15
@github-actions github-actions bot added the frontend:management Related to the management frontend code label Mar 23, 2025
@DanielJDufour
Copy link
Collaborator Author

I should caveat this by saying two things:

  1. this functionality is still behind a feature flag ?webforms=true in the url, which I continue to recommend. The use of mutation observer, and the hacky workarounds feel brittle to me. We'll want to make sure that we are doing a hard lock on dependencies before moving to production.
  2. I'm not sure the image upload is actually working. I'm adding the image file name between the <image></image> in the submission xml. I'm also successfully passing in the image binary through multipart form data body in the POST. FastAPI is finding this form data. Things are looking promising, but for some reason, fetching the image binary from ODKCentral doesn't appear to find the image.

getting http://api.fmtm.localhost:7050/submission/uuid:.../photos?project_id=1 will throw a 500 error or return an empty dictionary.

My hunch is that I need to update my .env file since the recent changes to S3 and file upload image management. Or I'm supposed to be passing something other than filename inside the tags in the submission xml. Any help would be appreciated!

@DanielJDufour
Copy link
Collaborator Author

I fixed the iframe rendering by setting stepperLayout to true and the iframe height to 100% instead of an absolute value.

@DanielJDufour
Copy link
Collaborator Author

Screenshot 2025-03-23 at 6 07 43β€―PM

@DanielJDufour
Copy link
Collaborator Author

I'm moving back to draft because I think the stepper layout might skip over the unsupported image upload node, which I overrode.

@DanielJDufour DanielJDufour changed the title updates to web forms submission DRAFT: updates to web forms submission Mar 23, 2025
@DanielJDufour DanielJDufour marked this pull request as draft March 23, 2025 22:09
@spwoodcock
Copy link
Member

I should caveat this by saying two things:

  1. this functionality is still behind a feature flag ?webforms=true in the url, which I continue to recommend. The use of mutation observer, and the hacky workarounds feel brittle to me. We'll want to make sure that we are doing a hard lock on dependencies before moving to production.
  2. I'm not sure the image upload is actually working. I'm adding the image file name between the <image></image> in the submission xml. I'm also successfully passing in the image binary through multipart form data body in the POST. FastAPI is finding this form data. Things are looking promising, but for some reason, fetching the image binary from ODKCentral doesn't appear to find the image.

getting http://api.fmtm.localhost:7050/submission/uuid:.../photos?project_id=1 will throw a 500 error or return an empty dictionary.

My hunch is that I need to update my .env file since the recent changes to S3 and file upload image management. Or I'm supposed to be passing something other than filename inside the tags in the submission xml. Any help would be appreciated!

You can download the images directly from the ODK Central UI as a test.

http://odk.fmtm.localhost:7050

Then login, go to the project, form, submissions table, then download all the data as a zip. You should see the images included hopefully.

You are right the FMTM 500 error is likely due due not having the S3 vars set

@DanielJDufour
Copy link
Collaborator Author

I got a fix to the stepper issue here: hotosm/web-forms#3. We can mark this ready for review, once that PR is merged.

@spwoodcock
Copy link
Member

How's it going with this PR?

@DanielJDufour
Copy link
Collaborator Author

Looks like there's some merge conflicts in this PR. hotosm/web-forms#4

I'll resolve those and merge the web-forms PR to fmtm branch. We should then be ready for review here.

@DanielJDufour DanielJDufour marked this pull request as ready for review April 1, 2025 01:42
@DanielJDufour DanielJDufour changed the title DRAFT: updates to web forms submission updates to web forms submission Apr 1, 2025
@spwoodcock spwoodcock merged commit add4e94 into hotosm:development Apr 1, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend:management Related to the management frontend code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants