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