Files
object-browser/portal-ui/build/static/js/1581.e5ea40c0.chunk.js
2022-04-25 15:41:06 -07:00

2 lines
4.4 KiB
JavaScript

"use strict";(self.webpackChunkportal_ui=self.webpackChunkportal_ui||[]).push([[1581],{1581:function(e,a,t){t.r(a);var n=t(29439),s=t(1413),o=t(72791),i=t(60364),l=t(36151),c=t(40986),r=t(11135),d=t(25787),u=t(61889),m=t(45248),f=t(42649),h=t(23814),Z=t(37516),x=t(21435),p=t(56028),j=t(81207),g=t(92388),k=t(56578),b=t(80184),v=(0,i.$j)(null,{setModalErrorSnackMessage:f.zb});a.default=(0,d.Z)((function(e){return(0,r.Z)((0,s.Z)((0,s.Z)({},h.DF),h.ID))}))(v((function(e){var a=e.classes,t=e.open,s=e.enabled,i=e.cfg,r=e.selectedBucket,d=e.closeModalAndRefresh,f=e.setModalErrorSnackMessage,h=(0,o.useState)(!1),v=(0,n.Z)(h,2),M=v[0],S=v[1],C=(0,o.useState)(!1),q=(0,n.Z)(C,2),N=q[0],B=q[1],P=(0,o.useState)("1"),y=(0,n.Z)(P,2),w=y[0],E=y[1],_=(0,o.useState)("TiB"),D=(0,n.Z)(_,2),z=D[0],F=D[1];(0,o.useEffect)((function(){if(s&&(B(!0),i)){E("".concat(i.quota)),F("Gi");for(var e="B",a=i.quota,t=0;t<m.Dl.length&&i.quota%Math.pow(1024,t)===0;t++)a=i.quota/Math.pow(1024,t),e=m.Dl[t];E("".concat(a)),F(e)}}),[s,i]);return(0,b.jsx)(p.Z,{modalOpen:t,onClose:function(){d()},title:"Enable Bucket Quota",titleIcon:(0,b.jsx)(g.Wq,{}),children:(0,b.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:function(e){e.preventDefault(),function(){if(!M){var e={enabled:N,amount:parseInt((0,m.Pw)(w,z,!0)),quota_type:"hard"};j.Z.invoke("PUT","/api/v1/buckets/".concat(r,"/quota"),e).then((function(){S(!1),d()})).catch((function(e){S(!1),f(e)}))}}()},children:(0,b.jsxs)(u.ZP,{container:!0,children:[(0,b.jsxs)(u.ZP,{item:!0,xs:12,className:a.formScrollable,children:[(0,b.jsx)(u.ZP,{item:!0,xs:12,className:a.formFieldRow,children:(0,b.jsx)(Z.Z,{value:"bucket_quota",id:"bucket_quota",name:"bucket_quota",checked:N,onChange:function(e){B(e.target.checked)},label:"Enabled"})}),N&&(0,b.jsx)(o.Fragment,{children:(0,b.jsx)(u.ZP,{item:!0,xs:12,className:a.formFieldRow,children:(0,b.jsx)(u.ZP,{container:!0,children:(0,b.jsx)(u.ZP,{item:!0,xs:12,children:(0,b.jsx)(x.Z,{id:"quota_size",name:"quota_size",onChange:function(e){e.target.validity.valid&&E(e.target.value)},pattern:"[0-9]*",label:"Quota",value:w,required:!0,min:"1",overlayObject:(0,b.jsx)(k.Z,{id:"quota_unit",onUnitChange:function(e){F(e)},unitSelected:z,unitsList:(0,m.zQ)(["Ki"]),disabled:!1})})})})})})]}),(0,b.jsxs)(u.ZP,{item:!0,xs:12,className:a.modalButtonBar,children:[(0,b.jsx)(l.Z,{type:"button",variant:"outlined",color:"primary",disabled:M,onClick:function(){d()},children:"Cancel"}),(0,b.jsx)(l.Z,{type:"submit",variant:"contained",color:"primary",disabled:M,children:"Save"})]}),M&&(0,b.jsx)(u.ZP,{item:!0,xs:12,children:(0,b.jsx)(c.Z,{})})]})})})})))},56028:function(e,a,t){var n=t(29439),s=t(1413),o=t(72791),i=t(60364),l=t(13400),c=t(55646),r=t(5574),d=t(65661),u=t(39157),m=t(11135),f=t(25787),h=t(23814),Z=t(42649),x=t(29823),p=t(28057),j=t(80184),g=(0,i.$j)((function(e){return{modalSnackMessage:e.system.modalSnackBar}}),{setModalSnackMessage:Z.MK});a.Z=(0,f.Z)((function(e){return(0,m.Z)((0,s.Z)((0,s.Z)({},h.Qw),{},{content:{padding:25,paddingBottom:0},customDialogSize:{width:"100%",maxWidth:765}},h.sN))}))(g((function(e){var a=e.onClose,t=e.modalOpen,i=e.title,m=e.children,f=e.classes,h=e.wideLimit,Z=void 0===h||h,g=e.modalSnackMessage,k=e.noContentPadding,b=e.setModalSnackMessage,v=e.titleIcon,M=void 0===v?null:v,S=(0,o.useState)(!1),C=(0,n.Z)(S,2),q=C[0],N=C[1];(0,o.useEffect)((function(){b("")}),[b]),(0,o.useEffect)((function(){if(g){if(""===g.message)return void N(!1);"error"!==g.type&&N(!0)}}),[g]);var B=Z?{classes:{paper:f.customDialogSize}}:{maxWidth:"lg",fullWidth:!0},P="";return g&&(P=g.detailedErrorMsg,(""===g.detailedErrorMsg||g.detailedErrorMsg.length<5)&&(P=g.message)),(0,j.jsxs)(r.Z,(0,s.Z)((0,s.Z)({open:t,classes:f},B),{},{scroll:"paper",onClose:function(e,t){"backdropClick"!==t&&a()},className:f.root,children:[(0,j.jsxs)(d.Z,{className:f.title,children:[(0,j.jsxs)("div",{className:f.titleText,children:[M," ",i]}),(0,j.jsx)("div",{className:f.closeContainer,children:(0,j.jsx)(l.Z,{"aria-label":"close",id:"close",className:f.closeButton,onClick:a,disableRipple:!0,size:"small",children:(0,j.jsx)(x.Z,{})})})]}),(0,j.jsx)(p.Z,{isModal:!0}),(0,j.jsx)(c.Z,{open:q,className:f.snackBarModal,onClose:function(){N(!1),b("")},message:P,ContentProps:{className:"".concat(f.snackBar," ").concat(g&&"error"===g.type?f.errorSnackBar:"")},autoHideDuration:g&&"error"===g.type?1e4:5e3}),(0,j.jsx)(u.Z,{className:k?"":f.content,children:m})]}))})))}}]);
//# sourceMappingURL=1581.e5ea40c0.chunk.js.map