-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add 'Download' button to record set attachment viewer #6052
base: production
Are you sure you want to change the base?
Conversation
🐐 |
Fix trying to download unavailable attachments WIP checkboxes?
Fix translations
Fix downloading files with the same filename Add ability to recieve and download binary files on the frontend
Looking for feedback on these👇! This PR ended up being a bit bigger than I thought so I want to make sure everything is right, Dev Note: Additional Notes: |
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.
great job on a complex feature!
the changes in ajax() look good - this is exactly how I would have done it 🤗
specifyweb/frontend/js_src/lib/components/Attachments/RecordSetAttachment.tsx
Outdated
Show resolved
Hide resolved
specifyweb/frontend/js_src/lib/components/Attachments/RecordSetAttachment.tsx
Outdated
Show resolved
Hide resolved
specifyweb/frontend/js_src/lib/components/Attachments/RecordSetAttachment.tsx
Outdated
Show resolved
Hide resolved
<Button.DialogClose>{commonText.close()}</Button.DialogClose> | ||
<> | ||
<Button.Info | ||
disabled={fetchedCount.current !== records.length || records.length <= 1} |
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.
it may not be clear to user that all attachments need to be bulked fetched by front-end for them to be downloadable
could you add a title={}
with explanation to this button when it is disabled?
OR, call back-end API with record set id and let back-end retrieve list of attachments
specifyweb/frontend/js_src/lib/components/Molecules/FilePicker.tsx
Outdated
Show resolved
Hide resolved
specifyweb/frontend/js_src/lib/components/Molecules/FilePicker.tsx
Outdated
Show resolved
Hide resolved
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.
Looks good to me. Good job!
Improve handling of files with same file name
Triggered by 8b1dea4 on branch refs/heads/issue-609
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.
- Download is successful
- Verify that the zip file contains all the requested attachments with the correct filenames.
- Make sure the download all button is only enabled when there are multiple attachments to download.
- With many attachments, make sure the download all button doesn't break when not all attachments have been loaded yet.
- Try to download multiple attachments with the same file name. Make sure they all get downloaded correctly. They should be named
OriginalFileName_InternalFileName.EXT
.
Test small download buttons: - Verify that the download button works in different contexts (Attachment viewer, Record set attachment gallery, etc.)
Great work so far!
For:
- Make sure the download all button is only enabled when there are multiple attachments to download.
The Download All button is a little confusing because it's disabled for a singular attachment/record. It says it downloads all attachments when you hover over it, so I think it should include and work for singular attachments too. Removing the button when there is only one attachment could work as well. @specify/ux-testing what do you think?
Also I found that if you have 1 record with 1 attachment, but select multiple records which do not have any attachments, the Download All button is functional and will create a zip file of only 1 attachment.
To reproduce:
- Select a record with 1 attachment in QB
- Select other records with no attachments in addition to it
- Click Browse in Forms -> Attachment Gallery icon -> Download All
- See a zip file has been downloaded with 1 attachment
Screen.Recording.2025-01-22.at.11.43.30.AM.mov
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.
- Download is successful
- Verify that the zip file contains all the requested attachments with the correct filenames.
- Make sure the download all button is only enabled when there are multiple attachments to download.
- With many attachments, make sure the download all button doesn't break when not all attachments have been loaded yet.
- Try out the button in different attachments galleries, like in individual records or in record sets.
- Try to download multiple attachments with the same file name. Make sure they all get downloaded correctly. They should be named
fileName_2.EXT
and so on.
Test small download buttons: - Verify that the download button works in different contexts (Attachment viewer, Record set attachment gallery, etc.)
Great work so far, Alejandro!
For #6052 (review), I agree that keeping the Download All option for records with only one attachment is more consistent, even if it feels redundant. I also noticed that when browsing a single form with multiple attachments, the Download All button is also disabled.
Additionally, I kept running into a crash dialog while using the Download All button on the KUFish
databases. Initially, I thought it might be related to the asset server configuration, preventing it from properly fetching the assets. However, I was able to download each asset individually without issues, so I'm thinking it might be another issue. The errors only occurred when trying to download all attachments at once.
Fixes #609
This PR adds two new features to speed up attachment downloading.
Additional Notes:
The URL to download all the attachments is
attachment_gw/download_all/
. Couldn't come up with a better name, so if you have a better name let me know!If you download multiple attachments with the same name they will be renamed to OriginalName_AssetServerName.EXT. I can also change this if it doesn't seem good enough.
Checklist
self-explanatory (or properly documented)
Testing instructions
Test 'Download All' button:
fileName_2.EXT
and so on.Test small download buttons: