import{d as z,T as K,a as Q,r as m,E as w,c as r,U as X,X as Z,Y as $,Z as G,$ as J,j as _,b as R,e as n,w as c,o,h as a,u as e,a0 as ee,g as V,K as se,F as h,a1 as oe,a2 as te,f as d,O as v,a3 as le,a4 as ne,a5 as ae,a6 as ue,a7 as re,a8 as ce,a9 as de,aa as ie,H as fe,p as pe,ab as me}from"./index-562c8470.js";import{u as we}from"./usePageTitle-ad3dbf10.js";const _e={class:"flow-runs__list"},Re={class:"flow-runs__list-controls--right"},ge=z({__name:"FlowRuns",setup(ve){const T=K(),i=Q(),k=m(),y=w(i.flowRuns.getFlowRunsCount,[{}]),x=r(()=>y.executed),N=r(()=>y.response===0),f=m(),S=X(f,1200),{filter:s,isCustomFilter:B}=Z({flowRuns:{nameLike:S}}),g=r({get(){return s.flowRuns.parentTaskRunIdNull},set(F){s.flowRuns.parentTaskRunIdNull=F?!0:void 0}}),p={interval:3e4},b=w(i.flowRuns.getFlowRunsCount,[s],p),H=r(()=>b.response),O=w(i.ui.getFlowRunHistory,[s],p),U=r(()=>O.response??[]),{flowRuns:C,subscriptions:M,loadMore:A}=$(s,p),u=m([]),{margin:E}=G(),I=()=>({rootMargin:E.value}),{stuck:L}=J(k,I),D=r(()=>({listControls:{"flow-runs__list-controls--stuck":L.value&&_.md}}));function P(){T.push(me.flowRuns())}const W=()=>{u.value=[],M.refresh(),b.refresh()};return we("Flow Runs"),(F,t)=>{const Y=R("p-toggle"),j=R("p-button"),q=R("p-layout-default");return o(),n(q,{class:"flow-runs"},{header:c(()=>[a(e(ee))]),default:c(()=>[x.value?(o(),V(h,{key:0},[N.value?(o(),n(e(se),{key:0})):(o(),V(h,{key:1},[a(e(oe)),e(_).md?(o(),n(e(te),{key:0,history:U.value,"start-date":e(s).flowRuns.expectedStartTimeAfter,"end-date":e(s).flowRuns.expectedStartTimeBefore,class:"flow-runs__chart"},null,8,["history","start-date","end-date"])):d("",!0),v("div",_e,[v("div",{ref_key:"listControls",ref:k,class:le(["flow-runs__list-controls",D.value.listControls])},[v("div",Re,[u.value.length==0?(o(),n(e(ne),{key:0,count:H.value,label:"Flow run"},null,8,["count"])):(o(),n(e(ae),{key:1,count:u.value.length},null,8,["count"])),a(e(ue),{selected:u.value,onDelete:W},null,8,["selected"])]),a(Y,{modelValue:g.value,"onUpdate:modelValue":t[0]||(t[0]=l=>g.value=l),class:"flow-runs__subflows-toggle",append:"Hide subflows"},null,8,["modelValue"]),e(_).md?(o(),n(e(re),{key:0,modelValue:f.value,"onUpdate:modelValue":t[1]||(t[1]=l=>f.value=l),placeholder:"Search by run name",label:"Search by run name"},null,8,["modelValue"])):d("",!0),a(e(ce),{modelValue:e(s).sort,"onUpdate:modelValue":t[2]||(t[2]=l=>e(s).sort=l),class:"flow-runs__sort"},null,8,["modelValue"])],2),a(e(de),{selected:u.value,"onUpdate:selected":t[3]||(t[3]=l=>u.value=l),selectable:"","flow-runs":e(C),onBottom:e(A)},null,8,["selected","flow-runs","onBottom"]),e(C).length?d("",!0):(o(),n(e(ie),{key:0},fe({_:2},[e(B)?{name:"actions",fn:c(()=>[a(j,{small:"",onClick:P},{default:c(()=>[pe(" Clear Filters ")]),_:1})]),key:"0"}:void 0]),1024))])],64))],64)):d("",!0)]),_:1})}}});export{ge as default};
