"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6654],{36654:(e,t,s)=>{s.r(t),s.d(t,{default:()=>k});var n=s(65043),a=s(89923),l=s(85330),c=s(56629),i=s(53518),o=s(77403),r=s(64159),d=s(20554),p=s(99161),m=s(77938),u=s(6681),x=s(58661),y=s(38375),h=s(70579);const j=e=>{let{closeAddModalAndRefresh:t,addOpen:s}=e;const l=(0,d.jL)(),[o,p]=(0,n.useState)(!1),[m,u]=(0,n.useState)("");return(0,h.jsx)(x.A,{title:"",confirmText:"Create",isOpen:s,isLoading:o,onConfirm:()=>{p(!0),c.F.kms.kmsCreateKey({key:m}).then((e=>{t(!0)})).catch((async e=>{const s=await e.json();l((0,r.C9)((0,i.S)(s))),t(!1)})).finally((()=>p(!1)))},onClose:()=>t(!1),confirmButtonProps:{disabled:-1!==m.indexOf(" ")||""===m||o,variant:"callAction"},confirmationContent:(0,h.jsxs)(n.Fragment,{children:[(0,h.jsx)(y.A,{helpText:"Create Key",contents:["Create a new cryptographic key in the Key Management Service server connected to MINIO."]}),(0,h.jsx)(a.xA9,{item:!0,xs:12,sx:{marginTop:15},children:(0,h.jsx)(a.cl_,{id:"key-name",name:"key-name",label:"Key Name",autoFocus:!0,value:m,error:-1!==m.indexOf(" ")?"Key name cannot contain spaces":"",onChange:e=>{u(e.target.value)}})})]})})};var b=s(94141);const k=e=>{let{open:t,encryptionCfg:s,selectedBucket:x,closeModalAndRefresh:y}=e;const k=(0,d.jL)(),[S,f]=(0,n.useState)(!1),[v,C]=(0,n.useState)(""),[g,A]=(0,n.useState)("disabled"),[K,M]=(0,n.useState)([]),[E,w]=(0,n.useState)(!1),[B,D]=(0,n.useState)(!1);(0,n.useEffect)((()=>{s&&("AES256"===s.algorithm?A(l.M0.SseS3):(A(l.M0.SseKms),C(s.kmsMasterKeyID||"")))}),[s]),(0,n.useEffect)((()=>{"sse-kms"===g&&c.F.kms.kmsListKeys().then((e=>{M(e.data.results),w(!1)})).catch((e=>{w(!1),k((0,r.Dy)((0,i.S)(e.error)))}))}),[g,E,k]);return(0,h.jsxs)(n.Fragment,{children:[B&&(0,h.jsx)(j,{addOpen:B,closeAddModalAndRefresh:e=>{D(!1),w(!0)}}),(0,h.jsx)(b.A,{modalOpen:t,onClose:()=>{y()},title:"Enable Bucket Encryption",titleIcon:(0,h.jsx)(a.j6H,{}),children:(0,h.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),S||("disabled"===g?c.F.buckets.disableBucketEncryption(x).then((()=>{f(!1),y()})).catch((async e=>{const t=await e.json();f(!1),k((0,r.Dy)((0,i.S)(t)))})):c.F.buckets.enableBucketEncryption(x,{encType:g,kmsKeyID:v}).then((()=>{f(!1),y()})).catch((async e=>{const t=await e.json();f(!1),k((0,r.Dy)((0,i.S)(t)))})))},children:(0,h.jsxs)(a.Hbc,{withBorders:!1,containerPadding:!1,children:[(0,h.jsx)(a.l6P,{onChange:e=>{A(e)},id:"select-encryption-type",name:"select-encryption-type",label:"Encryption Type",value:g,options:[{label:"Disabled",value:"disabled"},{label:"SSE-S3",value:l.M0.SseS3},{label:"SSE-KMS",value:l.M0.SseKms}]}),"sse-kms"===g&&(0,h.jsxs)(a.azJ,{sx:{display:"flex",gap:10},className:"inputItem",children:[K&&(0,h.jsx)(a.l6P,{onChange:e=>{C(e)},id:"select-kms-key-id",name:"select-kms-key-id",label:"KMS Key ID",value:v,options:K.map((e=>({label:e.name||"",value:e.name||""})))}),(0,h.jsx)(m.R,{scopes:[p.OV.KMS_IMPORT_KEY],resource:p.Ms,errorProps:{disabled:!0},children:(0,h.jsx)(u.A,{tooltip:"Add key",children:(0,h.jsx)(a.$nd,{id:"import-key",variant:"regular",icon:(0,h.jsx)(a.REV,{}),onClick:e=>{D(!0),e.preventDefault()}})})})]}),(0,h.jsxs)(a.xA9,{item:!0,xs:12,sx:o.Uz.modalButtonBar,children:[(0,h.jsx)(a.$nd,{id:"cancel",type:"submit",variant:"regular",onClick:()=>{y()},disabled:S,label:"Cancel"}),(0,h.jsx)(a.$nd,{id:"save",type:"submit",variant:"callAction",disabled:S,label:"Save"})]}),S&&(0,h.jsx)(a.xA9,{item:!0,xs:12,children:(0,h.jsx)(a.z21,{})})]})})})]})}},38375:(e,t,s)=>{s.d(t,{A:()=>c});var n=s(65043),a=s(89923),l=s(70579);const c=e=>{let{helpText:t,contents:s}=e;return(0,l.jsx)(a.lVp,{iconComponent:(0,l.jsx)(a.nag,{}),title:t,help:(0,l.jsx)(n.Fragment,{children:s.map((e=>(0,l.jsx)(a.azJ,{sx:{paddingBottom:"20px"},children:e})))})})}}}]);
//# sourceMappingURL=6654.d76daa88.chunk.js.map