import{d as J,B as L,v as Z,c as t,S as A,E as O,r as m,R as Q,ap as R,a3 as j,a as c,e as a,w as o,o as n,g as s,aQ as z,i as l,m as i,aR as G,aS as b,L as H,aT as K,n as M,au as X,Z as Y,J as ee}from"./index-a91efef8.js";import{u as ue}from"./useToast-8a72a25c.js";import{u as te}from"./usePageTitle-6b86fe3b.js";const oe={class:"work-queue__upcoming-runs"},re=J({__name:"WorkQueue",setup(se){const g=L(),v=Z(),q=ue(),y=t(()=>{const u=["Upcoming Runs","Runs"];return A.xl||u.unshift("Details"),u}),C=O("workQueueId"),h=t(()=>`prefect agent start ${e.value?` --work-queue "${e.value.name}"`:""}`),d=m([]),p=m(),W=()=>{d.value=["Running","Pending"],p.value="Runs"},T={interval:3e5},k=Q(v.workQueues.getWorkQueue,[C.value],T),e=t(()=>k.response),f=t(()=>{var u;return(u=e.value)==null?void 0:u.concurrencyLimit}),x=t(()=>{var u;return(u=e.value)==null?void 0:u.isPaused}),N=t(()=>!!(f.value&&f.value<=V.value&&!x.value)),_=t(()=>e.value?[e.value.name]:[]),{filter:S}=R({flowRuns:{workQueueName:_}}),U=()=>{g.push(Y.workQueues())},B=t(()=>e.value?`Work Queue: ${e.value.name}`:"Work Queue"),{filter:F}=R({flowRuns:{state:{name:["Running","Pending"]},workQueueName:_.value}}),P=Q(v.flowRuns.getFlowRunsCount,[F],{interval:3e4}),V=t(()=>P.response??[]);return te(B),j(()=>{var u;return(u=e.value)==null?void 0:u.deprecated},u=>{u&&q(ee.info.deprecatedWorkQueue,"default",{dismissible:!1,timeout:!1})}),(u,r)=>{const $=c("p-button"),D=c("p-tabs"),E=c("p-layout-well"),I=c("p-layout-default");return n(),a(I,{class:"work-queue"},{header:o(()=>[e.value?(n(),a(s(z),{key:0,"work-queue":e.value,onUpdate:s(k).refresh,onDelete:U},null,8,["work-queue","onUpdate"])):l("",!0)]),default:o(()=>[i(E,{class:"work-queue__body"},{header:o(()=>[i(s(G),{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(b),{key:0,alternate:"","work-queue":e.value},null,8,["work-queue"])):l("",!0)]),default:o(()=>[i(D,{selected:p.value,"onUpdate:selected":r[1]||(r[1]=w=>p.value=w),tabs:y.value},{details:o(()=>[e.value?(n(),a(s(b),{key:0,"work-queue":e.value},null,8,["work-queue"])):l("",!0)]),"upcoming-runs":o(()=>[H("div",oe,[e.value?(n(),a(s(K),{key:0,"work-queue":e.value},null,8,["work-queue"])):l("",!0),N.value?(n(),a($,{key:1,secondary:"",class:"work-queue__active-runs-button",onClick:W},{default:o(()=>[M(" Show active runs ")]),_:1})):l("",!0)])]),runs:o(()=>[i(s(X),{states:d.value,"onUpdate:states":r[0]||(r[0]=w=>d.value=w),"flow-run-filter":s(S)},null,8,["states","flow-run-filter"])]),_:1},8,["selected","tabs"])]),_:1})]),_:1})}}});export{re as default};
