"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[968],{50968:(e,t,a)=>{a.r(t),a.d(t,{default:()=>x});var l=a(69060),s=a(66152),n=a(95705),i=a(66156),c=a(61180),o=a(32296),r=a(4836),u=a(61628),d=a(82496);const x=e=>{let{open:t,selectedBucket:a,closeModalAndRefresh:x}=e;const b=(0,i.Ab)(),[m,p]=(0,l.useState)(!1),[f,h]=(0,l.useState)(""),[v,j]=(0,l.useState)(""),[g,S]=(0,l.useState)(""),[y,k]=(0,l.useState)([]),[E,B]=(0,l.useState)([]),C=(0,l.useCallback)((()=>{p(!0),c.m.admin.arnList().then((e=>{null!==e.data.arns&&B(e.data.arns),p(!1)})).catch((e=>{p(!1),b((0,n.op)(e))}))}),[b]);(0,l.useEffect)((()=>{C()}),[C]);const N=[{label:"PUT - Object Uploaded",value:o.YB.Put},{label:"GET - Object accessed",value:o.YB.Get},{label:"DELETE - Object Deleted",value:o.YB.Delete},{label:"REPLICA - Object Replicated",value:o.YB.Replica},{label:"ILM - Object Transitioned",value:o.YB.Ilm},{label:"SCANNER - Object has too many versions / Prefixes has too many sub-folders",value:o.YB.Scanner}],R=null===E||void 0===E?void 0:E.map((e=>({label:e,value:e})));return(0,d.jsx)(r.c,{modalOpen:t,onClose:()=>{x()},title:"Subscribe To Bucket Events",titleIcon:(0,d.jsx)(s.Etd,{}),children:(0,d.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),m||(p(!0),c.m.buckets.createBucketEvent(a,{configuration:{arn:g,events:y,prefix:f,suffix:v},ignoreExisting:!0}).then((()=>{p(!1),x()})).catch((e=>{p(!1),b((0,n.op)(e))})))},children:(0,d.jsxs)(s.yeN,{container:!0,children:[(0,d.jsxs)(s.yeN,{item:!0,xs:12,sx:u.gN.formScrollable,children:[(0,d.jsx)(s.yeN,{item:!0,xs:12,sx:{...u.G0.formFieldRow,"& div div .MuiOutlinedInput-root":{padding:0}},children:(0,d.jsx)(s.GE2,{onChange:e=>{S(e)},id:"select-access-policy",name:"select-access-policy",label:"ARN",value:g,options:R||[],helpTip:(0,d.jsx)(l.Fragment,{children:(0,d.jsx)("a",{target:"blank",href:"https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html",children:"Amazon Resource Name"})})})}),(0,d.jsx)(s.yeN,{item:!0,xs:12,sx:u.G0.formFieldRow,children:(0,d.jsx)(s.q22,{id:"prefix-input",name:"prefix-input",label:"Prefix",value:f,onChange:e=>{h(e.target.value)}})}),(0,d.jsx)(s.yeN,{item:!0,xs:12,sx:u.G0.formFieldRow,children:(0,d.jsx)(s.q22,{id:"suffix-input",name:"suffix-input",label:"Suffix",value:v,onChange:e=>{j(e.target.value)}})}),(0,d.jsx)(s.yeN,{item:!0,xs:12,sx:u.G0.formFieldRow,children:(0,d.jsx)(s.iSL,{columns:[{label:"Event",elementKey:"label"}],idField:"value",records:N,onSelect:e=>{const t=e.target,a=t.value,l=t.checked;let s=[...y];l?s.push(a):s=s.filter((e=>e!==a)),k(s)},selectedItems:y,noBackground:!0,customPaperHeight:"260px"})})]}),(0,d.jsxs)(s.yeN,{item:!0,xs:12,sx:u.W2.modalButtonBar,children:[(0,d.jsx)(s.qaq,{id:"cancel-add-event",type:"button",variant:"regular",disabled:m,onClick:()=>{x()},label:"Cancel"}),(0,d.jsx)(s.qaq,{id:"save-event",type:"submit",variant:"callAction",disabled:m||""===g||0===y.length,label:"Save"})]})]})})})}}}]);
//# sourceMappingURL=968.5ee29217.chunk.js.map