"use strict";(self.webpackChunkportal_ui=self.webpackChunkportal_ui||[]).push([[8391],{18391:function(e,s,n){n.r(s);var t=n(29439),a=n(1413),i=n(72791),l=n(61889),o=n(36151),c=n(40986),r=n(11135),d=n(25787),u=n(23814),m=n(81207),p=n(56028),f=n(21435),Z=n(90673),h=n(38734),x=n(87995),b=n(25469),k=n(80184);s.default=(0,d.Z)((function(e){return(0,r.Z)((0,a.Z)((0,a.Z)({},u.ID),u.DF))}))((function(e){var s=e.classes,n=e.open,a=e.encryptionCfg,r=e.selectedBucket,d=e.closeModalAndRefresh,u=(0,b.TL)(),v=(0,i.useState)(!1),y=(0,t.Z)(v,2),j=y[0],S=y[1],g=(0,i.useState)(""),C=(0,t.Z)(g,2),N=C[0],E=C[1],M=(0,i.useState)("disabled"),B=(0,t.Z)(M,2),D=B[0],P=B[1];(0,i.useEffect)((function(){a&&("AES256"===a.algorithm?P("sse-s3"):(P("sse-kms"),E(a.kmsMasterKeyID)))}),[a]);return(0,k.jsx)(p.Z,{modalOpen:n,onClose:function(){d()},title:"Enable Bucket Encryption",titleIcon:(0,k.jsx)(h.Xn4,{}),children:(0,k.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:function(e){e.preventDefault(),j||("disabled"===D?m.Z.invoke("POST","/api/v1/buckets/".concat(r,"/encryption/disable")).then((function(){S(!1),d()})).catch((function(e){S(!1),u((0,x.zb)(e))})):m.Z.invoke("POST","/api/v1/buckets/".concat(r,"/encryption/enable"),{encType:D,kmsKeyID:N}).then((function(){S(!1),d()})).catch((function(e){S(!1),u((0,x.zb)(e))})))},children:(0,k.jsxs)(l.ZP,{container:!0,children:[(0,k.jsxs)(l.ZP,{item:!0,xs:12,className:s.modalFormScrollable,children:[(0,k.jsx)(l.ZP,{item:!0,xs:12,className:s.formFieldRow,children:(0,k.jsx)(Z.Z,{onChange:function(e){P(e.target.value)},id:"select-encryption-type",name:"select-encryption-type",label:"Encryption Type",value:D,options:[{label:"Disabled",value:"disabled"},{label:"SSE-S3",value:"sse-s3"},{label:"SSE-KMS",value:"sse-kms"}]})}),"sse-kms"===D&&(0,k.jsx)(l.ZP,{item:!0,xs:12,className:s.formFieldRow,children:(0,k.jsx)(f.Z,{id:"kms-key-id",name:"kms-key-id",label:"KMS Key ID",value:N,onChange:function(e){E(e.target.value)}})})]}),(0,k.jsxs)(l.ZP,{item:!0,xs:12,className:s.modalButtonBar,children:[(0,k.jsx)(o.Z,{type:"submit",variant:"outlined",color:"primary",onClick:function(){d()},disabled:j,children:"Cancel"}),(0,k.jsx)(o.Z,{type:"submit",variant:"contained",color:"primary",disabled:j,children:"Save"})]}),j&&(0,k.jsx)(l.ZP,{item:!0,xs:12,children:(0,k.jsx)(c.Z,{})})]})})})}))},56028:function(e,s,n){var t=n(29439),a=n(1413),i=n(72791),l=n(60364),o=n(13400),c=n(55646),r=n(5574),d=n(65661),u=n(39157),m=n(11135),p=n(25787),f=n(23814),Z=n(25469),h=n(29823),x=n(28057),b=n(87995),k=n(80184);s.Z=(0,p.Z)((function(e){return(0,m.Z)((0,a.Z)((0,a.Z)({},f.Qw),{},{content:{padding:25,paddingBottom:0},customDialogSize:{width:"100%",maxWidth:765}},f.sN))}))((function(e){var s=e.onClose,n=e.modalOpen,m=e.title,p=e.children,f=e.classes,v=e.wideLimit,y=void 0===v||v,j=e.noContentPadding,S=e.titleIcon,g=void 0===S?null:S,C=(0,Z.TL)(),N=(0,i.useState)(!1),E=(0,t.Z)(N,2),M=E[0],B=E[1],D=(0,l.v9)((function(e){return e.system.modalSnackBar}));(0,i.useEffect)((function(){C((0,b.MK)(""))}),[C]),(0,i.useEffect)((function(){if(D){if(""===D.message)return void B(!1);"error"!==D.type&&B(!0)}}),[D]);var P=y?{classes:{paper:f.customDialogSize}}:{maxWidth:"lg",fullWidth:!0},w="";return D&&(w=D.detailedErrorMsg,(""===D.detailedErrorMsg||D.detailedErrorMsg.length<5)&&(w=D.message)),(0,k.jsxs)(r.Z,(0,a.Z)((0,a.Z)({open:n,classes:f},P),{},{scroll:"paper",onClose:function(e,n){"backdropClick"!==n&&s()},className:f.root,children:[(0,k.jsxs)(d.Z,{className:f.title,children:[(0,k.jsxs)("div",{className:f.titleText,children:[g," ",m]}),(0,k.jsx)("div",{className:f.closeContainer,children:(0,k.jsx)(o.Z,{"aria-label":"close",id:"close",className:f.closeButton,onClick:s,disableRipple:!0,size:"small",children:(0,k.jsx)(h.Z,{})})})]}),(0,k.jsx)(x.Z,{isModal:!0}),(0,k.jsx)(c.Z,{open:M,className:f.snackBarModal,onClose:function(){B(!1),C((0,b.MK)(""))},message:w,ContentProps:{className:"".concat(f.snackBar," ").concat(D&&"error"===D.type?f.errorSnackBar:"")},autoHideDuration:D&&"error"===D.type?1e4:5e3}),(0,k.jsx)(u.Z,{className:j?"":f.content,children:p})]}))}))}}]);
//# sourceMappingURL=8391.824bba1f.chunk.js.map