"use strict";(self.webpackChunkportal_ui=self.webpackChunkportal_ui||[]).push([[402],{70402:function(e,n,t){t.r(n);var i=t(29439),r=t(72791),a=t(29945),l=t(31776),o=t(82342),c=t(87995),s=t(81551),u=t(59447),d=t(23814),f=t(80184);n.default=function(e){var n=e.closeVersioningModalAndRefresh,t=e.modalOpen,x=e.selectedBucket,h=e.versioningInfo,v=void 0===h?{}:h,g=e.objectLockingEnabled,p=(0,s.TL)(),m=(0,r.useState)(!1),j=(0,i.Z)(m,2),b=j[0],k=j[1],C=(0,r.useState)("Enabled"===(null===v||void 0===v?void 0:v.status)),w=(0,i.Z)(C,2),y=w[0],S=w[1],Z=(0,r.useState)(!(null===v||void 0===v||!v.excludeFolders)),B=(0,i.Z)(Z,2),E=B[0],I=B[1],F=(0,r.useState)(function(e){var n=null===e||void 0===e?void 0:e.excludedPrefixes;return n?n.map((function(e){return e.prefix})).join(","):""}(v)),P=(0,i.Z)(F,2),A=P[0],V=P[1];return(0,f.jsx)(a.cFD,{onClose:function(){return n(!1)},open:t,title:"Versioning on Bucket",children:(0,f.jsxs)(a.ltY,{withBorders:!1,containerPadding:!1,children:[(0,f.jsx)(a.rsf,{id:"activateVersioning",label:"Versioning Status",checked:y,onChange:function(e){S(e.target.checked)},indicatorLabels:["Enabled","Disabled"]}),y&&!g&&(0,f.jsxs)(r.Fragment,{children:[(0,f.jsx)(a.rsf,{id:"excludeFolders",label:"Exclude Folders",checked:E,onChange:function(e){I(e.target.checked)},indicatorLabels:["Enabled","Disabled"]}),(0,f.jsx)(u.Z,{elements:A,label:"Excluded Prefixes",name:"excludedPrefixes",onChange:function(e){var n="";n=Array.isArray(e)?e.join(","):e,V(n)},withBorder:!0})]}),(0,f.jsxs)(a.xuv,{sx:d.ID.modalButtonBar,children:[(0,f.jsx)(a.zxk,{id:"clear",type:"button",variant:"regular",color:"primary",onClick:function(){V(""),I(!1),S(!1)},label:"Clear"}),(0,f.jsx)(a.zxk,{type:"submit",variant:"callAction",onClick:function(){b||(k(!0),l.h.buckets.setBucketVersioning(x,{enabled:y,excludeFolders:!!y&&E,excludePrefixes:y?A.split(",").filter((function(e){return""!==e.trim()})):[]}).then((function(){k(!1),n(!0)})).catch((function(e){k(!1),p((0,c.Ih)((0,o.g)(e.error)))})))},id:"saveTag",label:"Save"})]})]})})}},59447:function(e,n,t){var i=t(93433),r=t(29439),a=t(72791),l=t(26181),o=t.n(l),c=t(29945),s=t(80184);n.Z=function(e){var n=e.elements,t=e.name,l=e.label,u=e.tooltip,d=void 0===u?"":u,f=e.commonPlaceholder,x=void 0===f?"":f,h=e.onChange,v=e.withBorder,g=void 0!==v&&v,p=(0,a.useState)([""]),m=(0,r.Z)(p,2),j=m[0],b=m[1],k=(0,a.createRef)();(0,a.useEffect)((function(){if(1===j.length&&""===j[0]&&n&&""!==n){var e=n.split(",");e.push(""),b(e)}}),[n,j]),(0,a.useEffect)((function(){if(j.length>1){var e=k.current;e&&e.scrollIntoView(!1)}}),[j,k]);var C=(0,a.useCallback)((function(e){h(e)}),[h]),w=(0,a.useRef)(!0);(0,a.useEffect)((function(){if(w.current)w.current=!1;else{var e=j.filter((function(e){return""!==e.trim()})).join(",");C(e)}}),[j]);var y=function(e){e.persist();var n=(0,i.Z)(j),t=o()(e.target,"dataset.index","0");n[parseInt(t)]=e.target.value,b(n)},S=j.map((function(e,n){return(0,s.jsx)(c.Wzg,{id:"".concat(t,"-").concat(n.toString()),label:"",name:"".concat(t,"-").concat(n.toString()),value:j[n],onChange:y,index:n,placeholder:x,overlayIcon:n===j.length-1?(0,s.jsx)(c.dtP,{}):null,overlayAction:function(){!function(e){if(""!==e[e.length-1].trim()){var n=(0,i.Z)(e);n.push(""),b(n)}}(j)}},"csv-multi-".concat(t,"-").concat(n.toString()))}));return(0,s.jsx)(a.Fragment,{children:(0,s.jsxs)(c.xuv,{sx:{display:"flex"},className:"inputItem",children:[(0,s.jsxs)(c.AZs,{sx:{alignItems:"flex-start"},children:[(0,s.jsx)("span",{children:l}),""!==d&&(0,s.jsx)(c.xuv,{sx:{marginLeft:5,display:"flex",alignItems:"center","& .min-icon":{width:13}},children:(0,s.jsx)(c.ua7,{tooltip:d,placement:"top",children:(0,s.jsx)(c.xuv,{className:d,children:(0,s.jsx)(c.byK,{})})})})]}),(0,s.jsxs)(c.xuv,{withBorders:g,sx:{width:"100%",overflowY:"auto",height:150,position:"relative"},children:[S,(0,s.jsx)("div",{ref:k})]})]})})}}}]);
//# sourceMappingURL=402.b31b43fa.chunk.js.map