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