Conversation
Triggered by 1d502c0 on branch refs/heads/issue-7794
|
I think this solution solves the main issue and is good enough. I added some extra logging on the front-end for asset connection errors. Let me know if you want to add some further abstraction to the code related to the asset server connect from the front-end. |
|
Looks like WB asset import is working, but there also seems to be a similar issue with the batch attachment upload where it is stilling hanging. Investigating... hold off on review for now. |
|
Ok, fixed the batch attachment upload issue as well and added to the testing instructions. Good to review now. |
emenslin
left a comment
There was a problem hiding this comment.
- See it doesn't get stuck on uploading, and that it continues to the 'Select a Base Table with Attachments' dialog.
- See that POST network request were made to the asset server, and that they were successful.
- See that the upload loading bar completes and doesn't stall.
After importing attachments in WB, selecting a base table, and then adding any fields, when trying to validate the fields are not getting validated.
03-10_11.46.mp4
bhumikaguptaa
left a comment
There was a problem hiding this comment.
- See it doesn't get stuck on uploading, and that it continues to the 'Select a Base Table with Attachments' dialog.
- See that POST network request were made to the asset server, and that they were successful.
- See that the upload loading bar completes and doesn't stall.
looks good to me, I am able to upload attachments via workbench and batch upload.
When I try to validate, except when the cell formatting is incorrect, when trying to validate the fields are not getting validated.
https://kufishv720260114-issue-7794.test.specifysystems.org/specify/workbench/19/
|
@emenslin @bhumikaguptaa Thanks, I'll check out the validation issue. |
Triggered by 2f76cad on branch refs/heads/issue-7794
|
Made some code changes to get the attachments validation results to appear in the WB dataset table UI view. Might need to do some extra testing to make sure all the validation results are correct. |
Fixes #7794
Identified and fixed two issues with the WB upload attachments.
The main issue was that the Upload promise could hang forever.
uploadFile()usedXMLHttpRequestbut only listened toreadystatechange. On network errors, the promise could remain unresolved and the loading UI never closed. This was solved by adding error, abort, and timeout handlers, set an upload timeout, and clean up listeners so the promise always settles.There was another issue with an invalid React hook usage in the legacy WorkBench import-attachments flow.
collectionPreferences.use(...)was called inside a plain helper function 'uploadFiles, not a component/hook. That can throw before upload starts and leave the modal stuck. There was a simple solution to move the hook call into 'FilesPicked' and pass the resolved value intouploadFiles(...).Looking at the network requests, the POST request to the asset server now occur and are successful.
The hook fix in 'WbImportAttachments/index.tsx' removes an invalid React hook call and keeps behavior the same, except it no longer can fail/hang from that mistake.
The XHR fix in 'Attachments/attachments.ts' ensures the upload should complete or fail, never hang forever.
The only new behavior change is the new upload timeout. A very slow upload that takes longer than the timeout will now fail instead of waiting indefinitely.
After some follow up, it seems that the batch attachment upload is also having a similar issue as the WB attachment upload. The problem is that when uploading in batch attachments, the loading is hanging as well.
Found an issue where the
collectionPreferences.use(...)function was being called withinuploadFileWrapped(...). This was causing an issueThe solution was to move the hook call into the component scope and pass the value down as a plain argument.
Checklist
self-explanatory (or properly documented)
Testing instructions