Skip to content
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

SIMSBIOHUB-614: Fix file upload error handling. #1366

Merged
merged 6 commits into from
Sep 18, 2024
Merged

Conversation

NickPhura
Copy link
Collaborator

Links to Jira Tickets

https://apps.nrs.gov.bc.ca/int/jira/browse/SIMSBIOHUB-614?

Description of Changes

Split the project/survey report/non-report attachment dialogs into 2 components.
Made 2 new attachment dialogs - one for single items, one for many items.
Added error handling to catch file upload errors.
Moved a few files around to group like-components.

Testing Notes

Changes to Project/Survey Report and Non-Report attachment upload

  • Should work as before, and should handle any errors thrown during upload.

Changes to observation/telemetry/sample-site/animal csv import

  • Should work as before, and should handle any errors thrown during upload.

…components.

Made 2 new attachment dialogs - one for single items, one for many items.
Added error handling to catch file upload errors.
Copy link

codecov bot commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 26.53061% with 72 lines in your changes missing coverage. Please review.

Project coverage is 48.49%. Comparing base (bc5663e) to head (2cd3f09).

Files with missing lines Patch % Lines
.../dialog/attachments/FileUploadSingleItemDialog.tsx 0.00% 24 Missing ⚠️
...urveys/telemetry/table/TelemetryTableContainer.tsx 0.00% 12 Missing ⚠️
.../src/features/projects/view/ProjectAttachments.tsx 31.25% 11 Missing ⚠️
...pp/src/features/surveys/view/SurveyAttachments.tsx 31.25% 11 Missing ⚠️
.../src/components/attachments/FileUploadWithMeta.tsx 14.28% 6 Missing ⚠️
...ents/dialog/attachments/ReportFileUploadDialog.tsx 61.53% 5 Missing ⚠️
...veys/animals/list/components/AnimalListToolbar.tsx 0.00% 1 Missing ⚠️
...le/import-obsevations/ImportObservationsButton.tsx 0.00% 1 Missing ⚠️
...ling-sites/components/ImportObservationsButton.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1366      +/-   ##
==========================================
- Coverage   48.56%   48.49%   -0.08%     
==========================================
  Files         771      772       +1     
  Lines       20706    20714       +8     
  Branches     3136     3127       -9     
==========================================
- Hits        10056    10045      -11     
- Misses      10498    10523      +25     
+ Partials      152      146       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NickPhura NickPhura added Ready For Review PR is ready for review labels Sep 17, 2024
mauberti-bc
mauberti-bc previously approved these changes Sep 17, 2024
Copy link
Collaborator

@mauberti-bc mauberti-bc left a comment

Choose a reason for hiding this comment

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

Tested locally and works well 👍

Minor future UI improvement: Closing the error dialog should also close the upload attachment dialog to avoid displaying "Complete" or "Success" on the upload dialog despite an error.

image

Fix project/survey regular attachments error display (shows error in the list, not as a popup).
Add fallback catch to report upload.
Fix error popup not displaying error message in body of dialog for the csv upload dialogs.
@NickPhura
Copy link
Collaborator Author

NickPhura commented Sep 18, 2024

@mauberti-bc

Minor future UI improvement: Closing the error dialog should also close the upload attachment dialog to avoid displaying "Complete" or "Success" on the upload dialog despite an error.

The error popup was actually a copy/paste mistake. The file upload component handles individual file errors already, so I just had to remove the try/catch and let it bubble up:

image

Tweaked some other trivial stuff as well, and added some JSDoc. So should all be happy now.

Copy link

sonarcloud bot commented Sep 18, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
10.1% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Copy link
Collaborator

@mauberti-bc mauberti-bc left a comment

Choose a reason for hiding this comment

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

👍

@mauberti-bc mauberti-bc merged commit 87a60fe into dev Sep 18, 2024
19 of 22 checks passed
@mauberti-bc mauberti-bc deleted the SIMSBIOHUB-614 branch September 18, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants