-
Notifications
You must be signed in to change notification settings - Fork 45
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
feat/fix: FORMS-1483 queued file handling #1515
base: main
Are you sure you want to change the base?
Conversation
Adds the functionality so that files are not uploaded/deleted until the submitter clicks submit or save draft
This comment has been minimized.
This comment has been minimized.
Yes, that would be the behaviour. The formio file component has a property called dataValue which determines whether a file was successfully uploaded or not. When a file is dragged or selected into the file component, that information is forwarded to the front end where we queue it for upload. When the user submits the form or saves the draft, we synchronously begin uploading the files. If it fails to upload a single file, it will show an error to the user, call the error handler for the file component, and continue uploading the rest of the files synchronously. If a file succeeds, it gets removed from the queue and we call the event handler for a successful file upload for the file component. If all files upload successfully, then it will continue to submit or save the draft. Some potential changes:
|
|
||
async function uploadQueuedFiles() { | ||
let err = false; | ||
for (let i = queuedUploadFiles.value.length - 1; i >= 0; i--) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious: is there a reason to upload them in reverse order? If I add file 0, 1, and 2, my submission shows file 2, 1, and 0. Might the users find this to be unexpected behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reasoning for this was because it was uploading files from the array, and when successful, would remove those files from the array. That way when running the upload file function again, it would just run through the array until it is empty.
When a file is chosen, a warning will pop up. This warning will not autodismiss and must be manually closed. It is also unique so that multiple of the same warning do not show up.
The notification can now be translated and updated when the translation changes
When a file is deleted from the file upload component and an error occurs, it will now display an error message.
Deleting files also occurs after uploading files instead of skipping the deletions if an error occurs when trying to upload files.
This comment has been minimized.
This comment has been minimized.
the warning colour across chefs is now changed from the yellowish colour to a more dark orange. the save as draft button is changed from an icon to an outlined button with text. changed translation keys from saveAsADraft to saveAsDraft.
Release cc6a871 deployed at https://chefs-dev.apps.silver.devops.gov.bc.ca/pr-1515 |
Description
Adds the functionality so that files are not uploaded/deleted until the submitter clicks submit or save draft. Users that would delete or upload a file, then navigate away without saving the draft or submitting would have their files either exist in our storage or deleted with no recovery. This mitigates that issue.
Resolves https://bcdevex.atlassian.net/browse/FORMS-1483
When adding a file to the file upload, it will give you a notification that it won't be uploaded until you hit save or save as draft.
Type of Change
feat (a new feature)
fix (a bug fix)
test (add missing tests or correct existing tests)
Checklist
Further comments