import{bc as j,b2 as D,d as I,M as A,g as t,p as E,U as J,h as L,f as b,bd as O,ao as z,w as G,c as a,j as o,l as i,a2 as H,o as n,u as s,be as K,a as c,n as d,bf as X,bg as q,J as Y,bh as Z,q as ee,ax as ue,af as te,i as oe}from"./index-bJiZR03d.js";import{u as se}from"./usePageTitle-wT6f1BZv.js";function ae(){const w=[];return j(()=>w.forEach(r=>r.dismiss())),(...r)=>{const l=D(...r);return w.push(l),l}}const ne={class:"work-queue__upcoming-runs"},ce=I({__name:"WorkQueue",setup(w){const r=H(),l=A(),Q=ae(),R=t(()=>{const u=["Upcoming Runs","Runs"];return E.xl||u.unshift("Details"),u}),g=J("workQueueId"),h=t(()=>`prefect agent start ${e.value?` --work-queue "${e.value.name}"`:""}`),p=L(),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}=O({flowRuns:{workQueueName:v}},"runs"),T=()=>{p.value="runs",m.flowRuns.state.name=["Running","Pending"]},U=()=>{r.push(te.workQueues())},W=t(()=>e.value?`Work Queue: ${e.value.name}`:"Work Queue"),{filter:N}=z({flowRuns:{state:{name:["Running","Pending"]},workQueueName:v.value}}),F=b(l.flowRuns.getFlowRunsCount,[N],{interval:3e4}),P=t(()=>F.response??0);return se(W),G(()=>{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"),M=i("p-layout-well"),S=i("p-layout-default");return n(),a(S,{class:"work-queue"},{header:o(()=>[e.value?(n(),a(s(K),{key:0,"work-queue":e.value,onUpdate:s(k).refresh,onDelete:U},null,8,["work-queue","onUpdate"])):c("",!0)]),default:o(()=>[d(M,{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(V,{selected:p.value,"onUpdate:selected":_[0]||(_[0]=$=>p.value=$),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),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};
