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