"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),l=n(72791),i=n(61889),o=n(40986),c=n(75952),r=n(11135),d=n(25787),u=n(23814),m=n(81207),f=n(56028),p=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,l.useState)(!1),j=(0,t.Z)(v,2),y=j[0],S=j[1],g=(0,l.useState)(""),C=(0,t.Z)(g,2),N=C[0],E=C[1],M=(0,l.useState)("disabled"),B=(0,t.Z)(M,2),D=B[0],P=B[1];(0,l.useEffect)((function(){a&&("AES256"===a.algorithm?P("sse-s3"):(P("sse-kms"),E(a.kmsMasterKeyID)))}),[a]);return(0,k.jsx)(f.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(),y||("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)(i.ZP,{container:!0,children:[(0,k.jsxs)(i.ZP,{item:!0,xs:12,className:s.modalFormScrollable,children:[(0,k.jsx)(i.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)(i.ZP,{item:!0,xs:12,className:s.formFieldRow,children:(0,k.jsx)(p.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)(i.ZP,{item:!0,xs:12,className:s.modalButtonBar,children:[(0,k.jsx)(c.z,{id:"cancel",type:"submit",variant:"regular",onClick:function(){d()},disabled:y,label:"Cancel"}),(0,k.jsx)(c.z,{id:"save",type:"submit",variant:"callAction",disabled:y,label:"Save"})]}),y&&(0,k.jsx)(i.ZP,{item:!0,xs:12,children:(0,k.jsx)(o.Z,{})})]})})})}))},56028:function(e,s,n){var t=n(29439),a=n(1413),l=n(72791),i=n(60364),o=n(13400),c=n(55646),r=n(5574),d=n(65661),u=n(39157),m=n(11135),f=n(25787),p=n(23814),Z=n(25469),h=n(29823),x=n(28057),b=n(87995),k=n(80184);s.Z=(0,f.Z)((function(e){return(0,m.Z)((0,a.Z)((0,a.Z)({},p.Qw),{},{content:{padding:25,paddingBottom:0},customDialogSize:{width:"100%",maxWidth:765}},p.sN))}))((function(e){var s=e.onClose,n=e.modalOpen,m=e.title,f=e.children,p=e.classes,v=e.wideLimit,j=void 0===v||v,y=e.noContentPadding,S=e.titleIcon,g=void 0===S?null:S,C=(0,Z.TL)(),N=(0,l.useState)(!1),E=(0,t.Z)(N,2),M=E[0],B=E[1],D=(0,i.v9)((function(e){return e.system.modalSnackBar}));(0,l.useEffect)((function(){C((0,b.MK)(""))}),[C]),(0,l.useEffect)((function(){if(D){if(""===D.message)return void B(!1);"error"!==D.type&&B(!0)}}),[D]);var P=j?{classes:{paper:p.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:p},P),{},{scroll:"paper",onClose:function(e,n){"backdropClick"!==n&&s()},className:p.root,children:[(0,k.jsxs)(d.Z,{className:p.title,children:[(0,k.jsxs)("div",{className:p.titleText,children:[g," ",m]}),(0,k.jsx)("div",{className:p.closeContainer,children:(0,k.jsx)(o.Z,{"aria-label":"close",id:"close",className:p.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:p.snackBarModal,onClose:function(){B(!1),C((0,b.MK)(""))},message:w,ContentProps:{className:"".concat(p.snackBar," ").concat(D&&"error"===D.type?p.errorSnackBar:"")},autoHideDuration:D&&"error"===D.type?1e4:5e3}),(0,k.jsx)(u.Z,{className:y?"":p.content,children:f})]}))}))}}]);
//# sourceMappingURL=8391.93be3c76.chunk.js.map