"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[6108],{66108:(e,t,l)=>{l.r(t),l.d(t,{default:()=>x});var a=l(65043),s=l(89923),n=l(64159),i=l(21383),o=l(56629),r=l(85330),c=l(94141),d=l(77403),u=l(70579);const x=e=>{let{open:t,selectedBucket:l,closeModalAndRefresh:x}=e;const m=(0,i.jL)(),[h,f]=(0,a.useState)(!1),[p,b]=(0,a.useState)(""),[j,v]=(0,a.useState)(""),[g,A]=(0,a.useState)(""),[C,S]=(0,a.useState)([]),[k,E]=(0,a.useState)([]),y=(0,a.useCallback)((()=>{f(!0),o.F.admin.arnList().then((e=>{null!==e.data.arns&&E(e.data.arns),f(!1)})).catch((e=>{f(!1),m((0,n.Dy)(e))}))}),[m]);(0,a.useEffect)((()=>{y()}),[y]);const w=[{label:"PUT - Object Uploaded",value:r.Wj.Put},{label:"GET - Object accessed",value:r.Wj.Get},{label:"DELETE - Object Deleted",value:r.Wj.Delete},{label:"REPLICA - Object Replicated",value:r.Wj.Replica},{label:"ILM - Object Transitioned",value:r.Wj.Ilm},{label:"SCANNER - Object has too many versions / Prefixes has too many sub-folders",value:r.Wj.Scanner}],R=null===k||void 0===k?void 0:k.map((e=>({label:e,value:e})));return(0,u.jsx)(c.A,{modalOpen:t,onClose:()=>{x()},title:"Subscribe To Bucket Events",titleIcon:(0,u.jsx)(s.VDx,{}),children:(0,u.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),h||(f(!0),o.F.buckets.createBucketEvent(l,{configuration:{arn:g,events:C,prefix:p,suffix:j},ignoreExisting:!0}).then((()=>{f(!1),x()})).catch((e=>{f(!1),m((0,n.Dy)(e))})))},children:(0,u.jsxs)(s.xA9,{container:!0,children:[(0,u.jsxs)(s.xA9,{item:!0,xs:12,sx:d.a_.formScrollable,children:[(0,u.jsx)(s.xA9,{item:!0,xs:12,sx:{...d.h$.formFieldRow,"& div div .MuiOutlinedInput-root":{padding:0}},children:(0,u.jsx)(s.jT8,{onChange:e=>{A(e)},id:"select-access-policy",name:"select-access-policy",label:"ARN",value:g,options:R||[],helpTip:(0,u.jsx)(a.Fragment,{children:(0,u.jsx)("a",{target:"blank",href:"https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html",children:"Amazon Resource Name"})})})}),(0,u.jsx)(s.xA9,{item:!0,xs:12,sx:d.h$.formFieldRow,children:(0,u.jsx)(s.cl_,{id:"prefix-input",name:"prefix-input",label:"Prefix",value:p,onChange:e=>{b(e.target.value)}})}),(0,u.jsx)(s.xA9,{item:!0,xs:12,sx:d.h$.formFieldRow,children:(0,u.jsx)(s.cl_,{id:"suffix-input",name:"suffix-input",label:"Suffix",value:j,onChange:e=>{v(e.target.value)}})}),(0,u.jsx)(s.xA9,{item:!0,xs:12,sx:d.h$.formFieldRow,children:(0,u.jsx)(s.bQt,{columns:[{label:"Event",elementKey:"label"}],idField:"value",records:w,onSelect:e=>{const t=e.target,l=t.value,a=t.checked;let s=[...C];a?s.push(l):s=s.filter((e=>e!==l)),S(s)},selectedItems:C,noBackground:!0,customPaperHeight:"260px"})})]}),(0,u.jsxs)(s.xA9,{item:!0,xs:12,sx:d.Uz.modalButtonBar,children:[(0,u.jsx)(s.$nd,{id:"cancel-add-event",type:"button",variant:"regular",disabled:h,onClick:()=>{x()},label:"Cancel"}),(0,u.jsx)(s.$nd,{id:"save-event",type:"submit",variant:"callAction",disabled:h||""===g||0===C.length,label:"Save"})]})]})})})}},94141:(e,t,l)=>{l.d(t,{A:()=>d});var a=l(65043),s=l(22166),n=l(89923),i=l(21383),o=l(64159),r=l(49555),c=l(70579);const d=e=>{let{onClose:t,modalOpen:l,title:d,children:u,wideLimit:x=!0,titleIcon:m=null,iconColor:h="default",sx:f}=e;const p=(0,i.jL)(),[b,j]=(0,a.useState)(!1),v=(0,s.d4)((e=>e.system.modalSnackBar));(0,a.useEffect)((()=>{p((0,o.h0)(""))}),[p]),(0,a.useEffect)((()=>{if(v){if(""===v.message)return void j(!1);"error"!==v.type&&j(!0)}}),[v]);let g="";return v&&(g=v.detailedErrorMsg,(""===g||g&&g.length<5)&&(g=v.message)),(0,c.jsxs)(n.ngX,{onClose:t,open:l,title:d,titleIcon:m,widthLimit:x,sx:f,iconColor:h,children:[(0,c.jsx)(r.A,{isModal:!0}),(0,c.jsx)(n.qb_,{onClose:()=>{j(!1),p((0,o.h0)(""))},open:b,message:g,mode:"inline",variant:"error"===v.type?"error":"default",autoHideDuration:"error"===v.type?10:5,condensed:!0}),u]})}}}]);
//# sourceMappingURL=6108.84010ebc.chunk.js.map