Skip to content

Commit d79efea

Browse files
committed
fix(FR-1501): fix file upload status tracking and error handling (#4412)
Resolves #4316 ([FR-1501](https://lablup.atlassian.net/browse/FR-1501)) ## Changes Fixes file upload status tracking and progress calculation issues, particularly for concurrent uploads. Refactored the upload state management to properly track upload progress using bytes instead of just file counts. ### Key Changes 1. Enhanced State Management Structure 2. Fixed Progress Calculation - Problem: Progress was only tracked by file count, not actual bytes uploaded - Solution: - Added completedBytes to track actual upload progress - Added totalExpectedSize for accurate percentage calculation - Progress now shows: completedBytes / totalExpectedSize * 100 3. Fixed Cumulative Bytes Issue - Problem: onProgress callback provides cumulative bytesUploaded, not incremental - Solution: Calculate delta bytes for each progress update ``` let previousBytesUploaded = 0; const deltaBytes = bytesUploaded - previousBytesUploaded; previousBytesUploaded = bytesUploaded; ``` 4. Improved Concurrent Upload Handling - Problem: When starting new uploads while others are in progress, total size wasn't properly accumulated - Solution: - totalExpectedSize accumulates across all upload requests - All progress callbacks reference the same total from state - Proper reset when all uploads complete 5. Better Upload Status Notifications - Progress notifications now show both file count and byte-based percentage - More accurate progress tracking during uploads - Proper cleanup of state after completion Testing - Single file upload progress tracking - Multiple files upload (folder) progress tracking - Concurrent uploads (starting new upload while another is in progress) - Upload failure handling - Progress percentage accuracy Technical Details The main issue was that the original implementation only tracked file names without considering actual bytes uploaded. This led to inaccurate progress reporting, especially for files of varying sizes. The new implementation: 1. Tracks both file counts and bytes for comprehensive progress reporting 2. Properly handles cumulative vs incremental byte reporting from the TUS upload library 3. Maintains a single source of truth (totalExpectedSize) for all concurrent uploads 4. Correctly accumulates sizes when new uploads are added **Checklist:** - [ ] Documentation - [ ] Minimum required manager version - [ ] Specific setting for review - [ ] Minimum requirements to check during review - [x] Test case: Upload multiple files and verify status tracking works correctly [FR-1501]: https://lablup.atlassian.net/browse/FR-1501?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 9484444 commit d79efea

File tree

23 files changed

+333
-175
lines changed

23 files changed

+333
-175
lines changed

react/src/components/FileUploadManager.tsx

Lines changed: 248 additions & 111 deletions
Large diffs are not rendered by default.

react/src/components/FolderExplorerModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const FolderExplorerModal: React.FC<FolderExplorerProps> = ({
6969
const bodyRef = useRef<HTMLDivElement | null>(null);
7070

7171
useEffect(() => {
72-
if (uploadStatus && _.isEmpty(uploadStatus.pending)) {
72+
if (uploadStatus && _.isEmpty(uploadStatus?.pendingFiles)) {
7373
updateFetchKey();
7474
}
7575
}, [uploadStatus, updateFetchKey]);

resources/i18n/de.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,17 +652,18 @@
652652
"Title": "Es ist ein Fehler aufgetreten."
653653
},
654654
"explorer": {
655-
"FileInProgress": "Hochladen von '{{fileName}}' ...",
656655
"FileUploadCancelled": "Das Datei -Upload wurde durch Benutzeranforderung storniert.",
657656
"FileUploadFailed": "Es wurden einige Dateien nicht in Ordner '{{folderName}}' hochgeladen.",
657+
"Filename": "Dateiname",
658658
"FolderNotFoundOrNoAccess": "Ordner, der nicht gefunden oder zugänglich ist verweigert",
659659
"InputTooShort": "EingabeTooShort",
660660
"NoExplorerSupportForUnmanagedFolder": "Nicht verwaltete Ordner unterstützen den Datei -Explorer nicht.",
661661
"NoPermissions": "Keine Berechtigungen für den Zugriff auf diesen Ordner",
662662
"ProcessingUpload": "Ihre Datei wird hochgeladen. \nBitte warten.",
663-
"SuccessfullyUploadedToFolder": "Dateien, die erfolgreich in Ordner '{{folderName}}' hochgeladen wurden",
663+
"SuccessfullyUploadedToFolder": "Dateien erfolgreich hochgeladen.",
664664
"UploadFailed": "Upload fehlgeschlagen in '{{folderName}}' '",
665-
"UploadToFolder": "Hochladen auf '{{folderName}}'",
665+
"UploadingFiles": "Dateien werden hochgeladen...",
666+
"VFolder": "Ordner",
666667
"ValueRequired": "WertErforderlich"
667668
},
668669
"general": {

resources/i18n/el.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,17 +649,18 @@
649649
"Title": "Εμφανίστηκε σφάλμα."
650650
},
651651
"explorer": {
652-
"FileInProgress": "Μεταφόρτωση '{{fileName}}' ...",
653652
"FileUploadCancelled": "Η μεταφόρτωση αρχείων ακυρώθηκε με αίτημα χρήστη.",
654653
"FileUploadFailed": "Απέτυχε να ανεβάσει κάποια αρχεία στο φάκελο '{{folderName}}'.",
654+
"Filename": "Όνομα αρχείου",
655655
"FolderNotFoundOrNoAccess": "Ο φάκελος δεν βρέθηκε ή απορρίφθηκε η πρόσβαση",
656656
"InputTooShort": "InputTooShort",
657657
"NoExplorerSupportForUnmanagedFolder": "Οι μη διαχειριζόμενοι φάκελοι δεν υποστηρίζουν τον εξερευνητή αρχείων.",
658658
"NoPermissions": "Δεν υπάρχουν δικαιώματα πρόσβασης σε αυτόν τον φάκελο",
659659
"ProcessingUpload": "Το αρχείο σας μεταφορτώνεται. \nΠεριμένετε.",
660-
"SuccessfullyUploadedToFolder": "Αρχεία που μεταφορτώθηκαν με επιτυχία στο φάκελο '{{folderName}}'",
660+
"SuccessfullyUploadedToFolder": "Τα αρχεία μεταφορτώθηκαν με επιτυχία.",
661661
"UploadFailed": "Η μεταφόρτωση απέτυχε στο '{{folderName}}'",
662-
"UploadToFolder": "Μεταφόρτωση στο '{{folderName}}'",
662+
"UploadingFiles": "Μεταφόρτωση αρχείων...",
663+
"VFolder": "Ντοσιέ",
663664
"ValueRequired": "Απαιτούμενη τιμή"
664665
},
665666
"general": {

resources/i18n/en.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,17 +657,18 @@
657657
"Title": "An error has occurred."
658658
},
659659
"explorer": {
660-
"FileInProgress": "Uploading '{{fileName}}'...",
661660
"FileUploadCancelled": "The file upload was canceled by user request.",
662661
"FileUploadFailed": "Failed to upload some files in folder '{{folderName}}'.",
662+
"Filename": "File Name",
663663
"FolderNotFoundOrNoAccess": "Folder not found or access denied",
664664
"InputTooShort": "InputTooShort",
665665
"NoExplorerSupportForUnmanagedFolder": "Unmanaged folders do not support the file explorer.",
666666
"NoPermissions": "No permissions to access this folder",
667667
"ProcessingUpload": "Your file is being uploaded. Please wait.",
668-
"SuccessfullyUploadedToFolder": "Files uploaded successfully in folder '{{folderName}}'",
668+
"SuccessfullyUploadedToFolder": "Files uploaded successfully.",
669669
"UploadFailed": "Upload failed in '{{folderName}}'",
670-
"UploadToFolder": "Uploading to '{{folderName}}'",
670+
"UploadingFiles": "Uploading files...",
671+
"VFolder": "Folder",
671672
"ValueRequired": "ValueRequired"
672673
},
673674
"general": {

resources/i18n/es.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,17 +652,18 @@
652652
"Title": "Se ha producido un error."
653653
},
654654
"explorer": {
655-
"FileInProgress": "Cargando '{{fileName}}' ...",
656655
"FileUploadCancelled": "La carga de archivo fue cancelada por solicitud del usuario.",
657656
"FileUploadFailed": "No se pudo cargar algunos archivos en la carpeta '{{folderName}}'.",
657+
"Filename": "Nombre del archivo",
658658
"FolderNotFoundOrNoAccess": "Carpeta no encontrada ni de acceso denegada",
659659
"InputTooShort": "InputTooShort",
660660
"NoExplorerSupportForUnmanagedFolder": "Las carpetas no administradas no admiten el explorador de archivos.",
661661
"NoPermissions": "No hay permisos para acceder a esta carpeta",
662662
"ProcessingUpload": "Se está cargando su archivo. \nEspere por favor.",
663-
"SuccessfullyUploadedToFolder": "Archivos cargados correctamente en la carpeta '{{folderName}}'",
663+
"SuccessfullyUploadedToFolder": "Archivos cargados exitosamente.",
664664
"UploadFailed": "La carga falló en '{{folderName}}'",
665-
"UploadToFolder": "Cargar a '{{folderName}}'",
665+
"UploadingFiles": "Subiendo archivos...",
666+
"VFolder": "Carpeta",
666667
"ValueRequired": "ValorRequerido"
667668
},
668669
"general": {

resources/i18n/fi.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,17 +652,18 @@
652652
"Title": "On tapahtunut virhe."
653653
},
654654
"explorer": {
655-
"FileInProgress": "Lataaminen '{{fileName}}' ...",
656655
"FileUploadCancelled": "Tiedoston lataus peruutettiin käyttäjäpyynnöllä.",
657656
"FileUploadFailed": "Joidenkin tiedostojen lähettäminen kansioon '{{folderName}}'.",
657+
"Filename": "Tiedoston nimi",
658658
"FolderNotFoundOrNoAccess": "Kansiota ei löydy tai pääsy kielletty",
659659
"InputTooShort": "InputTooShort",
660660
"NoExplorerSupportForUnmanagedFolder": "Hallitsemattomat kansiot eivät tue tiedostotutkijaa.",
661661
"NoPermissions": "Ei oikeuksia käyttää tätä kansiota",
662662
"ProcessingUpload": "Tiedostosi ladataan. \nOdota.",
663-
"SuccessfullyUploadedToFolder": "Tiedostot ladataan onnistuneesti kansioon '{{folderName}}'",
663+
"SuccessfullyUploadedToFolder": "Tiedostot on ladattu onnistuneesti.",
664664
"UploadFailed": "Lähettäminen epäonnistui '{{folderName}}'",
665-
"UploadToFolder": "Lataaminen '{{folderName}}'",
665+
"UploadingFiles": "Ladataan tiedostoja...",
666+
"VFolder": "Kansio",
666667
"ValueRequired": "ValueRequired"
667668
},
668669
"general": {

resources/i18n/fr.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,17 +652,18 @@
652652
"Title": "Une erreur s'est produite."
653653
},
654654
"explorer": {
655-
"FileInProgress": "Téléchargement '{{fileName}}' ...",
656655
"FileUploadCancelled": "Le téléchargement du fichier a été annulé par demande de l'utilisateur.",
657656
"FileUploadFailed": "Échec pour télécharger certains fichiers dans le dossier '{{folderName}}'.",
657+
"Filename": "Nom de fichier",
658658
"FolderNotFoundOrNoAccess": "Dossier non trouvé ou accès refusé",
659659
"InputTooShort": "Entrée Trop Courte",
660660
"NoExplorerSupportForUnmanagedFolder": "Les dossiers non gérés ne prennent pas en charge l'explorateur de fichiers.",
661661
"NoPermissions": "Aucune autorisation pour accéder à ce dossier",
662662
"ProcessingUpload": "Votre fichier est téléchargé. \nS'il vous plaît, attendez.",
663-
"SuccessfullyUploadedToFolder": "Fichiers téléchargés avec succès dans le dossier '{{folderName}}'",
663+
"SuccessfullyUploadedToFolder": "Fichiers téléchargés avec succès.",
664664
"UploadFailed": "Le téléchargement a échoué dans '{{folderName}}'",
665-
"UploadToFolder": "Téléchargement sur '{{folderName}}'",
665+
"UploadingFiles": "Téléchargement de fichiers...",
666+
"VFolder": "Dossier",
666667
"ValueRequired": "ValeurRequis"
667668
},
668669
"general": {

resources/i18n/id.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,17 +651,18 @@
651651
"Title": "Telah terjadi kesalahan."
652652
},
653653
"explorer": {
654-
"FileInProgress": "Mengunggah '{{fileName}}' ...",
655654
"FileUploadCancelled": "Unggah file dibatalkan dengan permintaan pengguna.",
656655
"FileUploadFailed": "Gagal mengunggah beberapa file di folder '{{folderName}}'.",
656+
"Filename": "Nama File",
657657
"FolderNotFoundOrNoAccess": "Folder tidak ditemukan atau akses ditolak",
658658
"InputTooShort": "MasukanTerlaluPendek",
659659
"NoExplorerSupportForUnmanagedFolder": "Folder yang tidak dikelola tidak mendukung file explorer.",
660660
"NoPermissions": "Tidak ada izin untuk mengakses folder ini",
661661
"ProcessingUpload": "File Anda sedang diunggah. \nHarap tunggu.",
662-
"SuccessfullyUploadedToFolder": "File berhasil diunggah di folder '{{folderName}}'",
662+
"SuccessfullyUploadedToFolder": "File berhasil diunggah.",
663663
"UploadFailed": "Unggah gagal di '{{folderName}}'",
664-
"UploadToFolder": "Mengunggah ke '{{folderName}}'",
664+
"UploadingFiles": "Mengunggah file...",
665+
"VFolder": "Map",
665666
"ValueRequired": "NilaiDiperlukan"
666667
},
667668
"general": {

resources/i18n/it.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,17 +651,18 @@
651651
"Title": "Si è verificato un errore."
652652
},
653653
"explorer": {
654-
"FileInProgress": "Caricamento '{{fileName}}' ...",
655654
"FileUploadCancelled": "Il caricamento del file è stato cancellato dalla richiesta dell'utente.",
656655
"FileUploadFailed": "Impossibile caricare alcuni file nella cartella '{{folderName}}'.",
656+
"Filename": "Nome del file",
657657
"FolderNotFoundOrNoAccess": "Cartella non trovata o accesso negata",
658658
"InputTooShort": "Inputtroppo corto",
659659
"NoExplorerSupportForUnmanagedFolder": "Le cartelle non gestite non supportano l'esploratore dei file.",
660660
"NoPermissions": "Nessuna autorizzazione per accedere a questa cartella",
661661
"ProcessingUpload": "Il tuo file viene caricato. \nAttendere prego.",
662-
"SuccessfullyUploadedToFolder": "File caricati correttamente nella cartella '{{folderName}}'",
662+
"SuccessfullyUploadedToFolder": "File caricati correttamente.",
663663
"UploadFailed": "Caricamento non riuscito in '{{folderName}'",
664-
"UploadToFolder": "Caricamento su '{{folderName}}'",
664+
"UploadingFiles": "Caricamento file...",
665+
"VFolder": "Cartella",
665666
"ValueRequired": "ValoreRichiesto"
666667
},
667668
"general": {

0 commit comments

Comments
 (0)