import{d as U,aF as z,ae as m,f as p,o as n,x as $,p as y,j as b,k as e,bp as D,c as u,bq as G,a as i,br as N,bs as Q,bt as A,az as L,W,bu as q,an as H,bv as J,bw as O,bx as Z,by as K,g as r,h as R,u as M,ah as F,bz as X,bA as Y,bB as ee,bC as le,bD as te,bE as se,bF as ae,bG as ne,bH as S,a5 as oe,bo as T,bI as ue}from"./index-BqDjVCF_.js";import{u as re}from"./usePageTitle-CZh_IXm2.js";const ie={class:"flow-run-graphs__graph-panel-container"},fe={class:"flow-run-graphs__graphs"},ce={class:"flow-run-graphs__panel p-background"},pe=U({__name:"FlowRunGraphs",props:{flowRun:{}},setup(j){const g=z(),_=m(),l=m(!1),s=m(null),k=p(()=>{var f,t;return{root:{"flow-run-graphs--fullscreen":l.value,"flow-run-graphs--show-panel":((f=s.value)==null?void 0:f.kind)==="task-run"||((t=s.value)==null?void 0:t.kind)==="flow-run"}}}),d=async({nodeId:f,since:t,until:c})=>{const v={anyResource:{id:[`prefect.flow-run.${f}`]},event:{excludePrefix:["prefect.log.write","prefect.task-run."]},occurred:{since:t,until:c}},{events:w}=await g.events.getEvents(v);return w};return(f,t)=>{var c,v,w;return n(),$("div",{class:L(["flow-run-graphs",k.value.root])},[y("div",ie,[y("div",fe,[b(e(D),{fullscreen:l.value,"onUpdate:fullscreen":t[0]||(t[0]=a=>l.value=a),viewport:_.value,"onUpdate:viewport":t[1]||(t[1]=a=>_.value=a),selected:s.value,"onUpdate:selected":t[2]||(t[2]=a=>s.value=a),"flow-run":f.flowRun,"fetch-events":d,class:"flow-run-graphs__flow-run"},null,8,["fullscreen","viewport","selected","flow-run"])]),y("div",ce,[((c=s.value)==null?void 0:c.kind)==="task-run"||((v=s.value)==null?void 0:v.kind)==="flow-run"?(n(),u(e(G),{key:0,selection:s.value,"onUpdate:selection":t[3]||(t[3]=a=>s.value=a),floating:l.value},null,8,["selection","floating"])):i("",!0)])]),s.value&&s.value.kind==="artifacts"?(n(),u(e(N),{key:0,selection:s.value,"onUpdate:selection":t[4]||(t[4]=a=>s.value=a)},null,8,["selection"])):i("",!0),((w=s.value)==null?void 0:w.kind)==="state"?(n(),u(e(Q),{key:1,selection:s.value,"onUpdate:selection":t[5]||(t[5]=a=>s.value=a)},null,8,["selection"])):i("",!0),b(e(A),{selection:s.value,"onUpdate:selection":t[6]||(t[6]=a=>s.value=a)},null,8,["selection"])],2)}}}),we=U({__name:"FlowRun",setup(j){const g=M(),_=W("flowRunId"),{flowRun:l,subscription:s}=q(_,{interval:5e3}),k=p(()=>{var o;return F(((o=l.value)==null?void 0:o.parameters)??{})}),d=p(()=>{var o;return(o=l.value)!=null&&o.stateType?X(l.value.stateType):!0}),f=p(()=>{var o;return F(((o=l.value)==null?void 0:o.jobVariables)??{})}),t=p(()=>[{label:"Logs"},{label:"Task Runs",hidden:d.value},{label:"Subflow Runs",hidden:d.value},{label:"Results",hidden:d.value},{label:"Artifacts",hidden:d.value},{label:"Details"},{label:"Parameters"},{label:"Job Variables"}]),c=H("tab","Logs"),{tabs:v}=J(t,c),w=p(()=>[_.value]),{filter:a}=O({flowRuns:{parentFlowRunId:w}});function B(){g.push(T.runs())}const C=p(()=>{var o;return(o=l.value)==null?void 0:o.stateType});Z(C);const E=p(()=>l.value?`Flow Run: ${l.value.name}`:"Flow Run");return re(E),K(()=>{s.error&&ue(s.error).isInRange("clientError")&&g.replace(T[404]())}),(o,h)=>{const x=R("p-code-highlight"),I=R("p-tabs"),P=R("p-layout-default");return n(),u(P,{class:"flow-run"},{header:r(()=>[e(l)?(n(),u(e(Y),{key:0,"flow-run-id":e(l).id,onDelete:B},null,8,["flow-run-id"])):i("",!0)]),default:r(()=>[e(l)&&!d.value?(n(),u(pe,{key:0,"flow-run":e(l)},null,8,["flow-run"])):i("",!0),b(I,{selected:e(c),"onUpdate:selected":h[0]||(h[0]=V=>oe(c)?c.value=V:null),tabs:e(v)},{details:r(()=>[e(l)?(n(),u(e(ee),{key:0,"flow-run":e(l)},null,8,["flow-run"])):i("",!0)]),logs:r(()=>[e(l)?(n(),u(e(le),{key:0,"flow-run":e(l)},null,8,["flow-run"])):i("",!0)]),results:r(()=>[e(l)?(n(),u(e(te),{key:0,"flow-run":e(l)},null,8,["flow-run"])):i("",!0)]),artifacts:r(()=>[e(l)?(n(),u(e(se),{key:0,"flow-run":e(l)},null,8,["flow-run"])):i("",!0)]),"task-runs":r(()=>[e(l)?(n(),u(e(ae),{key:0,"flow-run-id":e(l).id},null,8,["flow-run-id"])):i("",!0)]),"subflow-runs":r(()=>[b(e(ne),{filter:e(a)},null,8,["filter"])]),parameters:r(()=>[e(l)?(n(),u(e(S),{key:0,"text-to-copy":k.value},{default:r(()=>[b(x,{lang:"json",text:k.value,class:"flow-run__parameters"},null,8,["text"])]),_:1},8,["text-to-copy"])):i("",!0)]),"job-variables":r(()=>[e(l)?(n(),u(e(S),{key:0,"text-to-copy":f.value},{default:r(()=>[b(x,{lang:"json",text:f.value,class:"flow-run__job-variables"},null,8,["text"])]),_:1},8,["text-to-copy"])):i("",!0)]),_:1},8,["selected","tabs"])]),_:1})}}});export{we as default};
//# sourceMappingURL=FlowRun-CRS3uyKp.js.map
