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