import{bW as A,_ as D,d as O,al as X,b as t,W as E,ae as H,t as b,bX as L,b6 as Y,w as Z,c as a,e as o,f as i,u as j,ar as z,o as n,h as s,bY as G,a as c,g as d,bZ as J,b_ as h,k as K,b$ as M,x as ee,bh as ue,aX as te,A as oe}from"./index-BjFilUfY.js";import{u as se}from"./usePageTitle-J4-vayug.js";function ae(){const w=[];return A(()=>w.forEach(r=>r.dismiss())),(...r)=>{const l=D(...r);return w.push(l),l}}const ne={class:"work-queue__upcoming-runs"},ce=O({__name:"WorkQueue",setup(w){const r=j(),l=X(),q=ae(),Q=t(()=>{const u=["Upcoming Runs","Runs"];return z.xl||u.unshift("Details"),u}),R=E("workQueueId"),g=t(()=>`prefect agent start ${e.value?` --work-queue "${e.value.name}"`:""}`),p=H(),y={interval:3e5},k=b(l.workQueues.getWorkQueue,[R.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}=L({flowRuns:{workQueueName:f}},"runs"),x=()=>{p.value="runs",m.flowRuns.state.name=["Running","Pending"]},N=()=>{r.push(te.workQueues())},P=t(()=>e.value?`Work Queue: ${e.value.name}`:"Work Queue"),{filter:T}=Y({flowRuns:{state:{name:["Running","Pending"]},workQueueName:f.value}}),F=b(l.flowRuns.getFlowRunsCount,[T],{interval:3e4}),U=t(()=>F.response??0);return se(P),Z(()=>{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"),V=i("p-tabs"),$=i("p-layout-well"),I=i("p-layout-default");return n(),a(I,{class:"work-queue"},{header:o(()=>[e.value?(n(),a(s(G),{key:0,"work-queue":e.value,onUpdate:s(k).refresh,onDelete:N},null,8,["work-queue","onUpdate"])):c("",!0)]),default:o(()=>[d($,{class:"work-queue__body"},{header:o(()=>[d(s(J),{command:g.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(h),{key:0,alternate:"","work-queue":e.value},null,8,["work-queue"])):c("",!0)]),default:o(()=>[d(V,{selected:p.value,"onUpdate:selected":_[0]||(_[0]=S=>p.value=S),tabs:Q.value},{details:o(()=>[e.value?(n(),a(s(h),{key:0,"work-queue":e.value},null,8,["work-queue"])):c("",!0)]),"upcoming-runs":o(()=>[K("div",ne,[e.value?(n(),a(s(M),{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-MRbEeetH.js.map
