cloud-ide-element 1.0.111 → 1.0.113
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.
|
@@ -3725,21 +3725,28 @@ class CideEleFileInputComponent {
|
|
|
3725
3725
|
const notificationId = this.notificationService.showProgress('🔄 Preparing multiple file upload...', 0, { duration: 0 });
|
|
3726
3726
|
this.uploadNotificationId.set(notificationId);
|
|
3727
3727
|
// STEP 1: Generate or get group ID BEFORE starting any file uploads
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3728
|
+
// Check if component already has a group ID or if one is provided in uploadData
|
|
3729
|
+
const existingComponentGroupId = this.groupId();
|
|
3730
|
+
const existingUploadDataGroupId = this.uploadDataSignal().groupId;
|
|
3731
|
+
if (existingComponentGroupId) {
|
|
3732
|
+
// Component already has its own group ID - use it
|
|
3733
|
+
console.log('🆔 [FileInput] Using existing component group ID:', existingComponentGroupId);
|
|
3734
|
+
this.startMulti(files, existingComponentGroupId);
|
|
3735
|
+
}
|
|
3736
|
+
else if (existingUploadDataGroupId) {
|
|
3737
|
+
// Use group ID from uploadData and set it as component's group ID
|
|
3738
|
+
console.log('🆔 [FileInput] Using group ID from uploadData:', existingUploadDataGroupId);
|
|
3739
|
+
this.groupId.set(existingUploadDataGroupId);
|
|
3740
|
+
this.startMulti(files, existingUploadDataGroupId);
|
|
3734
3741
|
}
|
|
3735
3742
|
else {
|
|
3736
|
-
|
|
3737
|
-
|
|
3743
|
+
// Generate new group ID just before upload
|
|
3744
|
+
console.log('🆔 [FileInput] Generating new group ID just before upload...');
|
|
3738
3745
|
this.fileManagerService.generateObjectId().subscribe({
|
|
3739
3746
|
next: (response) => {
|
|
3740
3747
|
const newGroupId = response.data?.objectId;
|
|
3741
|
-
console.log('🆔 [FileInput]
|
|
3742
|
-
|
|
3748
|
+
console.log('🆔 [FileInput] Generated new group ID just before upload:', newGroupId);
|
|
3749
|
+
// Set the group ID to this component so it can track its own files
|
|
3743
3750
|
this.groupId.set(newGroupId);
|
|
3744
3751
|
this.startMulti(files, newGroupId);
|
|
3745
3752
|
},
|
|
@@ -4056,32 +4063,40 @@ class CideEleFileInputComponent {
|
|
|
4056
4063
|
/**
|
|
4057
4064
|
* Get total upload count from file manager service for this component's group ID
|
|
4058
4065
|
* Uses optimized service method for better performance
|
|
4066
|
+
* Only counts files for this component's specific group ID
|
|
4059
4067
|
*/
|
|
4060
4068
|
getUploadCount() {
|
|
4061
4069
|
const groupId = this.groupId();
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4070
|
+
const componentId = this.id();
|
|
4071
|
+
if (!groupId) {
|
|
4072
|
+
// No group ID yet - component hasn't uploaded anything, so count is 0
|
|
4073
|
+
return 0;
|
|
4074
|
+
}
|
|
4075
|
+
const count = this.fileManagerService.getFileCountForGroup(groupId);
|
|
4076
|
+
return count;
|
|
4065
4077
|
}
|
|
4066
4078
|
/**
|
|
4067
4079
|
* Check if there are active uploads for this component's group ID
|
|
4068
4080
|
* Uses optimized service method for better performance
|
|
4081
|
+
* Only checks files for this component's specific group ID
|
|
4069
4082
|
*/
|
|
4070
4083
|
hasActiveUploads() {
|
|
4071
4084
|
const groupId = this.groupId();
|
|
4072
4085
|
if (!groupId) {
|
|
4073
|
-
|
|
4086
|
+
// No group ID yet - component hasn't uploaded anything, so no active uploads
|
|
4087
|
+
return false;
|
|
4074
4088
|
}
|
|
4075
4089
|
return this.fileManagerService.hasActiveUploadsForGroup(groupId);
|
|
4076
4090
|
}
|
|
4077
4091
|
/**
|
|
4078
4092
|
* Get count of active (non-completed) uploads for this component's group ID
|
|
4093
|
+
* Only counts files for this component's specific group ID
|
|
4079
4094
|
*/
|
|
4080
4095
|
getActiveUploadCount() {
|
|
4081
4096
|
const groupId = this.groupId();
|
|
4082
4097
|
if (!groupId) {
|
|
4083
|
-
|
|
4084
|
-
|
|
4098
|
+
// No group ID yet - component hasn't uploaded anything, so no active uploads
|
|
4099
|
+
return 0;
|
|
4085
4100
|
}
|
|
4086
4101
|
return this.fileManagerService.getAllFilesForGroup(groupId)
|
|
4087
4102
|
.filter(file => file.stage !== 'complete').length;
|
|
@@ -4445,19 +4460,29 @@ class CideEleFloatingFileUploaderComponent {
|
|
|
4445
4460
|
this.showWithAnimation();
|
|
4446
4461
|
return;
|
|
4447
4462
|
}
|
|
4448
|
-
//
|
|
4449
|
-
if (shouldShow
|
|
4463
|
+
// Handle manual trigger (show OR switch group ID)
|
|
4464
|
+
if (shouldShow) {
|
|
4450
4465
|
if (triggerGroupId) {
|
|
4466
|
+
// Always switch to the new group ID (even if already visible)
|
|
4467
|
+
console.log('🔄 [FloatingFileUploader] Switching to group ID:', triggerGroupId);
|
|
4451
4468
|
this.currentGroupId.set(triggerGroupId);
|
|
4452
4469
|
// Fetch files for this group
|
|
4453
4470
|
this.fileManagerService.fetchAndStoreFilesByGroupId(triggerGroupId)
|
|
4454
4471
|
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
4455
4472
|
.subscribe({
|
|
4456
|
-
next: () =>
|
|
4457
|
-
|
|
4473
|
+
next: () => {
|
|
4474
|
+
if (!isCurrentlyVisible) {
|
|
4475
|
+
this.showWithAnimation();
|
|
4476
|
+
}
|
|
4477
|
+
},
|
|
4478
|
+
error: () => {
|
|
4479
|
+
if (!isCurrentlyVisible) {
|
|
4480
|
+
this.showWithAnimation(); // Show anyway
|
|
4481
|
+
}
|
|
4482
|
+
}
|
|
4458
4483
|
});
|
|
4459
4484
|
}
|
|
4460
|
-
else {
|
|
4485
|
+
else if (!isCurrentlyVisible) {
|
|
4461
4486
|
this.showWithAnimation();
|
|
4462
4487
|
}
|
|
4463
4488
|
}
|
|
@@ -4571,8 +4596,8 @@ class CideEleFloatingFileUploaderComponent {
|
|
|
4571
4596
|
*/
|
|
4572
4597
|
handleFiles(files) {
|
|
4573
4598
|
console.log('📁 [FloatingFileUploader] Handling files:', files.length);
|
|
4574
|
-
// Use
|
|
4575
|
-
this.
|
|
4599
|
+
// Use handleFileSelection to avoid duplicate upload paths
|
|
4600
|
+
this.handleFileSelection(files);
|
|
4576
4601
|
}
|
|
4577
4602
|
/**
|
|
4578
4603
|
* Update visibility - simplified for notification only
|
|
@@ -4708,41 +4733,6 @@ class CideEleFloatingFileUploaderComponent {
|
|
|
4708
4733
|
this.currentUserId.set(userId);
|
|
4709
4734
|
this.fileManagerService.setUserId(userId);
|
|
4710
4735
|
}
|
|
4711
|
-
/**
|
|
4712
|
-
* Public method to handle files from external sources
|
|
4713
|
-
* This can be called by other components to trigger the floating uploader
|
|
4714
|
-
*/
|
|
4715
|
-
handleExternalFiles(files, userId, groupId) {
|
|
4716
|
-
console.log('📁 [FloatingFileUploader] External files received:', files.length, 'files');
|
|
4717
|
-
// Set user ID if provided
|
|
4718
|
-
if (userId && userId !== this.currentUserId()) {
|
|
4719
|
-
this.setCurrentUserId(userId);
|
|
4720
|
-
}
|
|
4721
|
-
// Set group ID if provided
|
|
4722
|
-
if (groupId) {
|
|
4723
|
-
this.currentGroupId.set(groupId);
|
|
4724
|
-
}
|
|
4725
|
-
// Upload files using file manager service
|
|
4726
|
-
// The file manager service will handle adding to its queue and the effect will show the floating uploader
|
|
4727
|
-
files.forEach((file, index) => {
|
|
4728
|
-
console.log(`📁 [FloatingFileUploader] Starting upload for file ${index + 1}/${files.length}:`, file.name);
|
|
4729
|
-
this.fileManagerService.uploadFile(file, {
|
|
4730
|
-
userId: this.currentUserId(),
|
|
4731
|
-
groupId: groupId,
|
|
4732
|
-
permissions: ['read', 'write'],
|
|
4733
|
-
tags: []
|
|
4734
|
-
})
|
|
4735
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
4736
|
-
.subscribe({
|
|
4737
|
-
next: (response) => {
|
|
4738
|
-
console.log('✅ [FloatingFileUploader] Upload completed:', response);
|
|
4739
|
-
},
|
|
4740
|
-
error: (error) => {
|
|
4741
|
-
console.error('❌ [FloatingFileUploader] Upload failed:', error);
|
|
4742
|
-
}
|
|
4743
|
-
});
|
|
4744
|
-
});
|
|
4745
|
-
}
|
|
4746
4736
|
/**
|
|
4747
4737
|
* Check if there are any uploads for the current group
|
|
4748
4738
|
*/
|
|
@@ -4788,7 +4778,8 @@ class CideEleFloatingFileUploaderComponent {
|
|
|
4788
4778
|
* Trigger file input click
|
|
4789
4779
|
*/
|
|
4790
4780
|
triggerFileInput() {
|
|
4791
|
-
|
|
4781
|
+
// Use ViewChild or querySelector with specific selector to target only this component's file input
|
|
4782
|
+
const fileInput = document.querySelector('.floating-uploader input[type="file"]');
|
|
4792
4783
|
if (fileInput) {
|
|
4793
4784
|
fileInput.click();
|
|
4794
4785
|
}
|