Skip to content

Fix save button remaining inactive after upload completes (with passive deposit agreements) #6530

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 3 commits into from
Dec 12, 2023

Conversation

bbpennel
Copy link
Contributor

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 or fileuploaddone 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:

  • Uses an external counter for number of uploads in progress rather than the internal one, since it does not update in time for reevaluating the save button.
  • Adds a test to demonstrate the bug and check for passive deposit agreement behavior

@samvera/hyrax-code-reviewers

…eement is toggled off, which should currently fail due to issue 6517
…ble, since fileupload('active') is not getting updated before the completed or done event triggers.
Copy link
Member

@dlpierce dlpierce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tracking this down! Yes, it will need to be replaced. I think some Samvera apps have been investigating alternatives already.

@dlpierce dlpierce added the notes-bugfix Release Notes: Fixed a bug label Dec 12, 2023
@dlpierce dlpierce merged commit d201349 into main Dec 12, 2023
@dlpierce dlpierce deleted the hyrax-6517 branch December 12, 2023 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes-bugfix Release Notes: Fixed a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants