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