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