fix: handle restore warning responses in upload UI#421
fix: handle restore warning responses in upload UI#421lil-aditya wants to merge 1 commit intoEAPD-DRB:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the restore/upload UI so that backend “legacy restore” responses returned as status_code: "warning" are treated as successful restores (append model, close modal) while still surfacing the warning guidance to the user.
Changes:
- Added a shared helper (
handleCaseRestoreSuccess) to centralize “restore succeeded” UI actions. - Updated the Dropzone upload success handler to distinguish:
successwarningwithmessage_warning(legacy restore success + upgrade warning)warningwithout restore side effects (warning-only)
- Added a guard for missing/empty
response.response[0]payloads.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Message.bigBoxWarning("Upload response", result['message'], null); | ||
| } | ||
| } else if (result['status_code'] == 'error') { | ||
| Message.bigBoxDanger("Upload response", result['message'], null); |
There was a problem hiding this comment.
The success callback has no fallback for unexpected/malformed status_code values (or a missing status_code). In that case the handler will silently do nothing, which undermines the new defensive handling. Consider adding a final else that shows a danger/warning message (and optionally logs the payload) so users aren’t left with no UI feedback when the response shape changes.
| Message.bigBoxDanger("Upload response", result['message'], null); | |
| Message.bigBoxDanger("Upload response", result['message'], null); | |
| } else { | |
| console.warn('Unexpected upload response status_code', result); | |
| Message.bigBoxWarning("Upload response", "Upload completed but returned an unexpected status.", null); |
Linked issue
Existing related work reviewed
zf.extractallwithsafe_extractallafter_this_requestOverlap assessment
WebAPP/Classes/Base.Class.jsWhy this PR should proceed
Summary
WebAPP/Classes/Base.Class.jssuccesswarningwithmessage_warningfor successful legacy restoreswarningwithout restore side effects, such as "already exists"status_code: "warning"for older model restoreswarningbranch, so restore completion was not reflected in the UIValidation
Validation details:
success: model appended, success message shown, modal closedwarning: model appended, success message shown, upgrade warning shown, modal closedwarning: warning shown only, no UI mutationerror: danger message shownExample validation output: