import{d as j,g as S,af as k,j as f,o as c,A as $,x as R,m as o,n as l,bp as z,c as p,bq as D,a as d,br as J,bs as L,bt as N,bu as G,bv as H,aA as Q,f as W,bw as q,ao as K,bx as O,by as X,bz as Y,bA as M,k as u,l as y,i as Z,ai as U,bB as ee,bC as le,bD as te,bE as se,bF as ne,bG as ae,bH as oe,bI as F,a6 as ue,bo as T,bJ as re}from"./index-CgvuCQfr.js";import{u as ie}from"./usePageTitle-DVT0B9Gy.js";const fe={class:"flow-run-graphs__graph-panel-container"},ce={class:"flow-run-graphs__graphs"},pe={class:"flow-run-graphs__panel p-background"},de=j({__name:"FlowRunGraphs",props:{flowRun:{}},setup(B){const _=S(),g=k(),s=k(!1),e=k(null),m=f(()=>{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 _.events.getEvents(b);return w};return(r,t)=>{var i,b,w;return c(),$("div",{class:Q(["flow-run-graphs",m.value.root])},[R("div",fe,[R("div",ce,[o(l(z),{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",pe,[((i=e.value)==null?void 0:i.kind)==="task-run"||((b=e.value)==null?void 0:b.kind)==="flow-run"?(c(),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"?(c(),p(l(J),{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"?(c(),p(l(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"?(c(),p(l(N),{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"?(c(),p(l(G),{key:3,selection:e.value,"onUpdate:selection":t[7]||(t[7]=n=>e.value=n)},null,8,["selection"])):d("",!0),o(l(H),{selection:e.value,"onUpdate:selection":t[8]||(t[8]=n=>e.value=n)},null,8,["selection"])],2)}}}),we=j({__name:"FlowRun",setup(B){const _=Z(),g=W("flowRunId"),{flowRun:s,subscription:e}=q(g,{interval:5e3}),m=f(()=>{var a;return U(((a=s.value)==null?void 0:a.parameters)??{})}),v=f(()=>{var a;return(a=s.value)!=null&&a.stateType?ee(s.value.stateType):!0}),r=f(()=>{var a;return U(((a=s.value)==null?void 0:a.jobVariables)??{})}),t=f(()=>[{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:b}=O(t,i),w=f(()=>[g.value]),{filter:n}=X({flowRuns:{parentFlowRunId:w}});function A(){_.push(T.runs())}const C=f(()=>{var a;return(a=s.value)==null?void 0:a.stateType});Y(C);const E=f(()=>s.value?`Flow Run: ${s.value.name}`:"Flow Run");return ie(E),M(()=>{e.error&&re(e.error).isInRange("clientError")&&_.replace(T[404]())}),(a,x)=>{const h=y("p-code-highlight"),I=y("p-tabs"),V=y("p-layout-default");return l(s)?(c(),p(V,{key:l(s).id,class:"flow-run"},{header:u(()=>[o(l(le),{"flow-run-id":l(s).id,onDelete:A},null,8,["flow-run-id"])]),default:u(()=>[v.value?d("",!0):(c(),p(de,{key:0,"flow-run":l(s)},null,8,["flow-run"])),o(I,{selected:l(i),"onUpdate:selected":x[0]||(x[0]=P=>ue(i)?i.value=P:null),tabs:l(b)},{details:u(()=>[o(l(te),{"flow-run":l(s)},null,8,["flow-run"])]),logs:u(()=>[o(l(se),{"flow-run":l(s)},null,8,["flow-run"])]),artifacts:u(()=>[o(l(ne),{"flow-run":l(s)},null,8,["flow-run"])]),"task-runs":u(()=>[o(l(ae),{"flow-run-id":l(s).id},null,8,["flow-run-id"])]),"subflow-runs":u(()=>[o(l(oe),{filter:l(n)},null,8,["filter"])]),parameters:u(()=>[o(l(F),{"text-to-copy":m.value},{default:u(()=>[o(h,{lang:"json",text:m.value,class:"flow-run__parameters"},null,8,["text"])]),_:1},8,["text-to-copy"])]),"job-variables":u(()=>[o(l(F),{"text-to-copy":r.value},{default:u(()=>[o(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-wVLGxUCM.js.map
