import{d as H,ao as K,j as o,i as b,aR as L,bd as Q,v as O,c as n,w as s,r as c,ah as z,o as a,u as e,be as E,m as r,a as i,bf as J,bg as q,C as M,bh as X,K as Y,aV as Z,b3 as ee}from"./index-4d9fe32c-718dc5d9.js";import{N as ue}from"./prefect-design-a921a7c6.js";import{u as te,c as y}from"./vue-compositions-55710141.js";import{u as oe}from"./useToast-7cfa7c25.js";import{u as se}from"./usePageTitle-e8e2e29d.js";import"./index-558d177a.js";import{r as ne}from"./routes-1bd54f1a.js";import"./meta-26546594.js";const ae={class:"work-queue__upcoming-runs"},ve=H({__name:"WorkQueue",setup(re){const g=z(),m=K(),R=oe(),h=o(()=>{const t=["Upcoming Runs","Runs"];return ue.xl||t.unshift("Details"),t}),C=te("workQueueId"),T=o(()=>`prefect agent start ${u.value?` --work-queue "${u.value.name}"`:""}`),d=b([]),p=b(),F=()=>{d.value=["running","pending"],p.value="Runs"},W={interval:3e5},v=y(m.workQueues.getWorkQueue,[C.value],W),u=o(()=>v.response),f=o(()=>{var t;return(t=u.value)==null?void 0:t.concurrencyLimit}),x=o(()=>{var t;return(t=u.value)==null?void 0:t.isPaused}),_=o(()=>!!(f.value&&f.value<=A.value&&!x.value)),w=o(()=>u.value?[u.value.name]:[]),N=L({workQueues:w}),U=Q({workQueues:w}),V=o(()=>_.value?U.value:N.value),B=()=>{g.push(ne.workQueues())},P=o(()=>u.value?`Work Queue: ${u.value.name}`:"Work Queue");se(P);const S=Q({states:["Running","Pending"],workQueues:w}),$=y(m.flowRuns.getFlowRunsCount,[S.value],{interval:3e4}),A=o(()=>$.response??[]);return O(()=>{var t;return(t=u.value)==null?void 0:t.deprecated},t=>{t&&R(ee.info.deprecatedWorkQueue,"default",{dismissible:!1,timeout:!1})}),(t,l)=>{const D=c("p-button"),I=c("p-tabs"),j=c("p-layout-well"),G=c("p-layout-default");return a(),n(G,{class:"work-queue"},{header:s(()=>[e(u)?(a(),n(e(E),{key:0,"work-queue":e(u),onUpdate:e(v).refresh,onDelete:B},null,8,["work-queue","onUpdate"])):r("",!0)]),default:s(()=>[i(j,{class:"work-queue__body"},{header:s(()=>[i(e(J),{command:e(T),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:s(()=>[e(u)?(a(),n(e(q),{key:0,alternate:"","work-queue":e(u)},null,8,["work-queue"])):r("",!0)]),default:s(()=>[i(I,{selected:p.value,"onUpdate:selected":l[1]||(l[1]=k=>p.value=k),tabs:e(h)},{details:s(()=>[e(u)?(a(),n(e(q),{key:0,"work-queue":e(u)},null,8,["work-queue"])):r("",!0)]),"upcoming-runs":s(()=>[M("div",ae,[e(u)?(a(),n(e(X),{key:0,"work-queue":e(u)},null,8,["work-queue"])):r("",!0),e(_)?(a(),n(D,{key:1,secondary:"",class:"work-queue__active-runs-button",onClick:F},{default:s(()=>[Y(" Show active runs ")]),_:1})):r("",!0)])]),runs:s(()=>[i(e(Z),{states:d.value,"onUpdate:states":l[0]||(l[0]=k=>d.value=k),"flow-run-filter":e(V)},null,8,["states","flow-run-filter"])]),_:1},8,["selected","tabs"])]),_:1})]),_:1})}}});export{ve as default};
