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