import{d as C,g as z,ae as k,i as c,o as f,x as P,p as R,l as a,m as l,bl as D,c as p,bm as L,a as d,bn as N,bo as $,bp as q,bq as S,br as W,ax as G,W as J,bs as K,al as M,bt as O,bu as Y,bv as Z,bw as H,j as o,k 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 U,a6 as oe,bk as F,bF as ue}from"./index-Cq5Q7kWk.js";import{u as re}from"./usePageTitle-NgGMZFeo.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=C({__name:"FlowRunGraphs",props:{flowRun:{}},setup(j){const g=z(),_=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 g.events.getEvents(w);return b};return(r,t)=>{var i,w,b;return f(),P("div",{class:G(["flow-run-graphs",m.value.root])},[R("div",ie,[R("div",fe,[a(l(D),{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"||((w=e.value)==null?void 0:w.kind)==="flow-run"?(f(),p(l(L),{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($),{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(S),{key:3,selection:e.value,"onUpdate:selection":t[7]||(t[7]=n=>e.value=n)},null,8,["selection"])):d("",!0),a(l(W),{selection:e.value,"onUpdate:selection":t[8]||(t[8]=n=>e.value=n)},null,8,["selection"])],2)}}}),we=C({__name:"FlowRun",setup(j){const g=Q(),_=J("flowRunId"),{flowRun:s,subscription:e}=K(_,{interval:5e3}),m=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=M("tab","Logs"),{tabs:w}=O(t,i),b=c(()=>[_.value]),{filter:n}=Y({flowRuns:{parentFlowRunId:b}});function V(){g.push(F.runs())}Z(s);const B=c(()=>s.value?`Flow Run: ${s.value.name}`:"Flow Run");return re(B),H(()=>{e.error&&ue(e.error).isInRange("clientError")&&g.replace(F[404]())}),(u,x)=>{const h=y("p-code-highlight"),E=y("p-tabs"),I=y("p-layout-default");return l(s)?(f(),p(I,{key:l(s).id,class:"flow-run"},{header:o(()=>[a(l(ee),{"flow-run-id":l(s).id,onDelete:V},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(E,{selected:l(i),"onUpdate:selected":x[0]||(x[0]=T=>oe(i)?i.value=T:null),tabs:l(w)},{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(U),{"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(U),{"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-DlaGpNw5.js.map
