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