import{ck as S,L as $,d as D,aF as G,f as t,W as L,ae as j,t as b,cl as E,bw as H,w as X,c as a,g as o,h as i,i as z,aO as J,o as n,k as s,cm as K,a as c,j as d,cn as M,co as Q,p as Y,cp as Z,B as ee,bG as ue,bo as te,G as oe}from"./index-BMRLX027.js";import{u as se}from"./usePageTitle-C6TtrEA6.js";function ae(){const w=[];return S(()=>w.forEach(r=>r.dismiss())),(...r)=>{const l=$(...r);return w.push(l),l}}const ne={class:"work-queue__upcoming-runs"},ce=D({__name:"WorkQueue",setup(w){const r=z(),l=G(),q=ae(),R=t(()=>{const u=["Upcoming Runs","Runs"];return J.xl||u.unshift("Details"),u}),g=L("workQueueId"),h=t(()=>`prefect agent start ${e.value?` --work-queue "${e.value.name}"`:""}`),p=j(),y={interval:3e5},k=b(l.workQueues.getWorkQueue,[g.value],y),e=t(()=>k.response),v=t(()=>{var u;return(u=e.value)==null?void 0:u.concurrencyLimit}),C=t(()=>{var u;return(u=e.value)==null?void 0:u.isPaused}),W=t(()=>!!(v.value&&v.value<=U.value&&!C.value)),f=t(()=>e.value?[e.value.name]:[]),{filter:m}=E({flowRuns:{workQueueName:f}},"runs"),x=()=>{p.value="runs",m.flowRuns.state.name=["Running","Pending"]},F=()=>{r.push(te.workQueues())},N=t(()=>e.value?`Work Queue: ${e.value.name}`:"Work Queue"),{filter:P}=H({flowRuns:{state:{name:["Running","Pending"]},workQueueName:f.value}}),T=b(l.flowRuns.getFlowRunsCount,[P],{interval:3e4}),U=t(()=>T.response??0);return se(N),X(()=>{var u;return(u=e.value)==null?void 0:u.deprecated},u=>{u&&q(oe.info.deprecatedWorkQueue,"default",{dismissible:!1,timeout:!1})}),(u,_)=>{const B=i("p-button"),A=i("p-tabs"),V=i("p-layout-well"),I=i("p-layout-default");return n(),a(I,{class:"work-queue"},{header:o(()=>[e.value?(n(),a(s(K),{key:0,"work-queue":e.value,onUpdate:s(k).refresh,onDelete:F},null,8,["work-queue","onUpdate"])):c("",!0)]),default:o(()=>[d(V,{class:"work-queue__body"},{header:o(()=>[d(s(M),{command:h.value,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.value?(n(),a(s(Q),{key:0,alternate:"","work-queue":e.value},null,8,["work-queue"])):c("",!0)]),default:o(()=>[d(A,{selected:p.value,"onUpdate:selected":_[0]||(_[0]=O=>p.value=O),tabs:R.value},{details:o(()=>[e.value?(n(),a(s(Q),{key:0,"work-queue":e.value},null,8,["work-queue"])):c("",!0)]),"upcoming-runs":o(()=>[Y("div",ne,[e.value?(n(),a(s(Z),{key:0,"work-queue":e.value},null,8,["work-queue"])):c("",!0),W.value?(n(),a(B,{key:1,class:"work-queue__active-runs-button",onClick:x},{default:o(()=>[ee(" Show active runs ")]),_:1})):c("",!0)])]),runs:o(()=>[d(s(ue),{filter:s(m),prefix:"runs"},null,8,["filter"])]),_:1},8,["selected","tabs"])]),_:1})]),_:1})}}});export{ce as default};
//# sourceMappingURL=WorkQueue-C4ktc80i.js.map
