"use strict";(self.webpackChunkweb_app=self.webpackChunkweb_app||[]).push([[5756],{65756:(e,a,t)=>{t.r(a),t.d(a,{default:()=>p});var n=t(69060),c=t(58564),s=t.n(c),r=t(66152),l=t(61180),o=t(78256),i=t(61628),d=t(95705),u=t(66156),m=t(4836),h=t(82496);const p=e=>{let{open:a,closeModalAndRefresh:t,tierData:c}=e;const p=(0,u.Ab)(),[x,y]=(0,n.useState)(!1),[g,j]=(0,n.useState)(""),[v,b]=(0,n.useState)(""),[K,C]=(0,n.useState)(""),[f,S]=(0,n.useState)(""),[A,E]=(0,n.useState)(!0),k=s()(c,"type",""),q=s()(c,"".concat(k,".name"),"");(0,n.useEffect)((()=>{let e=!0;"s3"===k||"azure"===k||"minio"===k?""!==K&&""!==f||(e=!1):"gcs"===k&&""===v&&(e=!1),E(e)}),[f,K,v,k]);return(0,h.jsx)(m.c,{modalOpen:a,titleIcon:(0,h.jsx)(r.mpG,{}),onClose:()=>{t(!1)},title:"Update Credentials - ".concat(k," / ").concat(q),children:(0,h.jsxs)("form",{noValidate:!0,autoComplete:"off",onSubmit:e=>{e.preventDefault(),y(!0),(()=>{let e={};"s3"===k||"azure"===k||"minio"===k?e={access_key:K,secret_key:f}:"gcs"===k&&(e={creds:v}),""!==q?l.m.admin.editTierCredentials(k,q,e).then((()=>{y(!1),t(!0)})).catch((e=>{y(!1),p((0,d.op)((0,o.K)(e.error)))})):(0,d.op)({errorMessage:"There was an error retrieving tier information",detailedError:""})})()},children:[(0,h.jsxs)(r.yE_,{withBorders:!1,containerPadding:!1,children:[("s3"===k||"minio"===k)&&(0,h.jsxs)(n.Fragment,{children:[(0,h.jsx)(r.q22,{id:"accessKey",name:"accessKey",label:"Access Key",placeholder:"Enter Access Key",value:K,onChange:e=>{C(e.target.value)}}),(0,h.jsx)(r.q22,{id:"secretKey",name:"secretKey",label:"Secret Key",placeholder:"Enter Secret Key",value:f,onChange:e=>{S(e.target.value)}})]}),"gcs"===k&&(0,h.jsx)(n.Fragment,{children:(0,h.jsx)(r.uMt,{accept:".json",id:"creds",label:"Credentials",name:"creds",returnEncodedData:!0,onChange:(e,a,t)=>{t&&(b(t),j(a))},value:g})}),"azure"===k&&(0,h.jsxs)(n.Fragment,{children:[(0,h.jsx)(r.q22,{id:"accountName",name:"accountName",label:"Account Name",placeholder:"Enter Account Name",value:K,onChange:e=>{C(e.target.value)}}),(0,h.jsx)(r.q22,{id:"accountKey",name:"accountKey",label:"Account Key",placeholder:"Enter Account Key",value:f,onChange:e=>{S(e.target.value)}})]})]}),x&&(0,h.jsx)(r.yeN,{item:!0,xs:12,children:(0,h.jsx)(r.cHM,{})}),(0,h.jsx)(r.yeN,{item:!0,xs:12,sx:i.W2.modalButtonBar,children:(0,h.jsx)(r.qaq,{id:"save-credentials",type:"submit",variant:"callAction",disabled:x||!A,label:"Save"})})]})})}}}]);
//# sourceMappingURL=5756.2a90f420.chunk.js.map