@kingsleyweb/bun-ui 3.0.0-rc.1 → 3.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/assets/main-0rchxtv5.js +18 -0
- package/dist/docs/assets/{main-pgxtmtja.js.map → main-0rchxtv5.js.map} +1 -1
- package/dist/docs/manifest.json +5 -5
- package/dist/jobs/assets/AddFlowDialog-h6xkgx9b.js +6 -0
- package/dist/jobs/assets/{AddFlowDialog-0ec5ff4r.js.map → AddFlowDialog-h6xkgx9b.js.map} +1 -1
- package/dist/jobs/assets/added-cbwsxv3e.js +4 -0
- package/dist/jobs/assets/{added-ma7xb2dx.js.map → added-cbwsxv3e.js.map} +1 -1
- package/dist/jobs/assets/{channel-a5chwqet.js → channel-tgkvqm8y.js} +3 -3
- package/dist/jobs/assets/{channel-a5chwqet.js.map → channel-tgkvqm8y.js.map} +1 -1
- package/dist/jobs/assets/{channelChecks-1epbhv9a.js → channelChecks-s4yz4yhw.js} +3 -3
- package/dist/jobs/assets/{channelChecks-1epbhv9a.js.map → channelChecks-s4yz4yhw.js.map} +1 -1
- package/dist/jobs/assets/index-09z2cjft.js +4 -0
- package/dist/jobs/assets/{index-m7zk18cj.js.map → index-09z2cjft.js.map} +1 -1
- package/dist/jobs/assets/index-47pxmyxn.js +4 -0
- package/dist/jobs/assets/{index-c7qk888t.js.map → index-47pxmyxn.js.map} +1 -1
- package/dist/jobs/assets/index-4e55z986.js +4 -0
- package/dist/jobs/assets/{index-7kbae3pm.js.map → index-4e55z986.js.map} +1 -1
- package/dist/jobs/assets/index-5c933424.js +4 -0
- package/dist/jobs/assets/{index-xfq292gs.js.map → index-5c933424.js.map} +1 -1
- package/dist/jobs/assets/index-d5r5n0mm.js +4 -0
- package/dist/jobs/assets/{index-j3h4v03g.js.map → index-d5r5n0mm.js.map} +3 -3
- package/dist/jobs/assets/index-hs60b25v.js +10 -0
- package/dist/jobs/assets/{index-y5zw06cs.js.map → index-hs60b25v.js.map} +1 -1
- package/dist/jobs/assets/index-k2smrr70.js +4 -0
- package/dist/jobs/assets/{index-de1fgbgf.js.map → index-k2smrr70.js.map} +1 -1
- package/dist/jobs/assets/index-q24jw3w9.js +4 -0
- package/dist/jobs/assets/{index-pjtmzrcd.js.map → index-q24jw3w9.js.map} +1 -1
- package/dist/jobs/assets/index-rtynx6wj.js +4 -0
- package/dist/jobs/assets/{index-mykmd5cv.js.map → index-rtynx6wj.js.map} +1 -1
- package/dist/jobs/assets/{live-erz9pvnm.js → live-6k7s6358.js} +3 -3
- package/dist/jobs/assets/{live-erz9pvnm.js.map → live-6k7s6358.js.map} +1 -1
- package/dist/jobs/assets/{main-smabxbn4.js → main-0jmeh6mq.js} +4 -4
- package/dist/jobs/assets/{main-smabxbn4.js.map → main-0jmeh6mq.js.map} +1 -1
- package/dist/jobs/assets/main-3yj6bv90.js +5 -0
- package/dist/jobs/assets/{main-yg6scp84.js.map → main-3yj6bv90.js.map} +1 -1
- package/dist/jobs/assets/main-4g69fn3x.js +5 -0
- package/dist/jobs/assets/{main-v2f8a4g3.js.map → main-4g69fn3x.js.map} +1 -1
- package/dist/jobs/assets/{main-e8zsqez2.js → main-4gte3eqq.js} +4 -4
- package/dist/jobs/assets/{main-e8zsqez2.js.map → main-4gte3eqq.js.map} +1 -1
- package/dist/jobs/assets/{main-zk3n47nq.js → main-4j1fcevh.js} +3 -3
- package/dist/jobs/assets/{main-zk3n47nq.js.map → main-4j1fcevh.js.map} +1 -1
- package/dist/jobs/assets/main-5grjvsy7.js +5 -0
- package/dist/jobs/assets/{main-3xxhy5jh.js.map → main-5grjvsy7.js.map} +1 -1
- package/dist/jobs/assets/{main-gzppw8ng.js → main-5zbx60gq.js} +3 -3
- package/dist/jobs/assets/{main-gzppw8ng.js.map → main-5zbx60gq.js.map} +1 -1
- package/dist/jobs/assets/{main-zx20z2e9.js → main-9prgjhg4.js} +4 -4
- package/dist/jobs/assets/{main-zx20z2e9.js.map → main-9prgjhg4.js.map} +1 -1
- package/dist/jobs/assets/main-a250ffk7.js +17 -0
- package/dist/jobs/assets/{main-xf44bv26.js.map → main-a250ffk7.js.map} +4 -4
- package/dist/jobs/assets/{main-qahvywvw.js → main-d6ge7w08.js} +4 -4
- package/dist/jobs/assets/{main-qahvywvw.js.map → main-d6ge7w08.js.map} +1 -1
- package/dist/jobs/assets/{main-kjywj2zd.js → main-gngzht43.js} +3 -3
- package/dist/jobs/assets/{main-kjywj2zd.js.map → main-gngzht43.js.map} +1 -1
- package/dist/jobs/assets/main-hg0hrg8j.js +5 -0
- package/dist/jobs/assets/{main-yjykmsvp.js.map → main-hg0hrg8j.js.map} +1 -1
- package/dist/jobs/assets/main-hm1ng3yg.js +5 -0
- package/dist/jobs/assets/{main-9qd3nqs5.js.map → main-hm1ng3yg.js.map} +1 -1
- package/dist/jobs/assets/main-jkvd92z9.js +5 -0
- package/dist/jobs/assets/{main-fcq7hfk0.js.map → main-jkvd92z9.js.map} +1 -1
- package/dist/jobs/assets/main-jv5xqd13.js +5 -0
- package/dist/jobs/assets/{main-grcj8v1z.js.map → main-jv5xqd13.js.map} +7 -7
- package/dist/jobs/assets/main-jxre7w93.js +5 -0
- package/dist/jobs/assets/{main-47391fgm.js.map → main-jxre7w93.js.map} +4 -4
- package/dist/jobs/assets/{main-b35rfpdf.js → main-kwmqkjfx.js} +4 -4
- package/dist/jobs/assets/{main-b35rfpdf.js.map → main-kwmqkjfx.js.map} +1 -1
- package/dist/jobs/assets/main-n9cf6bxm.js +5 -0
- package/dist/jobs/assets/{main-vargz49c.js.map → main-n9cf6bxm.js.map} +1 -1
- package/dist/jobs/assets/{main-6xdkyzv1.js → main-pegp0ygb.js} +2 -2
- package/dist/jobs/assets/{main-2n5wnj51.js → main-qr573853.js} +3 -3
- package/dist/jobs/assets/{main-2n5wnj51.js.map → main-qr573853.js.map} +1 -1
- package/dist/jobs/assets/main-rq97rdr4.js +4 -0
- package/dist/jobs/assets/{main-7jzem39c.js.map → main-rq97rdr4.js.map} +1 -1
- package/dist/jobs/assets/main-szjdmydc.js +5 -0
- package/dist/jobs/assets/{main-pqke97qp.js.map → main-szjdmydc.js.map} +1 -1
- package/dist/jobs/assets/{main-jex4pqaa.js → main-tnbhrm9n.js} +5 -5
- package/dist/jobs/assets/{main-jex4pqaa.js.map → main-tnbhrm9n.js.map} +1 -1
- package/dist/jobs/assets/main-ts19j4n0.js +5 -0
- package/dist/jobs/assets/{main-eekxtm5w.js.map → main-ts19j4n0.js.map} +1 -1
- package/dist/jobs/assets/{main-fn8r2zyb.js → main-w93x1dzs.js} +4 -4
- package/dist/jobs/assets/{main-fn8r2zyb.js.map → main-w93x1dzs.js.map} +1 -1
- package/dist/jobs/assets/sections-0y7w4fb4.js +4 -0
- package/dist/jobs/assets/{sections-b570mm22.js.map → sections-0y7w4fb4.js.map} +1 -1
- package/dist/jobs/assets/{sse-42e8mhar.js → sse-mn0t0fh7.js} +4 -4
- package/dist/jobs/assets/{sse-42e8mhar.js.map → sse-mn0t0fh7.js.map} +1 -1
- package/dist/jobs/assets/{sseChecks-0jskzcs1.js → sseChecks-t7tcm7ra.js} +3 -3
- package/dist/jobs/assets/{sseChecks-0jskzcs1.js.map → sseChecks-t7tcm7ra.js.map} +1 -1
- package/dist/jobs/assets/validation-ysjfy072.js +4 -0
- package/dist/jobs/assets/{validation-199pberh.js.map → validation-ysjfy072.js.map} +1 -1
- package/dist/jobs/manifest.json +213 -213
- package/package.json +10 -6
- package/dist/docs/assets/main-pgxtmtja.js +0 -18
- package/dist/jobs/assets/AddFlowDialog-0ec5ff4r.js +0 -6
- package/dist/jobs/assets/added-ma7xb2dx.js +0 -4
- package/dist/jobs/assets/index-7kbae3pm.js +0 -4
- package/dist/jobs/assets/index-c7qk888t.js +0 -4
- package/dist/jobs/assets/index-de1fgbgf.js +0 -4
- package/dist/jobs/assets/index-j3h4v03g.js +0 -4
- package/dist/jobs/assets/index-m7zk18cj.js +0 -4
- package/dist/jobs/assets/index-mykmd5cv.js +0 -4
- package/dist/jobs/assets/index-pjtmzrcd.js +0 -4
- package/dist/jobs/assets/index-xfq292gs.js +0 -4
- package/dist/jobs/assets/index-y5zw06cs.js +0 -10
- package/dist/jobs/assets/main-3xxhy5jh.js +0 -5
- package/dist/jobs/assets/main-47391fgm.js +0 -5
- package/dist/jobs/assets/main-7jzem39c.js +0 -4
- package/dist/jobs/assets/main-9qd3nqs5.js +0 -5
- package/dist/jobs/assets/main-eekxtm5w.js +0 -5
- package/dist/jobs/assets/main-fcq7hfk0.js +0 -5
- package/dist/jobs/assets/main-grcj8v1z.js +0 -5
- package/dist/jobs/assets/main-pqke97qp.js +0 -5
- package/dist/jobs/assets/main-v2f8a4g3.js +0 -5
- package/dist/jobs/assets/main-vargz49c.js +0 -5
- package/dist/jobs/assets/main-xf44bv26.js +0 -17
- package/dist/jobs/assets/main-yg6scp84.js +0 -5
- package/dist/jobs/assets/main-yjykmsvp.js +0 -5
- package/dist/jobs/assets/sections-b570mm22.js +0 -4
- package/dist/jobs/assets/validation-199pberh.js +0 -4
- /package/dist/jobs/assets/{main-6xdkyzv1.js.map → main-pegp0ygb.js.map} +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{Me,c,T,r,Z,K,b,n,e,t,f,i,gt,yt,m,y,ie,Y,a,_,s,de,E,ve,d,p,ee,ce,ls,ds,cs,ms,fs,ps,hs,gs,Ns,Os,As,Rs,Ds,Ts,vs,Ss,R,L,o,z,h,u,te,l,M,V,S,w,I,ne,le,Cs,Ls,Zt,Ps,Us,fr,pr,hr,jr,kt,zr,xs,Zr}from"./main-a250ffk7.js";import{wn}from"./main-rq97rdr4.js";import{rn}from"./main-5zbx60gq.js";import"./main-szjdmydc.js";import"./main-qr573853.js";import"./main-tnbhrm9n.js";import{Ye,Rt,mn,Eo,bo,fn,Dt}from"./main-ts19j4n0.js";import{Oe}from"./main-kwmqkjfx.js";import{Lo,U,Po}from"./main-hg0hrg8j.js";import{k}from"./main-4g69fn3x.js";import{O}from"./main-4j1fcevh.js";import{W,me,we}from"./main-3yj6bv90.js";import{ke,$n,Uo,xo,xe,yn,Ze,Bo}from"./main-jxre7w93.js";import{vt,En,wr,qo,kr,Ho,Go,Qo,jo,Ko,$o,Wo,zo,Zo,Xo}from"./main-w93x1dzs.js";import{A}from"./main-0jmeh6mq.js";import{Kt,bn,Nn}from"./main-n9cf6bxm.js";import{ae}from"./main-d6ge7w08.js";import{re,ts}from"./main-jkvd92z9.js";import{D}from"./main-hm1ng3yg.js";import{ge}from"./main-5grjvsy7.js";import{pt}from"./main-9prgjhg4.js";import{F}from"./main-pegp0ygb.js";function Le({queue:g}){let v=i(),P=le("demand"),N=a({queryKey:Zt.queue(g),queryFn:({signal:C})=>Ps(v,g,C),refetchInterval:P,placeholderData:Y});if(N.isPending)return e(p,{label:"Loading demand",showLabel:!0});if(N.isError)return e(D,{error:N.error,title:"Could not load demand",onRetry:()=>void N.refetch()});return e(ct,{reading:N.data,urls:Us(v.base,g,window.location.origin)})}function ct({reading:g,urls:v}){let P=jr.some(({figure:N})=>fr(g,N).approximate);return t("div",{className:"demand-panel","data-testid":"queue-demand",children:[g.paused&&e("p",{className:"notice",role:"note","data-testid":"demand-paused",children:"The queue is paused, so it demands nothing: demand and outstanding read 0 whatever is waiting, and a scaler polling them scales to zero."}),g.capped&&e("p",{className:"notice",role:"note","data-testid":"demand-capped",children:"At least these many: a count reached the backend's cap, so every figure is a lower bound (≥)."}),P&&e("p",{className:"notice",role:"note","data-testid":"demand-approximate",children:"Approximate (≈): this backend cannot count demand directly, so due now is only 1 or 0, stalled counts every active job while no worker is live, and the next due time is known only while nothing is due. Right as a trigger, not as a count."}),e(F,{items:[...jr.map(({figure:N,label:C,hint:x})=>({key:N,label:C,value:e("span",{className:"num",title:hr(g,N),"data-testid":`demand-${N}`,children:pr(g,N)}),hint:x})),{key:"workers",label:"Workers",value:e("span",{className:"num","data-testid":"demand-workers",children:o(g.workers)}),hint:"Live workers on the queue, from their heartbeats, paused ones included. 0 on a backend that keeps no worker records."},{key:"nextDueAt",label:"Next due",value:e("span",{"data-testid":"demand-next-due",children:g.nextDueAt===null?"None scheduled":e(A,{value:g.nextDueAt,hint:g.exact?void 0:"Approximate: known only while nothing is due."})}),hint:"The earliest delayed job or retry still in the future."},{key:"at",label:"Read",value:e(A,{value:g.at})}]}),t("div",{className:"demand-urls",children:[e("p",{className:"muted",children:"A scaler reads the same figures from these URLs (JSON, and the Prometheus text format), with the credentials this API asks for."}),e(Ae,{label:"JSON",url:v.json,testId:"demand-url-json"}),e(Ae,{label:"Prometheus",url:v.prometheus,testId:"demand-url-prometheus"})]})]})}function Ae({label:g,url:v,testId:P}){return t("div",{className:"demand-url",children:[e("span",{className:"demand-url-label",children:g}),e("code",{"data-testid":P,children:v}),e(ge,{text:v,ariaLabel:`Copy the ${g} demand URL`})]})}function Ee(){let g=m(),v=y("queues.read"),P=re(),N=g.features.jobDefaults&&v;return{shown:N,canEdit:N&&P("queues.defaults"),canApply:N&&g.features.jobDefaultsApply&&P("queues.applyDefaults")}}function qe(g){return{rateMax:g?.rate?.max,rateDuration:g?.rate?String(g.rate.duration):"",concurrency:g?.concurrency}}function Ie(g){return{queue:qe(g??void 0),names:Object.entries(g?.names??{}).map(([v,P],N)=>({key:N,name:v,...qe(P)}))}}function $e(g){let v={},P=Po(g.rateDuration);if(g.rateMax!==void 0||P!==void 0)v.rate={max:g.rateMax??0,duration:P??0};if(g.concurrency!==void 0)v.concurrency=g.concurrency;return v}function Be(g){let v=$e(g.queue),P={};for(let N of g.names){let C=N.name.trim();if(C)P[C]=$e(N)}if(Object.keys(P).length>0)v.names=P;return v}function Fe({queue:g,limits:v,editable:P}){if(!P)return e(ft,{limits:v});return e(ht,{queue:g,limits:v},JSON.stringify(v))}function ft({limits:g}){if(!g||Object.keys(g).length===0)return e("p",{className:"muted",children:"No limits are set on this queue."});let v=(P)=>[P.rate&&`${P.rate.max} per ${U(P.rate.duration)}`,P.concurrency!==void 0&&`${P.concurrency} at once`].filter(Boolean).join(", ")||"none";return t("dl",{className:"limits-summary",children:[e("dt",{children:"Queue"}),e("dd",{children:v(g)}),Object.entries(g.names??{}).map(([P,N])=>t("div",{children:[e("dt",{children:P}),e("dd",{children:v(N)})]},P))]})}function Qe({row:g,onChange:v,prefix:P,errors:N,label:C,scope:x}){let Q=(H)=>N[`${P}${H}`],B=x.kind==="queue"?"jobs on this queue":x.name?`jobs named “${x.name}”`:"jobs with this name";return t("div",{className:"field-row limits-row",children:[e(l,{label:`${C}: rate max`,hint:`The most ${B} that may START in one rate window, across every worker. Set it with the window beside it; leave both empty for no rate limit.`,error:Q("rate.max")??Q("rate"),children:e(V,{value:g.rateMax,onChange:(H)=>v({...g,rateMax:H}),min:1})}),e(l,{label:`${C}: rate window`,hint:"The length of the rate window: milliseconds (60000), or a duration such as “1 minute” or “30 seconds”. Starts are counted over this window.",error:Q("rate.duration"),children:e(M,{value:g.rateDuration,onChange:(H)=>v({...g,rateDuration:H}),maxLength:100})}),e(l,{label:`${C}: concurrency`,hint:`The most ${B} that may RUN at once, counted across every worker — on top of each worker's own concurrency, which still applies. A worker that dies holds its share until its lock expires. Empty means no limit.`,error:Q("concurrency"),children:e(V,{value:g.concurrency,onChange:(H)=>v({...g,concurrency:H}),min:1})})]})}function ht({queue:g,limits:v}){let P=i(),[N,C]=r(()=>Ie(v)),[x,Q]=r(!1),B=O({mutationFn:(q)=>q===null?Os(P,g):Ns(P,g,q),successMessage:(q,se)=>se===null?`Removed the limits of ${g}`:`Saved the limits of ${g}`,invalidate:ce(g),toastErrors:!1}),H=(q)=>{q?.preventDefault(),B.mutate(Be(N))},G=b(B.error)&&B.error.code==="LIMITS_CONTENDED",oe=B.error&&(Object.keys(B.fieldErrors).length===0||B.unplacedIssues.length>0)?B.error:null,X=N.names.reduce((q,se)=>Math.max(q,se.key+1),0);return t(n,{children:[t("form",{className:"limits-editor","aria-label":"Queue limits",onSubmit:H,children:[e(Qe,{row:N.queue,onChange:(q)=>C({...N,queue:q}),prefix:"",errors:B.fieldErrors,label:"Queue",scope:{kind:"queue"}}),t("fieldset",{className:"limits-names",children:[e("legend",{children:"Per-name limits"}),N.names.length===0&&e("p",{className:"muted",children:"None."}),N.names.map((q,se)=>t("div",{className:"limits-name",children:[e(l,{label:`Name ${se+1}`,hint:"The job name these limits apply to, exactly as jobs are added with it (e.g. “send-email”). They apply on top of the queue's own. A name at its limit is skipped, not waited behind, so other names keep running.",children:e(M,{value:q.name,onChange:(j)=>C({...N,names:N.names.map((ue)=>ue.key===q.key?{...ue,name:j}:ue)}),maxLength:200})}),e(Qe,{row:q,onChange:(j)=>C({...N,names:N.names.map((ue)=>ue.key===q.key?{...ue,...j}:ue)}),prefix:`names.${q.name.trim()}.`,errors:B.fieldErrors,label:q.name.trim()||`Name ${se+1}`,scope:{kind:"name",name:q.name.trim()}}),t(s,{size:"sm",variant:"ghost",onClick:()=>C({...N,names:N.names.filter((j)=>j.key!==q.key)}),children:["Remove ",q.name.trim()||`name ${se+1}`]})]},q.key)),e(s,{size:"sm",onClick:()=>C({...N,names:[...N.names,{key:X,name:"",rateMax:void 0,rateDuration:"",concurrency:void 0}]}),children:"Add a name"})]}),oe!==null&&e(D,{error:oe,title:G?"The limits changed while saving. Retry to save again.":"Could not save the limits",onRetry:G?()=>H():void 0}),t("div",{className:"form-actions",children:[e(s,{type:"submit",variant:"primary",disabled:B.isPending,"aria-busy":B.isPending||void 0,children:B.isPending?"Saving…":"Save limits"}),v!==null&&e(s,{variant:"danger",onClick:()=>Q(!0),disabled:B.isPending,children:"Remove all limits…"})]})]}),e(k,{open:x,onClose:()=>Q(!1),title:`Remove every limit on ${g}?`,description:"Workers stop rate-limiting and capping this queue once they refresh their limits.",variant:"danger",confirmLabel:"Remove limits",onConfirm:()=>B.mutateAsync(null)})]})}var bt=20;function wt(g,v){if(!b(g)||g.code!=="REPEATABLE_NOT_FOUND")return g;return new K({kind:g.kind,status:g.status,code:g.code,title:g.title,detail:`The repeat series “${v}” no longer exists: somebody removed it, or it ended. Refresh to see the series there are now.`,type:g.type,issues:g.issues,context:g.context,instance:g.instance,cause:g})}function _e({queue:g,canRemove:v,canDisable:P=!1,canEnable:N=!1}){let C=i(),[x,Q]=r(null),B=le("repeatables"),H=a({queryKey:ee.repeatables(g),queryFn:({signal:j})=>Ds(C,g,j),refetchInterval:B}),G=O({mutationFn:(j)=>Ts(C,g,j),successMessage:(j,ue)=>`Removed the repeat series ${ue}`,invalidate:ce(g),toastErrors:!1}),oe=O({mutationFn:async({key:j,to:ue})=>{try{return ue==="disable"?await vs(C,g,j):await Ss(C,g,j)}catch(pe){throw wt(pe,j)}},successMessage:(j,{key:ue,to:pe})=>pe==="disable"?`Disabled the repeat series ${ue}: it schedules nothing until enabled`:`Enabled the repeat series ${ue}: its next occurrence is scheduled from now`,errorTitle:"Could not change the repeat series",invalidate:ce(g)}),X=H.data?.items??[],q=kt(X,bt);if(H.isPending)return e(p,{label:"Loading repeatables",showLabel:!0});if(H.isError)return e(D,{error:H.error,title:"Could not load repeatables",onRetry:()=>void H.refetch()});let se=v||X.some((j)=>j.disabled?N:P);if(X.length===0)return e(d,{title:"No repeatables",description:"No repeat series is scheduled on this queue."});return t(n,{children:[t(I,{label:`Repeatables of ${g}`,children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Key"}),e("th",{scope:"col",children:"Name"}),e("th",{scope:"col",children:"Schedule"}),e("th",{scope:"col",children:"Next run"}),e("th",{scope:"col",className:"num",children:"Runs"}),e("th",{scope:"col",children:"Data"}),se&&e("th",{scope:"col",children:e("span",{className:"visually-hidden",children:"Actions"})})]})}),e("tbody",{children:q.rows.map((j)=>t("tr",{"data-testid":`repeatable-row-${j.key}`,children:[t("th",{scope:"row",children:[e("code",{children:j.key}),j.disabled&&t(n,{children:[" ",e(f,{tone:"warning",title:"Schedules nothing until it is enabled",children:"Disabled"})]})]}),e("td",{children:j.name}),e("td",{children:Eo(j)}),e("td",{"data-testid":`repeatable-next-${j.key}`,children:j.disabled?"paused (disabled)":e(A,{value:j.nextRunAt})}),t("td",{className:"num",children:[o(j.count),j.limit!==void 0&&` / ${o(j.limit)}`]}),e("td",{className:"repeatable-data",children:j.data===void 0?"—":e(ae,{value:j.data,label:`Data of ${j.key}`,expandDepth:0})}),se&&e("td",{children:t("div",{className:"repeatable-actions",children:[P&&!j.disabled&&e(We,{series:j,to:"disable",pending:oe.isPending&&oe.variables?.key===j.key,onClick:()=>oe.mutate({key:j.key,to:"disable"})}),N&&j.disabled&&e(We,{series:j,to:"enable",pending:oe.isPending&&oe.variables?.key===j.key,onClick:()=>oe.mutate({key:j.key,to:"enable"})}),v&&e(s,{size:"sm",variant:"danger","aria-label":`Remove repeatable ${j.key}`,onClick:()=>Q(j),children:"Remove…"})]})})]},j.key))})]}),q.paged&&e(ne,{label:"Repeatable pages",offset:q.offset,limit:q.limit,total:q.total,itemCount:q.rows.length,onChange:q.onChange}),e(k,{open:x!==null,onClose:()=>Q(null),title:`Remove the repeat series ${x?.key??""}?`,description:"No further occurrences are scheduled. Jobs it already produced stay.",variant:"danger",confirmLabel:"Remove",onConfirm:()=>x?G.mutateAsync(x.key):void 0})]})}function We({series:g,to:v,pending:P,onClick:N}){let C=v==="disable"?"Disable":"Enable";return e(s,{size:"sm","aria-label":`${C} repeatable ${g.key}`,disabled:P,"aria-busy":P||void 0,onClick:N,children:P?`${v==="disable"?"Disabling":"Enabling"}…`:C})}var Ke="Its policy is known only where its controller runs.",Pt="(provider default)",St="While the summoner is not ready, the configured values; once it is, they may be lowered to a wake pool's size.",He="The policy does not set this: the default applies.",Ge="Set for this queue by the unit's overrides.";function Je(g,v){if(!g)return"none";if(!v.local)return"elsewhere";return v.policy===void 0?"none":"shown"}function fe(g,v,P="",N=!1){return{joiner:P,text:g,keys:v,muted:N}}var Ue={onAdd:"On add",events:"Events",poll:"Poll"},Nt={onAdd:"triggers.onAdd",events:"triggers.events",poll:"triggers.poll"},je={"any-worker":"any live worker","summoned-only":"summoned workers only"};function Ve(g,v){return typeof v==="string"&&Object.hasOwn(g,v)}function Ct(g){let v=Object.entries(g).filter(([N])=>N!=="kind").map(([N,C])=>`${N}: ${u(C)}`),P=u(g.kind);return v.length===0?P:`${P} (${v.join(", ")})`}function xt(g){let v=[];return g.forEach((P,N)=>{let C=v.length===0?"":" · ";if(!Ve(Ue,P.kind)){v.push(fe(Ct(P),[],C,P.on===!1));return}let x=Ue[P.kind],Q=Nt[P.kind];if(P.on!==!0){v.push(fe(`${x} off`,[Q],C,!0));return}if(P.kind==="poll"){v.push(fe(typeof P.every==="number"?`${x} every ${U(P.every)}`:x,[Q],C));return}v.push(fe(x,[Q],C));let B=P.debounce,H=g.slice(N+1).some((G)=>G.on===!0&&(G.kind==="onAdd"||G.kind==="events")&&G.debounce===B);if(typeof B==="number"&&!H)v.push(fe(`(coalesced ${U(B)})`,["triggers.debounce"]," "))}),v}function ze(g){return g===null?"one regardless of depth":`${h(g,"job")} per worker`}function Tt(g){if(g.signal==="none")return"no stop signal (in-invocation)";let v=typeof g.graceMaxMs==="number"?` (up to ${U(g.graceMaxMs)})`:"";return`${u(g.signal)}, ${U(g.graceMs)} grace${v}`}function At(g,v){let P=(C)=>C.length>0&&C.every((x)=>!v.has(x)),N=g.pieces.length>0&&g.pieces.every((C)=>P(C.keys));return{id:g.id,label:g.label,...g.hint===void 0?{}:{hint:g.hint},tag:N,parts:g.pieces.map((C)=>({...C,muted:C.muted===!0,tag:!N&&P(C.keys)}))}}function Xe(g,v){let P=new Set(Array.isArray(g.explicit)?g.explicit:[]),N=g.circuit.group;return[{id:"triggers",label:"Triggers",pieces:xt(g.triggers),hint:"What makes the controller check for work to summon for."},{id:"workers",label:"Workers",pieces:[fe(`at most ${o(g.maxWorkers)}`,["maxWorkers"]),fe(ze(g.jobsPerWorker),["jobsPerWorker"]," · "),fe(`at most ${o(g.maxPending)} starting`,["maxPending"]," · ")],hint:St},{id:"cooldown",label:"Cooldown",pieces:[fe(U(g.cooldown),["cooldown"])],hint:"The least time between two attempts."},{id:"backoff",label:"Backoff",pieces:[fe(U(g.backoff.initial),["backoff.initial"]),fe(`doubling to ${U(g.backoff.max)}`,["backoff.max"],", ")],hint:"The wait after a failed or lost attempt, doubling with each one in a row."},{id:"circuit",label:"Circuit",pieces:[fe(`opens after ${h(g.circuit.failures,"failure")}`,["circuit.failures"]),fe(`for ${U(g.circuit.resetAfter)}`,["circuit.resetAfter"],", ")],hint:"Failed or lost attempts in a row that stop summoning, and for how long before one trial attempt."},N!==void 0&&{id:"group-circuit",label:"Group circuit",pieces:[fe(`opens after ${h(N.failures,"failure")} across the group`,["group.circuit.failures"]),fe(`for ${U(N.resetAfter)}`,["group.circuit.resetAfter"],", ")],hint:"The summon group's shared circuit: failures of this summoner's kind on any of its queues."},{id:"boot-budget",label:"Boot budget",pieces:[typeof g.bootBudget==="number"?fe(U(g.bootBudget),["bootBudget"]):fe(Pt,[])],hint:"How long an attempt counts as a worker on its way before it is lost."},{id:"lifetime",label:"Longest life",pieces:[fe(U(g.maxLifetime),["maxLifetime"]),...typeof v?.maxLifetimeMs==="number"?[fe(`platform cap ${U(v.maxLifetimeMs)}`,[]," · ")]:[]],hint:"The longest a summoned worker may live."},v!==void 0&&{id:"shutdown",label:"Shutdown",pieces:[fe(Tt(v.shutdown),[])],hint:"What the platform sends to stop a unit, and how long it waits: declared by the provider, not set by the policy."},v?.style==="scale"&&{id:"scale-down",label:"Scale down",pieces:[fe(`to zero after ${U(g.scaleDown.after)} idle`,["scaleDown.after"])]},{id:"summon-timeout",label:"Summon timeout",pieces:[fe(U(g.summonTimeout),["summonTimeout"])],hint:"How long one call to the summoner may take."},{id:"served-by",label:"Served by",pieces:[fe(Ve(je,g.servedBy)?je[g.servedBy]:u(g.servedBy),["servedBy"])],hint:"Which live workers count as serving the queue."},{id:"env",label:"Env",pieces:[{...fe("none",["env"]),names:g.env.map((x)=>u(x))}],hint:"The names the policy adds to every summoned worker's environment. Their values are never sent."},{id:"from-summoned",label:"From summoned workers",pieces:[fe(g.fromSummoned?"yes":"no",["fromSummoned"])],hint:"Whether this controller may run in a summoned process or a runner child."},{id:"failure-hook",label:"Failure hook",pieces:[fe(g.onSummonFailed?"set":"not set",["onSummonFailed"])],hint:"Whether an onSummonFailed hook is called on failed attempts."}].filter((x)=>x!==!1).map((x)=>At(x,P))}function et(g){if(g.perQueue===void 0)return;return Object.entries(g.perQueue).map(([v,P])=>{let N=Array.isArray(P.explicit)?P.explicit:[];return{queue:u(v),jobsPerWorker:ze(P.jobsPerWorker),maxWorkers:o(P.maxWorkers),jobsPerWorkerOverride:N.includes("jobsPerWorker"),maxWorkersOverride:N.includes("maxWorkers")}})}function tt(g){return g!==void 0&&Array.isArray(g.explicit)&&!g.explicit.includes("budget")}function nt({queue:g}){let v=i(),P=re(),N=le("summon"),[C,x]=r(null),[Q,B]=r(!0),[H,G]=r(!1),oe=ie("summonResetBudget")===!0,X=ie("summonPolicy")===!0,q=a({queryKey:ke.status(v,g),queryFn:({signal:ye})=>$n(v,g,ye),refetchInterval:N,placeholderData:Y}),se=te(),j=Lt(q.data?.queues),ue=(ye)=>{if(q.data?.queues!==void 0&&b(ye)&&ye.status===403)se.error(Zo,{description:ye.detail??ye.title})},pe=[...ke.changed(v,g),Zt.queue(g),ee.workers(g)],he=O({mutationFn:(ye)=>Uo(v,g,ye),successMessage:(ye)=>zo(ye),invalidate:pe,toastErrors:!1,onError:ue}),be=O({mutationFn:(ye)=>xo(v,g,ye?{budget:!0}:{}),successMessage:(ye,dt)=>dt?`Reset the summon state of ${g}: failures, backoff, circuit and budget usage cleared`:`Reset the summon state of ${g}: failures, backoff and circuit cleared`,invalidate:pe,toastErrors:!1,onError:ue});if(q.isPending)return e(p,{label:"Loading summon status",showLabel:!0});if(q.isError)return e(D,{error:q.error,title:"Could not load the summon status",onRetry:()=>void q.refetch()});if(q.data===null)return e(d,{title:"No summoner here",description:"No summon controller for this queue runs in this API's process."});let J=q.data,Re=Je(X,J),Se=Xo(J,j??P("queues.summon"));return t("div",{className:"summon-panel","data-testid":"queue-summon",children:[J.inert&&e("p",{className:"notice",role:"note","data-testid":"summon-inert",children:En(J.inertReason)}),!J.local&&e("p",{className:"notice",role:"note","data-testid":"summon-stored",children:"This queue's controller runs in another process: its state is read from the store, and it can be summoned or reset only from there."}),J.overlaps!==void 0&&J.overlaps.length>0&&e("p",{className:"notice",role:"note","data-testid":"summon-overlaps",children:J.queues===void 0?`Workers summoned for another summon group (${J.overlaps.map(u).join(", ")}) were seen on this queue at the last check: two units may be serving the same queue.`:`Workers summoned for another summon group (${J.overlaps.map(u).join(", ")}) were seen on this unit's queues at the last check: two units may be serving the same queues.`}),e(Et,{status:J,queue:g,policy:Re==="shown"?J.policy:void 0}),J.group!==void 0&&e(Bo,{group:J.group,queue:g,kind:J.summoner?.provider.kind}),J.summoner&&e($t,{summoner:J.summoner}),Re==="shown"&&J.policy!==void 0&&e(It,{policy:J.policy,capabilities:J.summoner?.capabilities,queue:g}),Re==="elsewhere"&&e("p",{className:"muted","data-testid":"summon-policy-elsewhere",children:Ke}),wr(J)&&J.pending.length>0&&e(Ft,{queue:g,queues:J.queues,pending:J.pending}),Se&&t("div",{className:"summon-actions",role:"group","aria-label":"Summon actions",children:[e(s,{variant:"primary",onClick:()=>x("summon"),disabled:he.isPending,children:"Summon now…"}),e(s,{onClick:()=>{G(!1),x("reset")},disabled:be.isPending,children:"Reset…"})]}),e(k,{open:C==="summon",onClose:()=>x(null),title:`Summon a worker for ${g} now?`,description:"Runs one check of the queue's summon controller now. The circuit, the budget, the attempts already on their way and the guard against two controllers summoning at once all still apply.",confirmLabel:"Summon now",onConfirm:()=>he.mutateAsync(Q),children:e(w,{checked:Q,onChange:B,label:"Skip the cooldown",hint:"Summon even if the last attempt was recent. Nothing else is skipped."})}),e(k,{open:C==="reset",onClose:()=>x(null),title:`Reset the summon state of ${g}?`,description:"Clears the consecutive failures, the backoff and an open circuit, so the next check may summon. Attempts already on their way are kept.",variant:"danger",confirmLabel:"Reset",onConfirm:()=>be.mutateAsync(oe&&H),children:oe&&e(w,{checked:H,onChange:G,label:"Also clear budget usage",hint:"Sets the attempts counted this UTC hour and today back to 0, so the budget allows its full limits again. Every controller on the queue shares the counts."})})]})}function Lt(g){let v=i(),{readOnly:P}=m(),N=rn({queries:(g??[]).map((C)=>({queryKey:_.permissions({queue:C}),queryFn:({signal:x})=>v.getPermissions({queue:C},x)}))});if(g===void 0)return;return!P&&N.length>0&&N.every((C)=>C.data!==void 0&&yt(C.data,"queues.summon"))}function Et({status:g,queue:v,policy:P}){let N=g.last===void 0?void 0:vt(g.last.outcome),C=g.last===void 0?[]:kr(g.last),x=g.last===void 0?void 0:Ho(g.last),Q=wr(g);return e(F,{items:[g.queues!==void 0&&{key:"unit",label:"Shared unit",value:e(qt,{queue:v,queues:g.queues}),hint:"One summoned process serves these queues, and this status is the unit's. Only the queues you may read are listed."},{key:"last",label:"Last outcome",value:g.last===void 0||N===void 0?e("span",{"data-testid":"summon-last",children:"None yet"}):t("span",{"data-testid":"summon-last",children:[e(f,{tone:N.tone,title:N.hint,children:N.label})," ",e(A,{value:g.last.at}),x!==void 0&&t("span",{className:"muted",children:[" — ",x]}),C.length>0&&e("span",{className:"summon-last-missing","data-testid":"summon-last-missing",children:Go(C)})]}),hint:g.last!==void 0&&C.length>0?Qo:void 0},Q&&{key:"pending",label:"On their way",value:e("span",{"data-testid":"summon-pending-count",children:o(g.pending.length)}),hint:"Summon attempts still counting as workers on their way."},Q&&{key:"failures",label:"Consecutive failures",value:e("span",{"data-testid":"summon-failures",children:o(g.failures)}),hint:"Failed, unavailable or lost attempts in a row, towards the circuit. A throttled call is not counted, and an auth or misconfiguration error counts enough to open it at once. A registration or a reset clears them."},Q&&g.backoffUntil!==void 0&&{key:"backoff",label:"Backing off until",value:e("span",{"data-testid":"summon-backoff",children:e(A,{value:g.backoffUntil})})},Q&&g.circuitOpenUntil!==void 0&&{key:"circuit",label:"Circuit open until",value:e("span",{"data-testid":"summon-circuit",children:e(A,{value:g.circuitOpenUntil})}),hint:"After repeated failures nothing is summoned until then, apart from one trial attempt."},Q&&g.budget!==void 0&&{key:"budget",label:"Budget",value:t(n,{children:[e(Ze,{budget:g.budget,testId:"summon-budget",group:g.group!==void 0&&g.group.budget.off!==!0}),tt(P)&&t(n,{children:[" ",e(Ce,{})]})]}),hint:yn(g.budget)}]})}function qt({queue:g,queues:v}){return t("span",{"data-testid":"summon-unit",children:["One process for ",h(v.length,"queue"),":"," ",v.map((P,N)=>{let C=P===g;return t("span",{children:[N>0&&", ",e(E,{to:xe(P),title:`The Summon tab of ${P}`,children:u(P)}),C&&e("span",{className:"muted",children:" (this queue)"})]},P)})]})}function $t({summoner:g}){let{provider:v,capabilities:P,facts:N}=g,C=Object.entries(N),x=pt(g.readiness),Q=Mt(g.providerId),B=re(),H=u(v.displayName??v.kind);return t("div",{className:"summon-summoner","data-testid":"summon-summoner",children:[e("h3",{className:"summon-heading",children:"Summoner"}),e(F,{items:[{key:"provider",label:"Provider",value:t("span",{"data-testid":"summon-provider",children:[u(v.displayName??v.kind)," ",t("span",{className:"muted",children:[u(v.name)," ",u(v.version)]})]})},{key:"readiness",label:"Readiness",value:e(f,{tone:x.tone,title:x.hint,testId:"summon-readiness",children:x.label}),hint:x.hint},...P===void 0?[]:[{key:"style",label:"Style",value:qo(P.style)},{key:"boot",label:"Provider default boot budget",value:U(P.bootBudgetMs),hint:"How long an attempt counts as a worker on its way before it is lost, unless the policy sets its own."},{key:"lifetime",label:"Longest life",value:P.maxLifetimeMs===null?"No platform limit known":U(P.maxLifetimeMs)}],...C.map(([G,oe])=>({key:`fact-${G}`,label:u(G),value:e("code",{children:u(oe)})}))]}),g.providerId!==void 0&&Q&&B("providers.validate")&&e(Nn,{providerId:g.providerId,label:H})]})}function It({policy:g,capabilities:v,queue:P}){let N=Xe(g,v),C=et(g),x=N.flatMap((Q)=>[{key:Q.id,label:Q.label,value:e(Bt,{row:Q}),hint:Q.hint},...Q.id==="workers"&&C!==void 0?[{key:"per-queue",label:"Per queue",value:e(Qt,{queue:P,rows:C}),hint:"Each of the unit's queues' own capacity: what its demand alone may ask for."}]:[]]);return t("div",{className:"summon-policy","data-testid":"summon-policy",children:[e("h3",{className:"summon-heading",children:"Policy"}),e(F,{items:x})]})}function Bt({row:g}){return t("span",{"data-testid":`summon-policy-${g.id}`,children:[g.parts.map((v,P)=>t("span",{children:[v.joiner,e(Ot,{part:v}),v.tag&&t(n,{children:[" ",e(Ce,{})]})]},P)),g.tag&&t(n,{children:[" ",e(Ce,{})]})]})}function Ot({part:g}){if(g.names!==void 0&&g.names.length>0)return e("span",{className:"summon-policy-names",children:g.names.map((v)=>e("code",{children:v},v))});return e("span",{className:g.muted?"muted":void 0,children:g.text})}function Ce(){return e("span",{className:"summon-policy-tag muted",title:He,"data-testid":"summon-policy-default",children:"default"})}function Qt({queue:g,rows:v}){return e("div",{"data-testid":"summon-policy-per-queue",children:t(I,{label:`Per-queue capacity of the unit serving ${g}`,children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Queue"}),e("th",{scope:"col",children:"Jobs per worker"}),e("th",{scope:"col",className:"num",children:"Max workers"})]})}),e("tbody",{children:v.map((P)=>t("tr",{"data-testid":`summon-policy-per-queue-${P.queue}`,children:[e("th",{scope:"row",children:P.queue}),t("td",{children:[P.jobsPerWorker,P.jobsPerWorkerOverride&&e(ot,{})]}),t("td",{className:"num",children:[P.maxWorkers,P.maxWorkersOverride&&e(ot,{})]})]},P.queue))})]})})}function ot(){return t(n,{children:[" ",e(f,{tone:"accent",title:Ge,testId:"summon-policy-override",children:"override"})]})}function Mt(g){let v=i(),P=m(),N=y("providers.read"),C=g!==void 0&&P.features.providers&&N,x=a({queryKey:Kt.list,queryFn:({signal:Q})=>bn(v,Q),enabled:C,staleTime:30000});return C&&x.data?.providers.some((Q)=>Q.id===g&&Q.preflight)===!0}function Ft({queue:g,queues:v,pending:P}){let N=P.some((x)=>x.handles!==void 0),C=Wo(P);return t(I,{label:`Summon attempts on their way for ${g}`,children:[e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Attempt"}),e("th",{scope:"col",children:"Started"}),e("th",{scope:"col",children:"Lost unless a worker registers"}),e("th",{scope:"col",className:"num",children:"Workers"}),e("th",{scope:"col",children:"Summoner"}),C&&e("th",{scope:"col",children:jo}),N&&e("th",{scope:"col",children:"Handles"})]})}),e("tbody",{children:P.map((x)=>t("tr",{"data-testid":`summon-pending-${x.id}`,children:[e("th",{scope:"row",children:e("code",{children:u(x.id)})}),e("td",{children:e(A,{value:x.at})}),e("td",{children:e(A,{value:x.until})}),e("td",{className:"num",children:o(x.count)}),e("td",{children:u(x.kind)}),C&&e("td",{children:e(Wt,{attempt:x.id,badges:$o(x.coverage,v,g)})}),N&&e("td",{children:x.handles?.map((Q)=>e("code",{className:"worker-target-file",children:u(Q)},Q))})]},x.id))})]})}function Wt({attempt:g,badges:v}){if(v===void 0||v.length===0)return e("span",{className:"muted",children:Ko});return e("ul",{className:"summon-coverage",children:v.map((P)=>t("li",{children:[e(f,{tone:P.tone,title:P.title,testId:`summon-coverage-${g}-${P.queue}`,children:P.label}),P.current&&e("span",{className:"muted",children:" (this queue)"})]},P.queue))})}var De=[15,60,360,1440],rt=60,Te={15:"Last 15 minutes",60:"Last hour",360:"Last 6 hours",1440:"Last 24 hours"},Pe=120,at=2,_t=new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"});function Ne(g){return _t.format(new Date(g))}function it(g){let v=Number(g);return De.find((P)=>P===v)??60}function st({queue:g}){let v=i(),[P,N]=W(),C=it(P.get("window")),x=c(),Q=le("throughput"),B=a({queryKey:ee.throughput(g,C),queryFn:({signal:H})=>Rs(v,g,C,H),refetchInterval:Q,placeholderData:Y});return t("div",{className:"throughput-panel",children:[t("div",{className:"throughput-controls",children:[e("label",{htmlFor:x,children:"Window"}),e(S,{id:x,options:De.map((H)=>({value:String(H),label:Te[H]})),value:String(C),onChange:(H)=>N({window:H===String(rt)?null:H})})]}),B.isPending?e(p,{label:"Loading throughput",showLabel:!0}):B.isError?e(D,{error:B.error,title:"Could not load throughput",onRetry:()=>void B.refetch()}):e(Ut,{data:B.data,label:`${g}: jobs per minute, ${Te[C].toLowerCase()}`})]})}function Ut({data:g,label:v}){let{buckets:P}=g,N=Math.max(1,...P.map((B)=>B.completed+B.failed)),C=Math.max(1,P.length)*10,x=(B)=>B/N*Pe,Q=`${v}: ${o(g.completed)} completed, ${o(g.failed)} failed, peak ${o(N)} per minute.`;return t("figure",{className:"throughput-chart",children:[t("div",{className:"throughput-legend","aria-hidden":"true",children:[t("span",{children:[e("span",{className:"swatch swatch-completed"})," Completed"," ",o(g.completed)]}),t("span",{children:[e("span",{className:"swatch swatch-failed"})," Failed"," ",o(g.failed)]}),t("span",{className:"muted",children:["Peak ",o(N),"/min"]})]}),t("svg",{role:"img","aria-label":Q,viewBox:`0 0 ${C} ${Pe}`,preserveAspectRatio:"none",className:"throughput-svg",children:[e("line",{x1:0,x2:C,y1:Pe,y2:Pe,className:"throughput-baseline"}),P.map((B,H)=>{let G=H*10+1,oe=x(B.completed),X=x(B.failed),q=oe>0&&X>0?at:0;return t("g",{children:[e("title",{children:`${Ne(B.at)}: ${B.completed} completed, ${B.failed} failed`}),e("rect",{x:G-1,y:0,width:10,height:Pe,className:"throughput-hit"}),oe>0&&e("rect",{x:G,y:Pe-oe,width:8,height:oe,rx:1,className:"bar-completed"}),X>0&&e("rect",{x:G,y:Pe-oe-q-X,width:8,height:X,rx:1,className:"bar-failed"})]},B.at)})]}),P.length>0&&t("figcaption",{className:"throughput-axis","aria-hidden":"true",children:[e("span",{children:Ne(P[0].at)}),e("span",{children:Ne(P.at(-1).at)})]}),t("table",{className:"visually-hidden",children:[e("caption",{children:v}),e("thead",{children:t("tr",{children:[e("th",{scope:"col",children:"Minute"}),e("th",{scope:"col",children:"Completed"}),e("th",{scope:"col",children:"Failed"})]})}),e("tbody",{children:P.map((B)=>t("tr",{children:[e("th",{scope:"row",children:Ne(B.at)}),e("td",{children:B.completed}),e("td",{children:B.failed})]},B.at))})]})]})}function lt(g){let v=g.filter((N)=>N.sweeps!==void 0);if(v.length===0)return null;if(v.some((N)=>N.sweeps===!0))return null;let P=v.length<g.length;return{message:P?`No live worker on this queue reports that it runs housekeeping, and some are too old to say — so there may be nobody doing it. ${"Jobs still run — delayed jobs are promoted and stalled ones recovered — but expired results, repeat series and stale queue state are not swept."}`:`No live worker on this queue runs housekeeping. ${"Jobs still run — delayed jobs are promoted and stalled ones recovered — but expired results, repeat series and stale queue state are not swept."}`,uncertain:P}}var jt=25;function ut({queue:g}){let v=i(),P=le("workers");fn(g,y("queues.read"));let N=Oe(),C=a({queryKey:ee.workers(g),queryFn:({signal:H})=>As(v,g,H),refetchInterval:P});if(C.isPending)return e(p,{label:"Loading workers",showLabel:!0});if(C.isError)return e(D,{error:C.error,title:"Could not load workers",onRetry:()=>void C.refetch()});let x=C.data.items;if(x.length===0)return e(d,{title:"No live workers",description:"No worker has reported for this queue recently."});let Q=x.some((H)=>H.host!==void 0||H.pid!==void 0),B=lt(x);return t(n,{children:[B&&e("p",{className:"workers-sweep-note",role:"note","data-testid":"sweep-warning","data-uncertain":B.uncertain?"true":"false",children:B.message}),e(Dt,{workers:x,label:`Workers of ${g}`,showQueue:!1,showHost:Q,linkKeys:N,pageSize:jt})]})}var Ht=["completed","failed","dead","waiting","delayed","waiting-children"],Gt=["failed","dead","completed"],Jt=[{value:"minutes",label:"minutes"},{value:"hours",label:"hours"},{value:"days",label:"days"}];function mt({queue:g,paused:v}){let P=i(),N=re(),[C,x]=r(null),Q=()=>x(null),B=ce(g),H=O({mutationFn:()=>ms(P,g),successMessage:`Paused ${g}`,errorTitle:`Could not pause ${g}`,invalidate:B}),G=O({mutationFn:()=>fs(P,g),successMessage:`Resumed ${g}`,errorTitle:`Could not resume ${g}`,invalidate:B}),oe=v===!1&&N("queues.pause"),X=v===!0&&N("queues.resume"),q=N("queues.drain"),se=N("queues.clean"),j=N("jobs.retryAll");if(!oe&&!X&&!q&&!se&&!j)return null;return t("div",{className:"queue-actions",role:"group","aria-label":"Queue actions",children:[oe&&e(s,{onClick:()=>H.mutate(),disabled:H.isPending,"aria-busy":H.isPending||void 0,children:"Pause"}),X&&e(s,{variant:"primary",onClick:()=>G.mutate(),disabled:G.isPending,"aria-busy":G.isPending||void 0,children:"Resume"}),j&&e(s,{onClick:()=>x("retryAll"),children:"Retry all…"}),se&&e(s,{variant:"danger",onClick:()=>x("clean"),children:"Clean…"}),q&&e(s,{variant:"danger",onClick:()=>x("drain"),children:"Drain…"}),C==="drain"&&e(Vt,{queue:g,onClose:Q}),C==="clean"&&e(Yt,{queue:g,onClose:Q}),C==="retryAll"&&e(zt,{queue:g,onClose:Q})]})}function Vt({queue:g,onClose:v}){let P=i(),[N,C]=r(!1),x=O({mutationFn:(Q)=>ps(P,g,Q),successMessage:(Q)=>`Drained ${h(Q.count,"job")} from ${g}`,invalidate:ce(g),toastErrors:!1});return e(k,{open:!0,onClose:v,title:`Drain ${g}?`,description:"Removes every waiting job (and, if chosen, every delayed one). Running jobs are not touched. This cannot be undone.",variant:"danger",confirmLabel:"Drain",pendingLabel:"Draining…",confirmText:g,onConfirm:()=>x.mutateAsync(N),children:e(w,{checked:N,onChange:C,label:"Also remove delayed jobs"})})}function Yt({queue:g,onClose:v}){let P=i(),{limits:N}=m(),C=te(),[x,Q]=r("completed"),[B,H]=r(1),[G,oe]=r("days"),[X,q]=r(N.defaultClean),se=O({mutationFn:(he)=>hs(P,g,he),onSuccess:(he)=>{C.success(`Cleaned ${h(he.count,"job")} from ${g}`,{description:he.ids.length>0?`Removed: ${mn(he.ids)}`:void 0})},invalidate:ce(g),toastErrors:!1}),j=Lo(B,G),ue=X!==void 0&&Number.isInteger(X)&&X>=1&&X<=N.maxClean,pe=(he)=>se.fieldErrors[he];return t(k,{open:!0,onClose:v,title:`Clean ${g}?`,description:"Removes jobs in one state that are older than the age you give, up to the limit. This cannot be undone.",variant:"danger",confirmLabel:"Clean",pendingLabel:"Cleaning…",confirmText:g,confirmDisabled:j===void 0||!ue,onConfirm:()=>se.mutateAsync({state:x,olderThan:j??0,limit:X}),children:[e(l,{label:"State",error:pe("state"),children:e(S,{options:Ht.map((he)=>({value:he,label:z[he]})),value:x,onChange:Q})}),t("div",{className:"field-row",children:[e(l,{label:"Older than",error:pe("olderThan"),required:!0,children:e(V,{value:B,onChange:H,min:0,step:"any"})}),e(l,{label:"Unit",children:e(S,{options:Jt,value:G,onChange:oe})})]}),e(l,{label:"Limit",hint:`At most ${o(N.maxClean)}.`,error:pe("limit")??(ue?void 0:`Between 1 and ${o(N.maxClean)}.`),children:e(V,{value:X,onChange:q,min:1,max:N.maxClean})})]})}function zt({queue:g,onClose:v}){let P=i(),{limits:N}=m(),C=te(),[x,Q]=r("failed"),[B,H]=r(""),[G,oe]=r(""),[X,q]=r(N.maxRetryAll),[se,j]=r(!0),ue=O({mutationFn:(J)=>gs(P,g,J),onSuccess:(J)=>{C.success(`Retried ${h(J.count,"job")} in ${g}`,{description:J.ids.length===0?void 0:`${mn(J.ids)}${J.truncated?` (ids of the first ${N.maxRetryAllIds} only)`:""}`})},invalidate:ce(g),toastErrors:!1}),pe=X!==void 0&&Number.isInteger(X)&&X>=1&&X<=N.maxRetryAll,he=b(ue.error)&&ue.error.code==="OPERATION_IN_PROGRESS",be=(J)=>ue.fieldErrors[J];return t(k,{open:!0,onClose:v,title:`Retry every ${z[x].toLowerCase()} job in ${g}?`,description:"Moves matching jobs back to waiting. It runs to completion before answering, which can take a while on a large queue.",confirmLabel:"Retry all",pendingLabel:"Retrying… this can take a while",confirmText:g,confirmDisabled:!pe,onConfirm:()=>ue.mutateAsync({state:x,name:B.trim()||void 0,reason:G.trim()||void 0,limit:X,resetAttempts:se}),children:[e(l,{label:"State",error:be("state"),children:e(S,{options:Gt.map((J)=>({value:J,label:z[J]})),value:x,onChange:Q})}),e(l,{label:"Job name",hint:"Optional: only jobs with exactly this name.",error:be("name"),children:e(M,{value:B,onChange:H,maxLength:200})}),e(l,{label:"Failure reason contains",hint:"Optional: a plain substring of “ErrorName: message”.",error:be("reason"),children:e(M,{value:G,onChange:oe,maxLength:500})}),e(l,{label:"Limit",hint:`At most ${o(N.maxRetryAll)}.`,error:be("limit")??(pe?void 0:`Between 1 and ${o(N.maxRetryAll)}.`),children:e(V,{value:X,onChange:q,min:1,max:N.maxRetryAll})}),e(w,{checked:se,onChange:j,label:"Reset attempts"}),he&&e("p",{className:"notice",role:"note","data-testid":"retry-all-in-progress",children:"A retry-all is already running on this queue. Only one runs per queue at a time; wait for it to finish, then try again."})]})}function Xt(){let{queue:g=""}=de(),v=i(),P=m(),N=y("queues.read"),C=y("jobs.list"),x=y("jobs.add"),Q=y("repeatables.list"),B=gt(),H=le("detail"),G=le("counts");Cs(g,{enabled:N&&B,jobs:C,repeatables:Q});let[oe,X]=r(!1),q=T(null),[se,j]=r(!1),ue=T(null),pe=a({queryKey:ee.detail(g),queryFn:({signal:Se})=>ds(v,g,Se),refetchInterval:H,enabled:N}),he=a({queryKey:ee.counts(g),queryFn:({signal:Se})=>cs(v,g,Se),refetchInterval:G,enabled:N});if(N&&pe.isError&&!pe.data)return e("div",{className:"screen",children:e(L,{headingLevel:1,error:pe.error,title:`Could not load the queue ${g}`,onRetry:()=>void pe.refetch()})});let be=ts(P,x),J=be&&P.features.addFlow,Re=he.data?Z.reduce((Se,ye)=>Se+he.data[ye],0):pe.data?.total;return t("div",{className:"screen queue-screen","data-testid":"queue-screen",children:[t("nav",{"aria-label":"Breadcrumb",className:"breadcrumb",children:[e(E,{to:"/queues",children:"Queues"}),e("span",{"aria-hidden":"true",children:" / "})]}),t("header",{className:"queue-header",children:[t("div",{className:"queue-heading",children:[e("h1",{className:"screen-title",children:g}),pe.data?.paused&&e(f,{tone:"warning",children:"Paused"}),Re!==void 0&&t("span",{className:"queue-total","data-testid":"queue-total",children:[o(Re)," jobs"]}),he.dataUpdatedAt>0&&t("span",{className:"muted queue-updated",children:["Updated ",e(A,{value:he.dataUpdatedAt})]})]}),t("div",{className:"queue-toolbar",children:[be&&e(s,{ref:q,variant:"primary",onClick:()=>X(!0),children:"Add job"}),J&&e(s,{ref:ue,onClick:()=>j(!0),children:"Add flow"}),e(mt,{queue:g,paused:pe.data?.paused})]})]}),be&&e(wn,{queue:g,open:oe,onClose:()=>{X(!1),q.current?.focus()}}),J&&se&&e(Zr,{queue:g,open:!0,onClose:()=>{j(!1),ue.current?.focus()}}),C?e(R,{title:"Jobs",children:e(bo,{queue:g,counts:he.data})}):e(d,{title:"Jobs hidden",description:"You may not list this queue's jobs."}),e(eo,{queue:g,limits:pe.data?pe.data.limits:void 0,detailLoading:N&&pe.isPending})]})}function eo({queue:g,limits:v,detailLoading:P}){let N=m(),C=re(),x=y("workers.list"),Q=y("queues.read"),B=y("metrics.read"),H=y("repeatables.list"),G=Ee(),oe=i(),X=a({queryKey:ke.status(oe,g),queryFn:({signal:pe})=>$n(oe,g,pe),enabled:Q,retry:!1}),q=[];if(N.features.limits&&(v!==void 0||P))q.push({value:"limits",label:"Limits",render:()=>v===void 0?e(p,{label:"Loading limits",showLabel:!0}):e(Fe,{queue:g,limits:v,editable:C("queues.limits")})});if(G.shown)q.push({value:"job-defaults",label:"Job defaults",render:()=>e(xs,{queue:g,canEdit:G.canEdit,canApply:G.canApply})});if(N.features.workers&&x)q.push({value:"workers",label:"Workers",render:()=>e(ut,{queue:g})});if(N.features.demand&&Q)q.push({value:"demand",label:"Demand",render:()=>e(Le,{queue:g})});if(Q&&(X.isError||(X.data??null)!==null))q.push({value:"summon",label:"Summon",render:()=>e(nt,{queue:g})});if(N.features.throughput&&B)q.push({value:"throughput",label:"Throughput",render:()=>e(st,{queue:g})});if(H)q.push({value:"repeatables",label:"Repeatables",render:()=>e(_e,{queue:g,canRemove:C("repeatables.remove"),canDisable:C("repeatables.disable"),canEnable:C("repeatables.enable")})});let se=q[0]?.value??"limits",j=Ye("panel",q,se);if(q.length===0)return null;let ue=q.find((pe)=>pe.value===j)??q[0];return e(R,{title:"Details",className:"queue-panels",children:e(Rt,{tabs:q.map(({value:pe,label:he})=>({value:pe,label:he})),param:"panel",defaultValue:se,label:"Queue details",children:ue.render()})})}function to(){let g=i(),{limits:v}=m(),P=y("queues.list"),[N,C]=W(),x=c(),Q=N.get("search")??"",B=Me(Q),H=we(me(N,"limit",Math.min(v.defaultPageSize,v.maxQueues)),v.maxQueues),G=me(N,"offset",0),oe={search:B,offset:G,limit:H},X=le("list");Ls(P);let q=a({queryKey:ee.page(oe),queryFn:({signal:se})=>ls(g,oe,se),refetchInterval:X,placeholderData:Y,enabled:P});if(!P)return t("div",{className:"screen",children:[e("h1",{className:"screen-title",children:"Queues"}),e(d,{title:"Nothing to show",description:"You may not list queues on this API."})]});return t("div",{className:"screen","data-testid":"queues-list",children:[e("h1",{className:"screen-title",children:"Queues"}),e(R,{title:"Queues",actions:t("div",{className:"search",children:[e("label",{htmlFor:x,className:"visually-hidden",children:"Search queues by name"}),e("input",{id:x,type:"search",className:"input",placeholder:"Search queues",...ve,value:Q,maxLength:200,onChange:(se)=>C({search:se.target.value,offset:null})})]}),children:q.isPending?e(p,{label:"Loading queues",showLabel:!0}):q.isError?e(L,{error:q.error,title:"Could not load queues",onRetry:()=>void q.refetch()}):q.data.items.length===0&&G===0?B?e(d,{title:"No queues match",description:`No queue name contains “${B}”.`}):e(d,{title:"No queues yet",description:"Queues appear here once a job is added to one."}):t(n,{children:[e(zr,{items:q.data.items,sparklines:!1}),e(ne,{label:"Queue pages",offset:G,limit:H,total:q.data.page.total,itemCount:q.data.items.length,hasMore:q.data.page.hasMore,maxPageSize:v.maxQueues,onChange:(se)=>C({offset:se.offset>0?String(se.offset):null,limit:String(se.limit)})})]})})]})}export{Xt as QueueScreen,to as QueuesListScreen};
|
|
2
|
+
|
|
3
|
+
//# debugId=5378BD3EF15812B464756E2164756E21
|
|
4
|
+
//# sourceMappingURL=index-d5r5n0mm.js.map
|