cloud-ide-element 1.0.91 → 1.0.93
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.
|
@@ -9,8 +9,8 @@ import * as i2$1 from '@angular/router';
|
|
|
9
9
|
import * as i1$1 from '@angular/common/http';
|
|
10
10
|
import { HttpClient, HttpEventType, HttpRequest } from '@angular/common/http';
|
|
11
11
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
12
|
+
import { generateStringFromObject, coreRoutesUrl, cidePath, hostManagerRoutesUrl } from 'cloud-ide-lms-model';
|
|
12
13
|
import { tap, catchError as catchError$1 } from 'rxjs/operators';
|
|
13
|
-
import { coreRoutesUrl, generateStringFromObject, cidePath, hostManagerRoutesUrl } from 'cloud-ide-lms-model';
|
|
14
14
|
|
|
15
15
|
class CapitalizePipe {
|
|
16
16
|
transform(value, capitalizationMethod) {
|
|
@@ -2910,7 +2910,10 @@ class CideEleFileManagerService {
|
|
|
2910
2910
|
const payload = {
|
|
2911
2911
|
cyfm_group_id: groupId
|
|
2912
2912
|
};
|
|
2913
|
-
|
|
2913
|
+
// Convert payload to string using generateStringFromObject
|
|
2914
|
+
const queryString = generateStringFromObject(payload);
|
|
2915
|
+
console.log('📝 [FileManagerService] Query string generated:', queryString);
|
|
2916
|
+
return this.http.get(`${this._baseUrl()}/group/${queryString}`).pipe(retry(2), catchError(this.handleError.bind(this)), takeUntilDestroyed(this.destroyRef));
|
|
2914
2917
|
}
|
|
2915
2918
|
/**
|
|
2916
2919
|
* Fetch and store files by group ID in service state
|
|
@@ -3807,13 +3810,22 @@ class CideEleFileInputComponent {
|
|
|
3807
3810
|
writeValue(value) {
|
|
3808
3811
|
console.log('📝 [FileInput] writeValue called with:', value);
|
|
3809
3812
|
if (typeof value === 'string') {
|
|
3810
|
-
//
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3813
|
+
// Check if this is a group ID for multiple files or single file ID
|
|
3814
|
+
if (this.isMultipleFileMode()) {
|
|
3815
|
+
// Multiple file mode - value is group ID
|
|
3816
|
+
console.log('📁 [FileInput] Value is group ID for multiple files:', value);
|
|
3817
|
+
this.groupId.set(value);
|
|
3818
|
+
this.loadFilesFromGroupId(value);
|
|
3819
|
+
}
|
|
3820
|
+
else {
|
|
3821
|
+
// Single file mode - value is file ID
|
|
3822
|
+
console.log('📝 [FileInput] Value is single file ID:', value);
|
|
3823
|
+
this.files.set(null);
|
|
3824
|
+
this.fileNames.set([]);
|
|
3825
|
+
this.clearPreviews();
|
|
3826
|
+
// Fetch file details to get base64 and set preview
|
|
3827
|
+
this.loadFileDetailsFromId(value);
|
|
3828
|
+
}
|
|
3817
3829
|
}
|
|
3818
3830
|
else if (value instanceof FileList) {
|
|
3819
3831
|
// Value is a FileList
|
|
@@ -3821,6 +3833,14 @@ class CideEleFileInputComponent {
|
|
|
3821
3833
|
this.files.set(value);
|
|
3822
3834
|
this.fileNames.set(Array.from(value).map(f => f.name));
|
|
3823
3835
|
this.generatePreviews();
|
|
3836
|
+
// For multiple files, use group ID API to fetch files
|
|
3837
|
+
if (value.length > 1) {
|
|
3838
|
+
const groupId = this.groupId();
|
|
3839
|
+
if (groupId) {
|
|
3840
|
+
console.log('📁 [FileInput] Multiple files detected, fetching files for group:', groupId);
|
|
3841
|
+
this.loadFilesFromGroupId(groupId);
|
|
3842
|
+
}
|
|
3843
|
+
}
|
|
3824
3844
|
}
|
|
3825
3845
|
else {
|
|
3826
3846
|
// Value is null
|
|
@@ -4223,6 +4243,42 @@ class CideEleFileInputComponent {
|
|
|
4223
4243
|
}
|
|
4224
4244
|
});
|
|
4225
4245
|
}
|
|
4246
|
+
/**
|
|
4247
|
+
* Check if the component is in multiple file mode
|
|
4248
|
+
*/
|
|
4249
|
+
isMultipleFileMode() {
|
|
4250
|
+
// Check if multiple attribute is set or if we have a group ID
|
|
4251
|
+
return this.multiple || this.groupId() !== null;
|
|
4252
|
+
}
|
|
4253
|
+
/**
|
|
4254
|
+
* Load files from group ID using the group API
|
|
4255
|
+
*/
|
|
4256
|
+
loadFilesFromGroupId(groupId) {
|
|
4257
|
+
console.log('🔍 [FileInput] Loading files for group ID:', groupId);
|
|
4258
|
+
if (!groupId)
|
|
4259
|
+
return;
|
|
4260
|
+
this.fileManagerService.fetchAndStoreFilesByGroupId(groupId)
|
|
4261
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
4262
|
+
.subscribe({
|
|
4263
|
+
next: (files) => {
|
|
4264
|
+
console.log('📋 [FileInput] Files loaded for group:', files.length);
|
|
4265
|
+
// Set file names to show count in input
|
|
4266
|
+
if (files && files.length > 0) {
|
|
4267
|
+
const fileNames = files.map(file => file.file_name || file.name || 'Unknown file');
|
|
4268
|
+
this.fileNames.set(fileNames);
|
|
4269
|
+
console.log('📝 [FileInput] File names set for display:', fileNames);
|
|
4270
|
+
}
|
|
4271
|
+
else {
|
|
4272
|
+
this.fileNames.set([]);
|
|
4273
|
+
}
|
|
4274
|
+
// Files are now stored in service state and will be displayed by floating uploader
|
|
4275
|
+
},
|
|
4276
|
+
error: (error) => {
|
|
4277
|
+
console.error('❌ [FileInput] Failed to load files for group:', error);
|
|
4278
|
+
this.fileNames.set([]);
|
|
4279
|
+
}
|
|
4280
|
+
});
|
|
4281
|
+
}
|
|
4226
4282
|
isImageFileFromName(fileName) {
|
|
4227
4283
|
if (!fileName)
|
|
4228
4284
|
return false;
|