"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[7264],{57264:(e,t,s)=>{s.r(t),s.d(t,{default:()=>j});var a=s(69060),n=s(66152),c=s(32296),l=s(61180),i=s(78256),o=s(61628),r=s(95705),d=s(66156),p=s(21124),m=s(3992),u=s(84612),x=s(70780),y=s(52224),h=s(82496);const k=e=>{let{closeAddModalAndRefresh:t,addOpen:s}=e;const c=(0,d.Ab)(),[o,p]=(0,a.useState)(!1),[m,u]=(0,a.useState)("");return(0,h.jsx)(x.c,{title:"",confirmText:"Create",isOpen:s,isLoading:o,onConfirm:()=>{p(!0),l.m.kms.kmsCreateKey({key:m}).then((e=>{t(!0)})).catch((async e=>{const s=await e.json();c((0,r.aW)((0,i.K)(s))),t(!1)})).finally((()=>p(!1)))},onClose:()=>t(!1),confirmButtonProps:{disabled:-1!==m.indexOf(" ")||""===m||o,variant:"callAction"},confirmationContent:(0,h.jsxs)(a.Fragment,{children:[(0,h.jsx)(y.c,{helpText:"Create Key",contents:["Create a new cryptographic key in the Key Management Service server connected to MINIO."]}),(0,h.jsx)(n.yeN,{item:!0,xs:12,sx:{marginTop:15},children:(0,h.jsx)(n.q22,{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(4836);const j=e=>{let{open:t,encryptionCfg:s,selectedBucket:x,closeModalAndRefresh:y}=e;const j=(0,d.Ab)(),[S,f]=(0,a.useState)(!1),[v,K]=(0,a.useState)(""),[g,C]=(0,a.useState)("disabled"),[E,M]=(0,a.useState)([]),[A,w]=(0,a.useState)(!1),[B,I]=(0,a.useState)(!1);(0,a.useEffect)((()=>{s&&("AES256"===s.algorithm?C(c.c1.SseS3):(C(c.c1.SseKms),K(s.kmsMasterKeyID||"")))}),[s]),(0,a.useEffect)((()=>{"sse-kms"===g&&l.m.kms.kmsListKeys().then((e=>{M(e.data.results),w(!1)})).catch((e=>{w(!1),j((0,r.op)((0,i.K)(e.error)))}))}),[g,A,j]);return(0,h.jsxs)(a.Fragment,{children:[B&&(0,h.jsx)(k,{addOpen:B,closeAddModalAndRefresh:e=>{I(!1),w(!0)}}),(0,h.jsx)(b.c,{modalOpen:t,onClose:()=>{y()},title:"Enable Bucket Encryption",titleIcon:(0,h.jsx)(n.KIL,{}),children:(0,h.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),S||("disabled"===g?l.m.buckets.disableBucketEncryption(x).then((()=>{f(!1),y()})).catch((async e=>{const t=await e.json();f(!1),j((0,r.op)((0,i.K)(t)))})):l.m.buckets.enableBucketEncryption(x,{encType:g,kmsKeyID:v}).then((()=>{f(!1),y()})).catch((async e=>{const t=await e.json();f(!1),j((0,r.op)((0,i.K)(t)))})))},children:(0,h.jsxs)(n.yE_,{withBorders:!1,containerPadding:!1,children:[(0,h.jsx)(n.M1e,{onChange:e=>{C(e)},id:"select-encryption-type",name:"select-encryption-type",label:"Encryption Type",value:g,options:[{label:"Disabled",value:"disabled"},{label:"SSE-S3",value:c.c1.SseS3},{label:"SSE-KMS",value:c.c1.SseKms}]}),"sse-kms"===g&&(0,h.jsxs)(n.kvh,{sx:{display:"flex",gap:10},className:"inputItem",children:[E&&(0,h.jsx)(n.M1e,{onChange:e=>{K(e)},id:"select-kms-key-id",name:"select-kms-key-id",label:"KMS Key ID",value:v,options:E.map((e=>({label:e.name||"",value:e.name||""})))}),(0,h.jsx)(m.K,{scopes:[p.Oi.KMS_IMPORT_KEY],resource:p.Gc,errorProps:{disabled:!0},children:(0,h.jsx)(u.c,{tooltip:"Add key",children:(0,h.jsx)(n.qaq,{id:"import-key",variant:"regular",icon:(0,h.jsx)(n.EgV,{}),onClick:e=>{I(!0),e.preventDefault()}})})})]}),(0,h.jsxs)(n.yeN,{item:!0,xs:12,sx:o.W2.modalButtonBar,children:[(0,h.jsx)(n.qaq,{id:"cancel",type:"submit",variant:"regular",onClick:()=>{y()},disabled:S,label:"Cancel"}),(0,h.jsx)(n.qaq,{id:"save",type:"submit",variant:"callAction",disabled:S,label:"Save"})]}),S&&(0,h.jsx)(n.yeN,{item:!0,xs:12,children:(0,h.jsx)(n.cHM,{})})]})})})]})}},52224:(e,t,s)=>{s.d(t,{c:()=>l});var a=s(69060),n=s(66152),c=s(82496);const l=e=>{let{helpText:t,contents:s}=e;return(0,c.jsx)(n.g1k,{iconComponent:(0,c.jsx)(n.cFZ,{}),title:t,help:(0,c.jsx)(a.Fragment,{children:s.map((e=>(0,c.jsx)(n.kvh,{sx:{paddingBottom:"20px"},children:e})))})})}}}]);
//# sourceMappingURL=7264.a0f227d8.chunk.js.map