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