import{u as y,ba as I,w as T,r,x as E,p as P,kk as w,bD as v,kl as N,kG as B,bG as F,bH as G,j as o,L as M,cE as O,bJ as $}from"./index-C6OVXshM.js";import{d as z,e as H,f as J}from"./index-D1PgvL_o.js";import{D as Q}from"./DataSourceCreate-B_7LzC8j.js";import"./useScreenWithScroll-zcr7TMGO.js";import"./form-DrxIax0x.js";import"./flip-FKUpVyRf.js";import"./index-CU_u1Yy3.js";import"./sum-BYCx-hLx.js";import"./countBy-DY8bBcai.js";import"./FeaturesForm-rBTLk3bq.js";import"./TagsForm-D7spoAiU.js";import"./useUpdateTdOrFvInfoService-CcnrN7pN.js";import"./index-Cgrh9eC0.js";import"./randomArrayString---X8tfjV.js";import"./sort-BOLIcXtz.js";import"./index-Clp3wC8S.js";import"./Project-CZXtYPe0.js";import"./alertManagerConfig.selectors-DfRN6QT6.js";import"./defineProperty-C28biA2x.js";import"./HumanizedCronExpression-B7-e7zEg.js";import"./index-D-ycbDlq.js";import"./symmetricDifference-BYGiWULO.js";import"./git-BLdzamrJ.js";import"./useCopyToClipboard-CRR-Czhi.js";import"./AlertForm-B4xAdNle.js";const Ct=()=>{const{connectorName:a,id:i,fsId:e}=y(),d=I(),[f,n]=T(),[m,{error:h,isLoading:l}]=z(),[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",N(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(()=>B(s)(t),[t,s]);return F(`${G.editStorageConnector} - ${t==null?void 0:t.name}`),C&&!t||j?o.jsx(M,{}):!t&&!C?o.jsx(O,{}):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($,{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};
