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