import{cd as h,d as b,g as k,f as N,ao as x,ce as D,af as F,j as I,n as e,c as S,k as d,a as O,l as B,i as J,o as P,m as p,cf as T,cg as Q,ch as U,ci as V,bo as i,N as f,O as j}from"./index-CgvuCQfr.js";import{u as K}from"./usePageTitle-DVT0B9Gy.js";class M extends h{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=J(),w=x("parameters",M,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,g=!r,C=U(V,{flowRun:n,flowRunRoute:i.flowRun,router:c,immediate:g,startTime:r});f(C,"success"),c.push(i.deployment(l.value))}catch(n){const r=j(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 K(v),(u,m)=>{const s=B("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(Q),{deployment:e(a),parameters:e(w),disabled:o.value,onSubmit:R,onCancel:_},null,8,["deployment","parameters","disabled"])]),_:1})):O("",!0)}}});export{z as default};
//# sourceMappingURL=FlowRunCreate-BYzFn8AT.js.map
