import{bb as I,b1 as $,d as A,D as Y,e as t,m as L,b as O,f as j,Y as b,bc as z,an as G,w as H,c as a,h as o,i,a1 as J,o as n,u as s,bd as K,a as c,k as d,be as M,bf as Q,E as X,bg as Z,p as ee,aw as ue,ae as te,g as oe}from"./index-WCZ_4nWW.js";import{u as se}from"./usePageTitle-Y7n4a-YH.js";function ae(){const w=[];return I(()=>w.forEach(r=>r.dismiss())),(...r)=>{const l=$(...r);return w.push(l),l}}const ne={class:"work-queue__upcoming-runs"},ce=A({__name:"WorkQueue",setup(w){const r=J(),l=Y(),R=ae(),q=t(()=>{const u=["Upcoming Runs","Runs"];return L.xl||u.unshift("Details"),u}),g=O("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),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}),x=t(()=>!!(f.value&&f.value<=P.value&&!C.value)),v=t(()=>e.value?[e.value.name]:[]),{filter:m}=z({flowRuns:{workQueueName:v}},"runs"),T=()=>{p.value="runs",m.flowRuns.state.name=["Running","Pending"]},W=()=>{r.push(te.workQueues())},F=t(()=>e.value?`Work Queue: ${e.value.name}`:"Work Queue"),{filter:N}=G({flowRuns:{state:{name:["Running","Pending"]},workQueueName:v.value}}),U=b(l.flowRuns.getFlowRunsCount,[N],{interval:3e4}),P=t(()=>U.response??0);return se(F),H(()=>{var u;return(u=e.value)==null?void 0:u.deprecated},u=>{u&&R(oe.info.deprecatedWorkQueue,"default",{dismissible:!1,timeout:!1})}),(u,_)=>{const B=i("p-button"),D=i("p-tabs"),S=i("p-layout-well"),V=i("p-layout-default");return n(),a(V,{class:"work-queue"},{header:o(()=>[e.value?(n(),a(s(K),{key:0,"work-queue":e.value,onUpdate:s(k).refresh,onDelete:W},null,8,["work-queue","onUpdate"])):c("",!0)]),default:o(()=>[d(S,{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(D,{selected:p.value,"onUpdate:selected":_[0]||(_[0]=E=>p.value=E),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(()=>[X("div",ne,[e.value?(n(),a(s(Z),{key:0,"work-queue":e.value},null,8,["work-queue"])):c("",!0),x.value?(n(),a(B,{key:1,class:"work-queue__active-runs-button",onClick:T},{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};
