@@ -27,7 +27,6 @@ import UIWindowSaveAccount from './UI/UIWindowSaveAccount.js';
27
27
import update_username_in_gui from './helpers/update_username_in_gui.js' ;
28
28
import update_title_based_on_uploads from './helpers/update_title_based_on_uploads.js' ;
29
29
import content_type_to_icon from './helpers/content_type_to_icon.js' ;
30
- import UIWindowDownloadDirProg from './UI/UIWindowDownloadDirProg.js' ;
31
30
import { PROCESS_RUNNING , PortalProcess , PseudoProcess } from "./definitions.js" ;
32
31
import UIWindowProgress from './UI/UIWindowProgress.js' ;
33
32
@@ -2965,14 +2964,14 @@ window.zipItems = async function(el_items, targetDirPath, download = true) {
2965
2964
let progwin , progwin_timeout ;
2966
2965
// only show progress window if it takes longer than 500ms to download
2967
2966
progwin_timeout = setTimeout ( async ( ) => {
2968
- progwin = await UIWindowDownloadDirProg ( ) ;
2967
+ progwin = await UIWindowProgress ( ) ;
2969
2968
} , 500 ) ;
2970
2969
2971
2970
for ( const el_item of el_items ) {
2972
2971
let targetPath = $ ( el_item ) . attr ( 'data-path' ) ;
2973
2972
// if directory, zip the directory
2974
2973
if ( $ ( el_item ) . attr ( 'data-is_dir' ) === '1' ) {
2975
- $ ( progwin ) . find ( '.dir-dl-status' ) . html ( `Reading <strong> ${ html_encode ( targetPath ) } </strong>` ) ;
2974
+ progwin ?. set_status ( i18n ( 'reading_file' , targetPath ) ) ;
2976
2975
// Recursively read the directory
2977
2976
let children = await readDirectoryRecursive ( targetPath ) ;
2978
2977
@@ -2985,7 +2984,7 @@ window.zipItems = async function(el_items, targetDirPath, download = true) {
2985
2984
relativePath = path . basename ( targetPath ) + '/' + child . relativePath ;
2986
2985
2987
2986
// update progress window
2988
- $ ( progwin ) . find ( '.dir-dl-status' ) . html ( `Zipping <strong> ${ html_encode ( relativePath ) } </strong>` ) ;
2987
+ progwin ?. set_status ( i18n ( 'zipping_file' , relativePath ) ) ;
2989
2988
2990
2989
// read file content
2991
2990
let content = await puter . fs . read ( child . path ) ;
@@ -3034,17 +3033,18 @@ window.zipItems = async function(el_items, targetDirPath, download = true) {
3034
3033
// close progress window
3035
3034
clearTimeout ( progwin_timeout ) ;
3036
3035
setTimeout ( ( ) => {
3037
- $ ( progwin ) . close ( ) ;
3036
+ progwin ? .close ( ) ;
3038
3037
} , Math . max ( 0 , window . copy_progress_hide_delay - ( Date . now ( ) - start_ts ) ) ) ;
3039
3038
} )
3040
3039
. catch ( function ( err ) {
3041
3040
// close progress window
3042
3041
clearTimeout ( progwin_timeout ) ;
3043
3042
setTimeout ( ( ) => {
3044
- $ ( progwin ) . close ( ) ;
3043
+ progwin ? .close ( ) ;
3045
3044
} , Math . max ( 0 , window . copy_progress_hide_delay - ( Date . now ( ) - start_ts ) ) ) ;
3046
3045
3047
3046
// handle errors
3047
+ // TODO: Display in progress dialog
3048
3048
console . error ( "Error in zipping files: " , err ) ;
3049
3049
} ) ;
3050
3050
}
@@ -3087,7 +3087,7 @@ window.unzipItem = async function(itemPath) {
3087
3087
let progwin , progwin_timeout ;
3088
3088
// only show progress window if it takes longer than 500ms to download
3089
3089
progwin_timeout = setTimeout ( async ( ) => {
3090
- progwin = await UIWindowDownloadDirProg ( ) ;
3090
+ progwin = await UIWindowProgress ( ) ;
3091
3091
} , 500 ) ;
3092
3092
3093
3093
const zip = new JSZip ( ) ;
@@ -3109,15 +3109,15 @@ window.unzipItem = async function(itemPath) {
3109
3109
// close progress window
3110
3110
clearTimeout ( progwin_timeout ) ;
3111
3111
setTimeout ( ( ) => {
3112
- $ ( progwin ) . close ( ) ;
3112
+ progwin ? .close ( ) ;
3113
3113
} , Math . max ( 0 , window . copy_progress_hide_delay - ( Date . now ( ) - start_ts ) ) ) ;
3114
3114
3115
3115
} ) . catch ( function ( e ) {
3116
3116
// UIAlert(e.message);
3117
3117
// close progress window
3118
3118
clearTimeout ( progwin_timeout ) ;
3119
3119
setTimeout ( ( ) => {
3120
- $ ( progwin ) . close ( ) ;
3120
+ progwin ? .close ( ) ;
3121
3121
} , Math . max ( 0 , window . copy_progress_hide_delay - ( Date . now ( ) - start_ts ) ) ) ;
3122
3122
} )
3123
3123
}
0 commit comments