bunqueue-dashboard 0.0.29 → 0.0.31
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/agent/db.ts +16 -19
- package/agent/server.ts +4 -4
- package/dist/.vite/manifest.json +194 -146
- package/dist/assets/{AddJob-UCSTFuum.js → AddJob-CAhdg38n.js} +1 -1
- package/dist/assets/{Alerts-CofRabaP.js → Alerts-70bxf-PT.js} +1 -1
- package/dist/assets/{AreaChart-Dl_9G6GH.js → AreaChart-2gM0YoZT.js} +1 -1
- package/dist/assets/{Benchmark-B1VUJJLw.js → Benchmark-CFZ3WCvj.js} +1 -1
- package/dist/assets/{BulkAddJobs-DVgkRtrp.js → BulkAddJobs-BzgzpGg_.js} +1 -1
- package/dist/assets/CopilotPanel-DZUGIf1q.js +44 -0
- package/dist/assets/{Cron-CqlZj2V5.js → Cron-ltjSoTjj.js} +1 -1
- package/dist/assets/CronManager-BcFALDeT.js +1 -0
- package/dist/assets/{Database-BYZ8LJb5.js → Database-CV2yt5O2.js} +2 -2
- package/dist/assets/{Diagnostics-Dk1ErNCF.js → Diagnostics-D-EK4GEi.js} +1 -1
- package/dist/assets/Dlq-fZAKwQoC.js +1 -0
- package/dist/assets/DlqControl-eTrrQCrn.js +1 -0
- package/dist/assets/{DlqPro-D8DOy5MI.js → DlqPro-CF79339e.js} +1 -1
- package/dist/assets/{Flows-DP9-h7a0.js → Flows-Ba8G7mcC.js} +1 -1
- package/dist/assets/JobInspector--d_8ca9p.js +2 -0
- package/dist/assets/Jobs-DEqAc1A5.js +1 -0
- package/dist/assets/JobsPro-BcaokZIf.js +1 -0
- package/dist/assets/Logs-DBTukPIX.js +1 -0
- package/dist/assets/LogsPro-Wl_e6hZM.js +1 -0
- package/dist/assets/{McpServer-MfQ0qsAI.js → McpServer-CnWJsKw7.js} +1 -1
- package/dist/assets/{Metrics-C4Dwg_DP.js → Metrics-DzeIhNL-.js} +1 -1
- package/dist/assets/{MetricsPro-Bt9zLjkN.js → MetricsPro-O9eVJSH0.js} +1 -1
- package/dist/assets/Overview-Bnu7rWqt.js +1 -0
- package/dist/assets/{Pagination-BQg6KGW1.js → Pagination-D4ki-pGz.js} +1 -1
- package/dist/assets/QueueActions-DHoSkWRz.js +1 -0
- package/dist/assets/QueueControl-DKqEXnkM.js +1 -0
- package/dist/assets/{QueueDetail-wjRLlCYY.js → QueueDetail-DLRow04B.js} +1 -1
- package/dist/assets/QueueDetailPro-BYmOVd4T.js +1 -0
- package/dist/assets/Queues-CoyjRFN7.js +1 -0
- package/dist/assets/{QueuesOverview-DfRqAfS1.js → QueuesOverview-BeWdJpKi.js} +1 -1
- package/dist/assets/{S3Backup-UQ_HKrn0.js → S3Backup-BaLFgl9d.js} +1 -1
- package/dist/assets/{S3BackupPro-V3JNhUK8.js → S3BackupPro-DJB4oWgz.js} +1 -1
- package/dist/assets/{ServerControl-DXidWdsq.js → ServerControl-_0lVB33E.js} +1 -1
- package/dist/assets/{Settings-0j8DZK9n.js → Settings-zKFJTtnq.js} +1 -1
- package/dist/assets/Usage-CKGkvl0j.js +1 -0
- package/dist/assets/{UsagePro-CbVFCD3J.js → UsagePro-B-TJ6fp4.js} +1 -1
- package/dist/assets/{Webhooks-Dr0oBZr9.js → Webhooks-C3zmvY-_.js} +1 -1
- package/dist/assets/{Workers-Bwil4zIU.js → Workers-jKhhXl3W.js} +1 -1
- package/dist/assets/{WorkersPro-BRYPAhyx.js → WorkersPro-mvY5VX8I.js} +1 -1
- package/dist/assets/{connectionStore-B-hNUqwK.js → connectionStore-Ci04lJmR.js} +1 -1
- package/dist/assets/dist-1f1fMHVO.js +11 -0
- package/dist/assets/dist-BlWBaCN6.js +11 -0
- package/dist/assets/dist-DZL8soAh.js +79 -0
- package/dist/assets/dist-DjvZiKhB.js +2 -0
- package/dist/assets/dist-DpZcbP9W.js +11 -0
- package/dist/assets/{form-C-zZyKfB.js → form-DGinTEEb.js} +1 -1
- package/dist/assets/index-BOcegTHa.js +8 -0
- package/dist/assets/index-DWV3tgrk.css +1 -0
- package/dist/assets/{react-vendor-B68RYDeC.js → react-vendor-BcouBxpZ.js} +2 -2
- package/dist/assets/{useThroughputSeries-defI_JpV.js → useThroughputSeries-Chp5OLx3.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +5 -5
- package/scripts/embedded.gen.ts +122 -112
- package/scripts/serve.ts +11 -0
- package/dist/assets/CopilotPanel-BJeJYfaz.js +0 -152
- package/dist/assets/CronManager-C6kjWCLE.js +0 -1
- package/dist/assets/Dlq-DANXiXsm.js +0 -1
- package/dist/assets/DlqControl-DUturU7q.js +0 -1
- package/dist/assets/JobInspector-BHZtkFL6.js +0 -2
- package/dist/assets/Jobs-Bgr-HRmL.js +0 -1
- package/dist/assets/JobsPro-C2Vc2iRC.js +0 -1
- package/dist/assets/Logs-CaOn3IpL.js +0 -1
- package/dist/assets/LogsPro-BpSZaHzN.js +0 -1
- package/dist/assets/Overview-BO3xG6I0.js +0 -1
- package/dist/assets/QueueActions-Bez_iOjl.js +0 -1
- package/dist/assets/QueueControl-CEXlJDkE.js +0 -1
- package/dist/assets/QueueDetailPro-CuVyxX4Z.js +0 -1
- package/dist/assets/Queues-2W2E6e5R.js +0 -1
- package/dist/assets/Usage-C5DsZvR5.js +0 -1
- package/dist/assets/index-BjRjwWwc.js +0 -8
- package/dist/assets/index-mF63w920.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r}from"./react-vendor-B68RYDeC.js";import{A as i,C as a,L as o,S as s,T as c,Y as l,a as u,b as d,c as f,h as p,nt as m,rt as h,v as g,w as _,x as v}from"./index-BjRjwWwc.js";import{i as y,n as b,o as x,t as S}from"./form-C-zZyKfB.js";import{t as C}from"./Pagination-BQg6KGW1.js";var w=e(n(),1),T=[`jan`,`feb`,`mar`,`apr`,`may`,`jun`,`jul`,`aug`,`sep`,`oct`,`nov`,`dec`],E=[`sun`,`mon`,`tue`,`wed`,`thu`,`fri`,`sat`];function D(e,t,n,r){let i=e===`*`||/^\*\/\d+$/.test(e),a=new Set;for(let i of e.split(`,`)){let e=i.trim().toLowerCase();if(e===``)return null;let o=e.match(/^(.+)\/(\d+)$/),s=o?Number(o[2]):1,c=o?o[1]:e;if(s<1)return null;let l,u;if(c===`*`)l=t,u=n;else if(c.includes(`-`)){let[e,t]=c.split(`-`),n=O(e,r),i=O(t,r);if(n==null||i==null)return null;l=n,u=i}else{let e=O(c,r);if(e==null)return null;l=e,u=o?n:e}if(l<t||u>n||l>u)return null;for(let e=l;e<=u;e+=s)a.add(e)}return a.size?{values:a,star:i}:null}function O(e,t){let n=e.trim().toLowerCase();if(n===``)return null;if(t){let e=t.indexOf(n.slice(0,3));if(e!==-1)return e}return/^\d+$/.test(n)?Number(n):null}function k(e,t,n){let r=e.trim().split(/\s+/);if(r.length!==5)return{valid:!1,error:`Expected 5 fields (min hour day month weekday), got ${r.length}.`,runs:[]};let i=D(r[0],0,59),a=D(r[1],0,23),o=D(r[2],1,31),s=D(r[3],1,12,T),c=D(r[4],0,7,E);if(!i||!a||!o||!s||!c)return{valid:!1,error:`Invalid field syntax.`,runs:[]};let l=new Set;for(let e of c.values)l.add(e===7?0:e);let u={values:l,star:c.star},d=e=>{let t=o.values.has(e.getDate()),n=u.values.has(e.getDay());return o.star||u.star?t&&n:t||n},f=[],p=new Date(n);p.setSeconds(0,0),p.setMinutes(p.getMinutes()+1);for(let e=0;e<22e5&&f.length<t;e++){if(!s.values.has(p.getMonth()+1)){p.setMonth(p.getMonth()+1,1),p.setHours(0,0,0,0);continue}if(!d(p)){p.setDate(p.getDate()+1),p.setHours(0,0,0,0);continue}if(!a.values.has(p.getHours())){p.setHours(p.getHours()+1,0,0,0);continue}if(!i.values.has(p.getMinutes())){p.setMinutes(p.getMinutes()+1,0,0);continue}f.push(p.getTime()),p.setMinutes(p.getMinutes()+1,0,0)}return{valid:!0,runs:f}}var A=r();function j(){let{data:e,error:t,loading:n,refetch:r}=i(()=>m.crons(),[]),_=e?.crons??[],[y,b]=(0,w.useState)(0),x=Math.max(1,Math.ceil(_.length/15)),S=Math.min(y,x-1),[T,E]=(0,w.useState)(null),D=async e=>{if(window.confirm(`Delete cron "${e}"?`)){E(null);try{await m.deleteCron(e),h.success(`Cron deleted`,e),r()}catch(e){E(e.message),h.error(`Delete cron failed`,e.message)}}};return(0,A.jsxs)(`div`,{children:[t&&(0,A.jsx)(v,{onRetry:r}),(0,A.jsx)(p,{title:`Cron Manager`,description:`Schedule and manage repeatable jobs.`,live:!0}),T&&(0,A.jsx)(`div`,{role:`status`,className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-danger`,children:T}),(0,A.jsxs)(s,{className:`mb-6`,children:[(0,A.jsx)(a,{title:`Create schedule`}),(0,A.jsx)(N,{onCreate:async e=>{await m.createCron(e),h.success(`Cron created`,e.name),r()}})]}),n&&!e&&!t?(0,A.jsx)(d,{label:`Loading crons…`}):_.length===0?(0,A.jsx)(g,{icon:(0,A.jsx)(o,{}),title:`No scheduled jobs`,hint:`Create one above.`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,A.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Name`}),(0,A.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Queue`}),(0,A.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Schedule`}),(0,A.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Next Run`}),(0,A.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Runs`}),(0,A.jsx)(`th`,{scope:`col`,className:`w-12 px-5 py-3`})]})}),(0,A.jsx)(`tbody`,{children:_.slice(S*15,S*15+15).map(e=>(0,A.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,A.jsx)(`td`,{className:`px-5 py-3 font-medium text-fg`,children:e.name}),(0,A.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queue}),(0,A.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.schedule??(e.repeatEvery?`every ${e.repeatEvery}ms`:`—`)}),(0,A.jsx)(`td`,{className:`px-5 py-3 text-faint`,children:u(e.nextRun)}),(0,A.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:f(e.executions)}),(0,A.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,A.jsx)(c,{"aria-label":`Delete cron`,onClick:()=>D(e.name),children:(0,A.jsx)(l,{className:`size-3.5`})})})]},e.name))})]})}),(0,A.jsx)(C,{page:S,pageSize:15,total:_.length,onPageChange:b,label:`crons`})]})]})}function M(e){let t=Number(e);if(!Number.isInteger(t)||t<=0)return null;if(t<1e3)return`every ${t}ms`;for(let[e,n]of[[864e5,`d`],[36e5,`h`],[6e4,`m`],[1e3,`s`]])if(t>=e){let r=t/e;return`${Number.isInteger(r)?``:`≈ `}every ${Math.round(r*10)/10}${n}`}return null}function N({onCreate:e}){let[n,r]=(0,w.useState)(``),[i,a]=(0,w.useState)(``),[o,s]=(0,w.useState)(`cron`),[c,l]=(0,w.useState)(``),[d,f]=(0,w.useState)(``),[p,m]=(0,w.useState)(`{}`),[h,g]=(0,w.useState)(!1),[v,C]=(0,w.useState)(``),[T,E]=(0,w.useState)(``),[D,O]=(0,w.useState)(!1),[j,N]=(0,w.useState)(!1),[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(!1),[R,z]=(0,w.useState)(!1),[B,V]=(0,w.useState)(``),[H,U]=(0,w.useState)(``),[W,G]=(0,w.useState)(``),[K,q]=(0,w.useState)(null),[J,Y]=(0,w.useState)(!1),[X,Z]=(0,w.useState)(!1),Q=(0,w.useMemo)(()=>o!==`cron`||!c.trim()?null:k(c.trim(),3,Date.now()),[o,c]),$=async()=>{if(J)return;if(q(null),Z(!1),!n.trim()||!i.trim()){q(`Name and queue are required`);return}let t={};try{t=p.trim()?JSON.parse(p):{}}catch{q(`Data is not valid JSON`);return}let a={name:n,queue:i,data:t};if(o===`cron`){if(!c.trim()){q(`Cron expression required`);return}if(Q&&!Q.valid){q(Q.error??`Invalid cron expression`);return}a.schedule=c.trim()}else{let e=Number(d);if(!Number.isInteger(e)||e<=0){q(`Interval must be a whole number of milliseconds greater than 0`);return}a.repeatEvery=e}v.trim()&&(a.timezone=v.trim());let s=Number(T);T.trim()!==``&&Number.isFinite(s)&&(a.priority=s),D&&(a.preventOverlap=!0),j&&(a.skipIfNoWorker=!0);let u=Number(P);P.trim()!==``&&Number.isInteger(u)&&u>0&&(a.maxLimit=u),I&&(a.immediately=!0),R&&(a.skipMissedOnRestart=!0);let m={},h=Number(B);B.trim()!==``&&Number.isFinite(h)&&(m.maxAttempts=h);let g=Number(H);H.trim()!==``&&Number.isFinite(g)&&(m.backoff=g);let _=Number(W);W.trim()!==``&&Number.isFinite(_)&&(m.timeout=_),Object.keys(m).length>0&&(a.jobOptions=m),Y(!0);try{await e(a),r(``),l(``),f(``),Z(!0),setTimeout(()=>Z(!1),3e3)}catch(e){q(e.message)}finally{Y(!1)}};return(0,A.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),$()},children:[(0,A.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,A.jsx)(S,{label:`Name`,children:(0,A.jsx)(b,{value:n,onChange:e=>r(e.target.value),placeholder:`daily-report`})}),(0,A.jsx)(S,{label:`Queue`,children:(0,A.jsx)(b,{value:i,onChange:e=>a(e.target.value),placeholder:`reports`})})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,A.jsx)(y,{options:[`cron`,`every`],value:o,onChange:s}),o===`cron`?(0,A.jsx)(`div`,{className:`min-w-56 flex-1`,children:(0,A.jsx)(S,{label:`Cron expression`,children:(0,A.jsx)(b,{value:c,onChange:e=>l(e.target.value),placeholder:`0 9 * * *`})})}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`w-40`,children:(0,A.jsx)(S,{label:`Every (ms)`,children:(0,A.jsx)(b,{type:`number`,value:d,onChange:e=>f(e.target.value),placeholder:`30000`})})}),d.trim()!==``&&(0,A.jsx)(`span`,{className:t(`pb-2 text-xs`,M(d)?`text-muted`:`text-danger`),children:M(d)??`not a valid interval`})]})]}),o===`cron`&&c.trim()&&Q&&(0,A.jsx)(`div`,{className:`rounded-lg border border-line bg-surface-2 px-3 py-2 text-xs`,children:Q.valid?Q.runs.length?(0,A.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,A.jsxs)(`span`,{className:`text-faint`,children:[`Next runs`,v.trim()?` (local)`:``,`:`]}),Q.runs.map(e=>(0,A.jsx)(`span`,{className:`font-mono text-muted`,children:u(e)},e)),v.trim()&&(0,A.jsxs)(`span`,{className:`text-faint`,children:[`— server evaluates in `,v.trim()]})]}):(0,A.jsx)(`span`,{className:`text-warning`,children:`Valid, but no runs in the next few years.`}):(0,A.jsx)(`span`,{className:`text-danger`,children:Q.error})}),(0,A.jsx)(S,{label:`Data (JSON)`,children:(0,A.jsx)(`textarea`,{value:p,onChange:e=>m(e.target.value),rows:3,spellCheck:!1,className:`w-full rounded-lg border border-line bg-surface-2 px-3 py-2 font-mono text-sm text-fg placeholder:text-faint transition-colors focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})}),(0,A.jsxs)(`div`,{children:[(0,A.jsx)(`button`,{type:`button`,onClick:()=>g(e=>!e),className:`text-xs font-medium text-muted hover:text-fg`,children:h?`− Hide advanced`:`+ Advanced options`}),h&&(0,A.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[(0,A.jsx)(S,{label:`Timezone (IANA)`,hint:`e.g. Europe/Rome. Default: server timezone.`,children:(0,A.jsx)(b,{value:v,onChange:e=>C(e.target.value),placeholder:`Europe/Rome`})}),(0,A.jsx)(S,{label:`Priority`,children:(0,A.jsx)(b,{type:`number`,value:T,onChange:e=>E(e.target.value),placeholder:`0`})}),(0,A.jsx)(S,{label:`Max executions`,hint:`blank = unlimited`,children:(0,A.jsx)(b,{type:`number`,min:1,value:P,onChange:e=>F(e.target.value),placeholder:`∞`})}),(0,A.jsxs)(`div`,{className:`col-span-2 flex flex-wrap gap-6`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(x,{checked:D,onChange:O,label:`prevent overlap`}),(0,A.jsx)(`span`,{className:`text-sm text-muted`,children:`prevent overlap`})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(x,{checked:j,onChange:N,label:`skip if no worker`}),(0,A.jsx)(`span`,{className:`text-sm text-muted`,children:`skip if no worker`})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(x,{checked:I,onChange:L,label:`run immediately`}),(0,A.jsx)(`span`,{className:`text-sm text-muted`,children:`run immediately`})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsx)(x,{checked:R,onChange:z,label:`skip missed on restart`}),(0,A.jsx)(`span`,{className:`text-sm text-muted`,children:`skip missed on restart`})]})]}),(0,A.jsxs)(`div`,{className:`col-span-2`,children:[(0,A.jsx)(`div`,{className:`mb-2 text-[11px] uppercase tracking-wider text-faint`,children:`Spawned-job options`}),(0,A.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,A.jsx)(S,{label:`Max attempts`,children:(0,A.jsx)(b,{type:`number`,min:1,value:B,onChange:e=>V(e.target.value),placeholder:`3`})}),(0,A.jsx)(S,{label:`Backoff (ms)`,children:(0,A.jsx)(b,{type:`number`,min:0,value:H,onChange:e=>U(e.target.value),placeholder:`1000`})}),(0,A.jsx)(S,{label:`Timeout (ms)`,children:(0,A.jsx)(b,{type:`number`,min:0,value:W,onChange:e=>G(e.target.value),placeholder:`—`})})]})]})]})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(_,{type:`submit`,variant:`accent`,size:`sm`,disabled:J,children:J?`Creating…`:`Create`}),K&&(0,A.jsx)(`span`,{role:`status`,className:`text-xs text-danger`,children:K}),X&&(0,A.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Cron created ✓`})]})]})}export{j as CronManager};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{A as r,R as i,b as a,c as o,h as s,j as c,m as l,u,v as d,w as f,x as p}from"./index-BjRjwWwc.js";import{a as m}from"./form-C-zZyKfB.js";import{t as h}from"./Pagination-BQg6KGW1.js";var g=e(t(),1),_=n(),v=25;function y(){let[e,t]=(0,g.useState)(``),[n,y]=(0,g.useState)(0),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(null),{data:w}=r(()=>c.queues(500),[],{intervalMs:3e4});(0,g.useEffect)(()=>{e||!w?.queues?.length||t((w.queues.find(e=>e.dlq>0)??w.queues[0]).name)},[w,e]);let{data:T,error:E,loading:D,refetch:O}=r((0,g.useCallback)(async()=>{if(!e)return{entries:[],total:0};let t=await c.dlq(e,v,n*v);return{entries:t.entries??[],total:t.total??t.entries?.length??0}},[e,n]),[e,n]),k=async(t,n)=>{if(window.confirm(`${t} the dead letter queue for "${e}"?`)){x(!0),C(null);try{await n(),C(`${t} done`),O()}catch(e){C(e.message)}finally{x(!1)}}},A=T?.entries??[];return(0,_.jsxs)(`div`,{children:[E&&(0,_.jsx)(p,{onRetry:O}),(0,_.jsx)(s,{title:`Dead Letter Queue`,description:`Jobs that exhausted their retries.`,live:!0,actions:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(f,{size:`sm`,disabled:!e||b,onClick:()=>k(`Retry`,()=>c.retryDlq(e)),children:`Retry all`}),(0,_.jsx)(f,{variant:`danger`,size:`sm`,disabled:!e||b,onClick:()=>k(`Purge`,()=>c.purgeDlq(e)),children:`Purge`})]})}),(0,_.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`w-56`,children:(0,_.jsx)(m,{value:e,onChange:e=>{t(e.target.value),y(0)},children:(w?.queues??[]).map(e=>(0,_.jsxs)(`option`,{value:e.name,children:[e.name,` `,e.dlq?`(${e.dlq})`:``]},e.name))})}),(0,_.jsx)(`div`,{className:`w-40`,children:(0,_.jsx)(l,{label:`DLQ Entries`,value:o(T?.total),tone:T?.total?`red`:`default`,compact:!0})}),S&&(0,_.jsx)(`span`,{className:`text-xs text-muted`,children:S})]}),D&&!T&&!E?(0,_.jsx)(a,{label:`Loading DLQ…`}):A.length===0?(0,_.jsx)(d,{icon:(0,_.jsx)(i,{}),title:`Dead letter queue is empty`,hint:`Jobs land here after exhausting their retry attempts.`}):(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Reason`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Attempts`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`})]})}),(0,_.jsx)(`tbody`,{children:A.map((e,t)=>(0,_.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,_.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.jobId??e.id}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-fg`,children:e.name||`unknown`}),(0,_.jsx)(`td`,{className:`max-w-md px-5 py-3 text-xs text-red-400/90`,children:String(e.reason||e.error||`—`)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:Array.isArray(e.attempts)?e.attempts.length:e.attempts??`—`}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:u(e.failedAt??e.enteredAt)})]},e.jobId??e.id??t))})]})}),T&&(0,_.jsx)(h,{page:n,pageSize:v,total:T.total,onPageChange:y,label:`entries`})]})}export{y as Dlq};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,r,t as i}from"./react-vendor-B68RYDeC.js";import{A as a,B as o,F as s,J as c,K as l,O as u,R as d,T as f,a as p,b as m,c as h,h as g,m as _,nt as v,o as y,rt as b,u as x,v as S,w as C,x as w,z as T}from"./index-BjRjwWwc.js";import{a as E}from"./form-C-zZyKfB.js";import{t as D}from"./Pagination-BQg6KGW1.js";import{t as O}from"./exportFile-tdUeW5m5.js";var k=e(n(),1),A=i(),j=25,M=e=>`${e.job.id}-${e.enteredAt}`;function N(){let[e,t]=(0,k.useState)(``),[n,r]=(0,k.useState)(0),[i,o]=(0,k.useState)(`all`),[s,u]=(0,k.useState)(``),[f,p]=(0,k.useState)(new Set),[y,N]=(0,k.useState)(!1),[F,I]=(0,k.useState)(null),{data:L}=a(()=>v.queues(),[],{intervalMs:3e4});(0,k.useEffect)(()=>{e||!L?.queues?.length||t((L.queues.find(e=>e.dlq>0)??L.queues[0]).name)},[L,e]);let{data:R,error:z,loading:B,refetch:V}=a((0,k.useCallback)(async()=>{if(!e)return{queue:e,page:n,entries:[],total:0,stats:null};let[t,r]=await Promise.all([v.dlq(e,j,n*j),v.dlqStats(e).catch(()=>null)]);return{queue:e,page:n,entries:t.entries??[],total:t.total??0,stats:r?.stats??null}},[e,n]),[e,n]),H=R&&R.queue===e&&R.page===n?R:null;(0,k.useEffect)(()=>{if(!H)return;let e=Math.max(0,Math.ceil((H.total??0)/j)-1);n>e&&r(e)},[H,n]),(0,k.useEffect)(()=>{p(new Set)},[e,n]);let U=async(t,n,r)=>{if(!(r&&!window.confirm(r))){N(!0),I(null);try{let r=(await n())?.count??0,i=`${t} ${h(r)} ${r===1?`entry`:`entries`}`;I({ok:!0,text:i}),b.success(i,e),V()}catch(e){let n=e.message;I({ok:!1,text:n}),b.error(`${t.replace(/ed$/,``)} failed`,n)}finally{N(!1)}}},W=H?.stats?.byReason??{},G=(0,k.useMemo)(()=>Object.keys(W).filter(e=>W[e]>0),[W]),K=(0,k.useMemo)(()=>[...G].sort((e,t)=>(W[t]??0)-(W[e]??0))[0],[G,W]),q=H?.entries??[],J=(0,k.useMemo)(()=>{let e=q;i!==`all`&&(e=e.filter(e=>e.reason===i));let t=s.trim().toLowerCase();return t&&(e=e.filter(e=>e.job.id.toLowerCase().includes(t))),[...e].sort((e,t)=>t.enteredAt-e.enteredAt)},[q,i,s]),Y=i!==`all`||s.trim()!==``,X=(H?.total??0)>j,Z=e=>p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(g,{title:`DLQ Control`,description:`Inspect, triage, and replay one queue's dead-lettered jobs.`,live:!0,actions:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(C,{size:`sm`,disabled:!e||!J.length,onClick:()=>{if(J.length===0){b.info(`Nothing to export`);return}O(`dlq-${e}`,J.map(e=>({jobId:e.job.id,reason:e.reason,error:e.error??``,attempts:e.job.attempts??e.attempts?.length??``,enteredAt:new Date(e.enteredAt).toISOString()})),[`jobId`,`reason`,`error`,`attempts`,`enteredAt`])},children:[(0,A.jsx)(T,{className:`size-3.5`}),` Export`]}),(0,A.jsxs)(C,{size:`sm`,disabled:!e||y||!H?.total,onClick:()=>U(`Retried`,()=>v.retryDlq(e),`Retry all ${H?.total??0} DLQ entries for "${e}"?`),children:[(0,A.jsx)(l,{className:`size-3.5`}),` Retry all`]}),(0,A.jsx)(C,{variant:`danger`,size:`sm`,disabled:!e||y||!H?.total,onClick:()=>{let t=window.prompt(`Purge all ${H?.total??0} DLQ entries for "${e}"? This cannot be undone.\n\nType the queue name to confirm:`);if(t!=null){if(t.trim()!==e){I({ok:!1,text:`Purge cancelled — queue name did not match.`});return}U(`Purged`,()=>v.purgeDlq(e))}},children:`Purge`})]})}),z&&(0,A.jsx)(w,{onRetry:V}),(0,A.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,A.jsx)(_,{label:`Entries`,value:h(H?.total),tone:H?.total?`red`:`green`,hint:H?.total?K?`top: ${K}`:void 0:`queue is clean`,compact:!0}),(0,A.jsx)(_,{label:`Failure types`,value:H?.stats?h(G.length):`—`,hint:`distinct reasons`,compact:!0}),(0,A.jsx)(_,{label:`Pending retry`,value:H?.stats?h(H.stats.pendingRetry??0):`—`,tone:H?.stats?.pendingRetry?`amber`:`default`,hint:`auto-retry queued`,compact:!0}),(0,A.jsx)(_,{label:`Oldest entry`,value:H?.stats?.oldestEntry?x(H.stats.oldestEntry):`—`,hint:`time in DLQ`,compact:!0})]}),(0,A.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,A.jsx)(`div`,{className:`w-56`,children:(0,A.jsx)(E,{value:e,"aria-label":`Queue`,onChange:e=>{t(e.target.value),r(0),o(`all`),u(``),I(null)},children:(L?.queues??[]).map(e=>(0,A.jsxs)(`option`,{value:e.name,children:[e.name,` `,e.dlq?`(${e.dlq})`:``]},e.name))})}),(0,A.jsx)(`div`,{className:`w-44`,children:(0,A.jsxs)(E,{value:i,"aria-label":`Filter by reason`,onChange:e=>o(e.target.value),children:[(0,A.jsx)(`option`,{value:`all`,children:`All reasons`}),G.map(e=>(0,A.jsxs)(`option`,{value:e,children:[e,` (`,W[e],`)`]},e))]})}),(0,A.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,A.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,A.jsx)(`input`,{value:s,onChange:e=>u(e.target.value),placeholder:X?`Filter this page by job ID…`:`Filter by job ID…`,"aria-label":`Filter by job ID`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),F&&(0,A.jsx)(`span`,{role:`status`,className:F.ok?`text-sm text-success`:`text-sm text-danger`,children:F.text})]}),B&&!H&&!z?(0,A.jsx)(m,{label:`Loading DLQ…`}):J.length===0?(0,A.jsx)(S,{icon:(0,A.jsx)(d,{}),title:Y?`No matches`:`Dead letter queue is empty`,hint:Y?X?`No entries on this page match your filter — filters are page-scoped. Try another page or clear them.`:`No entries match your filter. Clear it to see all entries.`:`Failed jobs that exhaust their retries land here.`}):(0,A.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,A.jsx)(`th`,{className:`w-8 py-3 pl-4`}),(0,A.jsx)(`th`,{className:`px-3 py-3 font-medium`,children:`Job ID`}),(0,A.jsx)(`th`,{className:`px-3 py-3 font-medium`,children:`Reason`}),(0,A.jsx)(`th`,{className:`px-3 py-3 font-medium`,children:`Error`}),(0,A.jsx)(`th`,{className:`px-3 py-3 text-right font-medium`,children:`Attempts`}),(0,A.jsx)(`th`,{className:`px-3 py-3 text-right font-medium`,children:`Entered`}),(0,A.jsx)(`th`,{className:`w-20 px-4 py-3`})]})}),(0,A.jsx)(`tbody`,{children:J.map(t=>{let n=M(t);return(0,A.jsx)(P,{entry:t,isOpen:f.has(n),busy:y,onToggle:()=>Z(n),onRetry:()=>U(`Retried`,()=>v.retryDlq(e,t.job.id),`Retry job ${t.job.id.slice(0,8)}… from "${e}"?`),attempts:t.attempts??[]},n)})})]})}),H&&(0,A.jsx)(D,{page:n,pageSize:j,total:H.total,onPageChange:r,label:`entries`})]})}function P({entry:e,isOpen:n,busy:i,onToggle:a,onRetry:c,attempts:d}){let m=e;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`tr`,{className:`border-b border-line align-top last:border-0 hover:bg-surface-2/40`,children:[(0,A.jsx)(`td`,{className:`py-3 pl-4`,children:(0,A.jsx)(f,{"aria-label":n?`Collapse details`:`Expand details`,"aria-expanded":n,onClick:a,children:(0,A.jsx)(s,{className:t(`size-3.5 transition-transform`,n&&`rotate-90`)})})}),(0,A.jsx)(`td`,{className:`px-3 py-3`,children:(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(r,{to:`/job?id=${encodeURIComponent(m.job.id)}`,className:`max-w-[14rem] truncate font-mono text-xs text-accent hover:underline`,title:m.job.id,children:m.job.id}),(0,A.jsx)(u,{value:m.job.id})]})}),(0,A.jsx)(`td`,{className:`px-3 py-3`,children:(0,A.jsx)(`span`,{className:`inline-block rounded-md bg-red-500/10 px-2 py-0.5 text-xs text-danger`,children:m.reason})}),(0,A.jsx)(`td`,{className:`px-3 py-3`,children:(0,A.jsx)(`span`,{className:`block max-w-md truncate text-xs text-danger/80`,title:m.error??``,children:m.error||`—`})}),(0,A.jsx)(`td`,{className:`px-3 py-3 text-right tnum text-muted`,children:m.job.attempts??d.length}),(0,A.jsx)(`td`,{className:`px-3 py-3 text-right text-faint`,title:p(m.enteredAt),children:x(m.enteredAt)}),(0,A.jsx)(`td`,{className:`px-4 py-3`,children:(0,A.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,A.jsx)(r,{to:`/job?id=${encodeURIComponent(m.job.id)}`,children:(0,A.jsx)(f,{"aria-label":`Inspect job`,children:(0,A.jsx)(o,{className:`size-3.5`})})}),(0,A.jsx)(f,{"aria-label":`Retry job`,disabled:i,onClick:c,children:(0,A.jsx)(l,{className:`size-3.5`})})]})})]}),n&&(0,A.jsxs)(`tr`,{className:`border-b border-line bg-surface-2/30 last:border-0`,children:[(0,A.jsx)(`td`,{}),(0,A.jsxs)(`td`,{colSpan:6,className:`px-3 pb-4 pt-1`,children:[m.error&&(0,A.jsxs)(`div`,{className:`mb-3`,children:[(0,A.jsx)(`div`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Error`}),(0,A.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap rounded-lg bg-surface p-3 font-mono text-xs text-danger/90`,children:m.error})]}),(0,A.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[11px] font-medium uppercase tracking-wider text-faint`,children:[`Failure history`,typeof m.retryCount==`number`&&m.retryCount>0&&(0,A.jsxs)(`span`,{className:`rounded-full bg-surface px-2 py-0.5 text-[10px] normal-case text-muted`,children:[`retried `,m.retryCount,`×`]})]}),d.length===0?(0,A.jsx)(`p`,{className:`text-xs text-faint`,children:`No per-attempt history recorded.`}):(0,A.jsx)(`ol`,{className:`space-y-1.5`,children:d.map(e=>(0,A.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-0.5 rounded-lg border border-line bg-surface px-3 py-2 text-xs`,children:[(0,A.jsxs)(`span`,{className:`font-medium text-fg`,children:[`Attempt `,e.attempt]}),(0,A.jsx)(`span`,{className:`text-faint`,title:p(e.failedAt),children:x(e.failedAt)}),e.duration!=null&&(0,A.jsx)(`span`,{className:`tnum text-muted`,children:y(e.duration)}),e.reason&&(0,A.jsx)(`span`,{className:`rounded bg-red-500/10 px-1.5 text-danger`,children:e.reason}),e.error&&(0,A.jsx)(`span`,{className:`w-full truncate text-danger/70`,children:e.error})]},`${e.attempt}-${e.failedAt}`))})]})]})]})}export{N as DlqControl};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{f as t,h as n,r,t as i}from"./react-vendor-B68RYDeC.js";import{C as a,J as o,O as s,S as c,T as l,a as u,b as d,et as f,g as p,h as m,nt as h,o as g,v as _,w as v,z as y}from"./index-BjRjwWwc.js";import{a as b,n as x}from"./form-C-zZyKfB.js";import{n as S}from"./exportFile-tdUeW5m5.js";import{t as C}from"./jobActions-CuOdMglt.js";var w=e(n(),1);function T(e){let t={};return typeof e.priority==`number`&&(t.priority=e.priority),typeof e.maxAttempts==`number`&&(t.maxAttempts=e.maxAttempts),typeof e.backoff==`number`&&(t.backoff=e.backoff),typeof e.timeout==`number`&&(t.timeout=e.timeout),typeof e.removeOnComplete==`boolean`&&(t.removeOnComplete=e.removeOnComplete),typeof e.removeOnFail==`boolean`&&(t.removeOnFail=e.removeOnFail),{clone:{queue:e.queue??``,dataText:JSON.stringify(e.data??{},null,2),options:t}}}var E=i();function ee({job:e,busy:t,act:n}){let r=C(e.state),i=r.cancel||r.discard||r.promote||r.retryActive||r.retryDlq||r.requeueCompleted||r.setPriority||r.setDelay||r.fail||r.moveToDelayed;return(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Actions`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.promote&&(0,E.jsx)(v,{size:`sm`,disabled:t,onClick:()=>n(`Promote`,()=>h.promoteJob(e.id)),children:`Promote (run now)`}),r.retryActive&&(0,E.jsx)(v,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>h.retryJob(e.id)),children:`Retry (move to waiting)`}),r.retryDlq&&(0,E.jsx)(v,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>h.retryDlq(e.queue??``,e.id)),children:`Retry from DLQ`}),r.requeueCompleted&&(0,E.jsx)(v,{size:`sm`,disabled:t,onClick:()=>n(`Requeue`,()=>h.retryCompleted(e.queue??``,e.id)),children:`Requeue`}),r.moveToDelayed&&(0,E.jsx)(D,{label:`Move to delayed (ms)`,cta:`To delayed`,disabled:t,onSubmit:t=>n(`Move to delayed`,()=>h.moveToDelayed(e.id,t))}),e.state===`active`&&(0,E.jsx)(D,{label:`Set progress (0–100)`,cta:`Progress`,disabled:t,onSubmit:t=>n(`Progress`,()=>h.setJobProgress(e.id,Math.max(0,Math.min(100,t))))}),r.discard&&(0,E.jsx)(v,{size:`sm`,disabled:t,onClick:()=>n(`Discard`,()=>h.discardJob(e.id)),children:`Discard (to DLQ)`}),r.setPriority&&(0,E.jsx)(D,{label:`Set priority`,cta:`Set`,disabled:t,onSubmit:t=>n(`Priority`,()=>h.changePriority(e.id,t))}),r.setDelay&&(0,E.jsx)(D,{label:`Set delay (ms)`,cta:`Delay`,disabled:t,onSubmit:t=>n(`Delay`,()=>h.changeDelay(e.id,t))}),r.fail&&(0,E.jsx)(O,{label:`Fail reason (optional)`,cta:`Fail`,variant:`warning`,disabled:t,onSubmit:t=>n(`Fail`,()=>h.failJob(e.id,t||void 0),`Force-fail this active job?`)}),r.cancel&&(0,E.jsx)(v,{variant:`danger`,size:`sm`,disabled:t,onClick:()=>n(`Cancel`,()=>h.cancelJob(e.id),`Cancel and remove job ${e.id}?`),children:`Cancel (delete)`}),!i&&(0,E.jsxs)(`p`,{className:`text-xs text-faint`,children:[`No actions available for a job in state "`,e.state??`unknown`,`".`]})]})]})}function D({label:e,cta:t,disabled:n,onSubmit:r}){let[i,a]=(0,w.useState)(``);return(0,E.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),!n&&i.trim()!==``&&r(Number(i))},children:[(0,E.jsx)(x,{type:`number`,value:i,onChange:e=>a(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(v,{type:`submit`,size:`sm`,disabled:n||i.trim()===``,children:t})]})}function O({label:e,cta:t,disabled:n,variant:r=`default`,onSubmit:i}){let[a,o]=(0,w.useState)(``);return(0,E.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),!n&&(i(a),o(``))},children:[(0,E.jsx)(x,{value:a,onChange:e=>o(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(v,{type:`submit`,size:`sm`,variant:r,disabled:n,children:t})]})}var k=36e5,A=10;function j(e){let t=e.maxAttempts??0,n=e.attempts??0,r=e.backoffConfig,i=r?.maxDelay??k,a=r?.delay??e.backoff??1e3,o=[];for(let e=n;e<t&&o.length<A;e++){let t=r?.type===`fixed`?a:a*2**e;o.push({attempt:e+1,delayMs:Math.min(t,i)})}return o}function M({job:e}){let t=e.maxAttempts??0,n=e.attempts??0;if(t<=1)return(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Backoff`}),(0,E.jsxs)(`p`,{className:`text-xs text-faint`,children:[`No retries configured (max attempts = `,t||1,`).`]})]});if(n>=t)return(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Backoff schedule`}),(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`Max attempts reached — no further retries will be scheduled.`})]});let r=e.backoffConfig,i=r?r.type:`exponential (default)`,o=t-n,s=j(e);return(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Backoff schedule`,action:(0,E.jsxs)(`span`,{className:`text-xs capitalize text-faint`,children:[i,r?.maxDelay?` · cap ${g(r.maxDelay)}`:``]})}),(0,E.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:s.map(e=>(0,E.jsxs)(`li`,{className:`flex items-center justify-between text-sm`,children:[(0,E.jsxs)(`span`,{className:`text-muted`,children:[`Attempt `,e.attempt,` / `,t]}),(0,E.jsxs)(`span`,{className:`font-mono text-xs text-fg`,children:[`~`,g(e.delayMs)]})]},e.attempt))}),o>A&&(0,E.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Showing next `,A,` of `,o,` remaining attempts.`]}),(0,E.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Approximate — the server applies ±`,r?.type===`fixed`?`20`:`50`,`% jitter at retry time, capped at `,g(r?.maxDelay??k),`.`]})]})}function N({jobId:e}){let[t,n]=(0,w.useState)(!1),[r,i]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[l,u]=(0,w.useState)(void 0),[d,f]=(0,w.useState)(null),p=async()=>{s(!0),f(null);try{u((await h.jobChildren(e)).data?.values),i(!0)}catch(e){f(e.message)}finally{s(!1)}},m=()=>{let e=!t;n(e),e&&!r&&!o&&p()},g=l&&typeof l==`object`?Array.isArray(l)?l.length:Object.keys(l).length:0;return(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Child values`,action:(0,E.jsx)(v,{size:`sm`,variant:`ghost`,onClick:m,children:t?`Hide`:`Show`})}),t?o?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`Loading child values…`}):d?(0,E.jsx)(`p`,{className:`text-xs text-danger`,children:d}):g===0?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No child values available.`}):(0,E.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:JSON.stringify(l,null,2)}):(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`Resolved return values from this flow job's children.`})]})}function P({data:e,busy:t,onSave:n}){let[r,i]=(0,w.useState)(()=>JSON.stringify(e??null,null,2)),[o,s]=(0,w.useState)(null),l=(0,w.useRef)(r);return(0,w.useEffect)(()=>{let t=JSON.stringify(e??null,null,2);t!==l.current&&(l.current=t,i(t),s(null))},[e]),(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Data`,action:(0,E.jsx)(v,{size:`sm`,disabled:t,onClick:()=>{let e;try{e=JSON.parse(r)}catch(e){s(`Invalid JSON: ${e.message}`);return}s(null),n(e)},children:`Save data`})}),(0,E.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),spellCheck:!1,rows:8,className:`w-full resize-y rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),o&&(0,E.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:o})]})}function F({jobId:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(0),[o,s]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(``),[p,m]=(0,w.useState)(`info`),[g,_]=(0,w.useState)(!1),y=(0,w.useCallback)(async()=>{s(!0),u(null);try{let t=await h.jobLogs(e);n(t.data?.logs??[]),i(t.data?.count??0)}catch(e){u(e.message)}finally{s(!1)}},[e]);(0,w.useEffect)(()=>{y()},[y]);let S=async()=>{if(g)return;let t=d.trim();if(t){_(!0),u(null);try{await h.addJobLog(e,t,p),f(``),await y()}catch(e){u(e.message)}finally{_(!1)}}};return(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Logs`,action:(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:r}),(0,E.jsx)(v,{size:`sm`,variant:`ghost`,disabled:o||g,onClick:y,children:`Refresh`}),(0,E.jsx)(v,{size:`sm`,variant:`danger`,disabled:g||t.length===0,onClick:async()=>{if(window.confirm(`Clear all logs for this job?`)){_(!0),u(null);try{await h.clearJobLogs(e),await y()}catch(e){u(e.message)}finally{_(!1)}}},children:`Clear logs`})]})}),l&&(0,E.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:l}),t.length===0?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No log lines recorded for this job.`}):(0,E.jsx)(`ol`,{className:`flex max-h-64 flex-col gap-1 overflow-auto rounded-lg bg-surface-2 p-3`,children:t.map((e,t)=>(0,E.jsx)(`li`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-muted`,children:typeof e==`string`?e:JSON.stringify(e)},t))}),(0,E.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,E.jsx)(x,{value:d,onChange:e=>f(e.target.value),onKeyDown:e=>e.key===`Enter`&&S(),placeholder:`Add a log line…`,className:`h-8 flex-1 text-xs`}),(0,E.jsxs)(b,{value:p,onChange:e=>m(e.target.value),className:`h-8 w-24 text-xs`,children:[(0,E.jsx)(`option`,{value:`info`,children:`info`}),(0,E.jsx)(`option`,{value:`warn`,children:`warn`}),(0,E.jsx)(`option`,{value:`error`,children:`error`})]}),(0,E.jsx)(v,{size:`sm`,disabled:g||d.trim()===``,onClick:S,children:`Add`})]})]})}function I({timeline:e}){let t=e??[];return(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Timeline`}),t.length===0?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No state transitions recorded yet.`}):(0,E.jsx)(`ol`,{className:`flex flex-col gap-0`,children:t.map((e,t)=>(0,E.jsxs)(`li`,{className:`border-b border-line/60 py-2 last:border-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(p,{status:e.state}),e.attempt!=null&&(0,E.jsxs)(`span`,{className:`font-mono text-[11px] text-faint`,children:[`attempt `,e.attempt]})]}),(0,E.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:u(e.timestamp)})]}),(e.worker||e.error)&&(0,E.jsxs)(`div`,{className:`mt-1 pl-0.5`,children:[e.worker&&(0,E.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.worker}),e.error&&(0,E.jsx)(`div`,{className:`mt-0.5 text-xs text-danger/90`,children:e.error})]})]},t))})]})}function te(e){let t=e.timeline??[];for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.state===`failed`&&n.error)return{message:n.error,attempt:n.attempt,timestamp:n.timestamp}}return null}function L(){let[e,n]=t(),[i,l]=(0,w.useState)(e.get(`id`)??``),[x,C]=(0,w.useState)(`id`),[D,O]=(0,w.useState)(null),[k,A]=(0,w.useState)({fetched:!1,value:void 0}),[j,L]=(0,w.useState)(!1),[ie,z]=(0,w.useState)(!1),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(!1),W=(0,w.useRef)(0),G=async(e,t=x,r=!1)=>{let i=e.trim();if(!i)return;let a=++W.current;L(!0),z(!1),r||V(null);try{let e=(await(t===`custom`?h.jobByCustomId(i):h.job(i))).job;if(!e){if(a!==W.current)return;O(null),A({fetched:!1,value:void 0}),z(!0),n({},{replace:!0});return}let r=e.state===`completed`?await h.jobResult(e.id).catch(()=>null):null;if(a!==W.current)return;O(e),l(t===`custom`?e.id:i),n({id:e.id},{replace:!0}),A(r?{fetched:!0,value:r.result}:{fetched:!1,value:void 0})}catch(e){if(a!==W.current)return;e instanceof f&&(e.status===404||/not found/i.test(e.message))?(O(null),A({fetched:!1,value:void 0}),z(!0),n({},{replace:!0})):V({ok:!1,text:e.message})}finally{a===W.current&&L(!1)}},K=e.get(`id`);(0,w.useEffect)(()=>{K&&K!==D?.id&&G(K,`id`)},[K,D?.id]);let q=async(e,t,r)=>{if(!(r&&!window.confirm(r))&&D){U(!0),V(null);try{await t(),V({ok:!0,text:`${e} ✓`}),e===`Cancel`?(O(null),A({fetched:!1,value:void 0}),n({},{replace:!0})):await G(D.id,`id`,!0)}catch(e){V({ok:!1,text:e.message})}finally{U(!1)}}},J=D?.state,Y=D?te(D):null,X=(D?.stacktrace?.length??0)>0,Z=(D?.childrenIds?.length??0)>0,Q=J===`failed`,$=D&&(Y||X)?(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Error`}),Y&&(0,E.jsxs)(`div`,{className:`mb-3`,children:[(0,E.jsx)(`p`,{className:`text-sm text-danger`,children:Y.message}),(0,E.jsxs)(`p`,{className:`mt-1 text-[11px] text-faint`,children:[Y.attempt==null?``:`Attempt ${Y.attempt} · `,u(Y.timestamp)]})]}),X&&(0,E.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap rounded-lg bg-surface-2 p-3 font-mono text-xs text-danger/90`,children:D.stacktrace?.join(`
|
|
2
|
-
`)})]}):null;return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(m,{title:`Job Inspector`,description:`Look up any job by ID and drive its full lifecycle.`,actions:D?(0,E.jsxs)(E.Fragment,{children:[(Z||D.parentId)&&(0,E.jsx)(r,{to:`/flows?root=${encodeURIComponent(D.id)}`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`View flow`}),(0,E.jsx)(r,{to:`/add-job`,state:T(D),title:`Enqueue a new job pre-filled from this one`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Clone`}),(0,E.jsxs)(v,{size:`sm`,onClick:()=>S(`job-${D.id}`,k.fetched?{...D,result:k.value}:D),children:[(0,E.jsx)(y,{className:`size-3.5`}),` Download JSON`]})]}):void 0}),(0,E.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-2`,children:[(0,E.jsxs)(b,{value:x,"aria-label":`Lookup mode`,onChange:e=>C(e.target.value),className:`w-40`,children:[(0,E.jsx)(`option`,{value:`id`,children:`By job ID`}),(0,E.jsx)(`option`,{value:`custom`,children:`By custom ID`})]}),(0,E.jsxs)(`div`,{className:`relative min-w-56 flex-1`,children:[(0,E.jsx)(o,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,E.jsx)(`input`,{value:i,"aria-label":x===`custom`?`Custom job ID`:`Job ID`,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&G(i),placeholder:x===`custom`?`custom / idempotency id — Enter to look up`:`job id (UUID) — Enter to look up`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 font-mono text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,E.jsx)(v,{variant:`accent`,disabled:j,onClick:()=>G(i),children:`Look up`})]}),B&&(0,E.jsx)(`div`,{role:`status`,className:B.ok?`mb-4 text-sm text-success`:`mb-4 text-sm text-danger`,children:B.text}),j&&!D?(0,E.jsx)(d,{label:`Loading job…`}):ie?(0,E.jsx)(_,{title:`Job not found`,hint:`Check the ID, or the job may have been removed.`}):D?(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-6 lg:col-span-2`,children:[(0,E.jsxs)(c,{children:[(0,E.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(`div`,{className:`truncate font-mono text-sm text-fg`,children:D.id}),(0,E.jsx)(s,{value:D.id})]}),(0,E.jsx)(`div`,{className:`mt-1 font-mono text-xs text-faint`,children:D.queue})]}),(0,E.jsx)(p,{status:J??`waiting`})]}),(0,E.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-2 text-sm sm:grid-cols-3`,children:[(0,E.jsx)(R,{k:`Priority`,v:String(D.priority??0)}),(0,E.jsx)(R,{k:`Attempts`,v:`${D.attempts??0} / ${D.maxAttempts??`?`}`}),(0,E.jsx)(R,{k:`Progress`,v:`${D.progress??0}%`}),(0,E.jsx)(R,{k:`Created`,v:u(D.createdAt)}),(0,E.jsx)(R,{k:`Started`,v:u(D.startedAt??void 0)}),(0,E.jsx)(R,{k:`Completed`,v:u(D.completedAt??void 0)}),(0,E.jsx)(R,{k:`Duration`,v:g(D.startedAt&&D.completedAt?D.completedAt-D.startedAt:void 0)}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`dt`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`Custom ID`}),(0,E.jsxs)(`dd`,{className:`flex items-center gap-1 text-fg`,children:[(0,E.jsx)(`span`,{className:`truncate font-mono`,children:D.customId??`—`}),D.customId&&(0,E.jsx)(s,{value:D.customId})]})]})]})]}),Q&&$,(0,E.jsx)(P,{data:D.data,busy:H,onSave:e=>q(`Data`,()=>h.updateJobData(D.id,e))}),J===`completed`&&(0,E.jsxs)(c,{children:[(0,E.jsx)(a,{title:`Result`,action:k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(re,{value:k.value,filename:`job-${D.id}-result`}):void 0}),k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(ne,{value:k.value}):(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No result stored for this job.`})]}),!Q&&$,(0,E.jsx)(F,{jobId:D.id},`logs-${D.id}`),Z&&(0,E.jsx)(N,{jobId:D.id},`children-${D.id}`),(0,E.jsx)(I,{timeline:D.timeline}),(0,E.jsx)(M,{job:D})]}),(0,E.jsx)(`div`,{className:`order-first lg:order-none`,children:(0,E.jsx)(ee,{job:D,busy:H,act:q})})]}):(0,E.jsx)(_,{title:`No job loaded`,hint:`Enter a job ID above to inspect it.`})]})}function R({k:e,v:t}){return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`dt`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:e}),(0,E.jsx)(`dd`,{className:`text-fg`,children:t})]})}function ne({value:e}){return(0,E.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:JSON.stringify(e??null,null,2)})}function re({value:e,filename:t}){return(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(s,{value:JSON.stringify(e??null,null,2)}),(0,E.jsx)(l,{"aria-label":`Download JSON`,title:`Download JSON`,onClick:()=>S(t,e??null),children:(0,E.jsx)(y,{className:`size-3.5`})})]})}export{L as JobInspector};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{f as t,h as n,t as r}from"./react-vendor-B68RYDeC.js";import{A as i,J as a,T as o,Y as s,b as c,c as l,f as u,g as d,h as f,j as p,l as m,m as h,n as g,o as _,u as v,x as y}from"./index-BjRjwWwc.js";import{a as b,i as x}from"./form-C-zZyKfB.js";var S=e(n(),1),C=r(),w=`__all__`,T=[`all`,`waiting`,`active`,`completed`,`failed`];function E(){let[e]=t(),[n,r]=(0,S.useState)(e.get(`queue`)??w),[E,D]=(0,S.useState)(`all`),[O,k]=(0,S.useState)(``),{data:A}=i(()=>p.queues(500),[]),{data:j}=i(()=>p.overview(),[]),{data:M,error:N,loading:P,refetch:F}=i((0,S.useCallback)(async()=>{let e=n===w?(A?.queues??[]).map(e=>e.name).slice(0,25):[n],t=E===`all`?void 0:[E];return(await Promise.all(e.map(e=>p.jobsList(e,{states:t,limit:40}).then(t=>(t.jobs??[]).map(t=>({...t,queue:t.queue??e}))).catch(()=>[])))).flat().sort((e,t)=>(t.createdAt??0)-(e.createdAt??0))},[n,E,A]),[n,E]),I=(0,S.useMemo)(()=>{let e=M??[],t=O.trim().toLowerCase();return(t?e.filter(e=>e.id.toLowerCase().includes(t)||(e.name??``).toLowerCase().includes(t)):e).slice(0,100)},[M,O]),L=j?.stats,R=L?g(L.totalCompleted,L.totalFailed)??0:0,z=async e=>{if(window.confirm(`Cancel job ${e}?`))try{await p.cancelJob(e),F()}catch{}};return(0,C.jsxs)(`div`,{children:[N&&(0,C.jsx)(y,{onRetry:F}),(0,C.jsx)(f,{title:`Jobs Explorer`,description:`Browse, inspect, and manage individual jobs.`,live:!0}),(0,C.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,C.jsx)(h,{label:`Total`,value:l((L?.totalCompleted??0)+(L?.totalFailed??0)+(L?.waiting??0)+(L?.active??0)),compact:!0}),(0,C.jsx)(h,{label:`Waiting`,value:l(L?.waiting),tone:`amber`,compact:!0}),(0,C.jsx)(h,{label:`Active`,value:l(L?.active),tone:`blue`,compact:!0}),(0,C.jsx)(h,{label:`Completed`,value:l(L?.totalCompleted),tone:`green`,compact:!0}),(0,C.jsx)(h,{label:`Failed`,value:l(L?.totalFailed),tone:L?.totalFailed?`red`:`default`,compact:!0}),(0,C.jsx)(h,{label:`Error Rate`,value:m(R),tone:R>.05?`red`:`green`,compact:!0})]}),(0,C.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,C.jsx)(`div`,{className:`w-48`,children:(0,C.jsxs)(b,{value:n,onChange:e=>r(e.target.value),children:[(0,C.jsx)(`option`,{value:w,children:`All Queues`}),(A?.queues??[]).map(e=>(0,C.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,C.jsx)(x,{options:T,value:E,onChange:D}),(0,C.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,C.jsx)(a,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,C.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:`Search by ID or name…`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),P&&!M&&!N?(0,C.jsx)(c,{label:`Loading jobs…`}):(0,C.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,C.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,C.jsx)(`thead`,{children:(0,C.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Priority`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Created`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,C.jsx)(`th`,{className:`w-12 px-5 py-3`})]})}),(0,C.jsx)(`tbody`,{children:I.length===0?(0,C.jsx)(`tr`,{children:(0,C.jsx)(`td`,{colSpan:8,className:`px-5 py-12 text-center text-sm text-faint`,children:`No jobs found.`})}):I.map(e=>(0,C.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,C.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent/90`,children:e.id}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-fg`,children:e.name||`unknown`}),(0,C.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queue}),(0,C.jsx)(`td`,{className:`px-5 py-3`,children:(0,C.jsx)(d,{status:String(e.state??e.status??`waiting`)})}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:e.priority??0}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:v(e.createdAt)}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:_(u(e.processedOn,e.finishedOn))}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,C.jsx)(o,{"aria-label":`Cancel job`,onClick:()=>z(e.id),children:(0,C.jsx)(s,{className:`size-3.5`})})})]},`${e.queue}:${e.id}`))})]})})]})}export{E as Jobs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{f as n,h as r,r as i,t as a}from"./react-vendor-B68RYDeC.js";import{A as o,B as s,I as ee,J as te,K as c,T as l,W as ne,Y as re,a as ie,b as u,c as ae,g as oe,h as se,l as d,m as f,n as ce,nt as p,o as le,rt as m,w as h,x as ue,z as de}from"./index-BjRjwWwc.js";import{a as fe,i as g}from"./form-C-zZyKfB.js";import{t as _}from"./Pagination-BQg6KGW1.js";import{t as pe}from"./exportFile-tdUeW5m5.js";import{t as v}from"./jobActions-CuOdMglt.js";var y=e(r(),1),b=a(),x=[`all`,`waiting`,`active`,`completed`,`failed`],S=25;function me(e=0){return e>=10?{t:`HIGH`,c:`text-warning`}:e>=1?{t:`MEDIUM`,c:`text-blue-400`}:{t:`LOW`,c:`text-faint`}}function C(e){let t=v(e.state);return t.retryActive?p.retryJob(e.id):t.retryDlq?p.retryDlq(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not retryable`))}function w(){let[e,r]=n(),[a,w]=(0,y.useState)(e.get(`queue`)??``),[T,he]=(0,y.useState)(()=>{let t=e.get(`status`);return t&&x.includes(t)?t:`all`}),[E,ge]=(0,y.useState)(``),[D,O]=(0,y.useState)(0),[k,A]=(0,y.useState)(new Set),[_e,j]=(0,y.useState)(new Set),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)(null),{data:I}=o(()=>p.queuesSummary(),[],{intervalMs:3e4}),{data:ve}=o(()=>p.overview(),[],{intervalMs:1e4});(0,y.useEffect)(()=>{!a&&I?.length&&w(I[0].name)},[I,a]);let L=`${a}|${T}|${D}`,{data:R,error:z,loading:ye,refetch:B}=o((0,y.useCallback)(async()=>{if(!a)return{view:L,jobs:[]};let e=T===`all`?void 0:[T];return{view:L,jobs:((await p.jobsList(a,e,S,D*S)).jobs??[]).map(e=>({...e,queue:e.queue??a}))}},[a,T,D,L]),[a,T,D]),V=R&&R.view===L?R.jobs:null,be=(V?.length??0)===S,H=(0,y.useMemo)(()=>{let e=E.trim().toLowerCase();return e?(V??[]).filter(t=>t.id.toLowerCase().includes(e)):V??[]},[V,E]),U=ve?.stats,W=(0,y.useMemo)(()=>(I??[]).reduce((e,t)=>e+(t.counts?.failed??0),0),[I]),G=U?ce(U.completed,W):null,K=e=>U?ae(e):`—`,q=()=>O(0),J=(e,t)=>{let n={};e&&(n.queue=e),t!==`all`&&(n.status=t),r(n,{replace:!0})};(0,y.useEffect)(()=>{A(new Set)},[a,T,D]);let xe=e=>A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Y=H.length>0&&H.every(e=>k.has(e.id)),Se=()=>A(()=>Y?new Set:new Set(H.map(e=>e.id))),X=async(e,t,n,r)=>{if(!(r&&!window.confirm(r))){j(t=>new Set(t).add(e.id)),F(null);try{await n(),F({ok:!0,text:`${t} ✓`}),m.success(`${t} ✓`,e.id)}catch(e){F({ok:!1,text:`${t} failed: ${e.message}`}),m.error(`${t} failed`,e.message)}finally{j(t=>{let n=new Set(t);return n.delete(e.id),n}),B()}}},Z=async(e,t,n)=>{let r=H.filter(e=>k.has(e.id));if(r.length===0||n&&!window.confirm(n(r.length)))return;N(!0),F(null);let i=await Promise.allSettled(r.map(t)),a=i.filter(e=>e.status===`fulfilled`).length,o=i.length-a,s=`${e}: ${a} succeeded${o?`, ${o} not eligible / failed`:``}`;F({ok:o===0,text:s}),o===0?m.success(s):m.error(s),A(new Set),N(!1),B()},Q=H.filter(e=>k.has(e.id)),$={retry:Q.some(e=>{let t=v(e.state);return t.retryActive||t.retryDlq}),promote:Q.some(e=>v(e.state).promote),requeue:Q.some(e=>v(e.state).requeueCompleted),fail:Q.some(e=>v(e.state).fail),cancel:Q.some(e=>v(e.state).cancel)};return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(se,{title:`Jobs Explorer`,description:`Browse, inspect, and manage individual jobs.`,live:!0,actions:(0,b.jsxs)(h,{size:`sm`,disabled:!V||H.length===0,onClick:()=>{if(H.length===0){m.info(`No jobs to export on this page`);return}let e=H.map(e=>({id:e.id,queue:e.queue??a,state:e.state??``,priority:e.priority??0,attempts:e.attempts??0,maxAttempts:e.maxAttempts??``,createdAt:e.createdAt?new Date(e.createdAt).toISOString():``,durationMs:e.startedAt&&e.completedAt?e.completedAt-e.startedAt:``}));pe(`jobs-${a}-${T}`,e,[`id`,`queue`,`state`,`priority`,`attempts`,`maxAttempts`,`createdAt`,`durationMs`])},children:[(0,b.jsx)(de,{className:`size-3.5`}),` Export CSV`]})}),(0,b.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,b.jsx)(f,{label:`Total`,value:K((U?.completed??0)+W+(U?.waiting??0)+(U?.active??0)+(U?.delayed??0)),hint:`all queues`,compact:!0}),(0,b.jsx)(f,{label:`Waiting`,value:K(U?.waiting),tone:`amber`,compact:!0}),(0,b.jsx)(f,{label:`Active`,value:K(U?.active),tone:`blue`,compact:!0}),(0,b.jsx)(f,{label:`Completed`,value:K(U?.completed),tone:`green`,compact:!0}),(0,b.jsx)(f,{label:`Failed`,value:K(W),tone:W?`red`:`default`,compact:!0}),(0,b.jsx)(f,{label:`Error Rate`,value:G==null?`—`:d(G),tone:G==null?`default`:G>.05?`red`:`green`,compact:!0})]}),(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,b.jsx)(`div`,{className:`w-48`,children:(0,b.jsx)(fe,{value:a,"aria-label":`Queue`,onChange:e=>{w(e.target.value),q(),J(e.target.value,T)},children:(I??[]).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),(0,b.jsx)(g,{options:x,value:T,onChange:e=>{he(e),q(),J(a,e)}}),(0,b.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,b.jsx)(te,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,b.jsx)(`input`,{value:E,onChange:e=>ge(e.target.value),placeholder:`Filter this page by ID…`,"aria-label":`Filter by job ID`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),k.size>0&&(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 rounded-lg border border-line bg-surface-2 px-4 py-2 text-sm`,children:[(0,b.jsxs)(`span`,{className:`mr-1 text-muted`,children:[k.size,` selected`]}),$.retry&&(0,b.jsx)(h,{size:`sm`,disabled:M,onClick:()=>Z(`Retry`,C),children:`Retry selected`}),$.promote&&(0,b.jsx)(h,{size:`sm`,disabled:M,onClick:()=>Z(`Promote`,e=>v(e.state).promote?p.promoteJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not delayed`))),children:`Promote selected`}),$.requeue&&(0,b.jsx)(h,{size:`sm`,disabled:M,onClick:()=>Z(`Requeue`,e=>v(e.state).requeueCompleted?p.retryCompleted(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not completed`))),children:`Requeue selected`}),$.fail&&(0,b.jsx)(h,{variant:`warning`,size:`sm`,disabled:M,onClick:()=>Z(`Fail`,e=>v(e.state).fail?p.failJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not active`)),e=>`Force-fail ${e} job(s)?`),children:`Fail selected`}),$.cancel&&(0,b.jsx)(h,{variant:`danger`,size:`sm`,disabled:M,onClick:()=>Z(`Cancel`,e=>v(e.state).cancel?p.cancelJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" cannot be cancelled`)),e=>`Cancel ${e} job(s)? This cannot be undone.`),children:`Cancel selected`}),!$.retry&&!$.promote&&!$.requeue&&!$.fail&&!$.cancel&&(0,b.jsx)(`span`,{className:`text-xs text-faint`,children:`No actions apply to the selected job states.`})]}),P&&(0,b.jsx)(`div`,{role:`status`,className:t(`mb-3 text-sm`,P.ok?`text-success`:`text-danger`),children:P.text}),z&&(0,b.jsx)(ue,{onRetry:B}),ye&&!V&&!z?(0,b.jsx)(u,{label:`Loading jobs…`}):(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`span`,{className:`text-faint`,children:`Jobs in queue`}),(0,b.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-0.5 font-mono text-xs text-fg`,children:a})]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,b.jsx)(`th`,{scope:`col`,className:`w-10 px-5 py-3`,children:(0,b.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:Se,"aria-label":`Select all jobs on page`,className:`accent-accent`})}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Status`}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Priority`}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Created`}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,b.jsx)(`th`,{scope:`col`,className:`w-28 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,b.jsx)(`tbody`,{children:H.length===0?(0,b.jsx)(`tr`,{children:(0,b.jsx)(`td`,{colSpan:7,className:`px-5 py-12 text-center text-sm text-faint`,children:E.trim()?`No jobs on this page match your ID filter.`:a?`No jobs found.`:`Select a queue.`})}):H.map(e=>{let n=me(e.priority),r=v(e.state),a=_e.has(e.id);return(0,b.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(`input`,{type:`checkbox`,checked:k.has(e.id),onChange:()=>xe(e.id),"aria-label":`Select job ${e.id}`,className:`accent-accent`})}),(0,b.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent/90`,children:(0,b.jsx)(`span`,{className:`block max-w-[16rem] truncate`,title:e.id,children:e.id})}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(oe,{status:String(e.state??`waiting`)})}),(0,b.jsx)(`td`,{className:t(`px-5 py-3 text-xs font-semibold`,n.c),children:n.t}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:ie(e.createdAt)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:le(e.startedAt&&e.completedAt?e.completedAt-e.startedAt:void 0)}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,b.jsx)(i,{to:`/job?id=${encodeURIComponent(e.id)}`,children:(0,b.jsx)(l,{"aria-label":`Inspect job`,children:(0,b.jsx)(s,{className:`size-3.5`})})}),r.promote&&(0,b.jsx)(l,{"aria-label":`Promote job`,disabled:a,onClick:()=>X(e,`Promote`,()=>p.promoteJob(e.id)),children:(0,b.jsx)(ne,{className:`size-3.5`})}),(r.retryActive||r.retryDlq)&&(0,b.jsx)(l,{"aria-label":`Retry job`,disabled:a,onClick:()=>X(e,`Retry`,()=>C(e)),children:(0,b.jsx)(c,{className:`size-3.5`})}),r.requeueCompleted&&(0,b.jsx)(l,{"aria-label":`Requeue job`,disabled:a,onClick:()=>X(e,`Requeue`,()=>p.retryCompleted(e.queue??``,e.id)),children:(0,b.jsx)(c,{className:`size-3.5`})}),r.fail&&(0,b.jsx)(l,{"aria-label":`Fail job`,disabled:a,onClick:()=>X(e,`Fail`,()=>p.failJob(e.id),`Force-fail this active job?`),children:(0,b.jsx)(ee,{className:`size-3.5`})}),r.cancel&&(0,b.jsx)(l,{"aria-label":`Cancel job`,disabled:a,onClick:()=>X(e,`Cancel`,()=>p.cancelJob(e.id),`Cancel this job?`),children:(0,b.jsx)(re,{className:`size-3.5`})})]})})]},e.id)})})]})}),(0,b.jsx)(_,{page:D,pageSize:S,hasNext:be,onPageChange:O,label:`jobs`})]})]})}export{w as JobsPro};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{A as r,H as i,J as a,c as o,g as s,h as c,j as l,m as u,t as d,u as f,v as p,x as m}from"./index-BjRjwWwc.js";import{a as h,i as g}from"./form-C-zZyKfB.js";import{t as _}from"./Pagination-BQg6KGW1.js";var v=e(t(),1),y=n(),b=`__all__`,x=[`all`,`waiting`,`active`,`completed`,`failed`],S=10;function C(){let[e,t]=(0,v.useState)(b),[n,C]=(0,v.useState)(`all`),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(0),{data:O}=r(()=>l.queues(500),[],{intervalMs:3e4}),{events:k,counters:A,throughput:j,connected:M}=d(e===b?void 0:e),N=(0,v.useMemo)(()=>{let e=w.trim().toLowerCase();return k.filter(t=>n!==`all`&&t.status!==n?!1:e?(t.jobId??``).toLowerCase().includes(e)||(t.name??``).toLowerCase().includes(e)||(t.queue??``).toLowerCase().includes(e):!0)},[k,n,w]);(0,v.useEffect)(()=>D(0),[e,n,w]);let P=Math.max(1,Math.ceil(N.length/S)),F=Math.min(E,P-1);return(0,y.jsxs)(`div`,{children:[!M&&k.length===0&&(0,y.jsx)(m,{}),(0,y.jsx)(c,{title:`Activity Logs`,description:`Real-time job activity across all queues.`,live:M}),(0,y.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,y.jsx)(u,{label:`Total Events`,value:o(A.total),compact:!0}),(0,y.jsx)(u,{label:`Completed`,value:o(A.completed),tone:`green`,compact:!0}),(0,y.jsx)(u,{label:`Failed`,value:o(A.failed),tone:A.failed?`red`:`default`,compact:!0}),(0,y.jsx)(u,{label:`Waiting`,value:o(A.waiting),tone:`amber`,compact:!0}),(0,y.jsx)(u,{label:`Active`,value:o(A.active),tone:`blue`,compact:!0}),(0,y.jsx)(u,{label:`Throughput`,value:`${j.toFixed(1)}/s`,tone:`accent`,compact:!0})]}),(0,y.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`w-48`,children:(0,y.jsxs)(h,{value:e,onChange:e=>t(e.target.value),children:[(0,y.jsx)(`option`,{value:b,children:`All Queues`}),(O?.queues??[]).map(e=>(0,y.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,y.jsx)(g,{options:x,value:n,onChange:C}),(0,y.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,y.jsx)(a,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,y.jsx)(`input`,{value:w,onChange:e=>T(e.target.value),placeholder:`Search by job name or ID…`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),N.length===0?(0,y.jsx)(p,{icon:(0,y.jsx)(i,{}),title:M?`Waiting for activity…`:`Connecting to the event stream…`,hint:`Job events stream in here live as they happen on the server.`}):(0,y.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,y.jsx)(`thead`,{children:(0,y.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,y.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,y.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job Name`}),(0,y.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,y.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Timestamp`}),(0,y.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`ID`})]})}),(0,y.jsx)(`tbody`,{children:N.slice(F*S,F*S+S).map(e=>(0,y.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,y.jsx)(`td`,{className:`px-5 py-3`,children:(0,y.jsx)(s,{status:e.status})}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-fg`,children:e.name||`unknown`}),(0,y.jsx)(`td`,{className:`px-5 py-3`,children:(0,y.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-0.5 font-mono text-xs text-muted`,children:e.queue||`—`})}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:f(e.timestamp)}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-right font-mono text-xs text-faint`,children:e.jobId||`—`})]},e.seq))})]})}),(0,y.jsx)(_,{page:F,pageSize:S,total:N.length,onPageChange:D,label:`events`})]})}export{C as Logs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{h as t,r as n,t as r}from"./react-vendor-B68RYDeC.js";import{A as i,J as a,O as o,c as s,g as c,h as l,m as u,nt as d,t as f,u as p,w as m,x as h}from"./index-BjRjwWwc.js";import{a as g,i as _}from"./form-C-zZyKfB.js";import{t as v}from"./Pagination-BQg6KGW1.js";var y=e(t(),1),b=r(),x=`__all__`,S=[`all`,`waiting`,`active`,`completed`,`failed`],C=10,w=250;function T(){let[e,t]=(0,y.useState)(x),[r,T]=(0,y.useState)(`all`),[E,D]=(0,y.useState)(``),[O,k]=(0,y.useState)(0),[A,j]=(0,y.useState)(null),M=A!==null,{data:N,error:P,refetch:F}=i(()=>d.queues(),[],{intervalMs:3e4}),{events:I,counters:L,throughput:R,connected:z}=f(e===x?void 0:e),B=(0,y.useMemo)(()=>{let e=A??I,t=E.trim().toLowerCase();return e.filter(e=>r!==`all`&&e.status!==r?!1:t?(e.jobId??``).toLowerCase().includes(t)||(e.queue??``).toLowerCase().includes(t):!0)},[I,A,r,E]),V=M?Math.max(0,(I[0]?.seq??0)-(A[0]?.seq??0)):0;(0,y.useEffect)(()=>k(0),[e,r,E]),(0,y.useEffect)(()=>j(null),[e]);let H=O*C,U=B.slice(H,H+C);return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(l,{title:`Activity Logs`,description:`Real-time job activity across all queues.`,live:z&&!M}),P&&(0,b.jsx)(h,{onRetry:F}),(0,b.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,b.jsx)(u,{label:`Total Events`,value:s(L.total),compact:!0}),(0,b.jsx)(u,{label:`Completed`,value:s(L.completed),tone:`green`,compact:!0}),(0,b.jsx)(u,{label:`Failed`,value:s(L.failed),tone:L.failed?`red`:`default`,compact:!0}),(0,b.jsx)(u,{label:`Waiting`,value:s(L.waiting),tone:`amber`,compact:!0}),(0,b.jsx)(u,{label:`Active`,value:s(L.active),tone:`blue`,compact:!0}),(0,b.jsx)(u,{label:`Throughput`,value:`${R.toFixed(1)}/s`,tone:`accent`,compact:!0})]}),(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,b.jsx)(`div`,{className:`w-48`,children:(0,b.jsxs)(g,{"aria-label":`Filter by queue`,value:e,onChange:e=>t(e.target.value),children:[(0,b.jsx)(`option`,{value:x,children:`All Queues`}),(N?.queues??[]).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,b.jsx)(_,{options:S,value:r,onChange:T}),(0,b.jsx)(m,{size:`sm`,variant:M?`warning`:`default`,onClick:()=>j(M?null:I),title:M?`Resume applying live events to the list`:`Freeze the visible list while the stream keeps buffering`,children:M?`Resume${V?` — ${s(V)} new`:``}`:`Following · Pause`}),(0,b.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,b.jsx)(a,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,b.jsx)(`input`,{"aria-label":`Search by job ID or queue`,value:E,onChange:e=>D(e.target.value),placeholder:`Search by job ID or queue…`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),(0,b.jsxs)(`p`,{className:`-mt-2 mb-4 text-xs text-faint`,children:[`Search and filters cover the last `,w,` streamed events held in this browser.`]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Event`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Timestamp`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`ID`})]})}),(0,b.jsx)(`tbody`,{children:U.length===0?(0,b.jsx)(`tr`,{children:(0,b.jsx)(`td`,{colSpan:5,className:`px-5 py-12 text-center text-sm text-faint`,children:z?I.length>0?`No events match the current filters.`:`Waiting for activity…`:`Connecting to the event stream…`})}):U.map(e=>(0,b.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(c,{status:e.status})}),(0,b.jsxs)(`td`,{className:`px-5 py-3 font-mono text-xs text-fg`,children:[e.event,e.status===`failed`&&e.error&&(0,b.jsx)(`div`,{className:`mt-0.5 max-w-64 truncate text-[11px] text-danger`,title:e.error,children:e.error})]}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-0.5 font-mono text-xs text-muted`,children:e.queue||`—`})}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,title:new Date(e.timestamp).toISOString(),children:p(e.timestamp)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right font-mono text-xs text-faint`,children:e.jobId?(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,b.jsx)(n,{to:`/job?id=${encodeURIComponent(e.jobId)}`,className:`text-accent hover:underline`,children:e.jobId}),(0,b.jsx)(o,{value:e.jobId})]}):`—`})]},e.seq))})]})}),(0,b.jsx)(v,{page:O,pageSize:C,total:B.length,onPageChange:k,label:`events`})]})}export{T as LogsPro};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-vendor-B68RYDeC.js";import{A as t,C as n,L as r,S as i,X as a,b as o,c as s,d as c,h as l,j as u,l as d,m as f,n as p,r as m,x as h}from"./index-BjRjwWwc.js";var g=e(),_={ok:!1,stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},throughput:{pushPerSec:0,pullPerSec:0,completePerSec:0,failPerSec:0},latency:{averages:{},percentiles:{}},memory:{heapUsed:0,heapTotal:0,rss:0},collections:{},workers:{total:0,active:0,list:[],truncated:!1},crons:{total:0,list:[],truncated:!1},storage:{},timestamp:0};function v(){let{data:e,error:v,loading:x,refetch:S}=t(()=>u.overview(),[]);if(x&&!e&&!v)return(0,g.jsx)(o,{label:`Loading overview…`});let{stats:C,throughput:w,memory:T,workers:E,crons:D,storage:O}=e??_,k=p(C.totalCompleted,C.totalFailed)??0;return(0,g.jsxs)(`div`,{children:[v&&(0,g.jsx)(h,{onRetry:S}),(0,g.jsx)(l,{title:`Overview`,description:`Live health and throughput across all queues.`,live:!0}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,g.jsx)(f,{label:`Waiting`,value:s(C.waiting),tone:`amber`}),(0,g.jsx)(f,{label:`Active`,value:s(C.active),tone:`blue`}),(0,g.jsx)(f,{label:`Completed`,value:s(C.totalCompleted),tone:`green`}),(0,g.jsx)(f,{label:`Failed`,value:s(C.totalFailed),tone:`red`}),(0,g.jsx)(f,{label:`DLQ`,value:s(C.dlq),tone:C.dlq>0?`red`:`default`}),(0,g.jsx)(f,{label:`Error Rate`,value:d(k),tone:k>.05?`red`:`green`})]}),(0,g.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,g.jsxs)(i,{children:[(0,g.jsx)(n,{title:`Throughput`}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[(0,g.jsx)(y,{label:`Pushed`,value:w.pushPerSec,tone:`text-fg`}),(0,g.jsx)(y,{label:`Pulled`,value:w.pullPerSec,tone:`text-blue-400`}),(0,g.jsx)(y,{label:`Completed`,value:w.completePerSec,tone:`text-emerald-400`}),(0,g.jsx)(y,{label:`Failed`,value:w.failPerSec,tone:`text-red-400`})]})]}),(0,g.jsxs)(i,{children:[(0,g.jsx)(n,{title:`Resources`}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:[(0,g.jsx)(b,{label:`Uptime`,value:c(C.uptime)}),(0,g.jsx)(b,{label:`Heap`,value:m(T.heapUsed*1024*1024)}),(0,g.jsx)(b,{label:`RSS`,value:m(T.rss*1024*1024)}),(0,g.jsx)(b,{label:`Storage`,value:O.diskFull?`Disk full`:`Healthy`,tone:O.diskFull?`text-red-400`:`text-emerald-400`})]})]})]}),(0,g.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,g.jsxs)(i,{children:[(0,g.jsx)(n,{title:`Workers`,icon:(0,g.jsx)(a,{className:`size-4 text-faint`}),action:(0,g.jsxs)(`span`,{className:`text-sm text-muted`,children:[(0,g.jsx)(`span`,{className:`font-semibold text-emerald-400`,children:E.active}),` /`,` `,E.total,` active`]})}),E.list.length===0?(0,g.jsx)(`p`,{className:`py-6 text-center text-sm text-faint`,children:`No workers registered.`}):(0,g.jsx)(`ul`,{className:`divide-y divide-line`,children:E.list.slice(0,6).map(e=>(0,g.jsxs)(`li`,{className:`flex items-center justify-between py-2 text-sm`,children:[(0,g.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.name||e.id}),(0,g.jsxs)(`span`,{className:`text-xs text-faint`,children:[e.queues.join(`, `)||`—`,` · `,s(e.processedJobs),` done`]})]},e.id))})]}),(0,g.jsxs)(i,{children:[(0,g.jsx)(n,{title:`Cron Jobs`,icon:(0,g.jsx)(r,{className:`size-4 text-faint`}),action:(0,g.jsxs)(`span`,{className:`text-sm text-muted`,children:[D.total,` scheduled`]})}),D.list.length===0?(0,g.jsx)(`p`,{className:`py-6 text-center text-sm text-faint`,children:`No cron jobs.`}):(0,g.jsx)(`ul`,{className:`divide-y divide-line`,children:D.list.slice(0,6).map(e=>(0,g.jsxs)(`li`,{className:`flex items-center justify-between py-2 text-sm`,children:[(0,g.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.name}),(0,g.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:e.schedule??(e.repeatEvery?`every ${e.repeatEvery}ms`:`—`)})]},e.name))})]})]})]})}function y({label:e,value:t,tone:n}){return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e}),(0,g.jsxs)(`div`,{className:`mt-1 text-2xl font-semibold tnum ${n}`,children:[t.toFixed(1),(0,g.jsx)(`span`,{className:`ml-0.5 text-sm font-normal text-faint`,children:`/s`})]})]})}function b({label:e,value:t,tone:n=`text-fg`}){return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e}),(0,g.jsx)(`div`,{className:`mt-1 text-base font-semibold ${n}`,children:t})]})}export{v as Overview};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{C as r,S as i,nt as a,w as o}from"./index-BjRjwWwc.js";import{n as s,o as c,t as l}from"./form-C-zZyKfB.js";var u=e(t(),1),d=n();function f(e){let[t,n]=(0,u.useState)(e),r=(0,u.useRef)(JSON.stringify(e));return(0,u.useEffect)(()=>{let t=JSON.stringify(e);t!==r.current&&(r.current=t,n(e))},[e]),[t,n]}function p(e){let t=String(e).trim();if(t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}function m({queue:e,config:t,onSaved:n}){let[m,h]=f(t),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(!1);return(0,d.jsxs)(i,{children:[(0,d.jsx)(r,{title:`Stall detection`}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,d.jsxs)(`div`,{className:`col-span-2 flex items-center gap-2`,children:[(0,d.jsx)(c,{checked:m.enabled,onChange:e=>h({...m,enabled:e}),label:`enabled`}),(0,d.jsx)(`span`,{className:`text-sm text-muted`,"aria-hidden":`true`,children:`enabled`})]}),(0,d.jsx)(l,{label:`Stall interval (ms)`,children:(0,d.jsx)(s,{type:`number`,value:m.stallInterval,onChange:e=>h({...m,stallInterval:e.target.value})})}),(0,d.jsx)(l,{label:`Max stalls`,children:(0,d.jsx)(s,{type:`number`,value:m.maxStalls,onChange:e=>h({...m,maxStalls:e.target.value})})}),(0,d.jsx)(l,{label:`Grace period (ms)`,children:(0,d.jsx)(s,{type:`number`,value:m.gracePeriod,onChange:e=>h({...m,gracePeriod:e.target.value})})})]}),(0,d.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,d.jsx)(o,{variant:`accent`,size:`sm`,disabled:v,onClick:async()=>{let t=p(m.stallInterval),r=p(m.maxStalls),i=p(m.gracePeriod);if(t==null||r==null||i==null){_(`All numeric fields must be filled in`);return}y(!0),x(!1);try{_(null),await a.setStallConfig(e,{...m,stallInterval:t,maxStalls:r,gracePeriod:i}),n(),x(!0),window.setTimeout(()=>x(!1),2e3)}catch(e){_(e.message)}finally{y(!1)}},children:`Save`}),b&&(0,d.jsx)(`span`,{className:`text-xs text-success`,children:`Saved ✓`}),g&&(0,d.jsx)(`span`,{className:`text-xs text-danger`,children:g})]})]})}function h({queue:e,config:t,onSaved:n}){let[m,h]=f(t),[g,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(!1),[b,x]=(0,u.useState)(!1);return(0,d.jsxs)(i,{children:[(0,d.jsx)(r,{title:`DLQ policy`}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,d.jsxs)(`div`,{className:`col-span-2 flex items-center gap-2`,children:[(0,d.jsx)(c,{checked:m.autoRetry,onChange:e=>h({...m,autoRetry:e}),label:`auto-retry`}),(0,d.jsx)(`span`,{className:`text-sm text-muted`,"aria-hidden":`true`,children:`auto-retry`})]}),(0,d.jsx)(l,{label:`Retry interval (ms)`,children:(0,d.jsx)(s,{type:`number`,value:m.autoRetryInterval,onChange:e=>h({...m,autoRetryInterval:e.target.value})})}),(0,d.jsx)(l,{label:`Max auto-retries`,children:(0,d.jsx)(s,{type:`number`,value:m.maxAutoRetries,onChange:e=>h({...m,maxAutoRetries:e.target.value})})}),(0,d.jsx)(l,{label:`Max age (ms)`,children:(0,d.jsx)(s,{type:`number`,value:m.maxAge??``,onChange:e=>h({...m,maxAge:e.target.value})})}),(0,d.jsx)(l,{label:`Max entries`,children:(0,d.jsx)(s,{type:`number`,value:m.maxEntries,onChange:e=>h({...m,maxEntries:e.target.value})})})]}),(0,d.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,d.jsx)(o,{variant:`accent`,size:`sm`,disabled:v,onClick:async()=>{let t=p(m.autoRetryInterval),r=p(m.maxAutoRetries),i=p(m.maxEntries),o=m.maxAge==null?null:p(m.maxAge);if(t==null||r==null||i==null){_(`All numeric fields must be filled in`);return}y(!0),x(!1);try{_(null),await a.setDlqConfig(e,{...m,autoRetryInterval:t,maxAutoRetries:r,maxAge:o,maxEntries:i}),n(),x(!0),window.setTimeout(()=>x(!1),2e3)}catch(e){_(e.message)}finally{y(!1)}},children:`Save`}),b&&(0,d.jsx)(`span`,{className:`text-xs text-success`,children:`Saved ✓`}),g&&(0,d.jsx)(`span`,{className:`text-xs text-danger`,children:g})]})]})}function g({queue:e,paused:t,busy:n,run:c}){let[f,p]=(0,u.useState)(`0`),[m,h]=(0,u.useState)(`1000`),[g,_]=(0,u.useState)(``);return(0,d.jsxs)(i,{className:`mb-6`,children:[(0,d.jsx)(r,{title:`Lifecycle`}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[t?(0,d.jsx)(o,{variant:`success`,size:`sm`,disabled:n,onClick:()=>c(`Resumed`,()=>a.resume(e)),children:`Resume`}):(0,d.jsx)(o,{variant:`warning`,size:`sm`,disabled:n,onClick:()=>c(`Paused`,()=>a.pause(e)),children:`Pause`}),(0,d.jsx)(o,{size:`sm`,disabled:n,onClick:()=>c(`Retried completed`,()=>a.retryCompleted(e)),children:`Retry completed`}),(0,d.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,d.jsx)(`div`,{className:`w-24`,children:(0,d.jsx)(l,{label:`Promote N`,children:(0,d.jsx)(s,{type:`number`,value:g,onChange:e=>_(e.target.value),placeholder:`all`})})}),(0,d.jsx)(o,{size:`sm`,disabled:n,onClick:()=>c(`Promoted`,()=>a.promoteJobs(e,g?Number(g):void 0)),children:`Promote delayed`})]})]}),(0,d.jsxs)(`div`,{className:`mt-4 border-t border-line pt-3`,children:[(0,d.jsx)(`p`,{className:`mb-2 text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Destructive — these permanently remove jobs`}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,d.jsx)(o,{size:`sm`,disabled:n,onClick:()=>c(`Drained`,()=>a.drain(e),`Drain waiting jobs from "${e}"?`),children:`Drain`}),(0,d.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,d.jsx)(`div`,{className:`w-24`,children:(0,d.jsx)(l,{label:`Grace (ms)`,children:(0,d.jsx)(s,{type:`number`,value:f,onChange:e=>p(e.target.value)})})}),(0,d.jsx)(`div`,{className:`w-24`,children:(0,d.jsx)(l,{label:`Limit`,children:(0,d.jsx)(s,{type:`number`,value:m,onChange:e=>h(e.target.value)})})}),(0,d.jsx)(o,{variant:`danger`,size:`sm`,disabled:n,onClick:()=>c(`Cleaned`,()=>a.clean(e,{grace:Number(f),limit:Number(m)}),`Permanently delete up to ${m} completed/failed jobs older than ${f}ms from "${e}"?`),children:`Clean`})]})]})]})]})}function _({queue:e,busy:t,run:n}){let[c,f]=(0,u.useState)(``),[p,m]=(0,u.useState)(``);return(0,d.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,d.jsxs)(i,{children:[(0,d.jsx)(r,{title:`Rate limit`}),(0,d.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,d.jsx)(`div`,{className:`flex-1`,children:(0,d.jsx)(l,{label:`Limit`,children:(0,d.jsx)(s,{type:`number`,value:c,onChange:e=>f(e.target.value),placeholder:`max per window`})})}),(0,d.jsx)(o,{variant:`accent`,size:`sm`,disabled:t||!c,onClick:()=>n(`Rate limit set`,()=>a.setRateLimit(e,Number(c))),children:`Set`}),(0,d.jsx)(o,{size:`sm`,disabled:t,onClick:()=>n(`Rate limit cleared`,()=>a.clearRateLimit(e)),children:`Clear`})]})]}),(0,d.jsxs)(i,{children:[(0,d.jsx)(r,{title:`Concurrency`}),(0,d.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,d.jsx)(`div`,{className:`flex-1`,children:(0,d.jsx)(l,{label:`Concurrency`,children:(0,d.jsx)(s,{type:`number`,value:p,onChange:e=>m(e.target.value),placeholder:`max in-flight`})})}),(0,d.jsx)(o,{variant:`accent`,size:`sm`,disabled:t||!p,onClick:()=>n(`Concurrency set`,()=>a.setConcurrency(e,Number(p))),children:`Set`}),(0,d.jsx)(o,{size:`sm`,disabled:t,onClick:()=>n(`Concurrency cleared`,()=>a.clearConcurrency(e)),children:`Clear`})]})]})]})}export{m as i,_ as n,h as r,g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{A as r,_ as i,b as a,c as o,h as s,m as c,nt as l,x as u}from"./index-BjRjwWwc.js";import{a as d}from"./form-C-zZyKfB.js";import{i as f,n as p,r as m,t as h}from"./QueueActions-Bez_iOjl.js";var g=e(t(),1),_=n(),v=[`waiting`,`active`,`completed`,`failed`,`delayed`,`paused`];function y(){let[e,t]=(0,g.useState)(``),[n,y]=(0,g.useState)(!1),[b,x]=(0,g.useState)(null),{data:S}=r(()=>l.queues(),[],{intervalMs:3e4});(0,g.useEffect)(()=>{!e&&S?.queues?.length&&t(S.queues[0].name)},[S,e]);let{data:C,error:w,loading:T,refetch:E}=r((0,g.useCallback)(async()=>{if(!e)return null;let[t,n,r]=await Promise.all([l.queueDetail(e,!1),l.getStallConfig(e).catch(()=>null),l.getDlqConfig(e).catch(()=>null)]);return{queue:e,detail:t,stall:n?.config??null,dlq:r?.config??null}},[e]),[e]),D=C&&C.queue===e?C:null,O=(e,t,n)=>{n&&!window.confirm(n)||(y(!0),x(null),t().then(t=>{let n=t?.count;x({ok:!0,text:`${e}${n==null?` ✓`:`: ${n}`}`}),E()}).catch(e=>x({ok:!1,text:e.message})).finally(()=>y(!1)))};return(0,_.jsxs)(`div`,{children:[(0,_.jsx)(s,{title:`Queue Control`,description:`Full per-queue operations and configuration.`,live:!0}),(0,_.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`w-56`,children:(0,_.jsx)(d,{value:e,"aria-label":`Queue`,onChange:e=>t(e.target.value),children:(S?.queues??[]).map(e=>(0,_.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),D?.detail&&(0,_.jsx)(i,{label:D.detail.paused?`Paused`:`Active`,tone:D.detail.paused?`amber`:`green`}),b&&(0,_.jsx)(`span`,{role:`status`,className:b.ok?`text-xs text-success`:`text-xs text-danger`,children:b.text})]}),w&&(0,_.jsx)(u,{onRetry:E}),T&&!D&&!w?(0,_.jsx)(a,{}):D?.detail?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`div`,{className:`mb-6 grid grid-cols-3 gap-3 md:grid-cols-6`,children:v.map(e=>(0,_.jsx)(c,{label:e,value:o(D.detail.counts[e]),compact:!0},e))}),(0,_.jsx)(h,{queue:e,paused:D.detail.paused,busy:n,run:O}),(0,_.jsx)(p,{queue:e,busy:n,run:O}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[D.stall&&(0,_.jsx)(f,{queue:e,config:D.stall,onSaved:()=>x({ok:!0,text:`Stall config saved ✓`})},e),D.dlq&&(0,_.jsx)(m,{queue:e,config:D.dlq,onSaved:()=>x({ok:!0,text:`DLQ config saved ✓`})},e)]})]}):!w&&(0,_.jsx)(`p`,{className:`text-sm text-faint`,children:`Select a queue.`})]})}export{y as QueueControl};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{d as n,h as r,r as i,t as a,u as o}from"./react-vendor-B68RYDeC.js";import{A as s,C as c,M as l,P as u,S as d,T as f,_ as p,b as m,c as h,h as g,l as _,m as v,n as y,nt as b,o as x,rt as S,v as C,w,x as T}from"./index-BjRjwWwc.js";import{t as E}from"./AreaChart-Dl_9G6GH.js";import{t as D}from"./useThroughputSeries-defI_JpV.js";import{i as O,n as k,r as A,t as ee}from"./QueueActions-Bez_iOjl.js";var j=e(r(),1),M=a(),N=[`waiting`,`active`,`completed`,`failed`,`delayed`,`paused`],P=[`active`,`waiting`,`completed`,`failed`,`delayed`],F=2e3;function I(){let{name:e=``}=n(),r=o(),[a,I]=(0,j.useState)(!1),[z,B]=(0,j.useState)(null),{data:V,error:H,loading:U,refetch:W}=s((0,j.useCallback)(async()=>{if(!e)return null;let[t,n,r,i]=await Promise.all([b.queueDetail(e,!1),b.getStallConfig(e).catch(()=>null),b.getDlqConfig(e).catch(()=>null),b.jobsList(e,P,12).catch(()=>({ok:!1,jobs:[]}))]);return{queue:e,detail:t,stall:n?.config??null,dlq:r?.config??null,jobs:i.jobs??[]}},[e]),[e]),G=V&&V.queue===e?V:null,[K,q]=(0,j.useState)([]),J=(0,j.useRef)(null);(0,j.useEffect)(()=>{let e=G?.detail?.counts;e&&(J.current=(e.waiting??0)+(e.active??0)+(e.delayed??0))},[G]),(0,j.useEffect)(()=>{J.current=null,q([]);let e=setInterval(()=>{let e=J.current;e!=null&&q(t=>[...t,e].slice(-40))},F);return()=>clearInterval(e)},[e]);let Y=(t,n,r)=>{r&&!window.confirm(r)||(I(!0),B(null),n().then(n=>{let r=n?.count,i=`${t}${r==null?` ✓`:`: ${r}`}`;B({ok:!0,text:i}),S.success(i,e),W()}).catch(e=>{let n=e.message;B({ok:!1,text:n}),S.error(`${t} failed`,n)}).finally(()=>I(!1)))},X=()=>{window.confirm(`Obliterate "${e}"? This removes the queue and all its jobs.`)&&(I(!0),b.obliterate(e).then(()=>{S.success(`Queue obliterated`,e),r(`/queues`)}).catch(e=>{let t=e.message;B({ok:!1,text:t}),S.error(`Obliterate failed`,t),I(!1)}))},Z=G?.detail,Q=Z?.counts,te=Q?y(Q.completed??0,Q.failed??0)??0:0,$=D(K);return(0,M.jsxs)(`div`,{children:[(0,M.jsx)(g,{title:(0,M.jsx)(`span`,{className:`font-mono`,children:e}),description:`Full per-queue operations and live backlog.`,live:!0,back:(0,M.jsx)(f,{"aria-label":`Back to queues`,onClick:()=>r(`/queues`),children:(0,M.jsx)(u,{className:`size-4`})}),actions:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(i,{to:`/jobs?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:[`Jobs `,(0,M.jsx)(l,{className:`size-3.5`})]}),(0,M.jsxs)(i,{to:`/dlq?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:[`DLQ `,(0,M.jsx)(l,{className:`size-3.5`})]}),(0,M.jsx)(w,{variant:`danger`,size:`sm`,disabled:a,onClick:X,children:`Obliterate`})]})}),H&&(0,M.jsx)(T,{onRetry:W}),U&&!G&&!H?(0,M.jsx)(m,{label:`Loading ${e}…`}):!Z||!Q?!H&&(0,M.jsx)(C,{title:`Queue not found`,hint:`No queue named "${e}" exists — it may have been obliterated, or the link is stale.`,action:(0,M.jsx)(i,{to:`/queues`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Back to queues`})}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[(0,M.jsx)(p,{label:Z.paused?`Paused`:`Active`,tone:Z.paused?`amber`:`green`}),z&&(0,M.jsx)(`span`,{role:`status`,className:z.ok?`text-xs text-success`:`text-xs text-danger`,children:z.text})]}),(0,M.jsx)(`div`,{className:`mb-6 grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6`,children:N.map(e=>(0,M.jsx)(v,{label:e,value:h(Q[e]),tone:e===`failed`&&Q.failed?`red`:`default`,compact:!0},e))}),(0,M.jsxs)(d,{padded:!1,className:`mb-6`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3`,children:[(0,M.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:`Recent jobs`}),(0,M.jsxs)(i,{to:`/jobs?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 text-sm text-muted hover:text-fg`,children:[`View all `,(0,M.jsx)(l,{className:`size-3.5`})]})]}),(0,M.jsx)(`div`,{className:`overflow-x-auto border-t border-line`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,M.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`ID`}),(0,M.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`State`}),(0,M.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Attempts`}),(0,M.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Duration`})]})}),(0,M.jsx)(`tbody`,{children:G.jobs.length===0?(0,M.jsx)(`tr`,{children:(0,M.jsx)(`td`,{colSpan:4,className:`px-5 py-10 text-center text-sm text-faint`,children:`No recent jobs.`})}):G.jobs.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,M.jsx)(`td`,{className:`px-5 py-3`,children:(0,M.jsx)(i,{to:`/job?id=${encodeURIComponent(e.id)}`,className:`font-mono text-xs text-accent hover:underline`,children:e.id})}),(0,M.jsx)(`td`,{className:`px-5 py-3 text-muted`,children:e.state??`—`}),(0,M.jsxs)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:[e.attempts??0,` / `,e.maxAttempts??`?`]}),(0,M.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:x(e.startedAt&&e.completedAt?e.completedAt-e.startedAt:void 0)})]},e.id))})]})})]}),(0,M.jsx)(L,{counts:Z.priorityCounts}),(0,M.jsxs)(d,{className:`mb-6`,children:[(0,M.jsx)(c,{title:`Backlog depth`,action:(0,M.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,$.draining?`bg-emerald-500/10 text-success`:$.label===`accumulating`?`bg-red-500/10 text-danger`:`bg-surface-2 text-muted`),children:$.label})}),K.length<2?(0,M.jsx)(`p`,{className:`py-6 text-center text-xs text-faint`,children:`Sampling… the backlog trend appears after a few polls.`}):(0,M.jsx)(E,{height:140,ariaLabel:`${e} backlog depth`,series:[{label:`depth`,color:`var(--accent)`,points:K,area:!0}]}),(0,M.jsxs)(`div`,{className:`mt-1 flex items-center justify-between text-xs text-faint`,children:[(0,M.jsx)(`span`,{children:`waiting + active + delayed`}),(0,M.jsxs)(`span`,{className:`tnum`,children:[`Error rate `,_(te)]})]})]}),(0,M.jsx)(ee,{queue:e,paused:Z.paused,busy:a,run:Y}),(0,M.jsx)(k,{queue:e,busy:a,run:Y}),(0,M.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[G.stall?(0,M.jsx)(O,{queue:e,config:G.stall,onSaved:()=>{B({ok:!0,text:`Stall config saved ✓`}),S.success(`Stall config saved`,e)}},e):(0,M.jsx)(R,{title:`Stall detection`,onRetry:W}),G.dlq?(0,M.jsx)(A,{queue:e,config:G.dlq,onSaved:()=>{B({ok:!0,text:`DLQ config saved ✓`}),S.success(`DLQ config saved`,e)}},e):(0,M.jsx)(R,{title:`DLQ policy`,onRetry:W})]})]})]})}function L({counts:e}){let t=Object.entries(e??{}).map(([e,t])=>[Number(e),t]).filter(([,e])=>e>0).sort((e,t)=>t[0]-e[0]);if(t.length===0)return null;let n=Math.max(...t.map(([,e])=>e));return(0,M.jsxs)(d,{className:`mb-6`,children:[(0,M.jsx)(c,{title:`Jobs by priority`}),(0,M.jsx)(`div`,{className:`flex flex-col gap-2`,children:t.map(([e,t])=>(0,M.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,M.jsxs)(`span`,{className:`w-16 shrink-0 text-right font-mono text-xs text-muted`,children:[`p`,e]}),(0,M.jsx)(`div`,{className:`h-4 flex-1 overflow-hidden rounded bg-surface-2`,children:(0,M.jsx)(`div`,{className:`h-full rounded bg-accent`,style:{width:`${Math.max(2,t/n*100)}%`}})}),(0,M.jsx)(`span`,{className:`w-14 shrink-0 tnum text-xs text-fg`,children:h(t)})]},e))}),(0,M.jsx)(`p`,{className:`mt-2 text-xs text-faint`,children:`Higher p = higher priority. Waiting jobs only.`})]})}function R({title:e,onRetry:t}){return(0,M.jsxs)(d,{children:[(0,M.jsx)(c,{title:e}),(0,M.jsx)(`p`,{className:`mb-3 text-sm text-muted`,children:`Couldn't load this queue's config.`}),(0,M.jsx)(w,{size:`sm`,onClick:t,children:`Retry`})]})}export{I as QueueDetailPro};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r,u as i}from"./react-vendor-B68RYDeC.js";import{A as a,G as o,J as s,M as c,b as l,c as u,h as d,j as f,m as p,x as m}from"./index-BjRjwWwc.js";import{t as h}from"./Pagination-BQg6KGW1.js";var g=e(n(),1),_=r(),v=20,y={ok:!1,queues:[],total:0,limit:v,offset:0,timestamp:0};function b(){let e=i(),[n,r]=(0,g.useState)(``),[b,x]=(0,g.useState)(0),{data:S,error:C,loading:w,refetch:T}=a(()=>f.queues(v,b*v),[b]),E=S??y,D=(0,g.useMemo)(()=>{let e=E.queues,t=n.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[E,n]);if(w&&!S&&!C)return(0,_.jsx)(l,{label:`Loading queues…`});let O=E.queues.reduce((e,t)=>(e.waiting+=t.waiting,e.active+=t.active,e.delayed+=t.delayed,e.dlq+=t.dlq,e),{waiting:0,active:0,delayed:0,dlq:0});return(0,_.jsxs)(`div`,{children:[C&&(0,_.jsx)(m,{onRetry:T}),(0,_.jsx)(d,{title:`Queues`,description:`${E.total} queues`,live:!0}),(0,_.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,_.jsx)(p,{label:`Waiting`,value:u(O.waiting),tone:`amber`,compact:!0}),(0,_.jsx)(p,{label:`Active`,value:u(O.active),tone:`blue`,compact:!0}),(0,_.jsx)(p,{label:`Delayed`,value:u(O.delayed),tone:`default`,compact:!0}),(0,_.jsx)(p,{label:`DLQ`,value:u(O.dlq),tone:O.dlq?`red`:`default`,compact:!0})]}),(0,_.jsxs)(`div`,{className:`relative mb-4 max-w-sm`,children:[(0,_.jsx)(s,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,_.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`Search queues…`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,_.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-line bg-surface`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Waiting`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Delayed`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`DLQ`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,_.jsx)(`th`,{className:`w-10 px-5 py-3`})]})}),(0,_.jsx)(`tbody`,{children:D.length===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{colSpan:7,className:`px-5 py-12 text-center text-sm text-faint`,children:n?`No queues match on this page.`:`No queues yet.`})}):D.map(n=>(0,_.jsxs)(`tr`,{onClick:()=>e(`/queues/${encodeURIComponent(n.name)}`),className:`group cursor-pointer border-b border-line last:border-0 transition-colors hover:bg-surface-2/50`,children:[(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsxs)(`span`,{className:`flex items-center gap-2 font-medium text-fg`,children:[(0,_.jsx)(o,{className:`size-4 text-faint`}),n.name]})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:u(n.waiting)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:u(n.active)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:u(n.delayed)}),(0,_.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,n.dlq?`text-red-400`:`text-muted`),children:u(n.dlq)}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsxs)(`span`,{className:t(`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium`,n.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-emerald-400`),children:[(0,_.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),n.paused?`Paused`:`Active`]})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-faint`,children:(0,_.jsx)(c,{className:`size-4 opacity-0 transition-opacity group-hover:opacity-100`})})]},n.name))})]})}),(0,_.jsx)(h,{page:b,pageSize:v,total:E.total,onPageChange:x,label:`queues`})]})}export{b as Queues};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-vendor-B68RYDeC.js";import{A as t,C as n,S as r,b as i,c as a,d as o,h as s,j as c,m as l,r as u,x as d}from"./index-BjRjwWwc.js";var f=e(),p={stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},memory:{heapUsed:0,heapTotal:0,rss:0},workers:{total:0,active:0},crons:{total:0},storage:{}};function m(){let{data:e,error:m,loading:g,refetch:_}=t(()=>c.overview(),[]);if(g&&!e&&!m)return(0,f.jsx)(i,{label:`Loading usage…`});let{stats:v,memory:y,workers:b,crons:x,storage:S}=e??p;return(0,f.jsxs)(`div`,{children:[(0,f.jsx)(s,{title:`Usage`,description:`Cumulative resource usage on the connected server.`,live:!0}),m&&(0,f.jsx)(d,{onRetry:_}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,f.jsx)(l,{label:`Jobs Pushed`,value:a(v.totalPushed)}),(0,f.jsx)(l,{label:`Jobs Completed`,value:a(v.totalCompleted),tone:`green`}),(0,f.jsx)(l,{label:`Jobs Failed`,value:a(v.totalFailed),tone:v.totalFailed?`red`:`default`}),(0,f.jsx)(l,{label:`Jobs Pulled`,value:a(v.totalPulled),tone:`blue`})]}),(0,f.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,f.jsxs)(r,{children:[(0,f.jsx)(n,{title:`Runtime`}),(0,f.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,f.jsx)(h,{label:`Uptime`,value:o(v.uptime)}),(0,f.jsx)(h,{label:`Heap used`,value:u(y.heapUsed*1024*1024)}),(0,f.jsx)(h,{label:`RSS`,value:u(y.rss*1024*1024)}),(0,f.jsx)(h,{label:`Workers`,value:`${b.active} active / ${b.total}`}),(0,f.jsx)(h,{label:`Cron jobs`,value:String(x.total)})]})]}),(0,f.jsxs)(r,{children:[(0,f.jsx)(n,{title:`Storage`}),(0,f.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,f.jsx)(h,{label:`Status`,value:S.diskFull?`Disk full`:`Healthy`}),(0,f.jsx)(h,{label:`Path`,value:String(S.path??`—`),mono:!0}),S.error?(0,f.jsx)(h,{label:`Error`,value:String(S.error)}):null]})]})]})]})}function h({label:e,value:t,mono:n}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,f.jsx)(`dt`,{className:`text-muted`,children:e}),(0,f.jsx)(`dd`,{className:n?`font-mono text-xs text-fg`:`font-medium text-fg`,children:t})]})}export{m as Usage};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CopilotPanel-BJeJYfaz.js","assets/cn-CMFYpumL.js","assets/react-vendor-B68RYDeC.js","assets/form-C-zZyKfB.js","assets/AddJob-UCSTFuum.js","assets/Benchmark-B1VUJJLw.js","assets/connectionStore-B-hNUqwK.js","assets/AreaChart-Dl_9G6GH.js","assets/BulkAddJobs-DVgkRtrp.js","assets/CronManager-C6kjWCLE.js","assets/Pagination-BQg6KGW1.js","assets/Database-BYZ8LJb5.js","assets/Diagnostics-Dk1ErNCF.js","assets/DlqControl-DUturU7q.js","assets/exportFile-tdUeW5m5.js","assets/DlqPro-D8DOy5MI.js","assets/promisePool-Daxkc1OB.js","assets/Flows-DP9-h7a0.js","assets/JobInspector-BHZtkFL6.js","assets/jobActions-CuOdMglt.js","assets/JobsPro-C2Vc2iRC.js","assets/LogsPro-BpSZaHzN.js","assets/McpServer-MfQ0qsAI.js","assets/MetricsPro-Bt9zLjkN.js","assets/useThroughputSeries-defI_JpV.js","assets/QueueControl-CEXlJDkE.js","assets/QueueActions-Bez_iOjl.js","assets/QueueDetailPro-CuVyxX4Z.js","assets/QueuesOverview-DfRqAfS1.js","assets/S3BackupPro-V3JNhUK8.js","assets/ServerControl-DXidWdsq.js","assets/UsagePro-CbVFCD3J.js","assets/Webhooks-Dr0oBZr9.js","assets/WorkersPro-BRYPAhyx.js","assets/Alerts-CofRabaP.js","assets/Cron-CqlZj2V5.js","assets/Dlq-DANXiXsm.js","assets/Jobs-Bgr-HRmL.js","assets/Logs-CaOn3IpL.js","assets/Metrics-C4Dwg_DP.js","assets/Overview-BO3xG6I0.js","assets/QueueDetail-wjRLlCYY.js","assets/Queues-2W2E6e5R.js","assets/S3Backup-UQ_HKrn0.js","assets/Settings-0j8DZK9n.js","assets/Usage-C5DsZvR5.js","assets/Workers-Bwil4zIU.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{a as n,c as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m}from"./react-vendor-B68RYDeC.js";import{a as h,i as g,n as _,o as v,r as y,t as ee}from"./connectionStore-B-hNUqwK.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var b=e(i(),1),x=s(),te=()=>`${Date.now().toString(36)}${Math.floor(Math.random()*1e6).toString(36)}`;function ne(e){return{channels:e.channels.map(e=>e.type===`email`?e:{...e,target:``}),rules:e.rules}}var S=v()(h(e=>({channels:[],rules:[],addChannel:(t,n)=>e(e=>({channels:[...e.channels,{id:te(),type:t,target:n}]})),removeChannel:t=>e(e=>({channels:e.channels.filter(e=>e.id!==t)})),addRule:t=>e(e=>({rules:[...e.rules,{...t,id:te()}]})),removeRule:t=>e(e=>({rules:e.rules.filter(e=>e.id!==t)})),toggleRule:t=>e(e=>({rules:e.rules.map(e=>e.id===t?{...e,enabled:!e.enabled}:e)}))}),{name:`bq-dash-alerts`,partialize:ne})),re={error_rate:`error rate`,p99_latency:`p99 latency`,waiting:`waiting jobs`,failed:`failed jobs`,dlq:`DLQ size`},ie=1,C=v(e=>({toasts:[],push:({level:t,title:n,detail:r,ttlMs:i})=>{let a=ie++,o=i??(t===`error`?8e3:4e3);return e(e=>({toasts:[...e.toasts,{id:a,level:t,title:n,detail:r,ttlMs:o}].slice(-5)})),a},dismiss:t=>e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))})),ae={success:(e,t)=>C.getState().push({level:`success`,title:e,detail:t}),error:(e,t)=>C.getState().push({level:`error`,title:e,detail:t}),info:(e,t)=>C.getState().push({level:`info`,title:e,detail:t})},w=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`BqError`}};async function oe(e,t,n,r,i=!0,a=`server`){let o=await fetch(e+t,{...r,headers:{"Content-Type":`application/json`,...n,...r?.headers}});if(!o.ok){let e=`HTTP ${o.status}`;try{let t=await o.json();t?.error&&(e=t.error)}catch{}throw o.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:a}})),new w(e,o.status)}if(o.status===204)return;let s=await o.text();if(!s)return;let c;try{c=JSON.parse(s)}catch{throw new w(`Invalid JSON response (HTTP ${o.status})`,o.status)}if(i&&c&&typeof c==`object`&&c.ok===!1){let e=c.error;throw new w(e??`Operation failed`,o.status)}return c}var T=(e,t,n=!0)=>oe(y(),e,_(),t,n),se=(globalThis.__BUNQUEUE_AGENT_URL__||`http://localhost:6800`).replace(/\/$/,``),E=(e,t)=>oe(se,e,ee(),t,!0,`agent`),D=e=>encodeURIComponent(e),O=(e,t)=>({method:e,body:t===void 0?void 0:JSON.stringify(t)}),ce=[`job.pushed`,`job.started`,`job.completed`,`job.failed`,`job.progress`],k={overview:()=>T(`/dashboard`),queues:(e=500,t=0)=>T(`/dashboard/queues?limit=${e}&offset=${t}`),queuesSummary:()=>T(`/queues/summary`),queueDetail:(e,t=!0)=>T(`/dashboard/queues/${D(e)}?includeJobs=${t}`),stats:()=>T(`/stats`),storage:()=>T(`/storage`),health:()=>T(`/health`,void 0,!1),ping:()=>T(`/ping`),prometheusUrl:()=>`${y()}/prometheus`,gc:()=>T(`/gc`,O(`POST`)),heapStats:()=>T(`/heapstats`),jobsList:(e,t,n=50,r=0)=>{let i=new URLSearchParams;return t?.length&&i.set(`states`,t.join(`,`)),i.set(`limit`,String(n)),i.set(`offset`,String(r)),T(`/queues/${D(e)}/jobs/list?${i}`)},job:e=>T(`/jobs/${D(e)}`),jobByCustomId:e=>T(`/jobs/custom/${D(e)}`),jobResult:e=>T(`/jobs/${D(e)}/result`),jobLogs:e=>T(`/jobs/${D(e)}/logs`),jobChildren:e=>T(`/jobs/${D(e)}/children`),addJob:(e,t)=>T(`/queues/${D(e)}/jobs`,O(`POST`,t)),addJobsBulk:(e,t)=>T(`/queues/${D(e)}/jobs/bulk`,O(`POST`,{jobs:t})),pullBatch:(e,t)=>T(`/queues/${D(e)}/jobs/pull-batch`,O(`POST`,{count:t})),ackBatch:e=>T(`/jobs/ack-batch`,O(`POST`,{ids:e})),cancelJob:e=>T(`/jobs/${D(e)}`,{method:`DELETE`}),promoteJob:e=>T(`/jobs/${D(e)}/promote`,O(`POST`)),discardJob:e=>T(`/jobs/${D(e)}/discard`,O(`POST`)),retryJob:e=>T(`/jobs/${D(e)}/move-to-wait`,O(`POST`)),failJob:(e,t)=>T(`/jobs/${D(e)}/fail`,O(`POST`,{error:t})),updateJobData:(e,t)=>T(`/jobs/${D(e)}/data`,O(`PUT`,{data:t})),changePriority:(e,t)=>T(`/jobs/${D(e)}/priority`,O(`PUT`,{priority:t})),changeDelay:(e,t)=>T(`/jobs/${D(e)}/delay`,O(`PUT`,{delay:t})),moveToDelayed:(e,t)=>T(`/jobs/${D(e)}/move-to-delayed`,O(`POST`,{delay:t})),addJobLog:(e,t,n)=>T(`/jobs/${D(e)}/logs`,O(`POST`,{message:t,level:n})),clearJobLogs:e=>T(`/jobs/${D(e)}/logs`,{method:`DELETE`}),setJobProgress:(e,t,n)=>T(`/jobs/${D(e)}/progress`,O(`POST`,{progress:t,message:n})),counts:e=>T(`/queues/${D(e)}/counts`),pause:e=>T(`/queues/${D(e)}/pause`,O(`POST`)),resume:e=>T(`/queues/${D(e)}/resume`,O(`POST`)),drain:e=>T(`/queues/${D(e)}/drain`,O(`POST`)),obliterate:e=>T(`/queues/${D(e)}/obliterate`,O(`POST`)),clean:(e,t={})=>T(`/queues/${D(e)}/clean`,O(`POST`,t)),promoteJobs:(e,t)=>T(`/queues/${D(e)}/promote-jobs`,O(`POST`,t==null?void 0:{count:t})),retryCompleted:(e,t)=>T(`/queues/${D(e)}/retry-completed`,O(`POST`,t?{id:t}:void 0)),setRateLimit:(e,t)=>T(`/queues/${D(e)}/rate-limit`,O(`PUT`,{limit:t})),clearRateLimit:e=>T(`/queues/${D(e)}/rate-limit`,{method:`DELETE`}),setConcurrency:(e,t)=>T(`/queues/${D(e)}/concurrency`,O(`PUT`,{concurrency:t})),clearConcurrency:e=>T(`/queues/${D(e)}/concurrency`,{method:`DELETE`}),getStallConfig:e=>T(`/queues/${D(e)}/stall-config`),setStallConfig:(e,t)=>T(`/queues/${D(e)}/stall-config`,O(`PUT`,{config:t})),getDlqConfig:e=>T(`/queues/${D(e)}/dlq-config`),setDlqConfig:(e,t)=>T(`/queues/${D(e)}/dlq-config`,O(`PUT`,{config:t})),dlq:(e,t=100,n=0)=>T(`/queues/${D(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>T(`/queues/${D(e)}/dlq/stats`),retryDlq:(e,t)=>T(`/queues/${D(e)}/dlq/retry`,O(`POST`,t?{jobId:t}:void 0)),purgeDlq:e=>T(`/queues/${D(e)}/dlq/purge`,O(`POST`)),crons:()=>T(`/crons`),createCron:e=>T(`/crons`,O(`POST`,e)),deleteCron:e=>T(`/crons/${D(e)}`,{method:`DELETE`}),webhooks:()=>T(`/webhooks`),addWebhook:e=>T(`/webhooks`,O(`POST`,e)),removeWebhook:e=>T(`/webhooks/${D(e)}`,{method:`DELETE`}),setWebhookEnabled:(e,t)=>T(`/webhooks/${D(e)}/enabled`,O(`PUT`,{enabled:t})),workers:()=>T(`/workers`),unregisterWorker:e=>T(`/workers/${D(e)}`,{method:`DELETE`}),eventsUrl:e=>y()+(e?`/events/queues/${D(e)}`:`/events`),db:{info:()=>E(`/db/info`),tables:()=>E(`/db/tables`),schema:e=>E(`/db/tables/${D(e)}/schema`),rows:(e,t=50,n=0,r,i=`asc`,a)=>E(`/db/tables/${D(e)}?limit=${t}&offset=${n}`+(r?`&orderBy=${D(r)}&dir=${i}`:``)+(a?.value?`&fcol=${D(a.column)}&fop=${a.op}&fval=${D(a.value)}`:``)),cell:(e,t,n)=>E(`/db/tables/${D(e)}/cell?rowid=${t}&column=${D(n)}`),query:e=>E(`/db/query`,O(`POST`,{sql:e}))},agentBase:se,control:{status:()=>E(`/control/status`),start:()=>E(`/control/start`,{method:`POST`}),stop:()=>E(`/control/stop`,{method:`POST`}),restart:()=>E(`/control/restart`,{method:`POST`}),logs:()=>E(`/control/logs`),getConfig:()=>E(`/control/config`),setConfig:e=>E(`/control/config`,O(`PUT`,e))}},le=15e3,ue=6e4,de=v(e=>({breaching:[],setBreaching:t=>e({breaching:t})}));async function fe(){if(typeof Notification>`u`)return`denied`;if(Notification.permission===`granted`)return`granted`;try{return await Notification.requestPermission()}catch{return`denied`}}function pe(e,t,n){switch(t){case`>=`:return e>=n;case`>`:return e>n;case`<=`:return e<=n;case`<`:return e<n;default:return!1}}var me=(e,t)=>{let n=e+t;return n>0?t/n*100:0};function he(e,t){let n=e.queue.trim();switch(e.metric){case`waiting`:return t.summary?n?t.summary.find(e=>e.name===n)?.counts.waiting??null:t.summary.reduce((e,t)=>e+t.counts.waiting,0):null;case`failed`:return t.summary?n?t.summary.find(e=>e.name===n)?.counts.failed??null:t.summary.reduce((e,t)=>e+t.counts.failed,0):null;case`dlq`:return t.queues?n?t.queues.find(e=>e.name===n)?.dlq??null:t.queues.reduce((e,t)=>e+(t.dlq??0),0):null;case`error_rate`:if(!t.summary)return null;if(n){let e=t.summary.find(e=>e.name===n);return e?me(e.counts.completed,e.counts.failed):null}return me(t.summary.reduce((e,t)=>e+t.counts.completed,0),t.summary.reduce((e,t)=>e+t.counts.failed,0));case`p99_latency`:{let e=t.overview?.latency?.percentiles;if(!e)return null;let n=Object.values(e).map(e=>e.p99).filter(e=>Number.isFinite(e));return n.length?Math.max(...n):null}default:return null}}function ge(e){let t=`${e.queue||`All queues`}: ${e.metricLabel} ${e.operator} ${e.threshold} (now ${Math.round(e.value)})`;if(ae.error(`Alert: ${e.ruleName}`,t),typeof Notification<`u`&&Notification.permission===`granted`)try{new Notification(`bunqueue alert: ${e.ruleName}`,{body:t,tag:e.ruleId})}catch{}}function _e(){let e=S(e=>e.rules),t=de(e=>e.setBreaching),n=(0,b.useRef)(new Map),r=(0,b.useRef)(new Map),i=(0,b.useRef)(new Map),a=e.filter(e=>e.enabled).map(e=>`${e.id}:${e.metric}:${e.operator}:${e.threshold}:${e.queue}`).join(`|`);(0,b.useEffect)(()=>{if(!a){t([]),n.current.clear(),r.current.clear(),i.current.clear();return}let e=!1,o=!1,s=async()=>{if(!o){o=!0;try{let[a,o,s]=await Promise.all([k.queuesSummary().catch(()=>null),k.queues().catch(()=>null),k.overview().catch(()=>null)]);if(e||!s)return;let c={summary:a,queues:o?.queues??null,overview:s},l=Date.now(),u=[],d=S.getState().rules.filter(e=>e.enabled),f=new Set(d.map(e=>e.id));for(let e of d){let t=he(e,c);if(t==null)continue;let a=pe(t,e.operator,e.threshold),o=n.current.get(e.id)??!1;if(a){let n=o?i.current.get(e.id)??l:l;i.current.set(e.id,n);let a={ruleId:e.id,ruleName:e.name,metricLabel:re[e.metric],operator:e.operator,threshold:e.threshold,value:t,queue:e.queue,at:n};u.push(a);let s=l-(r.current.get(e.id)??0)>ue;!o&&s&&(ge(a),r.current.set(e.id,l))}else i.current.delete(e.id);n.current.set(e.id,a)}for(let e of[...n.current.keys()])f.has(e)||(n.current.delete(e),r.current.delete(e),i.current.delete(e));t(u)}finally{o=!1}}};s();let c=setInterval(s,le);return()=>{e=!0,clearInterval(c)}},[a,t])}function ve(){return _e(),null}var A=p();function ye(){let[e,t]=(0,b.useState)(!1),[n,r]=(0,b.useState)(`server`),[i,a]=(0,b.useState)(``),o=g(e=>e.baseUrl),s=g(e=>e.setToken),c=g(e=>e.setAgentToken),l=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let e=e=>{let n=e.detail?.scope;r(n===`agent`?`agent`:`server`),t(!0)};return window.addEventListener(`auth:required`,e),()=>window.removeEventListener(`auth:required`,e)},[]),(0,b.useEffect)(()=>{if(!e)return;let t=requestAnimationFrame(()=>l.current?.focus());return()=>cancelAnimationFrame(t)},[e]),e?(0,A.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4`,children:(0,A.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let r=i.trim();r&&(n===`agent`?c(r):s(r),a(``),t(!1))},role:`dialog`,"aria-modal":`true`,"aria-label":`Authentication required`,className:`w-full max-w-sm rounded-xl border border-line-strong bg-surface p-6 shadow-2xl`,children:[(0,A.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:`Authentication required`}),n===`agent`?(0,A.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[`The control agent at `,(0,A.jsx)(`span`,{className:`break-all font-mono text-fg`,children:k.agentBase}),` `,`rejected the request (401). Enter its`,` `,(0,A.jsx)(`span`,{className:`font-mono text-fg`,children:`AGENT_TOKEN`}),` to continue.`]}):(0,A.jsxs)(`p`,{className:`mt-1 text-sm text-muted`,children:[`The server at `,(0,A.jsx)(`span`,{className:`break-all font-mono text-fg`,children:o}),` rejected the request (401). Enter its bearer token to continue.`]}),(0,A.jsx)(`input`,{ref:l,type:`password`,value:i,onChange:e=>a(e.target.value),placeholder:n===`agent`?`AGENT_TOKEN`:`Bearer token`,"aria-label":n===`agent`?`Agent token`:`Bearer token`,autoComplete:`off`,className:`mt-4 w-full rounded-lg border border-line bg-surface-2 px-3 py-2 text-sm text-fg outline-none placeholder:text-faint focus-visible:ring-2 focus-visible:ring-accent/50`}),(0,A.jsxs)(`div`,{className:`mt-4 flex items-center justify-between gap-3`,children:[(0,A.jsx)(d,{to:`/settings`,onClick:()=>t(!1),className:`text-xs text-muted underline-offset-2 hover:text-fg hover:underline`,children:`Open Settings instead`}),(0,A.jsx)(`button`,{type:`submit`,disabled:!i.trim(),className:`rounded-lg bg-accent px-4 py-2 text-sm font-medium text-accent-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-50`,children:`Unlock`})]})]})}):null}function j(e){typeof document<`u`&&(document.documentElement.dataset.theme=e,document.documentElement.style.colorScheme=e)}var M=v()(h((e,t)=>({theme:`dark`,toggle:()=>{let n=t().theme===`dark`?`light`:`dark`;j(n),e({theme:n})},setTheme:t=>{j(t),e({theme:t})}}),{name:`bq-dash-theme`,onRehydrateStorage:()=>e=>{e&&j(e.theme)}}));function be(){j(M.getState().theme)}function N({children:e,...t}){return(0,A.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...t,children:e})}var xe=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M3 3v18h18`}),(0,A.jsx)(`rect`,{x:`7`,y:`12`,width:`3`,height:`6`}),(0,A.jsx)(`rect`,{x:`12`,y:`8`,width:`3`,height:`10`}),(0,A.jsx)(`rect`,{x:`17`,y:`5`,width:`3`,height:`13`})]}),P=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,A.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,A.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,A.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`}),(0,A.jsx)(`line`,{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`}),(0,A.jsx)(`line`,{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`})]}),F=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`2`,y:`7`,width:`20`,height:`14`,rx:`2`}),(0,A.jsx)(`path`,{d:`M16 7V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`})]}),I=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z`}),(0,A.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,A.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),Se=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,A.jsx)(`polyline`,{points:`12 7 12 12 15 14`})]}),Ce=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M3 3v18h18`}),(0,A.jsx)(`path`,{d:`m19 9-5 5-4-4-3 3`})]}),L=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`8`,rx:`2`}),(0,A.jsx)(`rect`,{x:`4`,y:`14`,width:`16`,height:`6`,rx:`2`}),(0,A.jsx)(`line`,{x1:`8`,y1:`8`,x2:`8.01`,y2:`8`}),(0,A.jsx)(`line`,{x1:`8`,y1:`17`,x2:`8.01`,y2:`17`})]}),we=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9`}),(0,A.jsx)(`path`,{d:`M13.73 21a2 2 0 0 1-3.46 0`})]}),Te=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,A.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,A.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,A.jsx)(`path`,{d:`M3 6h.01M3 12h.01M3 18h.01`})]}),Ee=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M12 20V10`}),(0,A.jsx)(`path`,{d:`M18 20V4`}),(0,A.jsx)(`path`,{d:`M6 20v-4`})]}),De=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,A.jsx)(`path`,{d:`M4 5v6c0 1.66 3.58 3 8 3s8-1.34 8-3V5`}),(0,A.jsx)(`path`,{d:`M4 11v6c0 1.66 3.58 3 8 3s8-1.34 8-3v-6`})]}),Oe=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,A.jsx)(`path`,{d:`M3 10h18`}),(0,A.jsx)(`path`,{d:`M9 10v10`})]}),ke=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,A.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z`})]}),Ae=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,A.jsx)(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41`})]}),je=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z`})}),Me=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),Ne=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),Pe=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})}),Fe=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`}),(0,A.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`})]}),Ie=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,A.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]}),Le=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`polyline`,{points:`23 4 23 10 17 10`}),(0,A.jsx)(`polyline`,{points:`1 20 1 14 7 14`}),(0,A.jsx)(`path`,{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`})]}),Re=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,A.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),ze=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8Z`}),(0,A.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),R=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polygon`,{points:`13 2 3 14 12 14 11 22 21 10 12 10 13 2`})}),z=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,A.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),Be=e=>(0,A.jsx)(N,{...e,children:(0,A.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),B=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,A.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]}),Ve=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,A.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),He=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`line`,{x1:`3`,y1:`6`,x2:`21`,y2:`6`}),(0,A.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),(0,A.jsx)(`line`,{x1:`3`,y1:`18`,x2:`21`,y2:`18`})]}),Ue=e=>(0,A.jsxs)(N,{...e,children:[(0,A.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,A.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,A.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]}),We=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`ApiError`}};async function V(e,t,n=!0){let r=await fetch(y()+e,{...t,headers:{"Content-Type":`application/json`,..._(),...t?.headers}});if(!r.ok){let e=`HTTP ${r.status}`;try{let t=await r.json();t?.error&&(e=t.error)}catch{}throw new We(e,r.status)}if(r.status===204)return;let i=await r.json();if(n&&i&&typeof i==`object`&&i.ok===!1){let e=i.error;throw new We(e??`Operation failed`,r.status)}return i}var H=e=>encodeURIComponent(e),U=(e,t)=>V(e,{method:`POST`,body:t?JSON.stringify(t):void 0}),Ge=(e,t)=>V(e,{method:`PUT`,body:t?JSON.stringify(t):void 0}),W=e=>V(e,{method:`DELETE`}),G={overview:()=>V(`/dashboard`),queues:(e=200,t=0)=>V(`/dashboard/queues?limit=${e}&offset=${t}`),queueDetail:(e,t=!0)=>V(`/dashboard/queues/${H(e)}?includeJobs=${t}`),stats:()=>V(`/stats`),storage:()=>V(`/storage`,void 0,!1),health:()=>V(`/health`,void 0,!1),jobsList:(e,t={})=>{let n=new URLSearchParams;return t.states?.length&&n.set(`states`,t.states.join(`,`)),n.set(`limit`,String(t.limit??50)),n.set(`offset`,String(t.offset??0)),V(`/queues/${H(e)}/jobs/list?${n.toString()}`)},job:e=>V(`/jobs/${H(e)}`),cancelJob:e=>W(`/jobs/${H(e)}`),promoteJob:e=>U(`/jobs/${H(e)}/promote`),retryJob:e=>U(`/jobs/${H(e)}/move-to-wait`),pause:e=>U(`/queues/${H(e)}/pause`),resume:e=>U(`/queues/${H(e)}/resume`),drain:e=>U(`/queues/${H(e)}/drain`),obliterate:e=>U(`/queues/${H(e)}/obliterate`),clean:(e,t=0,n=1e3)=>U(`/queues/${H(e)}/clean`,{grace:t,limit:n}),retryCompleted:e=>U(`/queues/${H(e)}/retry-completed`),setRateLimit:(e,t)=>Ge(`/queues/${H(e)}/rate-limit`,{limit:t}),clearRateLimit:e=>W(`/queues/${H(e)}/rate-limit`),setConcurrency:(e,t)=>Ge(`/queues/${H(e)}/concurrency`,{concurrency:t}),clearConcurrency:e=>W(`/queues/${H(e)}/concurrency`),dlq:(e,t=50,n=0)=>V(`/queues/${H(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>V(`/queues/${H(e)}/dlq/stats`),retryDlq:e=>U(`/queues/${H(e)}/dlq/retry`),purgeDlq:e=>U(`/queues/${H(e)}/dlq/purge`),crons:()=>V(`/crons`),deleteCron:e=>W(`/crons/${H(e)}`),workers:()=>V(`/workers`),eventsUrl:e=>y()+(e?`/events/queues/${H(e)}`:`/events`)};function Ke(e){let t=!0;return()=>t?(t=!1,!0):!e()}function qe(e,t=[],n={}){let r=g(e=>e.refreshMs),i=n.intervalMs??r,[a,o]=(0,b.useState)(null),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(!0),d=(0,b.useRef)(e);d.current=e;let f=(0,b.useRef)(!0),p=(0,b.useRef)(0),m=(0,b.useRef)(void 0),h=(0,b.useRef)(!0),_=(0,b.useRef)(!1),v=(0,b.useCallback)(async()=>{let e=++p.current;try{let t=await d.current();if(!f.current||e!==p.current)return;let n;try{n=JSON.stringify(t)}catch{n=String(Math.random())}n!==m.current&&(m.current=n,o(t)),_.current&&(_.current=!1,c(null))}catch(t){if(!f.current||e!==p.current)return;_.current=!0,c(t)}finally{f.current&&e===p.current&&h.current&&(h.current=!1,u(!1))}},[]);return(0,b.useEffect)(()=>{f.current=!0,m.current=void 0,h.current=!0,u(!0),_.current&&(_.current=!1,c(null));let e=null,t=!1,n=()=>typeof document<`u`&&document.hidden,r=Ke(n),a=async()=>{t||(r()&&await v(),!t&&(e=setTimeout(a,i)))};a();let o=()=>{!n()&&!t&&v()};return typeof document<`u`&&document.addEventListener(`visibilitychange`,o),()=>{t=!0,f.current=!1,e&&clearTimeout(e),typeof document<`u`&&document.removeEventListener(`visibilitychange`,o)}},[i,v,...t]),{data:a,error:s,loading:l,refreshing:l,refetch:v}}function Je(e){try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function Ye({value:e,className:n}){let[r,i]=(0,b.useState)(`idle`),a=(0,b.useRef)(null);return(0,b.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,A.jsx)(`button`,{type:`button`,onClick:async()=>{let t=!1;if(navigator.clipboard)try{await navigator.clipboard.writeText(e),t=!0}catch{}t||=Je(e),i(t?`copied`:`failed`),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(`idle`),1500)},"aria-label":`Copy to clipboard`,title:r===`failed`?`Copy failed`:`Copy to clipboard`,className:t(`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-faint transition-colors hover:bg-surface-2 hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,n),children:r===`copied`?(0,A.jsx)(Be,{className:`size-3.5 text-success`}):r===`failed`?(0,A.jsx)(z,{className:`size-3.5 text-danger`}):(0,A.jsx)(Ve,{className:`size-3.5`})})}function K(){if(typeof window>`u`)return!1;let{search:e,hash:t}=window.location;return new URLSearchParams(e).has(`demo`)||t.replace(/^#/,``)===`demo`}var Xe=`https://github.com/egeominotti/bunqueue-dashboard`,Ze=`https://egeominotti.github.io/bunqueue-dashboard/docs/`,Qe=`bunx bunqueue-dashboard`;function $e(){return(0,A.jsxs)(`div`,{className:`mx-3 mb-2 rounded-lg border border-accent/30 bg-accent/5 p-3`,children:[(0,A.jsx)(`p`,{className:`mb-2 text-[11px] font-medium leading-snug text-fg`,children:`Like it? Run it on your own bunqueue server.`}),(0,A.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 rounded-md border border-line bg-surface-2 px-2 py-1`,children:[(0,A.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-[11px] text-fg`,children:Qe}),(0,A.jsx)(Ye,{value:Qe})]}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,A.jsxs)(`a`,{href:Xe,target:`_blank`,rel:`noreferrer`,className:`flex flex-1 items-center justify-center gap-1 rounded-md bg-accent px-2 py-1.5 text-[11px] font-semibold text-accent-fg transition-opacity hover:opacity-90`,children:[(0,A.jsx)(`span`,{"aria-hidden":!0,children:`★`}),` Star`]}),(0,A.jsx)(`a`,{href:Ze,target:`_blank`,rel:`noreferrer`,className:`flex flex-1 items-center justify-center rounded-md border border-line px-2 py-1.5 text-[11px] font-medium text-muted transition-colors hover:bg-surface-2 hover:text-fg`,children:`Docs`})]})]})}function et(){let e=g(e=>e.baseUrl),t=e===`/api`?`localhost:6790`:e.replace(/^https?:\/\//,``);return(0,A.jsxs)(A.Fragment,{children:[K()&&(0,A.jsx)($e,{}),(0,A.jsxs)(`div`,{className:`mx-3 mb-3 flex items-center gap-2.5 rounded-lg border border-line bg-surface px-3 py-2`,children:[(0,A.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-accent to-fuchsia-600 text-[11px] font-bold text-white`,children:`bq`}),(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:`truncate text-xs font-medium text-fg`,children:`bunqueue`}),(0,A.jsx)(`div`,{className:`truncate font-mono text-[10px] text-faint`,title:e,children:t})]}),(0,A.jsx)(d,{to:`/settings`,"aria-label":`Settings`,className:`text-faint transition-colors hover:text-fg`,children:(0,A.jsx)(ke,{className:`size-4`})})]})]})}var tt=[{section:null,items:[{to:`/`,label:`Overview`,icon:xe,end:!0}]},{section:`Queues`,items:[{to:`/queues`,label:`Queues`,icon:P},{to:`/jobs`,label:`Jobs`,icon:F},{to:`/dlq`,label:`Dead Letter Queue`,icon:I},{to:`/cron`,label:`Cron Jobs`,icon:Se},{to:`/flows`,label:`Flows`,icon:B}]},{section:`Monitoring`,items:[{to:`/metrics`,label:`Metrics`,icon:Ce},{to:`/workers`,label:`Workers`,icon:L},{to:`/logs`,label:`Logs`,icon:Te},{to:`/alerts`,label:`Alerts`,icon:we}]},{section:`Control`,items:[{to:`/server`,label:`Server`,icon:L},{to:`/add-job`,label:`Add Job`,icon:F},{to:`/jobs/bulk-add`,label:`Bulk Add`,icon:F},{to:`/job`,label:`Job Inspector`,icon:ze},{to:`/queue-control`,label:`Queue Control`,icon:P},{to:`/dlq-control`,label:`DLQ Control`,icon:I},{to:`/webhooks`,label:`Webhooks`,icon:R},{to:`/diagnostics`,label:`Diagnostics`,icon:Ce},{to:`/benchmark`,label:`Benchmark`,icon:R}]},{section:`Management`,items:[{to:`/database`,label:`Database`,icon:Oe},{to:`/mcp`,label:`MCP`,icon:R},{to:`/usage`,label:`Usage`,icon:Ee},{to:`/s3`,label:`S3 Backup`,icon:De},{to:`/settings`,label:`Settings`,icon:ke}]}];function nt(){let e=g(e=>e.baseUrl),{data:n,error:r,loading:i}=qe(async()=>({ok:(await G.health()).ok}),[],{intervalMs:15e3}),a=!r&&n!=null&&n.ok!==!1,o=e.replace(/^https?:\/\//,``)||`local`;return(0,A.jsxs)(`div`,{className:`mx-3 mb-4 flex items-center gap-2 rounded-lg border border-line bg-surface px-3 py-1.5`,children:[(0,A.jsx)(`span`,{className:t(`size-1.5 rounded-full`,i?`bg-zinc-500`:a?`bg-emerald-400`:`bg-red-400`),title:i?`connecting`:a?`connected`:`offline`}),(0,A.jsx)(`span`,{className:`truncate font-mono text-[11px] text-muted`,title:e,children:o}),(0,A.jsx)(`span`,{className:`sr-only`,children:i?`connecting`:a?`connected`:`offline`})]})}function rt(){let e=M(e=>e.theme),t=M(e=>e.toggle),n=e===`dark`;return(0,A.jsxs)(`button`,{type:`button`,onClick:t,className:`mx-3 mb-3 flex items-center gap-3 rounded-lg px-3 py-2 text-sm text-muted transition-colors hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[n?(0,A.jsx)(Ae,{className:`size-4`}):(0,A.jsx)(je,{className:`size-4`}),n?`Light Mode`:`Dark Mode`]})}function it({open:e=!1,onClose:n}){return(0,A.jsxs)(A.Fragment,{children:[e&&(0,A.jsx)(`button`,{type:`button`,"aria-label":`Close navigation`,onClick:n,className:`fixed inset-0 z-40 bg-black/50 lg:hidden`}),(0,A.jsxs)(`aside`,{id:`app-nav`,className:t(`flex w-60 shrink-0 flex-col border-r border-line bg-sidebar`,`fixed inset-y-0 left-0 z-50 transition-[transform,visibility] lg:static lg:z-auto lg:translate-x-0`,e?`translate-x-0`:`-translate-x-full lg:translate-x-0 invisible lg:visible`),children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-5`,children:[(0,A.jsx)(`span`,{className:`text-lg font-bold tracking-tight text-fg`,children:`bunqueue`}),(0,A.jsx)(`span`,{className:`rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-accent`,children:`dash`}),(0,A.jsx)(`span`,{title:`Beta — under active development`,className:`rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wider text-warning`,children:`beta`})]}),(0,A.jsx)(`nav`,{className:`flex-1 overflow-y-auto px-3 pb-4`,children:tt.map(e=>(0,A.jsxs)(`div`,{className:`mb-4`,children:[e.section&&(0,A.jsx)(`div`,{className:`px-2 pb-2 pt-1 text-[10px] font-semibold uppercase tracking-wider text-faint`,children:e.section}),(0,A.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:e.items.map(({to:e,label:n,icon:r,end:i})=>(0,A.jsx)(a,{to:e,end:i,className:({isActive:e})=>t(`group relative flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,e?`bg-surface-2 text-fg`:`text-muted hover:bg-surface-2/60 hover:text-fg`),children:({isActive:e})=>(0,A.jsxs)(A.Fragment,{children:[e&&(0,A.jsx)(`span`,{className:`absolute inset-y-1.5 left-0 w-0.5 rounded-full bg-accent`}),(0,A.jsx)(r,{className:`size-[18px] shrink-0`}),(0,A.jsx)(`span`,{className:`truncate`,children:n})]})},e))})]},e.section??`root`))}),(0,A.jsx)(nt,{}),(0,A.jsx)(rt,{}),(0,A.jsx)(et,{})]})]})}var at=`https://egeominotti.github.io/bunqueue-dashboard/docs/`;function ot(){let[e,t]=(0,b.useState)(!1),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(0),o=m(),s=M(e=>e.toggle),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useMemo)(()=>{let e=tt.flatMap(e=>e.items.map(t=>({id:`nav:${t.to}`,label:t.label,hint:e.section??`Home`,run:()=>o(t.to)}))),t=[{id:`act:theme`,label:`Toggle theme (dark / light)`,hint:`Action`,run:s},{id:`act:docs`,label:`Open documentation`,hint:`Action`,run:()=>window.open(at,`_blank`,`noopener`)}];return[...e,...t]},[o,s]),d=(0,b.useMemo)(()=>{let e=n.trim().toLowerCase();return e?u.filter(t=>`${t.label} ${t.hint}`.toLowerCase().includes(e)):u},[u,n]);(0,b.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),t(e=>!e))},n=()=>t(!0);return window.addEventListener(`keydown`,e),window.addEventListener(`command-palette:open`,n),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`command-palette:open`,n)}},[]),(0,b.useEffect)(()=>{if(!e)return;let t=document.activeElement;r(``),a(0);let n=requestAnimationFrame(()=>c.current?.focus());return()=>{cancelAnimationFrame(n),t?.focus?.()}},[e]),(0,b.useEffect)(()=>{l.current?.querySelector(`[data-idx="${i}"]`)?.scrollIntoView({block:`nearest`})},[i]);let f=(0,b.useCallback)(()=>t(!1),[]),p=(0,b.useCallback)(e=>{e&&(e.run(),t(!1))},[]);return e?(0,A.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center p-4 pt-[12vh]`,children:[(0,A.jsx)(`button`,{type:`button`,"aria-label":`Close command palette`,onClick:f,className:`fixed inset-0 bg-black/50`}),(0,A.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":`Command palette`,className:`relative z-10 w-full max-w-lg overflow-hidden rounded-xl border border-line-strong bg-surface shadow-2xl`,children:[(0,A.jsx)(`input`,{ref:c,value:n,onChange:e=>{r(e.target.value),a(0)},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),f()):e.key===`ArrowDown`?(e.preventDefault(),a(e=>Math.min(e+1,d.length-1))):e.key===`ArrowUp`?(e.preventDefault(),a(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),p(d[i]))},placeholder:`Search pages and actions…`,"aria-label":`Search pages and actions`,className:`w-full border-b border-line bg-transparent px-4 py-3 text-sm text-fg outline-none placeholder:text-faint`}),(0,A.jsxs)(`ul`,{ref:l,className:`max-h-80 overflow-y-auto py-2`,"aria-label":`Results`,children:[d.length===0&&(0,A.jsx)(`li`,{className:`px-4 py-6 text-center text-sm text-faint`,children:`No matches`}),d.map((e,t)=>(0,A.jsx)(`li`,{children:(0,A.jsxs)(`button`,{type:`button`,"data-idx":t,onMouseEnter:()=>a(t),onClick:()=>p(e),className:`flex w-full items-center justify-between gap-3 px-4 py-2 text-left text-sm transition-colors ${t===i?`bg-accent/15 text-fg`:`text-muted`}`,children:[(0,A.jsx)(`span`,{className:`truncate`,children:e.label}),(0,A.jsx)(`span`,{className:`shrink-0 text-xs text-faint`,children:e.hint})]})},e.id))]}),(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-t border-line px-4 py-2 text-xs text-faint`,children:[(0,A.jsx)(`span`,{children:`↑↓ navigate · ↵ open · esc close`}),(0,A.jsx)(`span`,{className:`font-mono`,children:`⌘K`})]})]})]}):null}var st=()=>typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}`,q=new Map,J=(e,t,n)=>e.map(e=>e.id===t?n(e):e);function ct(e){return{config:{provider:e.config.provider,baseURL:e.config.baseURL,model:e.config.model}}}var lt=v()(h(e=>({open:!1,config:{provider:`anthropic`,baseURL:``,model:`claude-opus-4-8`,apiKey:``},messages:[],pending:[],busy:!1,setOpen:t=>e({open:t}),toggle:()=>e(e=>({open:!e.open})),setConfig:t=>e(e=>({config:{...e.config,...t}})),clear:()=>{for(let e of q.values())e(!1);q.clear(),e({messages:[],pending:[]})},cancelPending:()=>{for(let e of q.values())e(!1);q.clear(),e({pending:[]})},setBusy:t=>e({busy:t}),addUser:t=>e(e=>({messages:[...e.messages,{id:st(),role:`user`,content:t}]})),startAssistant:()=>{let t=st();return e(e=>({messages:[...e.messages,{id:t,role:`assistant`,content:``,tools:[]}]})),t},appendAssistant:(t,n)=>e(e=>({messages:J(e.messages,t,e=>({...e,content:e.content+n}))})),finishAssistant:(t,n)=>e(e=>({messages:J(e.messages,t,e=>({...e,error:!!n?.error,content:n?.error?e.content||n.error:e.content}))})),addTool:(t,n)=>e(e=>({messages:J(e.messages,t,e=>({...e,tools:[...e.tools??[],n]}))})),updateTool:(t,n,r)=>e(e=>({messages:J(e.messages,t,e=>({...e,tools:(e.tools??[]).map(e=>e.id===n?{...e,...r}:e)}))})),requestConfirm:t=>new Promise(n=>{let r=st();q.set(r,n),e(e=>({pending:[...e.pending,{...t,id:r}]}))}),resolveConfirm:(t,n)=>{let r=q.get(t);r&&(q.delete(t),r(n)),e(e=>({pending:e.pending.filter(e=>e.id!==t)}))}}),{name:`bq-dash-copilot`,partialize:e=>ct(e),merge:(e,t)=>{let n=e??{};return{...t,config:{...t.config,...n.config??{},apiKey:``}}}})),ut=(0,b.lazy)(()=>u(()=>import(`./CopilotPanel-BJeJYfaz.js`).then(e=>({default:e.CopilotPanel})),__vite__mapDeps([0,1,2,3])));function dt({className:e}){return(0,A.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`,children:[(0,A.jsx)(`path`,{d:`M12 3l1.9 4.6L18.5 9.5 13.9 11.4 12 16l-1.9-4.6L5.5 9.5l4.6-1.9L12 3z`,fill:`currentColor`}),(0,A.jsx)(`path`,{d:`M19 14l.8 2 2 .8-2 .8-.8 2-.8-2-2-.8 2-.8.8-2z`,fill:`currentColor`,opacity:`0.7`})]})}function ft(){let e=lt(e=>e.open),t=lt(e=>e.setOpen);return(0,A.jsxs)(A.Fragment,{children:[!e&&(0,A.jsxs)(`button`,{type:`button`,onClick:()=>t(!0),className:`fixed bottom-5 right-5 z-40 flex items-center gap-2 rounded-full border border-line bg-surface px-4 py-2.5 text-sm font-medium text-fg shadow-lg transition-colors hover:border-accent/50 hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,"aria-label":`Open Copilot`,children:[(0,A.jsx)(dt,{className:`size-4 text-accent`}),`Copilot`,(0,A.jsx)(`span`,{className:`rounded bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-accent`,children:`beta`})]}),e&&(0,A.jsx)(b.Suspense,{fallback:(0,A.jsx)(`div`,{className:`fixed inset-y-0 right-0 z-[60] flex w-full max-w-md items-center justify-center border-l border-line bg-surface text-sm text-muted`,children:`Loading Copilot…`}),children:(0,A.jsx)(ut,{})})]})}var pt={default:`border border-line bg-surface-2 text-fg hover:bg-surface-2/70 hover:border-line-strong`,ghost:`text-muted hover:text-fg hover:bg-surface-2`,accent:`bg-accent text-accent-fg hover:opacity-90 border border-transparent`,danger:`border border-red-500/30 text-danger hover:bg-red-500/10 hover:border-red-500/50`,warning:`border border-amber-500/30 text-warning hover:bg-amber-500/10 hover:border-amber-500/50`,success:`bg-emerald-500 text-white hover:bg-emerald-500/90 border border-transparent`},mt={sm:`h-8 px-3 text-xs gap-1.5`,md:`h-9 px-4 text-sm gap-2`};function ht({children:e,variant:n=`default`,size:r=`md`,className:i,...a}){return(0,A.jsx)(`button`,{type:`button`,className:t(`inline-flex items-center justify-center rounded-lg font-medium transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,`disabled:cursor-not-allowed disabled:opacity-50`,pt[n],mt[r],i),...a,children:e})}function gt({children:e,className:n,variant:r=`ghost`,...i}){return(0,A.jsx)(`button`,{type:`button`,className:t(`inline-flex size-8 items-center justify-center rounded-lg transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,`disabled:cursor-not-allowed disabled:opacity-50`,pt[r],n),...i,children:e})}function Y({children:e,className:n,padded:r=!0}){return(0,A.jsx)(`div`,{className:t(`rounded-xl border border-line bg-surface`,r&&`p-5`,n),children:e})}function _t({title:e,action:t,icon:n}){return(0,A.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,A.jsxs)(`h3`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[n,e]}),t]})}function vt({className:e}){return(0,A.jsx)(`span`,{className:t(`inline-block size-4 animate-spin rounded-full border-2 border-current border-t-transparent`,e),role:`status`,"aria-label":`Loading`})}function yt({label:e=`Loading…`}){return(0,A.jsxs)(`div`,{className:`flex items-center justify-center gap-3 py-16 text-sm text-muted`,children:[(0,A.jsx)(vt,{}),e]})}function bt({icon:e,title:t,hint:n,action:r}){return(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-line py-14 text-center`,children:[e&&(0,A.jsx)(`div`,{className:`text-faint [&>svg]:size-8`,children:e}),(0,A.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t}),n&&(0,A.jsx)(`div`,{className:`max-w-sm text-xs text-faint`,children:n}),r&&(0,A.jsx)(`div`,{className:`mt-2`,children:r})]})}function xt({onRetry:e,message:t=`Not connected to the bunqueue server — showing empty data.`}){return(0,A.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-500/25 bg-amber-500/[0.06] px-4 py-2.5 text-sm`,children:[(0,A.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,A.jsx)(`span`,{className:`text-amber-300/90 light:text-amber-700`,children:t}),e&&(0,A.jsx)(`button`,{type:`button`,onClick:e,className:`ml-auto shrink-0 rounded-md border border-amber-500/30 px-2.5 py-1 text-xs font-medium text-amber-200 light:text-amber-700 hover:border-amber-400/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`Retry`})]})}function St({error:e,onRetry:t}){return(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 rounded-xl border border-red-500/20 bg-red-500/5 py-14 text-center`,children:[(0,A.jsx)(`div`,{className:`text-sm font-medium text-danger`,children:`Something went wrong`}),(0,A.jsx)(`div`,{className:`max-w-md text-xs text-faint`,children:e.message}),t&&(0,A.jsx)(`button`,{type:`button`,onClick:t,className:`mt-1 rounded-lg border border-line bg-surface-2 px-3 py-1.5 text-xs font-medium text-fg hover:border-line-strong`,children:`Retry`})]})}var Ct=class extends b.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`ErrorBoundary caught an error`,e,t.componentStack)}componentDidUpdate(e){this.state.error&&e.resetKey!==this.props.resetKey&&this.setState({error:null})}render(){let{error:e}=this.state;return e?(0,A.jsx)(`div`,{className:`flex min-h-screen items-center justify-center p-6`,children:(0,A.jsxs)(Y,{className:`w-full max-w-lg`,children:[(0,A.jsx)(St,{error:e}),(0,A.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,A.jsx)(ht,{onClick:()=>window.location.reload(),children:`Reload`})})]})}):this.props.children}},wt={success:{bar:`bg-emerald-500`,title:`text-success`},error:{bar:`bg-red-500`,title:`text-danger`},info:{bar:`bg-accent`,title:`text-accent`}};function Tt({toast:e,dismiss:n}){(0,b.useEffect)(()=>{let t=window.setTimeout(()=>n(e.id),e.ttlMs);return()=>window.clearTimeout(t)},[e.id,e.ttlMs,n]);let r=wt[e.level];return(0,A.jsxs)(`div`,{className:`pointer-events-auto flex w-80 max-w-[calc(100vw-2rem)] overflow-hidden rounded-lg border border-line bg-surface shadow-lg`,children:[(0,A.jsx)(`span`,{className:t(`w-1 shrink-0`,r.bar),"aria-hidden":`true`}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3 px-3 py-2.5`,children:[(0,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsx)(`div`,{className:t(`text-sm font-medium`,r.title),children:e.title}),e.detail&&(0,A.jsx)(`div`,{className:`mt-0.5 break-words text-xs text-muted`,children:e.detail})]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>n(e.id),"aria-label":`Dismiss notification`,className:`-mr-1 shrink-0 rounded p-0.5 text-faint hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:(0,A.jsx)(z,{className:`size-4`})})]})]})}function Et(){let e=C(e=>e.toasts),t=C(e=>e.dismiss);return e.length===0?null:(0,A.jsx)(`section`,{className:`pointer-events-none fixed bottom-4 right-4 z-[60] flex flex-col gap-2`,"aria-label":`Notifications`,"aria-live":`polite`,children:e.map(e=>(0,A.jsx)(Tt,{toast:e,dismiss:t},e.id))})}var Dt=K(),Ot={"/":`Overview`,"/queues":`Queues`,"/jobs":`Jobs`,"/dlq":`Dead Letter Queue`,"/cron":`Cron Jobs`,"/flows":`Flows`,"/metrics":`Metrics`,"/workers":`Workers`,"/logs":`Logs`,"/server":`Server`,"/add-job":`Add Job`,"/jobs/bulk-add":`Bulk Add Jobs`,"/job":`Job Inspector`,"/queue-control":`Queue Control`,"/dlq-control":`DLQ Control`,"/webhooks":`Webhooks`,"/diagnostics":`Diagnostics`,"/alerts":`Alerts`,"/benchmark":`Benchmark`,"/database":`Database`,"/mcp":`MCP`,"/usage":`Usage`,"/s3":`S3 Backup`,"/settings":`Settings`,"/overview-classic":`Overview (classic)`,"/queues-classic":`Queues (classic)`,"/jobs-classic":`Jobs (classic)`,"/dlq-classic":`DLQ (classic)`,"/metrics-classic":`Metrics (classic)`,"/logs-classic":`Logs (classic)`,"/s3-classic":`S3 Backup (classic)`};function kt(e){if(Ot[e])return Ot[e];if(e.startsWith(`/queues/`)){let t=e.slice(8);try{t=decodeURIComponent(t)}catch{}return`${t} · Queue`}return`bunqueue`}function At({onMenu:e,navOpen:t=!1}){let{pathname:n}=o();return(0,A.jsxs)(`header`,{className:`sticky top-0 z-10 flex h-14 items-center justify-between gap-3 border-b border-line bg-bg/80 px-4 backdrop-blur sm:px-6 lg:px-8`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,A.jsx)(`button`,{type:`button`,"aria-label":`Open navigation`,"aria-expanded":t,"aria-controls":`app-nav`,onClick:e,className:`-ml-1 flex size-9 shrink-0 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 lg:hidden`,children:(0,A.jsx)(He,{className:`size-5`})}),(0,A.jsxs)(`div`,{className:`truncate text-sm text-muted`,children:[(0,A.jsx)(`span`,{className:`text-faint`,children:kt(n)}),(0,A.jsx)(`span`,{className:`mx-2 hidden text-faint sm:inline`,children:`·`}),(0,A.jsx)(`span`,{className:`hidden text-faint sm:inline`,children:`bunqueue`})]})]}),(0,A.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[Dt&&(0,A.jsxs)(`span`,{title:`Showing canned sample data. No real bunqueue server is connected.`,className:`hidden items-center gap-1.5 rounded-full border border-accent/40 bg-accent/10 px-2.5 py-1 text-xs font-medium text-accent sm:inline-flex`,children:[(0,A.jsx)(`span`,{className:`size-1.5 rounded-full bg-accent`}),`Live demo`]}),(0,A.jsx)(`button`,{type:`button`,onClick:()=>window.dispatchEvent(new Event(`command-palette:open`)),title:`Command palette`,"aria-label":`Open command palette`,className:`flex size-9 shrink-0 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:hidden`,children:(0,A.jsx)(Re,{className:`size-5`})}),(0,A.jsxs)(`button`,{type:`button`,onClick:()=>window.dispatchEvent(new Event(`command-palette:open`)),title:`Command palette (⌘K)`,"aria-label":`Open command palette`,className:`hidden items-center gap-2 rounded-lg border border-line px-2.5 py-1.5 text-xs text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 sm:flex`,children:[(0,A.jsx)(`span`,{children:`Search`}),(0,A.jsx)(`kbd`,{className:`rounded border border-line bg-surface-2 px-1 font-mono text-[10px]`,children:`⌘K`})]}),(0,A.jsx)(d,{to:`/settings`,title:`Settings`,"aria-label":`Open settings`,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-accent to-fuchsia-600 text-xs font-bold text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`bq`})]})]})}function jt(){let[e,n]=(0,b.useState)(!1),{pathname:r,key:i}=o();return(0,b.useEffect)(()=>n(!1),[r]),(0,b.useEffect)(()=>{let e=window.matchMedia(`(min-width: 1024px)`),t=()=>e.matches&&n(!1);return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,b.useEffect)(()=>{if(!e)return;let t=e=>{e.key===`Escape`&&n(!1)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]),(0,b.useEffect)(()=>{if(!e)return;let t=document.activeElement,n=()=>{let e=document.getElementById(`app-nav`);return e?Array.from(e.querySelectorAll(`a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])`)):[]};n()[0]?.focus();let r=e=>{if(e.key!==`Tab`)return;let t=n();if(!t.length)return;let r=t[0],i=t[t.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),i.focus()):!e.shiftKey&&document.activeElement===i&&(e.preventDefault(),r.focus())};return window.addEventListener(`keydown`,r),()=>{window.removeEventListener(`keydown`,r),t?.focus?.()}},[e]),(0,A.jsx)(Ct,{children:(0,A.jsxs)(`div`,{className:`flex h-screen overflow-hidden bg-bg text-fg`,children:[(0,A.jsx)(`a`,{href:`#main`,className:`sr-only rounded-md bg-accent px-3 py-2 text-sm font-medium text-accent-fg shadow-lg focus:not-sr-only focus:absolute focus:left-4 focus:top-3 focus:z-50`,children:`Skip to content`}),(0,A.jsx)(it,{open:e,onClose:()=>n(!1)}),(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,A.jsx)(At,{navOpen:e,onMenu:()=>n(!0)}),(0,A.jsx)(`main`,{id:`main`,tabIndex:-1,className:t(`flex-1 px-4 pt-5 pb-24 outline-none sm:px-6 lg:px-8 lg:pt-6`,e?`overflow-hidden`:`overflow-y-auto`),children:(0,A.jsx)(b.Suspense,{fallback:(0,A.jsx)(`div`,{className:`p-2 text-sm text-muted`,children:`Loading…`}),children:(0,A.jsx)(Ct,{resetKey:i,children:(0,A.jsx)(l,{})})})})]}),(0,A.jsx)(ot,{}),(0,A.jsx)(ye,{}),(0,A.jsx)(ft,{}),(0,A.jsx)(Et,{}),(0,A.jsx)(ve,{})]})})}var Mt={completed:`text-success bg-emerald-500/10`,active:`text-blue-400 light:text-blue-700 bg-blue-500/10`,failed:`text-danger bg-red-500/10`,waiting:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`,prioritized:`text-violet-400 light:text-violet-700 bg-violet-500/10`,delayed:`text-warning bg-amber-500/10`,paused:`text-orange-400 light:text-orange-700 bg-orange-500/10`,"waiting-children":`text-cyan-400 light:text-cyan-700 bg-cyan-500/10`,stalled:`text-orange-400 light:text-orange-700 bg-orange-500/10`,enqueued:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`,started:`text-blue-400 light:text-blue-700 bg-blue-500/10`,finished:`text-success bg-emerald-500/10`,retry:`text-warning bg-amber-500/10`,cancelled:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`,default:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`};function Nt({status:e}){return(0,A.jsxs)(`span`,{className:t(`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium capitalize`,Mt[(e||``).toLowerCase()]??Mt.default),children:[(0,A.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),e||`unknown`]})}function Pt({label:e,tone:n=`green`}){return(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-muted`,children:[(0,A.jsx)(`span`,{className:t(`size-1.5 rounded-full`,n===`green`?`bg-emerald-400`:n===`amber`?`bg-amber-400`:n===`red`?`bg-red-400`:`bg-zinc-400`)}),e]})}function Ft({title:e,description:t,live:n,actions:r,back:i}){return(0,A.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-start justify-between gap-4`,children:[(0,A.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i,(0,A.jsxs)(`div`,{children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`h1`,{className:`text-2xl font-bold tracking-tight text-fg`,children:e}),n&&(0,A.jsx)(Pt,{label:`Live`,tone:`green`})]}),t&&(0,A.jsx)(`p`,{className:`mt-1 text-sm text-muted`,children:t})]})]}),r&&(0,A.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:r})]})}var It={default:`text-fg`,green:`text-success`,red:`text-danger`,blue:`text-blue-400 light:text-blue-700`,amber:`text-warning`,accent:`text-accent`};function X({label:e,value:n,tone:r=`default`,hint:i,compact:a}){return(0,A.jsxs)(`div`,{className:t(`rounded-xl border border-line bg-surface`,a?`px-4 py-3`:`px-5 py-4`),children:[(0,A.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e}),(0,A.jsx)(`div`,{className:t(`mt-2 font-semibold tnum`,a?`text-xl`:`text-3xl`,It[r]),children:n}),i!=null&&(0,A.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:i})]})}var Lt=new Intl.NumberFormat(`de-DE`),Rt=new Intl.DateTimeFormat(`it-IT`,{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function Z(e){return e==null||!Number.isFinite(e)?`0`:Lt.format(e)}function zt(e,t=2){return e==null||!Number.isFinite(e)?`0%`:`${(e*100).toFixed(t)}%`}function Bt(e,t){let n=e+t;return n>0?t/n:null}function Vt(e){if(e==null||!Number.isFinite(e))return`—`;let t=new Date(e);return Number.isNaN(t.getTime())?`—`:Rt.format(t)}function Ht(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function Ut(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;if(e<1e3)return`${Math.round(e)}ms`;let t=e/1e3;if(t<59.95)return`${t.toFixed(1)}s`;let n=Math.round(t);return`${Math.floor(n/60)}m ${n%60}s`}function Wt(e,t){if(e==null||t==null)return;let n=t-e;return n>=0?n:void 0}function Gt(e){if(e==null||!Number.isFinite(e))return`—`;let t=Math.floor(e),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=[];return n&&a.push(`${n}d`),(r||n)&&a.push(`${r}h`),a.push(`${i}m`),a.join(` `)}function Kt(e){return e==null||!Number.isFinite(e)?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function qt(e){return e==null||!Number.isFinite(e)?`—`:e>=1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(+(e<10))}ms`}var Jt=/(?:\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b[@-Z\\^_])/g;function Yt(e){return e.replace(Jt,``)}function Xt(e){if(e==null||!Number.isFinite(e))return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function Zt(e){return!0}function Qt(e){let t=`message`,n,r=[];for(let i of e.split(`
|
|
3
|
-
`)){if(!i||i.startsWith(`:`))continue;let e=i.indexOf(`:`),a=e===-1?i:i.slice(0,e),o=e===-1?``:i.slice(e+1).replace(/^ /,``);a===`event`?t=o:a===`data`?r.push(o):a===`id`&&(n=o)}if(r.length===0)return null;let i=r.join(`
|
|
4
|
-
`),a=i;try{a=JSON.parse(i)}catch{}return{id:n,event:t,data:a}}async function $t(e,t,n){let r=await fetch(e,{headers:{Accept:`text/event-stream`,..._()},signal:n});if(!r.ok||!r.body)throw Error(`SSE connect failed: HTTP ${r.status}`);let i=r.body.getReader(),a=new TextDecoder,o=``;try{for(;;){let{done:e,value:n}=await i.read();if(e)break;o+=a.decode(n,{stream:!0});let r;for(;(r=o.indexOf(`
|
|
5
|
-
|
|
6
|
-
`))!==-1||(r=o.indexOf(`\r
|
|
7
|
-
\r
|
|
8
|
-
`))!==-1;){let e=o[r]===`\r`,n=o.slice(0,r);o=o.slice(r+(e?4:2));let i=Qt(n.replace(/\r/g,``));i&&t(i)}}}finally{i.releaseLock()}}var Q={total:0,completed:0,failed:0,waiting:0,active:0},en=250;function tn(e){let t=e.includes(`:`)?e.split(`:`)[1]:e;switch(t){case`pushed`:case`added`:return`waiting`;case`pulled`:return`active`;case`progress`:return`active`;default:return t}}function nn(e){let t=g(e=>e.baseUrl),n=g(e=>e.token),[r,i]=(0,b.useState)([]),[a,o]=(0,b.useState)(Q),[s,c]=(0,b.useState)(0),[l,u]=(0,b.useState)(!1),d=(0,b.useRef)([]),f=(0,b.useRef)([]),p=(0,b.useRef)({...Q});return(0,b.useEffect)(()=>{let t=new AbortController,n=0,r=!1;i([]),o(Q),d.current=[],f.current=[],p.current={...Q};let a=e=>new Promise(n=>{let r=()=>{clearTimeout(i),n()},i=setTimeout(()=>{t.signal.removeEventListener(`abort`,r),n()},e);t.signal.addEventListener(`abort`,r,{once:!0})}),s=e=>{if(Zt(e)&&u(!0),!e.event.startsWith(`job:`))return;let t=e.data??{},r=tn(e.event),i={seq:++n,event:e.event,queue:t.queue,jobId:t.jobId,name:t.name,status:r,timestamp:t.timestamp??Date.now(),error:t.error,progress:t.progress};f.current.push(i);let a=p.current;a.total+=1,r===`completed`?a.completed+=1:r===`failed`?a.failed+=1:r===`waiting`?a.waiting+=1:r===`active`&&(a.active+=1),d.current.push(Date.now())};(async()=>{for(;!r;){try{await $t(G.eventsUrl(e),s,t.signal)}catch{}if(r)break;u(!1),await a(2e3)}})();let c=setInterval(()=>{if(f.current.length){let e=f.current;f.current=[],e.reverse(),i(t=>[...e,...t].slice(0,en))}let e=p.current;e.total&&(p.current={...Q},o(t=>({total:t.total+e.total,completed:t.completed+e.completed,failed:t.failed+e.failed,waiting:t.waiting+e.waiting,active:t.active+e.active})))},150);return()=>{r=!0,t.abort(),clearInterval(c),u(!1)}},[e,t,n]),(0,b.useEffect)(()=>{let e=setInterval(()=>{let e=Date.now();d.current=d.current.filter(t=>e-t<5e3),c(d.current.length/5)},1e3);return()=>clearInterval(e)},[]),{events:r,counters:a,throughput:s,connected:l}}var rn={overview:{stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},throughput:{pushPerSec:0,pullPerSec:0,completePerSec:0,failPerSec:0},memory:{heapUsed:0,heapTotal:0,rss:0},crons:{total:0}},queuesTotal:0,details:[],failedTotal:0},an=100;function on(){let e=g(e=>e.baseUrl),n=(0,b.useRef)(null),{data:r,error:i,loading:a,refetch:o}=qe(async()=>{let[e,t]=await Promise.all([k.overview(),k.queuesSummary()]),r=[...t].sort((e,t)=>(t.counts?.failed??0)-(e.counts?.failed??0)||(t.counts?.waiting??0)-(e.counts?.waiting??0)).slice(0,6).map(e=>({name:e.name,paused:e.paused,counts:e.counts})),i=t.reduce((e,t)=>e+(t.counts?.failed??0),0);return n.current=Date.now(),{overview:e,queuesTotal:t.length,details:r,failedTotal:i}},[]);if(a&&!r&&!i)return(0,A.jsx)(yt,{label:`Loading overview…`});let{overview:s,queuesTotal:c,details:l,failedTotal:u}=r??rn,{stats:f,throughput:p,memory:m,crons:h}=s,_=Bt(f.completed,u),v=e===`/api`?`localhost:6790`:e.replace(/^https?:\/\//,``),y=f.uptime?Gt(f.uptime/1e3):`—`,ee=Xt(m.rss*1024*1024),x=!!i;return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(Ft,{title:`Overview`,description:`Real-time system health at a glance.`,live:!0}),i&&(0,A.jsx)(xt,{onRetry:o}),(0,A.jsxs)(`div`,{className:t(`mb-6 flex flex-wrap items-center justify-between gap-y-2 rounded-xl border px-5 py-4`,x?`border-amber-500/25 bg-amber-500/[0.06]`:`border-emerald-500/25 bg-emerald-500/[0.06]`),children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,A.jsxs)(`span`,{className:`relative flex size-2.5`,children:[!x&&(0,A.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-emerald-400 opacity-60`}),(0,A.jsx)(`span`,{className:t(`relative inline-flex size-2.5 rounded-full`,x?`bg-amber-400`:`bg-emerald-400`)})]}),(0,A.jsxs)(`div`,{className:`min-w-0`,children:[(0,A.jsx)(`div`,{className:t(`font-semibold`,x?`text-warning`:`text-success`),children:x?`Connection lost — showing last known data`:`bunqueue server connected`}),(0,A.jsxs)(`div`,{className:`truncate font-mono text-xs text-muted`,children:[v,` · uptime `,y,` · `,ee,` RAM`,x&&(0,A.jsxs)(A.Fragment,{children:[` `,`· last updated `,n.current?Ht(n.current):`never`]})]})]})]}),(0,A.jsx)(`span`,{className:t(`rounded-full px-3 py-1 text-xs font-medium`,x?`bg-amber-500/15 text-warning`:`bg-emerald-500/15 text-success`),children:x?`Stale`:`Online`})]}),(0,A.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-3`,children:[(0,A.jsx)(X,{label:`Error Rate`,value:_==null?`—`:zt(_),tone:_==null?`default`:_>.05?`red`:`green`,hint:`failed / processed`}),(0,A.jsx)(X,{label:`Failed`,value:Z(u),tone:u?`red`:`default`,hint:`recorded across queues`}),(0,A.jsx)(X,{label:`DLQ`,value:Z(f.dlq),tone:f.dlq?`red`:`default`,hint:`dead-lettered jobs`})]}),(0,A.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,A.jsx)(X,{label:`Completed`,value:Z(f.completed),tone:`green`,compact:!0}),(0,A.jsx)(X,{label:`Active`,value:Z(f.active),tone:`blue`,compact:!0}),(0,A.jsx)(X,{label:`Waiting`,value:Z(f.waiting),tone:f.waiting>an?`amber`:`default`,compact:!0}),(0,A.jsx)(X,{label:`Push/sec`,value:p.pushPerSec.toFixed(1),tone:`accent`,hint:`${Kt(f.totalPushed)} since restart`,compact:!0}),(0,A.jsx)(X,{label:`Pull/sec`,value:p.pullPerSec.toFixed(1),tone:`accent`,hint:`${Kt(f.totalPulled)} since restart`,compact:!0}),(0,A.jsx)(X,{label:`Queues`,value:Z(c),hint:`${h.total} cron active`,compact:!0})]}),(0,A.jsxs)(`div`,{className:`mt-8`,children:[(0,A.jsx)(cn,{title:`Queue Health — most loaded`,to:`/queues`}),l.length===0?(0,A.jsx)(Y,{children:(0,A.jsx)(`p`,{className:`py-4 text-center text-sm text-faint`,children:`No queues yet.`})}):(0,A.jsx)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:l.map(e=>(0,A.jsxs)(d,{to:`/queues/${encodeURIComponent(e.name)}`,className:`rounded-xl border border-line bg-surface p-4 transition-colors hover:border-line-strong`,children:[(0,A.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,A.jsx)(`span`,{className:`truncate font-mono text-sm font-medium text-accent`,children:e.name}),(0,A.jsx)(`span`,{className:t(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-success`),children:e.paused?`paused`:`active`})]}),(0,A.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 font-mono text-xs text-faint`,children:[(0,A.jsx)($,{label:`W`,value:e.counts?.waiting,tone:`text-warning`}),(0,A.jsx)($,{label:`A`,value:e.counts?.active,tone:`text-blue-400`}),(0,A.jsx)($,{label:`C`,value:e.counts?.completed,tone:`text-success`}),(0,A.jsx)($,{label:`F`,value:e.counts?.failed,tone:`text-danger`})]})]},e.name))})]}),(0,A.jsx)(sn,{})]})}function sn(){let{events:e,connected:n}=nn();return(0,A.jsxs)(`div`,{className:`mt-8`,children:[(0,A.jsx)(cn,{title:`Recent Activity`,to:`/logs`}),(0,A.jsxs)(Y,{padded:!1,children:[!n&&e.length>0&&(0,A.jsx)(`p`,{className:`border-b border-line px-5 py-2 text-xs text-warning`,children:`Event stream disconnected — reconnecting…`}),e.length===0?(0,A.jsx)(`p`,{className:`py-8 text-center text-sm text-faint`,children:n?`Waiting for live activity…`:`Connecting to the event stream…`}):(0,A.jsx)(`ul`,{className:`divide-y divide-line`,children:e.slice(0,8).map(e=>(0,A.jsxs)(`li`,{className:`flex items-center justify-between px-5 py-3`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`span`,{className:t(`size-2 rounded-full`,ln(e.status))}),(0,A.jsxs)(`div`,{className:`text-sm`,children:[(0,A.jsx)(`span`,{className:`font-mono font-medium text-fg`,children:e.queue||`—`}),(0,A.jsx)(`span`,{className:`text-faint`,children:` · `}),(0,A.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:e.jobId?e.jobId.slice(0,8):`—`}),(0,A.jsx)(`span`,{className:`text-faint`,children:` · `}),(0,A.jsx)(`span`,{className:`capitalize text-muted`,children:e.status})]})]}),(0,A.jsx)(`span`,{className:`text-xs text-faint`,children:Ht(e.timestamp)})]},e.seq))})]})]})}function cn({title:e,to:t}){return(0,A.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,A.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:e}),(0,A.jsxs)(d,{to:t,className:`flex items-center gap-1 text-sm text-muted hover:text-fg`,children:[`View All `,(0,A.jsx)(B,{className:`size-3.5`})]})]})}function $({label:e,value:n,tone:r}){return(0,A.jsxs)(`span`,{children:[e,` `,(0,A.jsx)(`span`,{className:t(`tnum font-semibold`,r),children:n==null?`—`:Z(n)})]})}function ln(e){switch(e){case`completed`:return`bg-emerald-400`;case`failed`:return`bg-red-400`;case`active`:return`bg-blue-400`;case`waiting`:return`bg-amber-400`;default:return`bg-accent`}}function un(){return(0,A.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3 py-24 text-center`,children:[(0,A.jsx)(`div`,{className:`text-5xl font-bold text-faint`,children:`404`}),(0,A.jsx)(`p`,{className:`text-sm text-muted`,children:`This page does not exist.`}),(0,A.jsx)(d,{to:`/`,className:`rounded-lg border border-line bg-surface-2 px-4 py-2 text-sm font-medium text-fg hover:border-line-strong`,children:`Back to Overview`})]})}var dn=(0,b.lazy)(()=>u(()=>import(`./AddJob-UCSTFuum.js`).then(e=>({default:e.AddJob})),__vite__mapDeps([4,1,2,3]))),fn=(0,b.lazy)(()=>u(()=>import(`./Benchmark-B1VUJJLw.js`).then(e=>({default:e.Benchmark})),__vite__mapDeps([5,1,2,6,3,7]))),pn=(0,b.lazy)(()=>u(()=>import(`./BulkAddJobs-DVgkRtrp.js`).then(e=>({default:e.BulkAddJobs})),__vite__mapDeps([8,1,2,3]))),mn=(0,b.lazy)(()=>u(()=>import(`./CronManager-C6kjWCLE.js`).then(e=>({default:e.CronManager})),__vite__mapDeps([9,1,2,3,10]))),hn=(0,b.lazy)(()=>u(()=>import(`./Database-BYZ8LJb5.js`).then(e=>({default:e.Database})),__vite__mapDeps([11,1,2,3,10]))),gn=(0,b.lazy)(()=>u(()=>import(`./Diagnostics-Dk1ErNCF.js`).then(e=>({default:e.Diagnostics})),__vite__mapDeps([12,1,2]))),_n=(0,b.lazy)(()=>u(()=>import(`./DlqControl-DUturU7q.js`).then(e=>({default:e.DlqControl})),__vite__mapDeps([13,1,2,3,10,14]))),vn=(0,b.lazy)(()=>u(()=>import(`./DlqPro-D8DOy5MI.js`).then(e=>({default:e.DlqPro})),__vite__mapDeps([15,1,2,3,10,14,16]))),yn=(0,b.lazy)(()=>u(()=>import(`./Flows-DP9-h7a0.js`).then(e=>({default:e.Flows})),__vite__mapDeps([17,1,2]))),bn=(0,b.lazy)(()=>u(()=>import(`./JobInspector-BHZtkFL6.js`).then(e=>({default:e.JobInspector})),__vite__mapDeps([18,1,2,3,14,19]))),xn=(0,b.lazy)(()=>u(()=>import(`./JobsPro-C2Vc2iRC.js`).then(e=>({default:e.JobsPro})),__vite__mapDeps([20,1,2,3,10,14,19]))),Sn=(0,b.lazy)(()=>u(()=>import(`./LogsPro-BpSZaHzN.js`).then(e=>({default:e.LogsPro})),__vite__mapDeps([21,1,2,3,10]))),Cn=(0,b.lazy)(()=>u(()=>import(`./McpServer-MfQ0qsAI.js`).then(e=>({default:e.McpServer})),__vite__mapDeps([22,2,1]))),wn=(0,b.lazy)(()=>u(()=>import(`./MetricsPro-Bt9zLjkN.js`).then(e=>({default:e.MetricsPro})),__vite__mapDeps([23,1,2,10,7,24]))),Tn=(0,b.lazy)(()=>u(()=>import(`./QueueControl-CEXlJDkE.js`).then(e=>({default:e.QueueControl})),__vite__mapDeps([25,1,2,3,26]))),En=(0,b.lazy)(()=>u(()=>import(`./QueueDetailPro-CuVyxX4Z.js`).then(e=>({default:e.QueueDetailPro})),__vite__mapDeps([27,1,2,7,24,26,3]))),Dn=(0,b.lazy)(()=>u(()=>import(`./QueuesOverview-DfRqAfS1.js`).then(e=>({default:e.QueuesOverview})),__vite__mapDeps([28,1,2,10,16]))),On=(0,b.lazy)(()=>u(()=>import(`./S3BackupPro-V3JNhUK8.js`).then(e=>({default:e.S3BackupPro})),__vite__mapDeps([29,1,2,6,3]))),kn=(0,b.lazy)(()=>u(()=>import(`./ServerControl-DXidWdsq.js`).then(e=>({default:e.ServerControl})),__vite__mapDeps([30,1,2,3]))),An=(0,b.lazy)(()=>u(()=>import(`./UsagePro-CbVFCD3J.js`).then(e=>({default:e.UsagePro})),__vite__mapDeps([31,2,1]))),jn=(0,b.lazy)(()=>u(()=>import(`./Webhooks-Dr0oBZr9.js`).then(e=>({default:e.Webhooks})),__vite__mapDeps([32,1,2,3,10]))),Mn=(0,b.lazy)(()=>u(()=>import(`./WorkersPro-BRYPAhyx.js`).then(e=>({default:e.WorkersPro})),__vite__mapDeps([33,1,2]))),Nn=(0,b.lazy)(()=>u(()=>import(`./Alerts-CofRabaP.js`).then(e=>({default:e.Alerts})),__vite__mapDeps([34,1,2,3]))),Pn=(0,b.lazy)(()=>u(()=>import(`./Cron-CqlZj2V5.js`).then(e=>({default:e.Cron})),__vite__mapDeps([35,1,2,10]))),Fn=(0,b.lazy)(()=>u(()=>import(`./Dlq-DANXiXsm.js`).then(e=>({default:e.Dlq})),__vite__mapDeps([36,1,2,3,10]))),In=(0,b.lazy)(()=>u(()=>import(`./Jobs-Bgr-HRmL.js`).then(e=>({default:e.Jobs})),__vite__mapDeps([37,1,2,3]))),Ln=(0,b.lazy)(()=>u(()=>import(`./Logs-CaOn3IpL.js`).then(e=>({default:e.Logs})),__vite__mapDeps([38,1,2,3,10]))),Rn=(0,b.lazy)(()=>u(()=>import(`./Metrics-C4Dwg_DP.js`).then(e=>({default:e.Metrics})),__vite__mapDeps([39,2,1]))),zn=(0,b.lazy)(()=>u(()=>import(`./Overview-BO3xG6I0.js`).then(e=>({default:e.Overview})),__vite__mapDeps([40,2,1]))),Bn=(0,b.lazy)(()=>u(()=>import(`./QueueDetail-wjRLlCYY.js`).then(e=>({default:e.QueueDetail})),__vite__mapDeps([41,1,2,3]))),Vn=(0,b.lazy)(()=>u(()=>import(`./Queues-2W2E6e5R.js`).then(e=>({default:e.Queues})),__vite__mapDeps([42,1,2,10]))),Hn=(0,b.lazy)(()=>u(()=>import(`./S3Backup-UQ_HKrn0.js`).then(e=>({default:e.S3Backup})),__vite__mapDeps([43,2,1]))),Un=(0,b.lazy)(()=>u(()=>import(`./Settings-0j8DZK9n.js`).then(e=>({default:e.Settings})),__vite__mapDeps([44,1,2,6,3]))),Wn=(0,b.lazy)(()=>u(()=>import(`./Usage-C5DsZvR5.js`).then(e=>({default:e.Usage})),__vite__mapDeps([45,2,1]))),Gn=(0,b.lazy)(()=>u(()=>import(`./Workers-Bwil4zIU.js`).then(e=>({default:e.Workers})),__vite__mapDeps([46,1,2,10])));function Kn(){return(0,A.jsx)(r,{children:(0,A.jsxs)(f,{element:(0,A.jsx)(jt,{}),children:[(0,A.jsx)(f,{path:`/`,element:(0,A.jsx)(on,{})}),(0,A.jsx)(f,{path:`/overview-classic`,element:(0,A.jsx)(zn,{})}),(0,A.jsx)(f,{path:`/queues`,element:(0,A.jsx)(Dn,{})}),(0,A.jsx)(f,{path:`/queues-classic`,element:(0,A.jsx)(Vn,{})}),(0,A.jsx)(f,{path:`/queues/:name`,element:(0,A.jsx)(En,{})}),(0,A.jsx)(f,{path:`/queues-classic/:name`,element:(0,A.jsx)(Bn,{})}),(0,A.jsx)(f,{path:`/jobs`,element:(0,A.jsx)(xn,{})}),(0,A.jsx)(f,{path:`/jobs-classic`,element:(0,A.jsx)(In,{})}),(0,A.jsx)(f,{path:`/dlq`,element:(0,A.jsx)(vn,{})}),(0,A.jsx)(f,{path:`/dlq-classic`,element:(0,A.jsx)(Fn,{})}),(0,A.jsx)(f,{path:`/cron`,element:(0,A.jsx)(mn,{})}),(0,A.jsx)(f,{path:`/cron-classic`,element:(0,A.jsx)(Pn,{})}),(0,A.jsx)(f,{path:`/flows`,element:(0,A.jsx)(yn,{})}),(0,A.jsx)(f,{path:`/metrics`,element:(0,A.jsx)(wn,{})}),(0,A.jsx)(f,{path:`/metrics-classic`,element:(0,A.jsx)(Rn,{})}),(0,A.jsx)(f,{path:`/workers`,element:(0,A.jsx)(Mn,{})}),(0,A.jsx)(f,{path:`/workers-classic`,element:(0,A.jsx)(Gn,{})}),(0,A.jsx)(f,{path:`/logs`,element:(0,A.jsx)(Sn,{})}),(0,A.jsx)(f,{path:`/logs-classic`,element:(0,A.jsx)(Ln,{})}),(0,A.jsx)(f,{path:`/server`,element:(0,A.jsx)(kn,{})}),(0,A.jsx)(f,{path:`/add-job`,element:(0,A.jsx)(dn,{})}),(0,A.jsx)(f,{path:`/jobs/bulk-add`,element:(0,A.jsx)(pn,{})}),(0,A.jsx)(f,{path:`/job`,element:(0,A.jsx)(bn,{})}),(0,A.jsx)(f,{path:`/queue-control`,element:(0,A.jsx)(Tn,{})}),(0,A.jsx)(f,{path:`/cron-manager`,element:(0,A.jsx)(n,{to:`/cron`,replace:!0})}),(0,A.jsx)(f,{path:`/dlq-control`,element:(0,A.jsx)(_n,{})}),(0,A.jsx)(f,{path:`/webhooks`,element:(0,A.jsx)(jn,{})}),(0,A.jsx)(f,{path:`/diagnostics`,element:(0,A.jsx)(gn,{})}),(0,A.jsx)(f,{path:`/alerts`,element:(0,A.jsx)(Nn,{})}),(0,A.jsx)(f,{path:`/benchmark`,element:(0,A.jsx)(fn,{})}),(0,A.jsx)(f,{path:`/database`,element:(0,A.jsx)(hn,{})}),(0,A.jsx)(f,{path:`/mcp`,element:(0,A.jsx)(Cn,{})}),(0,A.jsx)(f,{path:`/usage`,element:(0,A.jsx)(An,{})}),(0,A.jsx)(f,{path:`/usage-classic`,element:(0,A.jsx)(Wn,{})}),(0,A.jsx)(f,{path:`/s3`,element:(0,A.jsx)(On,{})}),(0,A.jsx)(f,{path:`/s3-classic`,element:(0,A.jsx)(Hn,{})}),(0,A.jsx)(f,{path:`/settings`,element:(0,A.jsx)(Un,{})}),(0,A.jsx)(f,{path:`*`,element:(0,A.jsx)(un,{})})]})})}be();var qn=document.getElementById(`root`);if(!qn)throw Error(`Root element #root not found`);function Jn(){(0,x.createRoot)(qn).render((0,A.jsx)(b.StrictMode,{children:(0,A.jsx)(c,{basename:`/`,children:(0,A.jsx)(Kn,{})})}))}K()?u(()=>import(`./install-DhTYJCUC.js`).then(e=>e.installDemo()),[]).catch(()=>{}).finally(Jn):Jn();export{de as $,qe as A,ze as B,_t as C,K as D,lt as E,Ne as F,P as G,Te as H,z as I,Re as J,Le as K,Se as L,B as M,Be as N,Ye as O,Me as P,fe as Q,I as R,Y as S,gt as T,Fe as U,R as V,Pe as W,L as X,Ie as Y,M as Z,Pt as _,Vt as a,S as at,yt as b,Z as c,Gt as d,w as et,Wt as f,Nt as g,Ft as h,Kt as i,re as it,G as j,Ke as k,zt as l,X as m,Bt as n,k as nt,Ut as o,Yt as p,De as q,Xt as r,ae as rt,qt as s,nn as t,ce as tt,Ht as u,bt as v,ht as w,xt as x,St as y,Ue as z};
|