import{a as O,x as j,c as o,D as A,b as M,r as v,$ as Q,al as b,_ as X,f as n,w as s,g as c,B as z,o as a,u as e,aN as E,h as r,j as i,aO as G,aP as q,L as H,aQ as J,n as K,aq as Y,X as Z,e as ee}from"./index-e7fdb3d4.js";import{u as ue}from"./useToast-1dd179fb.js";import{u as te}from"./usePageTitle-df55e3a5.js";const oe={class:"work-queue__upcoming-runs"},le=O({__name:"WorkQueue",setup(se){const R=z(),k=j(),y=ue(),g=o(()=>{const t=["Upcoming Runs","Runs"];return A.xl||t.unshift("Details"),t}),C=M("workQueueId"),h=o(()=>`prefect agent start ${u.value?` --work-queue "${u.value.name}"`:""}`),d=v([]),w=v(),x=()=>{d.value=["Running","Pending"],w.value="Runs"},N={interval:3e5},f=Q(k.workQueues.getWorkQueue,[C.value],N),u=o(()=>f.response),_=o(()=>{var t;return(t=u.value)==null?void 0:t.concurrencyLimit}),W=o(()=>{var t;return(t=u.value)==null?void 0:t.isPaused}),P=o(()=>!!(_.value&&_.value<=F.value&&!W.value)),m=o(()=>u.value?[u.value.name]:[]),{filter:T}=b({flowRuns:{workQueueName:m}}),U=()=>{R.push(Z.workQueues())},$=o(()=>u.value?`Work Queue: ${u.value.name}`:"Work Queue"),{filter:B}=b({flowRuns:{state:{name:["Running","Pending"]},workQueueName:m.value}}),D=Q(k.flowRuns.getFlowRunsCount,[B],{interval:3e4}),F=o(()=>D.response??[]);return te($),X(()=>{var t;return(t=u.value)==null?void 0:t.deprecated},t=>{t&&y(ee.info.deprecatedWorkQueue,"default",{dismissible:!1,timeout:!1})}),(t,l)=>{const V=c("p-button"),S=c("p-tabs"),I=c("p-layout-well"),L=c("p-layout-default");return a(),n(L,{class:"work-queue"},{header:s(()=>[e(u)?(a(),n(e(E),{key:0,"work-queue":e(u),onUpdate:e(f).refresh,onDelete:U},null,8,["work-queue","onUpdate"])):r("",!0)]),default:s(()=>[i(I,{class:"work-queue__body"},{header:s(()=>[i(e(G),{command:e(h),title:"Work queue is ready to go!",subtitle:"Work queues define the work to be done and agents poll a specific work queue for new work."},null,8,["command"])]),well:s(()=>[e(u)?(a(),n(e(q),{key:0,alternate:"","work-queue":e(u)},null,8,["work-queue"])):r("",!0)]),default:s(()=>[i(S,{selected:w.value,"onUpdate:selected":l[1]||(l[1]=p=>w.value=p),tabs:e(g)},{details:s(()=>[e(u)?(a(),n(e(q),{key:0,"work-queue":e(u)},null,8,["work-queue"])):r("",!0)]),"upcoming-runs":s(()=>[H("div",oe,[e(u)?(a(),n(e(J),{key:0,"work-queue":e(u)},null,8,["work-queue"])):r("",!0),e(P)?(a(),n(V,{key:1,secondary:"",class:"work-queue__active-runs-button",onClick:x},{default:s(()=>[K(" Show active runs ")]),_:1})):r("",!0)])]),runs:s(()=>[i(e(Y),{states:d.value,"onUpdate:states":l[0]||(l[0]=p=>d.value=p),"flow-run-filter":e(T)},null,8,["states","flow-run-filter"])]),_:1},8,["selected","tabs"])]),_:1})]),_:1})}}});export{le as default};
