(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/file-manager/upload-progress-dialog"],{1087:(e,t,a)=>{"use strict";a.r(t);var s=a(153),r=a.n(s),n=a(155),l=a(154),o=a(261),c=a.n(o);class i extends l.Component{renderItemStatus(e){switch(e.status){case"UPLOADING":return null===e.loaded?(0,l.createElement)("span",{className:"hint-wait"},(0,l.createElement)(n.Translate,{content:"statusUploading"})):this.renderItemProgress(e);case"ERROR":return(0,l.createElement)("span",{className:"hint-failed"},(0,l.createElement)(n.Translate,{content:"statusFailed"}));case"SUCCESS":return(0,l.createElement)("span",{className:"hint-ok"},(0,l.createElement)(n.Translate,{content:"statusCompleted"}));case"CANCELED":return(0,l.createElement)("span",{className:"hint-failed"},(0,l.createElement)(n.Translate,{content:"statusCanceled"}))}return(0,l.createElement)("span",{className:"hint-not-started"},(0,l.createElement)(n.Translate,{content:"statusNotStarted"}))}renderItemProgress(e){const t=e.total>0?Math.round(e.loaded/e.total*100):100;return(0,l.createElement)("div",{className:"progress progress-sm"},(0,l.createElement)("div",{className:"progress-bar",style:{width:"".concat(t,"%")}}))}getUploadProgressDescription(e){return null===e.loaded||e.loaded===e.total?this.getSize(e.total):(0,l.createElement)(n.Translate,{content:"progressText",params:{loaded:this.getSize(e.loaded),total:this.getSize(e.total)}})}getSize(e){let t=0;for(;e>=1024;)e/=1024,t++;return(0,l.createElement)(l.Fragment,null,t>0?e.toFixed(1):e," ",(0,l.createElement)(n.Translate,{content:["bytes","kbytes","mbytes","gbytes"][t]}))}render(){const{status:e,progress:t,items:a,uploadProgressSupported:s,...o}=this.props,c=a.filter((e=>"SUCCESS"===e.status)).length,i=(0,l.createElement)(n.Translate,{content:"descriptionUploadProgress","data-id":"progressUploadTitle",params:{total:a.length,completed:c}}),d=t>-1?(0,l.createElement)(n.Translate,{content:"totalProgressText",params:{percent:"".concat(t,"%")}}):(0,l.createElement)("span",null);return(0,l.createElement)(n.ProgressDialog,r()({title:(0,l.createElement)(n.Translate,{content:"uploadDialogTitle"}),description:(0,l.createElement)(n.Translate,{content:"uploadDialogHint"}),cancelable:!0},o),(0,l.createElement)(n.ProgressStep,{title:i,status:e,statusText:d,progress:t},(0,l.createElement)("div",{className:"list"},(0,l.createElement)("table",{width:"100%",cellSpacing:"0",style:{wordBreak:"break-word"}},(0,l.createElement)("tbody",null,a.map(((e,t)=>(0,l.createElement)("tr",{key:e.progressId,className:t%2==0?"odd":"even"},(0,l.createElement)("td",{className:"first"},(0,l.createElement)("span",{className:"type-".concat(e.type)},e.savedFileName)),s&&(0,l.createElement)("td",{className:"upload-progress nowrap t-r"},(0,l.createElement)("span",null,this.getUploadProgressDescription(e))),(0,l.createElement)("td",{style:{width:"100px"}},this.renderItemStatus(e))))))))))}}i.propTypes={status:c().string.isRequired,progress:c().number.isRequired,items:c().array.isRequired,uploadProgressSupported:c().bool.isRequired},t.default=i},1086:(e,t,a)=>{"use strict";a.r(t);var s=a(155),r=a(154),n=a(144),l=a(1087);t.default=({container:e,...t})=>{const a=n.Locale.getSection("smb.controllers.file-manager.upload").messages;a["ProgressDialog.closeButton"]=a.buttonClose,a["ProgressDialog.cancelButton"]=n.Locale.getSection("components.buttons").lmsg("cancel"),(0,r.render)((0,r.createElement)(s.LocaleProvider,{messages:a},(0,r.createElement)(l.default,t)),e)}}}]);
//# sourceMappingURL=upload-progress-dialog.js.map?ea08f24c6fcc8b8f2e92