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

Allow uploading CSVs to CSV supporting Tasks through the UI #308

Merged
merged 4 commits into from
Jan 25, 2021

Conversation

adrianna-chang-shopify
Copy link
Contributor

Closes: #202

Allows files to be uploaded for CSV Tasks in the UI. I've modified any of the action partials that allow a Task to be run to use the form_helper so that we can allow files to be submitted via a file input upload tag. The views call a new method TaskData#csv_task? to determine whether to render the file upload element.

I've also modified the TasksController show action to only set @refresh if there is an active run - this avoids unnecessarily refreshing when nothing is happening, which is particularly important for CSV Tasks, since the form might get refreshed before it is submitted with the current refresh behaviour (wiping the uploaded file).

We may want to look into allowing CSV tasks to run from the command line, but this is out of scope for this PR.

🎩

You can tophat the success case using Maintenance::ImportPostsTask and uploading sample.csv from the fixtures
Screen Shot 2021-01-21 at 3 26 32 PM

Failing to upload a CSV:
Screen Shot 2021-01-21 at 3 34 54 PM

Uploading a non-CSV file:
Screen Shot 2021-01-21 at 3 37 00 PM

(Most scenarios where the CSV is invalid / not a CSV / does not conform to what is expected by CSvTask#process will simply be rescued and cause the Run to become errored, and don't need special treatment)

@adrianna-chang-shopify adrianna-chang-shopify force-pushed the csv-tasks-ui branch 2 times, most recently from d010302 to b5d9068 Compare January 25, 2021 18:42
@adrianna-chang-shopify adrianna-chang-shopify merged commit 1ebf7a8 into main Jan 25, 2021
@adrianna-chang-shopify adrianna-chang-shopify deleted the csv-tasks-ui branch January 25, 2021 19:22
@adrianna-chang-shopify adrianna-chang-shopify added the CSV Requirements for CSV feature label Feb 11, 2021
@adrianna-chang-shopify adrianna-chang-shopify temporarily deployed to rubygems February 11, 2021 21:05 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSV Requirements for CSV feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CSV] Allow file upload in the UI
2 participants