cloud-ide-element 1.0.51 → 1.0.52

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.
@@ -2927,6 +2927,12 @@ class CideEleFileInputComponent {
2927
2927
  this.simulateProgress();
2928
2928
  this.fileManagerService.uploadFile(file, this.uploadData).subscribe({
2929
2929
  next: (response) => {
2930
+ // Clear progress interval
2931
+ if (this.progressInterval) {
2932
+ clearInterval(this.progressInterval);
2933
+ this.progressInterval = null;
2934
+ }
2935
+ // Complete the progress
2930
2936
  this.uploadProgress = 100;
2931
2937
  this.uploadProgressChange.emit(100);
2932
2938
  // Update progress notification to complete
@@ -2951,6 +2957,11 @@ class CideEleFileInputComponent {
2951
2957
  },
2952
2958
  error: (error) => {
2953
2959
  console.error('❌ Upload failed:', error);
2960
+ // Clear progress interval
2961
+ if (this.progressInterval) {
2962
+ clearInterval(this.progressInterval);
2963
+ this.progressInterval = null;
2964
+ }
2954
2965
  // Remove progress notification and show error
2955
2966
  if (this.uploadNotificationId) {
2956
2967
  this.notificationService.remove(this.uploadNotificationId);
@@ -2964,20 +2975,23 @@ class CideEleFileInputComponent {
2964
2975
  }
2965
2976
  });
2966
2977
  }
2978
+ progressInterval = null;
2967
2979
  simulateProgress() {
2968
- const interval = setInterval(() => {
2969
- if (this.uploadProgress < 90) {
2970
- this.uploadProgress += Math.random() * 8; // Smaller increments for smoother progress
2980
+ this.progressInterval = setInterval(() => {
2981
+ if (this.uploadProgress < 95 && this.isUploading) { // Continue until 95% and still uploading
2982
+ this.uploadProgress += Math.random() * 5; // Smaller increments for smoother progress
2971
2983
  this.uploadProgressChange.emit(this.uploadProgress);
2972
2984
  // Update progress notification
2973
2985
  if (this.uploadNotificationId) {
2974
2986
  this.notificationService.updateProgress(this.uploadNotificationId, this.uploadProgress, `Uploading file... ${Math.round(this.uploadProgress)}%`);
2975
2987
  }
2976
2988
  }
2977
- else {
2978
- clearInterval(interval);
2989
+ else if (this.uploadProgress >= 95) {
2990
+ // Stop at 95% and wait for actual API response
2991
+ clearInterval(this.progressInterval);
2992
+ this.progressInterval = null;
2979
2993
  }
2980
- }, 300); // More frequent updates for smoother progress bar
2994
+ }, 400); // Slightly slower updates
2981
2995
  }
2982
2996
  generatePreviews() {
2983
2997
  // Clear existing previews
@@ -3035,6 +3049,11 @@ class CideEleFileInputComponent {
3035
3049
  ngOnDestroy() {
3036
3050
  // Clean up preview URLs to prevent memory leaks
3037
3051
  this.clearPreviews();
3052
+ // Clean up progress interval
3053
+ if (this.progressInterval) {
3054
+ clearInterval(this.progressInterval);
3055
+ this.progressInterval = null;
3056
+ }
3038
3057
  // Clean up any active upload notification
3039
3058
  if (this.uploadNotificationId) {
3040
3059
  this.notificationService.remove(this.uploadNotificationId);