"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[7264],{47264:(e,t,n)=>{n.r(t),n.d(t,{default:()=>p});var a=n(65043),o=n(89923),l=n(56483),r=n(77403),i=n(94141),s=n(23758),d=n(64159),u=n(21383),c=n(56629),b=n(53518),h=n(70579);const p=e=>{let{open:t,enabled:n,cfg:p,selectedBucket:x,closeModalAndRefresh:m}=e;const g=(0,u.jL)(),[f,j]=(0,a.useState)(!1),[C,k]=(0,a.useState)(!1),[v,S]=(0,a.useState)("1"),[y,A]=(0,a.useState)("Ti"),[q,B]=(0,a.useState)(!1);(0,a.useEffect)((()=>{if(n&&(k(!0),p)){const e=(0,l.GT)(p.quota||0,!0,!1,!0);S(e.total.toString()),A(e.unit),B(!0)}}),[n,p]),(0,a.useEffect)((()=>{B(!C||/^\d*(?:\.\d{1,2})?$/.test(v))}),[C,v]);return(0,h.jsx)(i.A,{modalOpen:t,onClose:()=>{m()},title:"Enable Bucket Quota",titleIcon:(0,h.jsx)(o.Uh,{}),children:(0,h.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),!f&&q&&c.F.buckets.setBucketQuota(x,{enabled:C,amount:parseInt((0,l.q5)(v,y,!0)),quota_type:"hard"}).then((()=>{j(!1),m()})).catch((e=>{j(!1),g((0,d.Dy)((0,b.S)(e.error)))}))},children:(0,h.jsxs)(o.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,h.jsx)(o.dOG,{value:"bucket_quota",id:"bucket_quota",name:"bucket_quota",checked:C,onChange:e=>{k(e.target.checked)},label:"Enabled"}),C&&(0,h.jsx)(o.cl_,{id:"quota_size",name:"quota_size",onChange:e=>{S(e.target.value),e.target.validity.valid?B(!0):B(!1)},label:"Quota",value:v,required:!0,min:"1",overlayObject:(0,h.jsx)(s.A,{id:"quota_unit",onUnitChange:e=>{A(e)},unitSelected:y,unitsList:(0,l.l9)(["Ki"]),disabled:!1}),error:q?"":"Please enter a valid quota"}),(0,h.jsxs)(o.xA9,{item:!0,xs:12,sx:r.Uz.modalButtonBar,children:[(0,h.jsx)(o.$nd,{id:"cancel",type:"button",variant:"regular",disabled:f,onClick:()=>{m()},label:"Cancel"}),(0,h.jsx)(o.$nd,{id:"save",type:"submit",variant:"callAction",disabled:f||!q,label:"Save"})]}),f&&(0,h.jsx)(o.xA9,{item:!0,xs:12,children:(0,h.jsx)(o.z21,{})})]})})})}},23758:(e,t,n)=>{n.d(t,{A:()=>u});var a=n(65043),o=n(89923),l=n(94574),r=n(33097),i=n.n(r),s=n(70579);const d=l.Ay.button((e=>{let{theme:t}=e;return{border:`1px solid ${i()(t,"borderColor","#E2E2E2")}`,borderRadius:3,color:i()(t,"secondaryText","#5B5C5C"),backgroundColor:i()(t,"boxBackground","#FBFAFA"),fontSize:12}})),u=e=>{let{id:t,unitSelected:n,unitsList:l,disabled:r=!1,onUnitChange:i}=e;const[u,c]=a.useState(null),b=Boolean(u),h=e=>{c(null),""!==e&&i&&i(e)};return(0,s.jsxs)(a.Fragment,{children:[(0,s.jsx)(d,{id:`${t}-button`,"aria-controls":`${t}-menu`,"aria-haspopup":"true","aria-expanded":b?"true":void 0,onClick:e=>{c(e.currentTarget)},disabled:r,type:"button",children:n}),(0,s.jsx)(o.Vey,{id:"upload-main-menu",options:l,selectedOption:"",onSelect:e=>h(e),hideTriggerAction:()=>{h("")},open:b,anchorEl:u,anchorOrigin:"end"})]})}},94141:(e,t,n)=>{n.d(t,{A:()=>u});var a=n(65043),o=n(22166),l=n(89923),r=n(21383),i=n(64159),s=n(49555),d=n(70579);const u=e=>{let{onClose:t,modalOpen:n,title:u,children:c,wideLimit:b=!0,titleIcon:h=null,iconColor:p="default",sx:x}=e;const m=(0,r.jL)(),[g,f]=(0,a.useState)(!1),j=(0,o.d4)((e=>e.system.modalSnackBar));(0,a.useEffect)((()=>{m((0,i.h0)(""))}),[m]),(0,a.useEffect)((()=>{if(j){if(""===j.message)return void f(!1);"error"!==j.type&&f(!0)}}),[j]);let C="";return j&&(C=j.detailedErrorMsg,(""===C||C&&C.length<5)&&(C=j.message)),(0,d.jsxs)(l.ngX,{onClose:t,open:n,title:u,titleIcon:h,widthLimit:b,sx:x,iconColor:p,children:[(0,d.jsx)(s.A,{isModal:!0}),(0,d.jsx)(l.qb_,{onClose:()=>{f(!1),m((0,i.h0)(""))},open:g,message:C,mode:"inline",variant:"error"===j.type?"error":"default",autoHideDuration:"error"===j.type?10:5,condensed:!0}),c]})}}}]);
//# sourceMappingURL=7264.272579ce.chunk.js.map