"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[696],{20696:(e,a,t)=>{t.r(a),t.d(a,{default:()=>x});var n=t(65043),c=t(33097),s=t.n(c),r=t(89923),l=t(56629),o=t(53518),i=t(77403),d=t(64159),u=t(20554),m=t(94141),h=t(70579);const x=e=>{let{open:a,closeModalAndRefresh:t,tierData:c}=e;const x=(0,u.jL)(),[p,g]=(0,n.useState)(!1),[j,y]=(0,n.useState)(""),[v,b]=(0,n.useState)(""),[S,A]=(0,n.useState)(""),[C,K]=(0,n.useState)(""),[f,_]=(0,n.useState)(!0),E=s()(c,"type",""),k=s()(c,"".concat(E,".name"),"");(0,n.useEffect)((()=>{let e=!0;"s3"===E||"azure"===E||"minio"===E?""!==S&&""!==C||(e=!1):"gcs"===E&&""===v&&(e=!1),_(e)}),[C,S,v,E]);return(0,h.jsx)(m.A,{modalOpen:a,titleIcon:(0,h.jsx)(r.XAi,{}),onClose:()=>{t(!1)},title:"Update Credentials - ".concat(E," / ").concat(k),children:(0,h.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),g(!0),(()=>{let e={};"s3"===E||"azure"===E||"minio"===E?e={access_key:S,secret_key:C}:"gcs"===E&&(e={creds:v}),""!==k?l.F.admin.editTierCredentials(E,k,e).then((()=>{g(!1),t(!0)})).catch((e=>{g(!1),x((0,d.Dy)((0,o.S)(e.error)))})):(0,d.Dy)({errorMessage:"There was an error retrieving tier information",detailedError:""})})()},children:[(0,h.jsxs)(r.Hbc,{withBorders:!1,containerPadding:!1,children:[("s3"===E||"minio"===E)&&(0,h.jsxs)(n.Fragment,{children:[(0,h.jsx)(r.cl_,{id:"accessKey",name:"accessKey",label:"Access Key",placeholder:"Enter Access Key",value:S,onChange:e=>{A(e.target.value)}}),(0,h.jsx)(r.cl_,{id:"secretKey",name:"secretKey",label:"Secret Key",placeholder:"Enter Secret Key",value:C,onChange:e=>{K(e.target.value)}})]}),"gcs"===E&&(0,h.jsx)(n.Fragment,{children:(0,h.jsx)(r.SxS,{accept:".json",id:"creds",label:"Credentials",name:"creds",returnEncodedData:!0,onChange:(e,a,t)=>{t&&(b(t),y(a))},value:j})}),"azure"===E&&(0,h.jsxs)(n.Fragment,{children:[(0,h.jsx)(r.cl_,{id:"accountName",name:"accountName",label:"Account Name",placeholder:"Enter Account Name",value:S,onChange:e=>{A(e.target.value)}}),(0,h.jsx)(r.cl_,{id:"accountKey",name:"accountKey",label:"Account Key",placeholder:"Enter Account Key",value:C,onChange:e=>{K(e.target.value)}})]})]}),p&&(0,h.jsx)(r.xA9,{item:!0,xs:12,children:(0,h.jsx)(r.z21,{})}),(0,h.jsx)(r.xA9,{item:!0,xs:12,sx:i.Uz.modalButtonBar,children:(0,h.jsx)(r.$nd,{id:"save-credentials",type:"submit",variant:"callAction",disabled:p||!f,label:"Save"})})]})})}}}]);
//# sourceMappingURL=696.77a3fec7.chunk.js.map