import{d as I,u as K,c as s,O as v,a as Q,al as L,V as Z,ar as R,e as E,as as G,at as H,N as J,r as c,o as a,f as n,w as o,g as e,au as M,h as r,k as i,av as X,aw as y,j as Y,ax as ee,ay as ue,Z as te,t as se,C as oe,ac as ae}from"./index.52551726.js";import{u as ne}from"./useRouteParam.4bc8e74f.js";import{u as re}from"./useToast.e33cfb8b.js";const le={class:"work-queue__upcoming-runs"},pe=I({__name:"WorkQueue",setup(ce){const b=K(),q=re(),g=s(()=>{const t=["Upcoming Runs","Runs"];return oe.xl||t.unshift("Details"),t}),C=ne("id"),F=s(()=>`prefect agent start ${u.value?` --work-queue "${u.value.name}"`:""}`),w=v([]),d=v(),h=()=>{w.value=["running","pending"],d.value="Runs"},W={interval:3e5},k=Q(L.getWorkQueue,[C.value],W),u=s(()=>k.response),f=s(()=>{var t;return(t=u.value)==null?void 0:t.concurrencyLimit}),$=s(()=>{var t;return(t=u.value)==null?void 0:t.isPaused}),m=s(()=>!!(f.value&&f.value<=S.value&&!$.value)),p=s(()=>u.value?[u.value.name]:[]),x=Z({workQueues:p}),N=R({workQueues:p}),T=s(()=>m.value?N.value:x.value),U=()=>{b.push(se.workQueues())},P=s(()=>u.value?`Work Queue: ${u.value.name}`:"Work Queue");E(P);const V=G(H),A=R({states:["Running","Pending"],workQueues:p}),B=Q(V.getFlowRunsCount,[A.value],{interval:3e4}),S=s(()=>{var t;return(t=B.response)!=null?t:[]});return J(()=>{var t;return(t=u.value)==null?void 0:t.deprecated},t=>{t&&q(ae.info.deprecatedWorkQueue,"default",{dismissible:!1,timeout:!1})}),(t,l)=>{const j=c("p-button"),D=c("p-tabs"),O=c("p-layout-well"),z=c("p-layout-default");return a(),n(z,{class:"work-queue"},{header:o(()=>[e(u)?(a(),n(e(M),{key:0,"work-queue":e(u),onUpdate:e(k).refresh,onDelete:U},null,8,["work-queue","onUpdate"])):r("",!0)]),default:o(()=>[i(O,{class:"work-queue__body"},{header:o(()=>[i(e(X),{command:e(F),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:o(()=>[e(u)?(a(),n(e(y),{key:0,alternate:"","work-queue":e(u)},null,8,["work-queue"])):r("",!0)]),default:o(()=>[i(D,{selected:d.value,"onUpdate:selected":l[1]||(l[1]=_=>d.value=_),tabs:e(g)},{details:o(()=>[e(u)?(a(),n(e(y),{key:0,"work-queue":e(u)},null,8,["work-queue"])):r("",!0)]),"upcoming-runs":o(()=>[Y("div",le,[e(u)?(a(),n(e(ee),{key:0,"work-queue":e(u)},null,8,["work-queue"])):r("",!0),e(m)?(a(),n(j,{key:1,secondary:"",class:"work-queue__active-runs-button",onClick:h},{default:o(()=>[ue(" Show active runs ")]),_:1})):r("",!0)])]),runs:o(()=>[i(e(te),{states:w.value,"onUpdate:states":l[0]||(l[0]=_=>w.value=_),"flow-run-filter":e(T)},null,8,["states","flow-run-filter"])]),_:1},8,["selected","tabs"])]),_:1})]),_:1})}}});export{pe as default};
