Feature/allow for csv upload in import flow #978
Reference in New Issue
Block a user
Delete Branch "feature/allow-for-csv-upload-in-import-flow"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes: #799
This PR enables CSV upload in the load flow of imports.
It adds a dropzone controller, that through an XMLHttpRequest monitors the upload status, which can give you a progress bar.
It also handles wrong file formats and displays it in the dropzone.
it also uploads the parsed CSV and then redirects you back, where you can manually edit the content of the uploaded CSV while still having the success dropzone.
It is also translated and in accordance to the design spec, which can be found here:
https://www.figma.com/design/lonJmVk3HYkwZoIO7xYP2w/Maybe-App-(Community)?node-id=3656-18086&t=t84SVrxXV2CSiCM7-0
Media
https://github.com/user-attachments/assets/c05f8050-be9f-4196-94ca-3f700588a2cf
@@ -2,6 +2,7 @@ require "ostruct"class ImportsController < ApplicationControllerbefore_action :set_import, except: %i[ index new create ]protect_from_forgery with: :null_session, include: %i[ upload_csv ]I don't think this is the best practice, however was unsure how to make it work from a JS http request.
@@ -50,1 +66,4 @@endenddef configureThe errors are not translated, since they are only logged in the console here, which could be picked up by a service like Sentry.
The dropzone does translate errors as seen in the translation file.
@@ -50,1 +66,4 @@endenddef configureNo worries, think this is okay!
This Turbo Stream solution definitely works, but I think we should try to build this flow without any dependencies on Streams to start as outlined in the Turbo handbook:
I'm thinking we should build this endpoint a bit closer to what @tonyvince had in #973:
I know some of the designs dictate client-side interactions, but I'm 100% fine deviating a little bit from them for now so that we can achieve the simplest possible flow that's easy to test. This will also help us avoid the
protect_from_forgeryworkaround and quite a bit of Stimulus controller code as we'll just be doing a simple, Rails-native form submission.Awesome job setting up this PR ❤️
I think what we have in #973 is closer to the designs. If you don't want to make many changes, maybe we can at least copy the sample file download part?
Hey,
I'm going to move the download part away from turbo stream and just into progressing after a download like you did.
In regards to the table, see this comment: https://github.com/maybe-finance/maybe/issues/799#issuecomment-2214126257 where it was stated that mismatch between designs and application can and will occur as of right now, so the table already in the application is correct, and should not be changed, that is what I understand from it.
I was referring to the sample CSV file download part. See
Ah okay, feel free to go with @tonyvince's suggestion, since it's already made and closer to the wanted outcome.
Pull request closed