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