"use strict";(self.webpackChunkportal_ui=self.webpackChunkportal_ui||[]).push([[1604],{1604:function(e,t,n){n.r(t);var a=n(29439),i=n(72791),o=n(29945),l=n(31776),u=n(66315),r=n(82342),s=n(40986),c=n(23814),d=n(87995),f=n(81551),m=n(56028),b=n(80184);t.default=function(e){var t=e.open,n=e.bucketName,h=e.closeModalAndRefresh,p=(0,f.TL)(),v=(0,i.useState)(!1),g=(0,a.Z)(v,2),x=g[0],y=g[1],C=(0,i.useState)(!0),j=(0,a.Z)(C,2),k=j[0],S=j[1],Z=(0,i.useState)(u.oO.Compliance),R=(0,a.Z)(Z,2),_=R[0],z=R[1],N=(0,i.useState)(u.zR.Days),w=(0,a.Z)(N,2),B=w[0],D=w[1],O=(0,i.useState)(1),E=(0,a.Z)(O,2),V=E[0],A=E[1],M=(0,i.useState)(!1),Y=(0,a.Z)(M,2),q=Y[0],G=Y[1];return(0,i.useEffect)((function(){Number.isNaN(V)||(V||1)<1?G(!1):G(!0)}),[V]),(0,i.useEffect)((function(){k&&l.h.buckets.getBucketRetentionConfig(n).then((function(e){S(!1),z(e.data.mode),A(e.data.validity),D(e.data.unit)})).catch((function(){S(!1)}))}),[k,n]),(0,b.jsx)(m.Z,{title:"Set Retention Configuration",modalOpen:t,onClose:function(){h()},children:k?(0,b.jsx)(o.aNw,{style:{width:16,height:16}}):(0,b.jsx)("form",{noValidate:!0,autoComplete:"off",onSubmit:function(e){e.preventDefault(),x||(y(!0),l.h.buckets.setBucketRetentionConfig(n,{mode:_||u.oO.Compliance,unit:B||u.zR.Days,validity:V||1}).then((function(){y(!1),h()})).catch((function(e){y(!1),p((0,d.zb)((0,r.g)(e.error)))})))},children:(0,b.jsxs)(o.ltY,{containerPadding:!1,withBorders:!1,children:[(0,b.jsx)(o.Eep,{currentValue:_,id:"retention_mode",name:"retention_mode",label:"Retention Mode",onChange:function(e){z(e.target.value)},selectorOptions:[{value:"compliance",label:"Compliance"},{value:"governance",label:"Governance"}]}),(0,b.jsx)(o.Eep,{currentValue:B,id:"retention_unit",name:"retention_unit",label:"Retention Unit",onChange:function(e){D(e.target.value)},selectorOptions:[{value:"days",label:"Days"},{value:"years",label:"Years"}]}),(0,b.jsx)(o.Wzg,{type:"number",id:"retention_validity",name:"retention_validity",onChange:function(e){A(e.target.valueAsNumber)},label:"Retention Validity",value:String(V),required:!0,min:"1"}),(0,b.jsxs)(o.rjZ,{item:!0,xs:12,sx:c.ID.modalButtonBar,children:[(0,b.jsx)(o.zxk,{id:"cancel",type:"button",variant:"regular",disabled:x,onClick:function(){h()},label:"Cancel"}),(0,b.jsx)(o.zxk,{id:"set",type:"submit",variant:"callAction",color:"primary",disabled:x||!q,label:"Set"})]}),x&&(0,b.jsx)(o.rjZ,{item:!0,xs:12,children:(0,b.jsx)(s.Z,{})})]})})})}}}]);
//# sourceMappingURL=1604.2dfa540d.chunk.js.map