import{cd as g,d as b,f as k,W as N,ao as x,ce as D,af as F,i as I,m as e,c as S,j as d,a as B,k as J,h as O,o as P,l as p,cf as T,cg as M,ch as Q,ci as U,bo as i,M as f,N as V}from"./index-CcVNxLw9.js";import{u as W}from"./usePageTitle-B0-KYjWV.js";class j extends g{parse(t){return JSON.parse(decodeURIComponent(t??""))}format(t){return encodeURIComponent(JSON.stringify(t))}}const z=b({__name:"FlowRunCreate",setup(y){const t=k(),l=N("deploymentId"),c=O(),w=x("parameters",j,void 0),{deployment:a}=D(l),o=F(!1),R=async u=>{var m,s;if(!o.value)try{o.value=!0;const n=await t.deployments.createDeploymentFlowRun(l.value,u),r=((s=(m=u.state)==null?void 0:m.stateDetails)==null?void 0:s.scheduledTime)??void 0,h=!r,C=Q(U,{flowRun:n,flowRunRoute:i.flowRun,router:c,immediate:h,startTime:r});f(C,"success"),c.push(i.deployment(l.value))}catch(n){const r=V(n,"Something went wrong trying to create a flow run");f(r,"error"),console.error(n)}finally{o.value=!1}},_=()=>{c.back()},v=I(()=>a.value?`Create Flow Run for Deployment: ${a.value.name}`:"Create Flow Run for Deployment");return W(v),(u,m)=>{const s=J("p-layout-default");return e(a)?(P(),S(s,{key:0},{header:d(()=>[p(e(T),{deployment:e(a)},null,8,["deployment"])]),default:d(()=>[p(e(M),{deployment:e(a),parameters:e(w),disabled:o.value,onSubmit:R,onCancel:_},null,8,["deployment","parameters","disabled"])]),_:1})):B("",!0)}}});export{z as default};
//# sourceMappingURL=FlowRunCreate-C5qtS6bo.js.map
