cloud-ide-element 1.0.71 β†’ 1.0.73

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.
@@ -2626,6 +2626,7 @@ class CideEleFileManagerService {
2626
2626
  destroyRef = inject(DestroyRef);
2627
2627
  // Angular 20: Signal-based state management
2628
2628
  _baseUrl = signal('/api', ...(ngDevMode ? [{ debugName: "_baseUrl" }] : []));
2629
+ _objectIdEndpoint = signal('/utility/generateObjectId', ...(ngDevMode ? [{ debugName: "_objectIdEndpoint" }] : []));
2629
2630
  _userId = signal('', ...(ngDevMode ? [{ debugName: "_userId" }] : []));
2630
2631
  _isUploading = signal(false, ...(ngDevMode ? [{ debugName: "_isUploading" }] : []));
2631
2632
  _uploadQueue = signal([], ...(ngDevMode ? [{ debugName: "_uploadQueue" }] : []));
@@ -2633,6 +2634,7 @@ class CideEleFileManagerService {
2633
2634
  _error = signal(null, ...(ngDevMode ? [{ debugName: "_error" }] : []));
2634
2635
  // Angular 20: Computed values
2635
2636
  baseUrl = this._baseUrl.asReadonly();
2637
+ objectIdEndpoint = this._objectIdEndpoint.asReadonly();
2636
2638
  userId = this._userId.asReadonly();
2637
2639
  isUploading = this._isUploading.asReadonly();
2638
2640
  uploadQueue = this._uploadQueue.asReadonly();
@@ -2809,14 +2811,25 @@ class CideEleFileManagerService {
2809
2811
  console.log('πŸ” [FileManagerService] Setting user ID:', userId);
2810
2812
  this._userId.set(userId);
2811
2813
  }
2814
+ /**
2815
+ * Set the object ID generation endpoint
2816
+ * Angular 20: Using signal-based state management
2817
+ * @param endpoint The endpoint for generating object IDs (e.g., '/utility/generateObjectId')
2818
+ */
2819
+ setObjectIdEndpoint(endpoint) {
2820
+ console.log('πŸ” [FileManagerService] Setting object ID endpoint:', endpoint);
2821
+ this._objectIdEndpoint.set(endpoint);
2822
+ }
2812
2823
  /**
2813
2824
  * Generate Object ID for group uploads
2814
2825
  * Calls the backend API to generate a unique ObjectId for grouping multiple files
2826
+ * Uses the configurable object ID endpoint instead of hardcoded path
2815
2827
  * @returns Observable with the generated ObjectId
2816
2828
  */
2817
2829
  generateObjectId() {
2818
- const url = `${this._baseUrl()}/utility/generateObjectId`;
2830
+ const url = `${this._baseUrl()}${this._objectIdEndpoint()}`;
2819
2831
  console.log('πŸ†” [FileManagerService] Generating ObjectId from:', url);
2832
+ console.log('πŸ”§ [FileManagerService] Using object ID endpoint:', this._objectIdEndpoint());
2820
2833
  return this.http.get(url).pipe(catchError((error) => {
2821
2834
  console.error('❌ [FileManagerService] Error generating ObjectId:', error);
2822
2835
  this._error.set(`Failed to generate ObjectId: ${error.message}`);
@@ -3342,12 +3355,12 @@ class CideEleFileInputComponent {
3342
3355
  this.onTouched();
3343
3356
  // Auto upload if enabled
3344
3357
  if (this.autoUploadSignal() && selectedFiles && selectedFiles.length > 0) {
3345
- if (this.multipleSignal() && selectedFiles.length > 1) {
3346
- console.log('πŸš€ [FileInput] Auto upload enabled for multiple files:', selectedFiles.length);
3358
+ if (this.multipleSignal()) {
3359
+ console.log('πŸš€ [FileInput] Auto upload enabled for multiple files mode:', selectedFiles.length, 'files');
3347
3360
  this.uploadMultipleFiles(Array.from(selectedFiles));
3348
3361
  }
3349
3362
  else {
3350
- console.log('πŸš€ [FileInput] Auto upload enabled, starting upload for:', selectedFiles[0].name);
3363
+ console.log('πŸš€ [FileInput] Auto upload enabled for single file mode:', selectedFiles[0].name);
3351
3364
  this.uploadFile(selectedFiles[0]);
3352
3365
  }
3353
3366
  }
@@ -3488,10 +3501,11 @@ class CideEleFileInputComponent {
3488
3501
  }
3489
3502
  /**
3490
3503
  * Upload multiple files with group ID support
3491
- * Generates a group ID if not provided and uploads all files with the same group ID
3504
+ * FLOW: 1) Generate group ID first, 2) Upload all files with same group ID, 3) Emit group ID on completion
3492
3505
  */
3493
3506
  uploadMultipleFiles(files) {
3494
3507
  console.log('πŸ“€ [FileInput] uploadMultipleFiles called for:', files.length, 'files');
3508
+ console.log('πŸ”„ [FileInput] STEP 1: Generate group ID before starting any file uploads');
3495
3509
  // Set multiple upload mode flag
3496
3510
  this.isMultipleUploadMode.set(true);
3497
3511
  // Set upload status to 'start' before starting upload
@@ -3504,20 +3518,22 @@ class CideEleFileInputComponent {
3504
3518
  // Show initial progress notification
3505
3519
  const notificationId = this.notificationService.showProgress('πŸ”„ Preparing multiple file upload...', 0, { duration: 0 });
3506
3520
  this.uploadNotificationId.set(notificationId);
3507
- // Check if we already have a group ID from uploadData
3521
+ // STEP 1: Generate or get group ID BEFORE starting any file uploads
3508
3522
  const existingGroupId = this.uploadDataSignal().groupId;
3509
3523
  if (existingGroupId) {
3510
- console.log('πŸ†” [FileInput] Using existing group ID:', existingGroupId);
3524
+ console.log('πŸ†” [FileInput] STEP 1 COMPLETE: Using existing group ID:', existingGroupId);
3525
+ console.log('πŸ”„ [FileInput] STEP 2: Starting file uploads with group ID:', existingGroupId);
3511
3526
  this.groupId.set(existingGroupId);
3512
3527
  this.startMulti(files, existingGroupId);
3513
3528
  }
3514
3529
  else {
3515
- console.log('πŸ†” [FileInput] No group ID provided, generating new one...');
3516
- // Generate group ID first
3530
+ console.log('πŸ†” [FileInput] No existing group ID, generating new one...');
3531
+ // Generate group ID BEFORE starting any file uploads
3517
3532
  this.fileManagerService.generateObjectId().subscribe({
3518
3533
  next: (response) => {
3519
3534
  const newGroupId = response.objectId;
3520
- console.log('πŸ†” [FileInput] Generated new group ID:', newGroupId);
3535
+ console.log('πŸ†” [FileInput] STEP 1 COMPLETE: Generated new group ID:', newGroupId);
3536
+ console.log('πŸ”„ [FileInput] STEP 2: Starting file uploads with group ID:', newGroupId);
3521
3537
  this.groupId.set(newGroupId);
3522
3538
  this.startMulti(files, newGroupId);
3523
3539
  },
@@ -3538,18 +3554,21 @@ class CideEleFileInputComponent {
3538
3554
  }
3539
3555
  /**
3540
3556
  * Start uploading multiple files with the provided group ID
3557
+ * All files will be uploaded with the SAME group ID that was generated before this method
3541
3558
  */
3542
3559
  startMulti(files, groupId) {
3543
- console.log('πŸš€ [FileInput] Starting upload for', files.length, 'files with group ID:', groupId);
3560
+ console.log('πŸš€ [FileInput] STEP 2: Starting upload for', files.length, 'files with group ID:', groupId);
3561
+ console.log('πŸ“‹ [FileInput] All files will use the same group ID:', groupId);
3544
3562
  let completedUploads = 0;
3545
3563
  let failedUploads = 0;
3546
3564
  const totalFiles = files.length;
3547
- // Update upload data with group ID
3565
+ // IMPORTANT: All files use the SAME group ID that was generated before starting uploads
3548
3566
  const uploadDataWithGroupId = {
3549
3567
  ...this.uploadDataSignal(),
3550
3568
  groupId: groupId
3551
3569
  };
3552
3570
  files.forEach((file, index) => {
3571
+ console.log(`πŸ“€ [FileInput] Uploading file ${index + 1}/${totalFiles}: "${file.name}" with group ID: ${groupId}`);
3553
3572
  this.fileManagerService.uploadFile(file, uploadDataWithGroupId, (progress) => {
3554
3573
  // Calculate overall progress
3555
3574
  const fileProgress = progress / totalFiles;
@@ -3600,10 +3619,11 @@ class CideEleFileInputComponent {
3600
3619
  // All files uploaded successfully
3601
3620
  this.uploadStatus.set('success');
3602
3621
  this.notificationService.success(`βœ… All ${total} files uploaded successfully!`, { duration: 0 });
3603
- // For multiple file upload, return the group ID as the form value
3622
+ // STEP 3: For multiple file upload, emit the group ID (not individual file IDs)
3604
3623
  this.onChange(groupId);
3605
3624
  this.uploadSuccess.emit(groupId);
3606
- console.log('πŸ“ [FileInput] Form control value set to group ID:', groupId);
3625
+ console.log('πŸ“ [FileInput] STEP 3 COMPLETE: Form control value set to group ID:', groupId);
3626
+ console.log('βœ… [FileInput] Multiple upload SUCCESS - Group ID emitted:', groupId);
3607
3627
  }
3608
3628
  else if (completed > 0) {
3609
3629
  // Some files uploaded successfully
@@ -3838,8 +3858,14 @@ class CideEleFileInputComponent {
3838
3858
  this.onTouched();
3839
3859
  // Auto upload if enabled
3840
3860
  if (this.autoUploadSignal() && files.length > 0) {
3841
- console.log('πŸš€ [FileInput] Auto upload enabled, starting upload for:', files[0].name);
3842
- this.uploadFile(files[0]);
3861
+ if (this.multipleSignal()) {
3862
+ console.log('πŸš€ [FileInput] Auto upload enabled for multiple files mode (drag & drop):', files.length, 'files');
3863
+ this.uploadMultipleFiles(Array.from(files));
3864
+ }
3865
+ else {
3866
+ console.log('πŸš€ [FileInput] Auto upload enabled for single file mode (drag & drop):', files[0].name);
3867
+ this.uploadFile(files[0]);
3868
+ }
3843
3869
  }
3844
3870
  else {
3845
3871
  console.log('⏸️ [FileInput] Auto upload disabled or no files');