import{j as r,$ as C,c as T,bF as R,bo as h,by as A,a as v,cq as y,r as i,o as P,q as u,bw as w,bx as F,cr as N,cs as E}from"./index-46ma1THH.js";import{P as O}from"./ProjectForm-B6UBApZR.js";const D=({children:s})=>r.jsxs(C,{width:"100%",flexDirection:"column",alignItems:"center",children:[r.jsx(T,{bold:!0,color:"gray",fontSize:"18px",mb:"8px",children:"Building new project"}),r.jsx(R,{mb:"20px",children:"Project creation"}),s]}),M=()=>{const s=h(),l=A(),{currentData:c,isLoading:S}=v(),[j]=y(),[f,n]=i.useState({isProgressing:!1,isSuccess:!1,isError:!1}),g=i.useCallback(e=>{s(P(u.project.prj.view,u.project.value,{id:e}))},[s]),p=i.useCallback(async e=>{n(o=>({...o,isProgressing:!1,isSuccess:!0})),setTimeout(()=>{e?g(e):s(P(u.project.list))},1e3)},[s,g]),b=i.useCallback(async e=>{var o;try{n(a=>({...a,isProgressing:!0,isError:!1}));const t=await j({services:["JOBS","JUPYTER","HIVE","KAFKA","FEATURESTORE","SERVING","AIRFLOW"],projectName:e.projectName,namespace:e.namespace,description:e.description,featureStoreTopic:e.featureStoreTopic}).unwrap();p(t.data)}catch(t){n(d=>({...d,isProgressing:!1,isError:!0}));const a=(o=t==null?void 0:t.response)==null?void 0:o.data;l.error({title:"Error",content:`${a.errorMsg||""} ${a.usrMsg||""}`})}},[j,p,l]),{isProgressing:m,isSuccess:x}=f;return w(F.createProject),r.jsx(O,{projectsNames:c==null?void 0:c.map(({projectName:e})=>e),isLoading:S,onSubmit:b,isProgressingSubmit:m,isSuccessSubmit:x,progressElement:r.jsx(D,{children:r.jsx(N,{isAnimating:m,animationDuration:E/100,incrementDuration:E/25})})})};export{M as default};
