Skip to content

Commit 6d322c6

Browse files
Merge pull request #195 from microsoft/PSL_BUG_22004
fix: Meaningful error notification if file upload fails due to network disconnect
2 parents 4257161 + 033a7cb commit 6d322c6

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

src/frontend/src/components/uploadButton.tsx

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,20 +521,43 @@ const FileUploadZone: React.FC<FileUploadZoneProps> = ({
521521
</div>
522522

523523
<div style={{ display: 'flex', flexDirection: 'column', gap: '13px', width: '837px', paddingBottom: 10, borderRadius: '4px', }}>
524-
{allUploadsComplete && (
524+
{/* Show network error message bar if any file has error */}
525+
{uploadingFiles.some(f => f.status === 'error') && (
526+
<MessageBar
527+
messageBarType={MessageBarType.error}
528+
isMultiline={false}
529+
styles={{
530+
root: { display: "flex", alignItems: "left", background: "#fff4f4" },
531+
icon: { display: "none" },
532+
}}
533+
>
534+
<div style={{ display: "flex", alignItems: "left" }}>
535+
<X
536+
strokeWidth="2.5px"
537+
color="#d83b01"
538+
size="16px"
539+
style={{ marginRight: "8px" }}
540+
/>
541+
<span>Unable to connect to the server. Please try again later.</span>
542+
</div>
543+
</MessageBar>
544+
)}
545+
546+
{/* Success message bar if all uploads complete and no errors */}
547+
{allUploadsComplete && !uploadingFiles.some(f => f.status === 'error') && (
525548
<MessageBar
526549
messageBarType={MessageBarType.success}
527550
isMultiline={false}
528551
styles={{
529-
root: { display: "flex", alignItems: "left" }, // Align the icon and text
552+
root: { display: "flex", alignItems: "left" },
530553
icon: { display: "none" },
531554
}}
532555
>
533556
<div style={{ display: "flex", alignItems: "left" }}>
534557
<CircleCheck
535558
strokeWidth="2.5px"
536559
color="#37a04c"
537-
size="16px" // Slightly larger for better balance
560+
size="16px"
538561
style={{ marginRight: "8px" }}
539562
/>
540563
<span>All valid files uploaded successfully!</span>
@@ -584,6 +607,7 @@ const FileUploadZone: React.FC<FileUploadZoneProps> = ({
584607
backgroundColor: 'white',
585608
borderRadius: '4px',
586609
border: '1px solid #eee',
610+
position: 'relative'
587611
}}
588612
>
589613
<div style={{ display: 'flex', alignItems: 'center', width: '24px' }}>
@@ -634,7 +658,7 @@ const FileUploadZone: React.FC<FileUploadZoneProps> = ({
634658
background: 'none',
635659
cursor: 'pointer',
636660
padding: '4px',
637-
color: '#666',
661+
color: file.status === 'error' ? '#d83b01' : '#666',
638662
display: 'flex',
639663
alignItems: 'center',
640664
justifyContent: 'center',

0 commit comments

Comments
 (0)