import{d as k,u as v,a as D,c as m,e as $,r as b,g as t,o as B,f as F,w as p,k as i,ae as S,af as T,h as x,$ as d,ag as I,ah as N,t as f,a4 as y}from"./index.52551726.js";import{u as P}from"./useRouteParam.4bc8e74f.js";const j=k({__name:"FlowRunCreate",setup(V){const a=P("id"),n=v(),_=D(d.getDeployment,[a]),e=m(()=>_.response),w=async s=>{var r,o,c;try{const u=await d.createDeploymentFlowRun(a.value,s),l=(c=(o=(r=s.state)==null?void 0:r.stateDetails)==null?void 0:o.scheduledTime)!=null?c:void 0,g=!l,C=I(N,{flowRun:u,flowRunRoute:f.flowRun,router:n,immediate:g,startTime:l});y(C,"success"),n.push(f.deployment(a.value))}catch(u){y("Something went wrong trying to create a flow run","error"),console.error(u)}},h=()=>{n.back()},R=m(()=>e.value?`Create Flow Run for Deployment: ${e.value.name}`:"Create Flow Run for Deployment");return $(R),(s,r)=>{const o=b("p-layout-default");return t(e)?(B(),F(o,{key:0},{header:p(()=>[i(t(S),{deployment:t(e)},null,8,["deployment"])]),default:p(()=>[i(t(T),{deployment:t(e),onSubmit:w,onCancel:h},null,8,["deployment"])]),_:1})):x("",!0)}}});export{j as default};
