import{u as y,ba as I,w as T,r,x as E,p as P,kj as w,bD as v,kk as F,kF as N,bG as B,bH as M,j as o,L as O,cE as $,bJ as z}from"./index-DHiyXWqE.js";import{d as G,e as H,f as J}from"./index-DRFB149W.js";import{D as Q}from"./DataSourceCreate-MXAjvEQL.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./form-CrZPXKpD.js";import"./flip-DHDmt_vj.js";import"./index-DFvCs-SP.js";import"./sum-BEzIvRoW.js";import"./countBy-aXEkOZ3e.js";import"./FeaturesForm-D_iMRo0-.js";import"./TagsForm-BQYOp_QK.js";import"./useUpdateTdOrFvInfoService-DgmLaBNN.js";import"./index-C52WzLFZ.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-Bat3pAWW.js";import"./Project-DwrxbZJj.js";import"./alertManagerConfig.selectors-0se_RTtj.js";import"./defineProperty-C28_3XcK.js";import"./HumanizedCronExpression-FxwdMNJF.js";import"./index-5hEKE-oe.js";import"./symmetricDifference-BqIFhGVd.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-D6oq-fy9.js";import"./AlertForm-jO9r3OcZ.js";const Ct=()=>{const{connectorName:a,id:i,fsId:e}=y(),d=I(),[f,n]=T(),[m,{error:h,isLoading:l}]=G(),[g,{isLoading:u}]=H(),{currentData:t,isUninitialized:j,isFetching:C}=J({pId:+i,fsId:+e,id:a}),D=r.useCallback(()=>{d(E.project.storageConnector.list,{fsId:e})},[e,d]),k=r.useCallback(async(p,c)=>{const{storageConnectorType:b}=p,S=P(v("type",F(b)),w(b))(p);await m({pId:+i,fsId:+e,id:a,data:S}).unwrap().then(R=>{c==null||c(p)})},[m,i,e,a]),x=r.useCallback(()=>g({pId:+i,fsId:+e,id:a}).unwrap().then(D),[g,i,e,a,D]),s=t==null?void 0:t.storageConnectorType,L=r.useMemo(()=>N(s)(t),[t,s]);return B(`${M.editStorageConnector} - ${t==null?void 0:t.name}`),C&&!t||j?o.jsx(O,{}):!t&&!C?o.jsx($,{}):o.jsxs(o.Fragment,{children:[o.jsx(Q,{error:h,isSaving:l||u,isDisabled:l,onSubmit:k,initialProtocol:s,initialData:L,onDelete:n,isEdit:!0}),o.jsx(z,{title:`Delete ${t==null?void 0:t.name}`,secondaryText:"Once you delete a storage connector, there is no going back. Please be certain.",isOpen:f,onClose:n,mainButtonProps:{children:"Delete",onClick:x,isLoading:u,"data-test":"delete-ds"},secondaryButtonProps:{children:"Back",onClick:n}})]})};export{Ct as default};
