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