Fix save button remaining inactive after upload completes (with passive deposit agreements) #6530
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
#6517
Summary
Fixes issue where the "Save" button on the work page is disabled after an upload completes even if all requirements have been met.
Guidance for testing, such as acceptance criteria or new user interface behaviors:
See the linked issue for how to replicate the issue.
Type of change (for release notes)
notes-bugfix
Detailed Description
The issue appears to be that the fileupload('active') value is still "1" at the time that the
fileuploadcompleted
orfileuploaddone
events are fired. It is being retrieved here:https://github.com/samvera/hyrax/blob/main/app/assets/javascripts/hyrax/save_work/uploaded_files.es6#L16
which is used for deciding if the "Save" button should be disabled. So when the completed event fires, it checks to see if there are any active uploads, and there still are since the plugin doesn't seem to have cleared them yet.
Since 'active' doesn't seem reliable for this purpose, I switched to externally tracking when an upload was started and ended. There is also a 'progress' attribute which records the number of bytes uploaded that might be usable for this, which we could try if that's preferred.
For what its worth, it looks like the jquery.fileupload plugin was archived in May 2023. Some parts also don't seem to be working, like the "Cancel upload" button is disabled for me and doesn't work, plus it doesn't show in progress uploads, the file just eventually appears on the list once the upload finishes. I'm guessing we need to replace it at some point, which might already be in the backlog.
Changes proposed in this pull request:
@samvera/hyrax-code-reviewers