cat-documents-ng 0.2.69 → 0.2.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2369,12 +2369,14 @@ class DocumentUploadService {
|
|
|
2369
2369
|
*/
|
|
2370
2370
|
handleCreateFormData(uploadedFile, contextId) {
|
|
2371
2371
|
if (uploadedFile) {
|
|
2372
|
+
console.log("formData 1", uploadedFile);
|
|
2372
2373
|
let formData = new FormData();
|
|
2373
2374
|
formData.append(SHARED.FILE, uploadedFile, uploadedFile.name);
|
|
2374
2375
|
formData.append(SHARED.CONTEXT_ID, this.contextId);
|
|
2375
2376
|
return formData;
|
|
2376
2377
|
}
|
|
2377
2378
|
else {
|
|
2379
|
+
console.log("formData 2", uploadedFile);
|
|
2378
2380
|
return null;
|
|
2379
2381
|
}
|
|
2380
2382
|
}
|
|
@@ -2939,6 +2941,10 @@ class DocumentUploadComponent {
|
|
|
2939
2941
|
* @param event - Event containing the selected files
|
|
2940
2942
|
*/
|
|
2941
2943
|
onSelectedFiles(event) {
|
|
2944
|
+
// Clear previous files and progress
|
|
2945
|
+
this.uploadedFiles = [];
|
|
2946
|
+
this.fileProgress.clear();
|
|
2947
|
+
// Process files sequentially using concatMap
|
|
2942
2948
|
from(event.currentFiles).pipe(concatMap(file => this.uploadFile$(file)) // Upload one file at a time
|
|
2943
2949
|
).subscribe({
|
|
2944
2950
|
complete: () => {
|
|
@@ -3048,26 +3054,31 @@ class DocumentUploadComponent {
|
|
|
3048
3054
|
});
|
|
3049
3055
|
return of(null);
|
|
3050
3056
|
}
|
|
3051
|
-
|
|
3052
|
-
const uploadedFile = this.businessService.createUploadedFile(file, formattedSize);
|
|
3053
|
-
uploadedFile.progress = SHARED.UPLOAD_PROGRESS_10;
|
|
3054
|
-
this.uploadedFiles.push(uploadedFile);
|
|
3057
|
+
// Set initial progress for the file
|
|
3055
3058
|
this.fileProgress.set(file, SHARED.UPLOAD_PROGRESS_10);
|
|
3056
|
-
console.log("2
|
|
3059
|
+
console.log("2 Starting upload for file:", file.name);
|
|
3057
3060
|
return this.uploadService.create(formsData).pipe(tap((event) => {
|
|
3058
3061
|
console.log("3 event", event);
|
|
3062
|
+
// Create uploaded file object with response data
|
|
3063
|
+
const formattedSize = this.businessService.formatFileSize(file.size, this.config);
|
|
3064
|
+
const uploadedFile = this.businessService.createUploadedFile(file, formattedSize);
|
|
3059
3065
|
uploadedFile.uploadResponse = event;
|
|
3060
3066
|
uploadedFile.progress = SHARED.UPLOAD_PROGRESS_100;
|
|
3061
3067
|
uploadedFile.url = event?.url;
|
|
3062
3068
|
uploadedFile.contentType = event?.contentType;
|
|
3069
|
+
// Add to uploadedFiles array AFTER successful upload
|
|
3070
|
+
this.uploadedFiles.push(uploadedFile);
|
|
3063
3071
|
this.fileProgress.set(file, SHARED.UPLOAD_PROGRESS_100);
|
|
3072
|
+
console.log("4 File uploaded successfully:", file.name, "Total files:", this.uploadedFiles.length);
|
|
3064
3073
|
}), catchError((error) => {
|
|
3065
3074
|
this.messageService.add({
|
|
3066
3075
|
severity: SHARED.SEVERITY,
|
|
3067
3076
|
summary: SHARED.UPLOAD_SUMMERY,
|
|
3068
3077
|
detail: error?.message || 'Upload failed'
|
|
3069
3078
|
});
|
|
3070
|
-
|
|
3079
|
+
// Mark file as failed
|
|
3080
|
+
this.fileProgress.set(file, -1);
|
|
3081
|
+
return of(null);
|
|
3071
3082
|
}));
|
|
3072
3083
|
}
|
|
3073
3084
|
/**
|