bunqueue-dashboard 0.0.20 → 0.0.21

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.
Files changed (52) hide show
  1. package/dist/.vite/manifest.json +149 -149
  2. package/dist/assets/{AddJob-CaPckiUk.js → AddJob-BdBKp1lA.js} +2 -2
  3. package/dist/assets/{Alerts-B2c0ARdJ.js → Alerts-CBtbj7VF.js} +1 -1
  4. package/dist/assets/{AreaChart-DzUXW8u3.js → AreaChart-lY-mk5E1.js} +1 -1
  5. package/dist/assets/{Benchmark-BUCKbeuC.js → Benchmark-CWd91fdV.js} +1 -1
  6. package/dist/assets/{BulkAddJobs-BIUVhw79.js → BulkAddJobs-Db2Jz08R.js} +1 -1
  7. package/dist/assets/{CopilotPanel-krCimuWQ.js → CopilotPanel-Bo9KvCt-.js} +1 -1
  8. package/dist/assets/{CopyButton-DvGgfSEm.js → CopyButton-DhNun7Gi.js} +1 -1
  9. package/dist/assets/{Cron-DtuiCy5T.js → Cron-CgniaW__.js} +1 -1
  10. package/dist/assets/{CronManager-CorgubVA.js → CronManager-BfjJ7XRX.js} +1 -1
  11. package/dist/assets/{Database-D2Kg4jZ5.js → Database-m_cAcr3W.js} +1 -1
  12. package/dist/assets/{Diagnostics-B9eXpr9p.js → Diagnostics-DuuR1jQB.js} +1 -1
  13. package/dist/assets/{Dlq-DYBGJHQ7.js → Dlq-Mcb5cK1V.js} +1 -1
  14. package/dist/assets/{DlqControl-VeRgk2sV.js → DlqControl-982fUv41.js} +1 -1
  15. package/dist/assets/{DlqPro-D40bX5wt.js → DlqPro-CuC9E0_L.js} +1 -1
  16. package/dist/assets/{Flows-H8j_vUf9.js → Flows-DHM7TGds.js} +1 -1
  17. package/dist/assets/{JobInspector-CXzDoEVg.js → JobInspector-BH5O-C3Y.js} +1 -1
  18. package/dist/assets/{Jobs-CTYa9Wq9.js → Jobs-BStpSQDW.js} +1 -1
  19. package/dist/assets/{JobsPro-9JG9oKsi.js → JobsPro-blsDl4Et.js} +1 -1
  20. package/dist/assets/{Logs-D4_bxWwW.js → Logs-4alJwdiF.js} +1 -1
  21. package/dist/assets/{LogsPro-DjhlPDzs.js → LogsPro-B9T-oqAb.js} +1 -1
  22. package/dist/assets/{McpServer-BcNGlbb8.js → McpServer-EIQ0MSuW.js} +1 -1
  23. package/dist/assets/{Metrics-DDxWBIBZ.js → Metrics-vxs3mcKS.js} +1 -1
  24. package/dist/assets/{MetricsPro-DM__uhdn.js → MetricsPro-BbuSRbxq.js} +1 -1
  25. package/dist/assets/{Overview-bPieBOHN.js → Overview-HdSe2zeO.js} +1 -1
  26. package/dist/assets/{Pagination-B-6mVPUC.js → Pagination-Bm5HTIE3.js} +1 -1
  27. package/dist/assets/{QueueActions-DPqmozNf.js → QueueActions-BvXNsXKQ.js} +1 -1
  28. package/dist/assets/{QueueControl-Cxl_GKCw.js → QueueControl-C1lfn3lP.js} +1 -1
  29. package/dist/assets/{QueueDetail-BaehsuiZ.js → QueueDetail-Bx8hx-5F.js} +1 -1
  30. package/dist/assets/{QueueDetailPro-CDntEb4E.js → QueueDetailPro-C-DCfrRT.js} +1 -1
  31. package/dist/assets/{Queues-BXwcVq8b.js → Queues-C_Pt7-K2.js} +1 -1
  32. package/dist/assets/QueuesOverview-BT4B6ls7.js +1 -0
  33. package/dist/assets/{S3Backup-DKegjDS2.js → S3Backup-FzxBXfKG.js} +1 -1
  34. package/dist/assets/{S3BackupPro-BPop6lt3.js → S3BackupPro-BBx94VGs.js} +1 -1
  35. package/dist/assets/{ServerControl-ELjdOfy0.js → ServerControl-B7iVlX8g.js} +1 -1
  36. package/dist/assets/{Settings-CeRzvpaS.js → Settings-DNh5PdAt.js} +1 -1
  37. package/dist/assets/{Usage-nsrrx66q.js → Usage-DYa7HsgK.js} +1 -1
  38. package/dist/assets/{UsagePro-DTCHLKue.js → UsagePro-CNwxz-Dm.js} +1 -1
  39. package/dist/assets/{Webhooks-BSxGyZBk.js → Webhooks-Da3dnRY3.js} +1 -1
  40. package/dist/assets/{Workers-4FvLmhA2.js → Workers-B72sL29I.js} +1 -1
  41. package/dist/assets/{WorkersPro-EbCgSBaw.js → WorkersPro-D-p_yJi6.js} +1 -1
  42. package/dist/assets/{connectionStore-CCopJeU7.js → connectionStore-B-hNUqwK.js} +1 -1
  43. package/dist/assets/{form-PtDLk33Z.js → form-C-zZyKfB.js} +1 -1
  44. package/dist/assets/index-BRcFyrFG.js +8 -0
  45. package/dist/assets/react-vendor-B68RYDeC.js +11 -0
  46. package/dist/assets/{useThroughputSeries-D8wylrhf.js → useThroughputSeries-BhH_0wfd.js} +1 -1
  47. package/dist/index.html +3 -3
  48. package/package.json +2 -1
  49. package/scripts/embedded.gen.ts +104 -104
  50. package/dist/assets/QueuesOverview-CggwfR_n.js +0 -1
  51. package/dist/assets/index-DTo6fJH9.js +0 -8
  52. package/dist/assets/react-vendor-CHIHtdAC.js +0 -11
@@ -1,2 +1,2 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{d as t,m as n,r,t as i}from"./react-vendor-CHIHtdAC.js";import{$ as a,C as o,R as s,S as c,T as l,a as u,b as d,g as f,h as p,o as m,q as h,tt as g,w as _,y as v}from"./index-DTo6fJH9.js";import{a as y,n as b}from"./form-PtDLk33Z.js";import{t as x}from"./CopyButton-DvGgfSEm.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)(o,{title:`Actions`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.promote&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Promote`,()=>g.promoteJob(e.id)),children:`Promote (run now)`}),r.retryActive&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>g.retryJob(e.id)),children:`Retry (move to waiting)`}),r.retryDlq&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>g.retryDlq(e.queue??``,e.id)),children:`Retry from DLQ`}),r.requeueCompleted&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Requeue`,()=>g.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`,()=>g.moveToDelayed(e.id,t))}),r.discard&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Discard`,()=>g.discardJob(e.id)),children:`Discard (to DLQ)`}),r.setPriority&&(0,E.jsx)(D,{label:`Set priority`,cta:`Set`,disabled:t,onSubmit:t=>n(`Priority`,()=>g.changePriority(e.id,t))}),r.setDelay&&(0,E.jsx)(D,{label:`Set delay (ms)`,cta:`Delay`,disabled:t,onSubmit:t=>n(`Delay`,()=>g.changeDelay(e.id,t))}),r.fail&&(0,E.jsx)(O,{label:`Fail reason (optional)`,cta:`Fail`,variant:`warning`,disabled:t,onSubmit:t=>n(`Fail`,()=>g.failJob(e.id,t||void 0),`Force-fail this active job?`)}),r.cancel&&(0,E.jsx)(_,{variant:`danger`,size:`sm`,disabled:t,onClick:()=>n(`Cancel`,()=>g.cancelJob(e.id),`Cancel and remove this job?`),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)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(b,{type:`number`,value:i,onChange:e=>a(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(_,{size:`sm`,disabled:n||i.trim()===``,onClick:()=>r(Number(i)),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)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(b,{value:a,onChange:e=>o(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(_,{size:`sm`,variant:r,disabled:n,onClick:()=>{i(a),o(``)},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)(o,{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)(o,{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)`,a=t-n,s=j(e);return(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{title:`Backoff schedule`,action:(0,E.jsxs)(`span`,{className:`text-xs capitalize text-faint`,children:[i,r?.maxDelay?` · cap ${m(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:[`~`,m(e.delayMs)]})]},e.attempt))}),a>A&&(0,E.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Showing next `,A,` of `,a,` 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 `,m(r?.maxDelay??k),`.`]})]})}function N({jobId:e}){let[t,n]=(0,w.useState)(!1),[r,i]=(0,w.useState)(!1),[a,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 g.jobChildren(e)).data?.values),i(!0)}catch(e){f(e.message)}finally{s(!1)}},m=()=>{let e=!t;n(e),e&&!r&&!a&&p()},h=l&&typeof l==`object`?Array.isArray(l)?l.length:Object.keys(l).length:0;return(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{title:`Child values`,action:(0,E.jsx)(_,{size:`sm`,variant:`ghost`,onClick:m,children:t?`Hide`:`Show`})}),t?a?(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}):h===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)),[a,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)(o,{title:`Edit data`,action:(0,E.jsx)(_,{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`}),a&&(0,E.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:a})]})}function F({jobId:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(0),[a,s]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(``),[p,m]=(0,w.useState)(`info`),[h,v]=(0,w.useState)(!1),x=(0,w.useCallback)(async()=>{s(!0),u(null);try{let t=await g.jobLogs(e);n(t.data?.logs??[]),i(t.data?.count??0)}catch(e){u(e.message)}finally{s(!1)}},[e]);(0,w.useEffect)(()=>{x()},[x]);let S=async()=>{if(h)return;let t=d.trim();if(t){v(!0),u(null);try{await g.addJobLog(e,t,p),f(``),await x()}catch(e){u(e.message)}finally{v(!1)}}};return(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{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)(_,{size:`sm`,variant:`ghost`,disabled:a||h,onClick:x,children:`Refresh`}),(0,E.jsx)(_,{size:`sm`,variant:`danger`,disabled:h||t.length===0,onClick:async()=>{if(window.confirm(`Clear all logs for this job?`)){v(!0),u(null);try{await g.clearJobLogs(e),await x()}catch(e){u(e.message)}finally{v(!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)(b,{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)(y,{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)(_,{size:`sm`,disabled:h||d.trim()===``,onClick:S,children:`Add`})]})]})}function I({timeline:e}){let t=e??[];return(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{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)(f,{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`)??``),[b,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),[re,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(null),[W,G]=(0,w.useState)(!1),K=(0,w.useRef)(0),q=async(e,t=b,r=!1)=>{let i=e.trim();if(!i)return;let o=++K.current;L(!0),V(!1),r||U(null);try{let e=(await(t===`custom`?g.jobByCustomId(i):g.job(i))).job;if(!e){if(o!==K.current)return;O(null),A({fetched:!1,value:void 0}),V(!0),n({},{replace:!0});return}let r=e.state===`completed`?await g.jobResult(e.id).catch(()=>null):null;if(o!==K.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(o!==K.current)return;e instanceof a&&(e.status===404||/not found/i.test(e.message))?(O(null),A({fetched:!1,value:void 0}),V(!0),n({},{replace:!0})):U({ok:!1,text:e.message})}finally{o===K.current&&L(!1)}},J=e.get(`id`);(0,w.useEffect)(()=>{J&&J!==D?.id&&q(J,`id`)},[J,D?.id]);let Y=async(e,t,r)=>{if(!(r&&!window.confirm(r))&&D){G(!0),U(null);try{await t(),U({ok:!0,text:`${e} ✓`}),e===`Cancel`?(O(null),A({fetched:!1,value:void 0}),n({},{replace:!0})):await q(D.id,`id`,!0)}catch(e){U({ok:!1,text:e.message})}finally{G(!1)}}},X=D?.state,Z=D?te(D):null,Q=(D?.stacktrace?.length??0)>0,$=(D?.childrenIds?.length??0)>0;return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(p,{title:`Job Inspector`,description:`Look up any job by ID and drive its full lifecycle.`,actions:D?(0,E.jsxs)(E.Fragment,{children:[($||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)(_,{size:`sm`,onClick:()=>S(`job-${D.id}`,k.fetched?{...D,result:k.value}:D),children:[(0,E.jsx)(s,{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)(y,{value:b,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)(h,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,E.jsx)(`input`,{value:i,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&q(i),placeholder:b===`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)(_,{variant:`accent`,disabled:j,onClick:()=>q(i),children:`Look up`})]}),H&&(0,E.jsx)(`div`,{className:H.ok?`mb-4 text-sm text-success`:`mb-4 text-sm text-danger`,children:H.text}),j&&!D?(0,E.jsx)(d,{label:`Loading job…`}):re?(0,E.jsx)(v,{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)(x,{value:D.id})]}),(0,E.jsx)(`div`,{className:`mt-1 font-mono text-xs text-faint`,children:D.queue})]}),(0,E.jsx)(f,{status:X??`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:m(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)(x,{value:D.customId})]})]})]})]}),(0,E.jsx)(ne,{title:`Data`,value:D.data,filename:`job-${D.id}-data`}),(0,E.jsx)(P,{data:D.data,busy:W,onSave:e=>Y(`Data`,()=>g.updateJobData(D.id,e))}),X===`completed`&&(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{title:`Result`,action:k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(B,{value:k.value,filename:`job-${D.id}-result`}):void 0}),k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(z,{value:k.value}):(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No result stored for this job.`})]}),(Z||Q)&&(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{title:`Error`}),Z&&(0,E.jsxs)(`div`,{className:`mb-3`,children:[(0,E.jsx)(`p`,{className:`text-sm text-danger`,children:Z.message}),(0,E.jsxs)(`p`,{className:`mt-1 text-[11px] text-faint`,children:[Z.attempt==null?``:`Attempt ${Z.attempt} · `,u(Z.timestamp)]})]}),Q&&(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(`
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{$ as a,C as o,R as s,S as c,T as l,a as u,b as d,g as f,h as p,o as m,q as h,tt as g,w as _,y as v}from"./index-BRcFyrFG.js";import{a as y,n as b}from"./form-C-zZyKfB.js";import{t as x}from"./CopyButton-DhNun7Gi.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)(o,{title:`Actions`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.promote&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Promote`,()=>g.promoteJob(e.id)),children:`Promote (run now)`}),r.retryActive&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>g.retryJob(e.id)),children:`Retry (move to waiting)`}),r.retryDlq&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>g.retryDlq(e.queue??``,e.id)),children:`Retry from DLQ`}),r.requeueCompleted&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Requeue`,()=>g.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`,()=>g.moveToDelayed(e.id,t))}),r.discard&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Discard`,()=>g.discardJob(e.id)),children:`Discard (to DLQ)`}),r.setPriority&&(0,E.jsx)(D,{label:`Set priority`,cta:`Set`,disabled:t,onSubmit:t=>n(`Priority`,()=>g.changePriority(e.id,t))}),r.setDelay&&(0,E.jsx)(D,{label:`Set delay (ms)`,cta:`Delay`,disabled:t,onSubmit:t=>n(`Delay`,()=>g.changeDelay(e.id,t))}),r.fail&&(0,E.jsx)(O,{label:`Fail reason (optional)`,cta:`Fail`,variant:`warning`,disabled:t,onSubmit:t=>n(`Fail`,()=>g.failJob(e.id,t||void 0),`Force-fail this active job?`)}),r.cancel&&(0,E.jsx)(_,{variant:`danger`,size:`sm`,disabled:t,onClick:()=>n(`Cancel`,()=>g.cancelJob(e.id),`Cancel and remove this job?`),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)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(b,{type:`number`,value:i,onChange:e=>a(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(_,{size:`sm`,disabled:n||i.trim()===``,onClick:()=>r(Number(i)),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)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(b,{value:a,onChange:e=>o(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(_,{size:`sm`,variant:r,disabled:n,onClick:()=>{i(a),o(``)},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)(o,{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)(o,{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)`,a=t-n,s=j(e);return(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{title:`Backoff schedule`,action:(0,E.jsxs)(`span`,{className:`text-xs capitalize text-faint`,children:[i,r?.maxDelay?` · cap ${m(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:[`~`,m(e.delayMs)]})]},e.attempt))}),a>A&&(0,E.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Showing next `,A,` of `,a,` 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 `,m(r?.maxDelay??k),`.`]})]})}function N({jobId:e}){let[t,n]=(0,w.useState)(!1),[r,i]=(0,w.useState)(!1),[a,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 g.jobChildren(e)).data?.values),i(!0)}catch(e){f(e.message)}finally{s(!1)}},m=()=>{let e=!t;n(e),e&&!r&&!a&&p()},h=l&&typeof l==`object`?Array.isArray(l)?l.length:Object.keys(l).length:0;return(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{title:`Child values`,action:(0,E.jsx)(_,{size:`sm`,variant:`ghost`,onClick:m,children:t?`Hide`:`Show`})}),t?a?(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}):h===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)),[a,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)(o,{title:`Edit data`,action:(0,E.jsx)(_,{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`}),a&&(0,E.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:a})]})}function F({jobId:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(0),[a,s]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(``),[p,m]=(0,w.useState)(`info`),[h,v]=(0,w.useState)(!1),x=(0,w.useCallback)(async()=>{s(!0),u(null);try{let t=await g.jobLogs(e);n(t.data?.logs??[]),i(t.data?.count??0)}catch(e){u(e.message)}finally{s(!1)}},[e]);(0,w.useEffect)(()=>{x()},[x]);let S=async()=>{if(h)return;let t=d.trim();if(t){v(!0),u(null);try{await g.addJobLog(e,t,p),f(``),await x()}catch(e){u(e.message)}finally{v(!1)}}};return(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{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)(_,{size:`sm`,variant:`ghost`,disabled:a||h,onClick:x,children:`Refresh`}),(0,E.jsx)(_,{size:`sm`,variant:`danger`,disabled:h||t.length===0,onClick:async()=>{if(window.confirm(`Clear all logs for this job?`)){v(!0),u(null);try{await g.clearJobLogs(e),await x()}catch(e){u(e.message)}finally{v(!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)(b,{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)(y,{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)(_,{size:`sm`,disabled:h||d.trim()===``,onClick:S,children:`Add`})]})]})}function I({timeline:e}){let t=e??[];return(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{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)(f,{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`)??``),[b,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),[re,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(null),[W,G]=(0,w.useState)(!1),K=(0,w.useRef)(0),q=async(e,t=b,r=!1)=>{let i=e.trim();if(!i)return;let o=++K.current;L(!0),V(!1),r||U(null);try{let e=(await(t===`custom`?g.jobByCustomId(i):g.job(i))).job;if(!e){if(o!==K.current)return;O(null),A({fetched:!1,value:void 0}),V(!0),n({},{replace:!0});return}let r=e.state===`completed`?await g.jobResult(e.id).catch(()=>null):null;if(o!==K.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(o!==K.current)return;e instanceof a&&(e.status===404||/not found/i.test(e.message))?(O(null),A({fetched:!1,value:void 0}),V(!0),n({},{replace:!0})):U({ok:!1,text:e.message})}finally{o===K.current&&L(!1)}},J=e.get(`id`);(0,w.useEffect)(()=>{J&&J!==D?.id&&q(J,`id`)},[J,D?.id]);let Y=async(e,t,r)=>{if(!(r&&!window.confirm(r))&&D){G(!0),U(null);try{await t(),U({ok:!0,text:`${e} ✓`}),e===`Cancel`?(O(null),A({fetched:!1,value:void 0}),n({},{replace:!0})):await q(D.id,`id`,!0)}catch(e){U({ok:!1,text:e.message})}finally{G(!1)}}},X=D?.state,Z=D?te(D):null,Q=(D?.stacktrace?.length??0)>0,$=(D?.childrenIds?.length??0)>0;return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(p,{title:`Job Inspector`,description:`Look up any job by ID and drive its full lifecycle.`,actions:D?(0,E.jsxs)(E.Fragment,{children:[($||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)(_,{size:`sm`,onClick:()=>S(`job-${D.id}`,k.fetched?{...D,result:k.value}:D),children:[(0,E.jsx)(s,{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)(y,{value:b,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)(h,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,E.jsx)(`input`,{value:i,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&q(i),placeholder:b===`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)(_,{variant:`accent`,disabled:j,onClick:()=>q(i),children:`Look up`})]}),H&&(0,E.jsx)(`div`,{className:H.ok?`mb-4 text-sm text-success`:`mb-4 text-sm text-danger`,children:H.text}),j&&!D?(0,E.jsx)(d,{label:`Loading job…`}):re?(0,E.jsx)(v,{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)(x,{value:D.id})]}),(0,E.jsx)(`div`,{className:`mt-1 font-mono text-xs text-faint`,children:D.queue})]}),(0,E.jsx)(f,{status:X??`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:m(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)(x,{value:D.customId})]})]})]})]}),(0,E.jsx)(ne,{title:`Data`,value:D.data,filename:`job-${D.id}-data`}),(0,E.jsx)(P,{data:D.data,busy:W,onSave:e=>Y(`Data`,()=>g.updateJobData(D.id,e))}),X===`completed`&&(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{title:`Result`,action:k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(B,{value:k.value,filename:`job-${D.id}-result`}):void 0}),k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(z,{value:k.value}):(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No result stored for this job.`})]}),(Z||Q)&&(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{title:`Error`}),Z&&(0,E.jsxs)(`div`,{className:`mb-3`,children:[(0,E.jsx)(`p`,{className:`text-sm text-danger`,children:Z.message}),(0,E.jsxs)(`p`,{className:`mt-1 text-[11px] text-faint`,children:[Z.attempt==null?``:`Attempt ${Z.attempt} · `,u(Z.timestamp)]})]}),Q&&(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
2
  `)})]}),(0,E.jsx)(F,{jobId:D.id},`logs-${D.id}`),$&&(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)(ee,{job:D,busy:W,act:Y})]}):(0,E.jsx)(v,{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 z({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 B({value:e,filename:t}){return(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(x,{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)(s,{className:`size-3.5`})})]})}function ne({title:e,value:t,filename:n}){return(0,E.jsxs)(c,{children:[(0,E.jsx)(o,{title:e,action:(0,E.jsx)(B,{value:t,filename:n})}),(0,E.jsx)(z,{value:t})]})}export{L as JobInspector};
@@ -1 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{d as t,m as n,t as r}from"./react-vendor-CHIHtdAC.js";import{J as i,O as a,T as o,b as s,c,f as l,g as u,h as d,k as f,l as p,m,n as h,o as g,q as _,u as v,x as y}from"./index-DTo6fJH9.js";import{a as b,i as x}from"./form-PtDLk33Z.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}=a(()=>f.queues(500),[]),{data:j}=a(()=>f.overview(),[]),{data:M,error:N,loading:P,refetch:F}=a((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=>f.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?h(L.totalCompleted,L.totalFailed)??0:0,z=async e=>{if(window.confirm(`Cancel job ${e}?`))try{await f.cancelJob(e),F()}catch{}};return(0,C.jsxs)(`div`,{children:[N&&(0,C.jsx)(y,{onRetry:F}),(0,C.jsx)(d,{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)(m,{label:`Total`,value:c((L?.totalCompleted??0)+(L?.totalFailed??0)+(L?.waiting??0)+(L?.active??0)),compact:!0}),(0,C.jsx)(m,{label:`Waiting`,value:c(L?.waiting),tone:`amber`,compact:!0}),(0,C.jsx)(m,{label:`Active`,value:c(L?.active),tone:`blue`,compact:!0}),(0,C.jsx)(m,{label:`Completed`,value:c(L?.totalCompleted),tone:`green`,compact:!0}),(0,C.jsx)(m,{label:`Failed`,value:c(L?.totalFailed),tone:L?.totalFailed?`red`:`default`,compact:!0}),(0,C.jsx)(m,{label:`Error Rate`,value:p(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)(_,{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)(s,{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)(u,{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:g(l(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)(i,{className:`size-3.5`})})})]},`${e.queue}:${e.id}`))})]})})]})}export{E as Jobs};
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{J as i,O as a,T as o,b as s,c,f as l,g as u,h as d,k as f,l as p,m,n as h,o as g,q as _,u as v,x as y}from"./index-BRcFyrFG.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}=a(()=>f.queues(500),[]),{data:j}=a(()=>f.overview(),[]),{data:M,error:N,loading:P,refetch:F}=a((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=>f.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?h(L.totalCompleted,L.totalFailed)??0:0,z=async e=>{if(window.confirm(`Cancel job ${e}?`))try{await f.cancelJob(e),F()}catch{}};return(0,C.jsxs)(`div`,{children:[N&&(0,C.jsx)(y,{onRetry:F}),(0,C.jsx)(d,{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)(m,{label:`Total`,value:c((L?.totalCompleted??0)+(L?.totalFailed??0)+(L?.waiting??0)+(L?.active??0)),compact:!0}),(0,C.jsx)(m,{label:`Waiting`,value:c(L?.waiting),tone:`amber`,compact:!0}),(0,C.jsx)(m,{label:`Active`,value:c(L?.active),tone:`blue`,compact:!0}),(0,C.jsx)(m,{label:`Completed`,value:c(L?.totalCompleted),tone:`green`,compact:!0}),(0,C.jsx)(m,{label:`Failed`,value:c(L?.totalFailed),tone:L?.totalFailed?`red`:`default`,compact:!0}),(0,C.jsx)(m,{label:`Error Rate`,value:p(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)(_,{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)(s,{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)(u,{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:g(l(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)(i,{className:`size-3.5`})})})]},`${e.queue}:${e.id}`))})]})})]})}export{E as Jobs};
@@ -1 +1 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{d as n,m as r,r as i,t as a}from"./react-vendor-CHIHtdAC.js";import{G as o,J as ee,O as s,P as te,R as ne,T as c,U as re,a as ie,b as ae,c as l,g as u,h as oe,l as se,m as d,n as f,nt as p,o as m,q as ce,tt as h,w as g,x as le,z as ue}from"./index-DTo6fJH9.js";import{a as de,i as fe}from"./form-PtDLk33Z.js";import{t as pe}from"./Pagination-B-6mVPUC.js";import{t as me}from"./exportFile-tdUeW5m5.js";import{t as _}from"./jobActions-CuOdMglt.js";var v=e(r(),1),y=a(),b=[`all`,`waiting`,`active`,`completed`,`failed`],x=25;function he(e=0){return e>=10?{t:`HIGH`,c:`text-warning`}:e>=1?{t:`MEDIUM`,c:`text-blue-400`}:{t:`LOW`,c:`text-faint`}}function S(e){let t=_(e.state);return t.retryActive?h.retryJob(e.id):t.retryDlq?h.retryDlq(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not retryable`))}function C(){let[e]=n(),[r,a]=(0,v.useState)(e.get(`queue`)??``),[C,w]=(0,v.useState)(`all`),[T,ge]=(0,v.useState)(``),[E,D]=(0,v.useState)(0),[O,k]=(0,v.useState)(new Set),[A,j]=(0,v.useState)(new Set),[M,N]=(0,v.useState)(!1),[P,F]=(0,v.useState)(null),{data:I}=s(()=>h.queuesSummary(),[],{intervalMs:3e4}),{data:L}=s(()=>h.overview(),[],{intervalMs:1e4});(0,v.useEffect)(()=>{!r&&I?.length&&a(I[0].name)},[I,r]);let R=`${r}|${C}|${E}`,{data:z,error:B,loading:_e,refetch:V}=s((0,v.useCallback)(async()=>{if(!r)return{view:R,jobs:[]};let e=C===`all`?void 0:[C];return{view:R,jobs:((await h.jobsList(r,e,x,E*x)).jobs??[]).map(e=>({...e,queue:e.queue??r}))}},[r,C,E,R]),[r,C,E]),H=z&&z.view===R?z.jobs:null,ve=(H?.length??0)===x,U=(0,v.useMemo)(()=>{let e=T.trim().toLowerCase();return e?(H??[]).filter(t=>t.id.toLowerCase().includes(e)):H??[]},[H,T]),W=L?.stats,G=(0,v.useMemo)(()=>(I??[]).reduce((e,t)=>e+(t.counts?.failed??0),0),[I]),K=W?f(W.completed,G):null,q=e=>W?l(e):`—`,J=()=>D(0);(0,v.useEffect)(()=>{k(new Set)},[r,C,E]);let ye=e=>k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Y=U.length>0&&U.every(e=>O.has(e.id)),be=()=>k(()=>Y?new Set:new Set(U.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} ✓`})}catch(e){F({ok:!1,text:`${t} failed: ${e.message}`})}finally{j(t=>{let n=new Set(t);return n.delete(e.id),n}),V()}}},Z=async(e,t,n)=>{let r=U.filter(e=>O.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;F({ok:o===0,text:`${e}: ${a} succeeded${o?`, ${o} not eligible / failed`:``}`}),k(new Set),N(!1),V()},Q=U.filter(e=>O.has(e.id)),$={retry:Q.some(e=>{let t=_(e.state);return t.retryActive||t.retryDlq}),promote:Q.some(e=>_(e.state).promote),requeue:Q.some(e=>_(e.state).requeueCompleted),fail:Q.some(e=>_(e.state).fail),cancel:Q.some(e=>_(e.state).cancel)};return(0,y.jsxs)(`div`,{children:[(0,y.jsx)(oe,{title:`Jobs Explorer`,description:`Browse, inspect, and manage individual jobs.`,live:!0,actions:(0,y.jsxs)(g,{size:`sm`,disabled:!H||U.length===0,onClick:()=>{if(U.length===0){p.info(`No jobs to export on this page`);return}let e=U.map(e=>({id:e.id,queue:e.queue??r,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:``}));me(`jobs-${r}-${C}`,e,[`id`,`queue`,`state`,`priority`,`attempts`,`maxAttempts`,`createdAt`,`durationMs`])},children:[(0,y.jsx)(ne,{className:`size-3.5`}),` Export CSV`]})}),(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)(d,{label:`Total`,value:q((W?.completed??0)+G+(W?.waiting??0)+(W?.active??0)+(W?.delayed??0)),hint:`all queues`,compact:!0}),(0,y.jsx)(d,{label:`Waiting`,value:q(W?.waiting),tone:`amber`,compact:!0}),(0,y.jsx)(d,{label:`Active`,value:q(W?.active),tone:`blue`,compact:!0}),(0,y.jsx)(d,{label:`Completed`,value:q(W?.completed),tone:`green`,compact:!0}),(0,y.jsx)(d,{label:`Failed`,value:q(G),tone:G?`red`:`default`,compact:!0}),(0,y.jsx)(d,{label:`Error Rate`,value:K==null?`—`:se(K),tone:K==null?`default`:K>.05?`red`:`green`,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.jsx)(de,{value:r,"aria-label":`Queue`,onChange:e=>{a(e.target.value),J()},children:(I??[]).map(e=>(0,y.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),(0,y.jsx)(fe,{options:b,value:C,onChange:e=>{w(e),J()}}),(0,y.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,y.jsx)(ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,y.jsx)(`input`,{value:T,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`})]})]}),O.size>0&&(0,y.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,y.jsxs)(`span`,{className:`mr-1 text-muted`,children:[O.size,` selected`]}),$.retry&&(0,y.jsx)(g,{size:`sm`,disabled:M,onClick:()=>Z(`Retry`,S),children:`Retry selected`}),$.promote&&(0,y.jsx)(g,{size:`sm`,disabled:M,onClick:()=>Z(`Promote`,e=>_(e.state).promote?h.promoteJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not delayed`))),children:`Promote selected`}),$.requeue&&(0,y.jsx)(g,{size:`sm`,disabled:M,onClick:()=>Z(`Requeue`,e=>_(e.state).requeueCompleted?h.retryCompleted(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not completed`))),children:`Requeue selected`}),$.fail&&(0,y.jsx)(g,{variant:`warning`,size:`sm`,disabled:M,onClick:()=>Z(`Fail`,e=>_(e.state).fail?h.failJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not active`)),e=>`Force-fail ${e} job(s)?`),children:`Fail selected`}),$.cancel&&(0,y.jsx)(g,{variant:`danger`,size:`sm`,disabled:M,onClick:()=>Z(`Cancel`,e=>_(e.state).cancel?h.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,y.jsx)(`span`,{className:`text-xs text-faint`,children:`No actions apply to the selected job states.`})]}),P&&(0,y.jsx)(`div`,{className:t(`mb-3 text-sm`,P.ok?`text-success`:`text-danger`),children:P.text}),B&&(0,y.jsx)(le,{onRetry:V}),_e&&!H&&!B?(0,y.jsx)(ae,{label:`Loading jobs…`}):(0,y.jsxs)(y.Fragment,{children:[(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:`w-10 px-5 py-3`,children:(0,y.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:be,"aria-label":`Select all jobs on page`,className:`accent-accent`})}),(0,y.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(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:`Priority`}),(0,y.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Created`}),(0,y.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,y.jsx)(`th`,{className:`w-28 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,y.jsx)(`tbody`,{children:U.length===0?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:7,className:`px-5 py-12 text-center text-sm text-faint`,children:T.trim()?`No jobs on this page match your ID filter.`:r?`No jobs found.`:`Select a queue.`})}):U.map(e=>{let n=he(e.priority),r=_(e.state),a=A.has(e.id);return(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)(`input`,{type:`checkbox`,checked:O.has(e.id),onChange:()=>ye(e.id),"aria-label":`Select job ${e.id}`,className:`accent-accent`})}),(0,y.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent/90`,children:(0,y.jsx)(`span`,{className:`block max-w-[16rem] truncate`,title:e.id,children:e.id})}),(0,y.jsx)(`td`,{className:`px-5 py-3`,children:(0,y.jsx)(u,{status:String(e.state??`waiting`)})}),(0,y.jsx)(`td`,{className:t(`px-5 py-3 text-xs font-semibold`,n.c),children:n.t}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:ie(e.createdAt)}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:m(e.startedAt&&e.completedAt?e.completedAt-e.startedAt:void 0)}),(0,y.jsx)(`td`,{className:`px-5 py-3`,children:(0,y.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,y.jsx)(i,{to:`/job?id=${encodeURIComponent(e.id)}`,children:(0,y.jsx)(c,{"aria-label":`Inspect job`,children:(0,y.jsx)(ue,{className:`size-3.5`})})}),r.promote&&(0,y.jsx)(c,{"aria-label":`Promote job`,disabled:a,onClick:()=>X(e,`Promote`,()=>h.promoteJob(e.id)),children:(0,y.jsx)(re,{className:`size-3.5`})}),(r.retryActive||r.retryDlq)&&(0,y.jsx)(c,{"aria-label":`Retry job`,disabled:a,onClick:()=>X(e,`Retry`,()=>S(e)),children:(0,y.jsx)(o,{className:`size-3.5`})}),r.requeueCompleted&&(0,y.jsx)(c,{"aria-label":`Requeue job`,disabled:a,onClick:()=>X(e,`Requeue`,()=>h.retryCompleted(e.queue??``,e.id)),children:(0,y.jsx)(o,{className:`size-3.5`})}),r.fail&&(0,y.jsx)(c,{"aria-label":`Fail job`,disabled:a,onClick:()=>X(e,`Fail`,()=>h.failJob(e.id),`Force-fail this active job?`),children:(0,y.jsx)(te,{className:`size-3.5`})}),r.cancel&&(0,y.jsx)(c,{"aria-label":`Cancel job`,disabled:a,onClick:()=>X(e,`Cancel`,()=>h.cancelJob(e.id),`Cancel this job?`),children:(0,y.jsx)(ee,{className:`size-3.5`})})]})})]},e.id)})})]})}),(0,y.jsx)(pe,{page:E,pageSize:x,hasNext:ve,onPageChange:D,label:`jobs`})]})]})}export{C as JobsPro};
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{G as o,J as ee,O as s,P as te,R as ne,T as c,U as re,a as ie,b as ae,c as l,g as u,h as oe,l as se,m as d,n as f,nt as p,o as m,q as ce,tt as h,w as g,x as le,z as ue}from"./index-BRcFyrFG.js";import{a as de,i as fe}from"./form-C-zZyKfB.js";import{t as pe}from"./Pagination-Bm5HTIE3.js";import{t as me}from"./exportFile-tdUeW5m5.js";import{t as _}from"./jobActions-CuOdMglt.js";var v=e(r(),1),y=a(),b=[`all`,`waiting`,`active`,`completed`,`failed`],x=25;function he(e=0){return e>=10?{t:`HIGH`,c:`text-warning`}:e>=1?{t:`MEDIUM`,c:`text-blue-400`}:{t:`LOW`,c:`text-faint`}}function S(e){let t=_(e.state);return t.retryActive?h.retryJob(e.id):t.retryDlq?h.retryDlq(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not retryable`))}function C(){let[e]=n(),[r,a]=(0,v.useState)(e.get(`queue`)??``),[C,w]=(0,v.useState)(`all`),[T,ge]=(0,v.useState)(``),[E,D]=(0,v.useState)(0),[O,k]=(0,v.useState)(new Set),[A,j]=(0,v.useState)(new Set),[M,N]=(0,v.useState)(!1),[P,F]=(0,v.useState)(null),{data:I}=s(()=>h.queuesSummary(),[],{intervalMs:3e4}),{data:L}=s(()=>h.overview(),[],{intervalMs:1e4});(0,v.useEffect)(()=>{!r&&I?.length&&a(I[0].name)},[I,r]);let R=`${r}|${C}|${E}`,{data:z,error:B,loading:_e,refetch:V}=s((0,v.useCallback)(async()=>{if(!r)return{view:R,jobs:[]};let e=C===`all`?void 0:[C];return{view:R,jobs:((await h.jobsList(r,e,x,E*x)).jobs??[]).map(e=>({...e,queue:e.queue??r}))}},[r,C,E,R]),[r,C,E]),H=z&&z.view===R?z.jobs:null,ve=(H?.length??0)===x,U=(0,v.useMemo)(()=>{let e=T.trim().toLowerCase();return e?(H??[]).filter(t=>t.id.toLowerCase().includes(e)):H??[]},[H,T]),W=L?.stats,G=(0,v.useMemo)(()=>(I??[]).reduce((e,t)=>e+(t.counts?.failed??0),0),[I]),K=W?f(W.completed,G):null,q=e=>W?l(e):`—`,J=()=>D(0);(0,v.useEffect)(()=>{k(new Set)},[r,C,E]);let ye=e=>k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Y=U.length>0&&U.every(e=>O.has(e.id)),be=()=>k(()=>Y?new Set:new Set(U.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} ✓`})}catch(e){F({ok:!1,text:`${t} failed: ${e.message}`})}finally{j(t=>{let n=new Set(t);return n.delete(e.id),n}),V()}}},Z=async(e,t,n)=>{let r=U.filter(e=>O.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;F({ok:o===0,text:`${e}: ${a} succeeded${o?`, ${o} not eligible / failed`:``}`}),k(new Set),N(!1),V()},Q=U.filter(e=>O.has(e.id)),$={retry:Q.some(e=>{let t=_(e.state);return t.retryActive||t.retryDlq}),promote:Q.some(e=>_(e.state).promote),requeue:Q.some(e=>_(e.state).requeueCompleted),fail:Q.some(e=>_(e.state).fail),cancel:Q.some(e=>_(e.state).cancel)};return(0,y.jsxs)(`div`,{children:[(0,y.jsx)(oe,{title:`Jobs Explorer`,description:`Browse, inspect, and manage individual jobs.`,live:!0,actions:(0,y.jsxs)(g,{size:`sm`,disabled:!H||U.length===0,onClick:()=>{if(U.length===0){p.info(`No jobs to export on this page`);return}let e=U.map(e=>({id:e.id,queue:e.queue??r,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:``}));me(`jobs-${r}-${C}`,e,[`id`,`queue`,`state`,`priority`,`attempts`,`maxAttempts`,`createdAt`,`durationMs`])},children:[(0,y.jsx)(ne,{className:`size-3.5`}),` Export CSV`]})}),(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)(d,{label:`Total`,value:q((W?.completed??0)+G+(W?.waiting??0)+(W?.active??0)+(W?.delayed??0)),hint:`all queues`,compact:!0}),(0,y.jsx)(d,{label:`Waiting`,value:q(W?.waiting),tone:`amber`,compact:!0}),(0,y.jsx)(d,{label:`Active`,value:q(W?.active),tone:`blue`,compact:!0}),(0,y.jsx)(d,{label:`Completed`,value:q(W?.completed),tone:`green`,compact:!0}),(0,y.jsx)(d,{label:`Failed`,value:q(G),tone:G?`red`:`default`,compact:!0}),(0,y.jsx)(d,{label:`Error Rate`,value:K==null?`—`:se(K),tone:K==null?`default`:K>.05?`red`:`green`,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.jsx)(de,{value:r,"aria-label":`Queue`,onChange:e=>{a(e.target.value),J()},children:(I??[]).map(e=>(0,y.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),(0,y.jsx)(fe,{options:b,value:C,onChange:e=>{w(e),J()}}),(0,y.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,y.jsx)(ce,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,y.jsx)(`input`,{value:T,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`})]})]}),O.size>0&&(0,y.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,y.jsxs)(`span`,{className:`mr-1 text-muted`,children:[O.size,` selected`]}),$.retry&&(0,y.jsx)(g,{size:`sm`,disabled:M,onClick:()=>Z(`Retry`,S),children:`Retry selected`}),$.promote&&(0,y.jsx)(g,{size:`sm`,disabled:M,onClick:()=>Z(`Promote`,e=>_(e.state).promote?h.promoteJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not delayed`))),children:`Promote selected`}),$.requeue&&(0,y.jsx)(g,{size:`sm`,disabled:M,onClick:()=>Z(`Requeue`,e=>_(e.state).requeueCompleted?h.retryCompleted(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not completed`))),children:`Requeue selected`}),$.fail&&(0,y.jsx)(g,{variant:`warning`,size:`sm`,disabled:M,onClick:()=>Z(`Fail`,e=>_(e.state).fail?h.failJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not active`)),e=>`Force-fail ${e} job(s)?`),children:`Fail selected`}),$.cancel&&(0,y.jsx)(g,{variant:`danger`,size:`sm`,disabled:M,onClick:()=>Z(`Cancel`,e=>_(e.state).cancel?h.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,y.jsx)(`span`,{className:`text-xs text-faint`,children:`No actions apply to the selected job states.`})]}),P&&(0,y.jsx)(`div`,{className:t(`mb-3 text-sm`,P.ok?`text-success`:`text-danger`),children:P.text}),B&&(0,y.jsx)(le,{onRetry:V}),_e&&!H&&!B?(0,y.jsx)(ae,{label:`Loading jobs…`}):(0,y.jsxs)(y.Fragment,{children:[(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:`w-10 px-5 py-3`,children:(0,y.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:be,"aria-label":`Select all jobs on page`,className:`accent-accent`})}),(0,y.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(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:`Priority`}),(0,y.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Created`}),(0,y.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,y.jsx)(`th`,{className:`w-28 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,y.jsx)(`tbody`,{children:U.length===0?(0,y.jsx)(`tr`,{children:(0,y.jsx)(`td`,{colSpan:7,className:`px-5 py-12 text-center text-sm text-faint`,children:T.trim()?`No jobs on this page match your ID filter.`:r?`No jobs found.`:`Select a queue.`})}):U.map(e=>{let n=he(e.priority),r=_(e.state),a=A.has(e.id);return(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)(`input`,{type:`checkbox`,checked:O.has(e.id),onChange:()=>ye(e.id),"aria-label":`Select job ${e.id}`,className:`accent-accent`})}),(0,y.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent/90`,children:(0,y.jsx)(`span`,{className:`block max-w-[16rem] truncate`,title:e.id,children:e.id})}),(0,y.jsx)(`td`,{className:`px-5 py-3`,children:(0,y.jsx)(u,{status:String(e.state??`waiting`)})}),(0,y.jsx)(`td`,{className:t(`px-5 py-3 text-xs font-semibold`,n.c),children:n.t}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:ie(e.createdAt)}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:m(e.startedAt&&e.completedAt?e.completedAt-e.startedAt:void 0)}),(0,y.jsx)(`td`,{className:`px-5 py-3`,children:(0,y.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,y.jsx)(i,{to:`/job?id=${encodeURIComponent(e.id)}`,children:(0,y.jsx)(c,{"aria-label":`Inspect job`,children:(0,y.jsx)(ue,{className:`size-3.5`})})}),r.promote&&(0,y.jsx)(c,{"aria-label":`Promote job`,disabled:a,onClick:()=>X(e,`Promote`,()=>h.promoteJob(e.id)),children:(0,y.jsx)(re,{className:`size-3.5`})}),(r.retryActive||r.retryDlq)&&(0,y.jsx)(c,{"aria-label":`Retry job`,disabled:a,onClick:()=>X(e,`Retry`,()=>S(e)),children:(0,y.jsx)(o,{className:`size-3.5`})}),r.requeueCompleted&&(0,y.jsx)(c,{"aria-label":`Requeue job`,disabled:a,onClick:()=>X(e,`Requeue`,()=>h.retryCompleted(e.queue??``,e.id)),children:(0,y.jsx)(o,{className:`size-3.5`})}),r.fail&&(0,y.jsx)(c,{"aria-label":`Fail job`,disabled:a,onClick:()=>X(e,`Fail`,()=>h.failJob(e.id),`Force-fail this active job?`),children:(0,y.jsx)(te,{className:`size-3.5`})}),r.cancel&&(0,y.jsx)(c,{"aria-label":`Cancel job`,disabled:a,onClick:()=>X(e,`Cancel`,()=>h.cancelJob(e.id),`Cancel this job?`),children:(0,y.jsx)(ee,{className:`size-3.5`})})]})})]},e.id)})})]})}),(0,y.jsx)(pe,{page:E,pageSize:x,hasNext:ve,onPageChange:D,label:`jobs`})]})]})}export{C as JobsPro};
@@ -1 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{O as r,V as i,c as a,g as o,h as s,k as c,m as l,q as u,t as d,u as f,x as p,y as m}from"./index-DTo6fJH9.js";import{a as h,i as g}from"./form-PtDLk33Z.js";import{t as _}from"./Pagination-B-6mVPUC.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(()=>c.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)(p,{}),(0,y.jsx)(s,{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)(l,{label:`Total Events`,value:a(A.total),compact:!0}),(0,y.jsx)(l,{label:`Completed`,value:a(A.completed),tone:`green`,compact:!0}),(0,y.jsx)(l,{label:`Failed`,value:a(A.failed),tone:A.failed?`red`:`default`,compact:!0}),(0,y.jsx)(l,{label:`Waiting`,value:a(A.waiting),tone:`amber`,compact:!0}),(0,y.jsx)(l,{label:`Active`,value:a(A.active),tone:`blue`,compact:!0}),(0,y.jsx)(l,{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)(u,{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)(m,{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)(o,{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
+ import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{O as r,V as i,c as a,g as o,h as s,k as c,m as l,q as u,t as d,u as f,x as p,y as m}from"./index-BRcFyrFG.js";import{a as h,i as g}from"./form-C-zZyKfB.js";import{t as _}from"./Pagination-Bm5HTIE3.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(()=>c.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)(p,{}),(0,y.jsx)(s,{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)(l,{label:`Total Events`,value:a(A.total),compact:!0}),(0,y.jsx)(l,{label:`Completed`,value:a(A.completed),tone:`green`,compact:!0}),(0,y.jsx)(l,{label:`Failed`,value:a(A.failed),tone:A.failed?`red`:`default`,compact:!0}),(0,y.jsx)(l,{label:`Waiting`,value:a(A.waiting),tone:`amber`,compact:!0}),(0,y.jsx)(l,{label:`Active`,value:a(A.active),tone:`blue`,compact:!0}),(0,y.jsx)(l,{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)(u,{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)(m,{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)(o,{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 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{O as r,c as i,g as a,h as o,m as s,q as c,t as l,tt as u,u as d,x as f}from"./index-DTo6fJH9.js";import{a as p,i as m}from"./form-PtDLk33Z.js";import{t as h}from"./Pagination-B-6mVPUC.js";var g=e(t(),1),_=n(),v=`__all__`,y=[`all`,`waiting`,`active`,`completed`,`failed`],b=10;function x(){let[e,t]=(0,g.useState)(v),[n,x]=(0,g.useState)(`all`),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(0),{data:E,error:D,refetch:O}=r(()=>u.queues(),[],{intervalMs:3e4}),{events:k,counters:A,throughput:j,connected:M}=l(e===v?void 0:e),N=(0,g.useMemo)(()=>{let e=S.trim().toLowerCase();return k.filter(t=>n!==`all`&&t.status!==n?!1:e?(t.jobId??``).toLowerCase().includes(e)||(t.queue??``).toLowerCase().includes(e):!0)},[k,n,S]);(0,g.useEffect)(()=>T(0),[e,n,S]);let P=w*b,F=N.slice(P,P+b);return(0,_.jsxs)(`div`,{children:[(0,_.jsx)(o,{title:`Activity Logs`,description:`Real-time job activity across all queues.`,live:M}),D&&(0,_.jsx)(f,{onRetry:O}),(0,_.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,_.jsx)(s,{label:`Total Events`,value:i(A.total),compact:!0}),(0,_.jsx)(s,{label:`Completed`,value:i(A.completed),tone:`green`,compact:!0}),(0,_.jsx)(s,{label:`Failed`,value:i(A.failed),tone:A.failed?`red`:`default`,compact:!0}),(0,_.jsx)(s,{label:`Waiting`,value:i(A.waiting),tone:`amber`,compact:!0}),(0,_.jsx)(s,{label:`Active`,value:i(A.active),tone:`blue`,compact:!0}),(0,_.jsx)(s,{label:`Throughput`,value:`${j.toFixed(1)}/s`,tone:`accent`,compact:!0})]}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`w-48`,children:(0,_.jsxs)(p,{"aria-label":`Filter by queue`,value:e,onChange:e=>t(e.target.value),children:[(0,_.jsx)(`option`,{value:v,children:`All Queues`}),(E?.queues??[]).map(e=>(0,_.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,_.jsx)(m,{options:y,value:n,onChange:x}),(0,_.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,_.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,_.jsx)(`input`,{"aria-label":`Search by job ID or queue`,value:S,onChange:e=>C(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,_.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:`Status`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Event`}),(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:`Timestamp`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`ID`})]})}),(0,_.jsx)(`tbody`,{children:F.length===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{colSpan:5,className:`px-5 py-12 text-center text-sm text-faint`,children:M?k.length>0?`No events match the current filters.`:`Waiting for activity…`:`Connecting to the event stream…`})}):F.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(a,{status:e.status})}),(0,_.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-fg`,children:e.event}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-0.5 font-mono text-xs text-muted`,children:e.queue||`—`})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:d(e.timestamp)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right font-mono text-xs text-faint`,children:e.jobId||`—`})]},e.seq))})]})}),(0,_.jsx)(h,{page:w,pageSize:b,total:N.length,onPageChange:T,label:`events`})]})}export{x as LogsPro};
1
+ import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{O as r,c as i,g as a,h as o,m as s,q as c,t as l,tt as u,u as d,x as f}from"./index-BRcFyrFG.js";import{a as p,i as m}from"./form-C-zZyKfB.js";import{t as h}from"./Pagination-Bm5HTIE3.js";var g=e(t(),1),_=n(),v=`__all__`,y=[`all`,`waiting`,`active`,`completed`,`failed`],b=10;function x(){let[e,t]=(0,g.useState)(v),[n,x]=(0,g.useState)(`all`),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(0),{data:E,error:D,refetch:O}=r(()=>u.queues(),[],{intervalMs:3e4}),{events:k,counters:A,throughput:j,connected:M}=l(e===v?void 0:e),N=(0,g.useMemo)(()=>{let e=S.trim().toLowerCase();return k.filter(t=>n!==`all`&&t.status!==n?!1:e?(t.jobId??``).toLowerCase().includes(e)||(t.queue??``).toLowerCase().includes(e):!0)},[k,n,S]);(0,g.useEffect)(()=>T(0),[e,n,S]);let P=w*b,F=N.slice(P,P+b);return(0,_.jsxs)(`div`,{children:[(0,_.jsx)(o,{title:`Activity Logs`,description:`Real-time job activity across all queues.`,live:M}),D&&(0,_.jsx)(f,{onRetry:O}),(0,_.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,_.jsx)(s,{label:`Total Events`,value:i(A.total),compact:!0}),(0,_.jsx)(s,{label:`Completed`,value:i(A.completed),tone:`green`,compact:!0}),(0,_.jsx)(s,{label:`Failed`,value:i(A.failed),tone:A.failed?`red`:`default`,compact:!0}),(0,_.jsx)(s,{label:`Waiting`,value:i(A.waiting),tone:`amber`,compact:!0}),(0,_.jsx)(s,{label:`Active`,value:i(A.active),tone:`blue`,compact:!0}),(0,_.jsx)(s,{label:`Throughput`,value:`${j.toFixed(1)}/s`,tone:`accent`,compact:!0})]}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`w-48`,children:(0,_.jsxs)(p,{"aria-label":`Filter by queue`,value:e,onChange:e=>t(e.target.value),children:[(0,_.jsx)(`option`,{value:v,children:`All Queues`}),(E?.queues??[]).map(e=>(0,_.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,_.jsx)(m,{options:y,value:n,onChange:x}),(0,_.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,_.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,_.jsx)(`input`,{"aria-label":`Search by job ID or queue`,value:S,onChange:e=>C(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,_.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:`Status`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Event`}),(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:`Timestamp`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`ID`})]})}),(0,_.jsx)(`tbody`,{children:F.length===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{colSpan:5,className:`px-5 py-12 text-center text-sm text-faint`,children:M?k.length>0?`No events match the current filters.`:`Waiting for activity…`:`Connecting to the event stream…`})}):F.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(a,{status:e.status})}),(0,_.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-fg`,children:e.event}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-0.5 font-mono text-xs text-muted`,children:e.queue||`—`})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:d(e.timestamp)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right font-mono text-xs text-faint`,children:e.jobId||`—`})]},e.seq))})]})}),(0,_.jsx)(h,{page:w,pageSize:b,total:N.length,onPageChange:T,label:`events`})]})}export{x as LogsPro};
@@ -1,4 +1,4 @@
1
- import{t as e}from"./react-vendor-CHIHtdAC.js";import{C as t,S as n,h as r,m as i}from"./index-DTo6fJH9.js";import{t as a}from"./CopyButton-DvGgfSEm.js";var o=e(),s=`{
1
+ import{t as e}from"./react-vendor-B68RYDeC.js";import{C as t,S as n,h as r,m as i}from"./index-BRcFyrFG.js";import{t as a}from"./CopyButton-DhNun7Gi.js";var o=e(),s=`{
2
2
  "mcpServers": {
3
3
  "bunqueue": {
4
4
  "command": "bunx",
@@ -1 +1 @@
1
- import{t as e}from"./react-vendor-CHIHtdAC.js";import{C as t,O as n,S as r,b as i,c as a,h as o,k as s,m as c,r as l,x as u}from"./index-DTo6fJH9.js";var d=e(),f={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 p(){let{data:e,error:p,loading:g,refetch:_}=n(()=>s.overview(),[]);if(g&&!e&&!p)return(0,d.jsx)(i,{label:`Loading metrics…`});let{stats:v,throughput:y,latency:b,memory:x,collections:S}=e??f,C={};for(let[e,t]of Object.entries(b.percentiles??{}))t&&typeof t==`object`&&(C[`${e} p50`]=t.p50,C[`${e} p95`]=t.p95,C[`${e} p99`]=t.p99);return(0,d.jsxs)(`div`,{children:[p&&(0,d.jsx)(u,{onRetry:_}),(0,d.jsx)(o,{title:`Metrics`,description:`Throughput, latency, and resource internals.`,live:!0}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,d.jsx)(c,{label:`Pushed /s`,value:y.pushPerSec.toFixed(1),compact:!0}),(0,d.jsx)(c,{label:`Pulled /s`,value:y.pullPerSec.toFixed(1),tone:`blue`,compact:!0}),(0,d.jsx)(c,{label:`Completed /s`,value:y.completePerSec.toFixed(1),tone:`green`,compact:!0}),(0,d.jsx)(c,{label:`Failed /s`,value:y.failPerSec.toFixed(1),tone:`red`,compact:!0})]}),(0,d.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`Totals`}),(0,d.jsx)(m,{rows:[[`Pushed`,a(v.totalPushed)],[`Pulled`,a(v.totalPulled)],[`Completed`,a(v.totalCompleted)],[`Failed`,a(v.totalFailed)]]})]}),(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`Memory`}),(0,d.jsx)(m,{rows:[[`Heap Used`,l(x.heapUsed*1024*1024)],[`Heap Total`,l(x.heapTotal*1024*1024)],[`RSS`,l(x.rss*1024*1024)]]})]}),(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`Latency — percentiles (ms)`}),(0,d.jsx)(h,{record:C,suffix:`ms`})]}),(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`Latency — averages (ms)`}),(0,d.jsx)(h,{record:b.averages,suffix:`ms`})]})]}),(0,d.jsx)(`div`,{className:`mt-6`,children:(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`In-memory collections`}),(0,d.jsx)(h,{record:S})]})})]})}function m({rows:e}){return(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:e.map(([e,t])=>(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e}),(0,d.jsx)(`div`,{className:`mt-1 text-xl font-semibold tnum text-fg`,children:t})]},e))})}function h({record:e,suffix:t}){let n=Object.entries(e??{});return n.length===0?(0,d.jsx)(`p`,{className:`py-4 text-sm text-faint`,children:`No data.`}):(0,d.jsx)(`dl`,{className:`divide-y divide-line`,children:n.map(([e,n])=>(0,d.jsxs)(`div`,{className:`flex items-center justify-between py-2 text-sm`,children:[(0,d.jsx)(`dt`,{className:`font-mono text-xs text-muted`,children:e}),(0,d.jsxs)(`dd`,{className:`tnum font-medium text-fg`,children:[typeof n==`number`?a(Math.round(n*100)/100):String(n),t&&(0,d.jsx)(`span`,{className:`ml-1 text-xs text-faint`,children:t})]})]},e))})}export{p as Metrics};
1
+ import{t as e}from"./react-vendor-B68RYDeC.js";import{C as t,O as n,S as r,b as i,c as a,h as o,k as s,m as c,r as l,x as u}from"./index-BRcFyrFG.js";var d=e(),f={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 p(){let{data:e,error:p,loading:g,refetch:_}=n(()=>s.overview(),[]);if(g&&!e&&!p)return(0,d.jsx)(i,{label:`Loading metrics…`});let{stats:v,throughput:y,latency:b,memory:x,collections:S}=e??f,C={};for(let[e,t]of Object.entries(b.percentiles??{}))t&&typeof t==`object`&&(C[`${e} p50`]=t.p50,C[`${e} p95`]=t.p95,C[`${e} p99`]=t.p99);return(0,d.jsxs)(`div`,{children:[p&&(0,d.jsx)(u,{onRetry:_}),(0,d.jsx)(o,{title:`Metrics`,description:`Throughput, latency, and resource internals.`,live:!0}),(0,d.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,d.jsx)(c,{label:`Pushed /s`,value:y.pushPerSec.toFixed(1),compact:!0}),(0,d.jsx)(c,{label:`Pulled /s`,value:y.pullPerSec.toFixed(1),tone:`blue`,compact:!0}),(0,d.jsx)(c,{label:`Completed /s`,value:y.completePerSec.toFixed(1),tone:`green`,compact:!0}),(0,d.jsx)(c,{label:`Failed /s`,value:y.failPerSec.toFixed(1),tone:`red`,compact:!0})]}),(0,d.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`Totals`}),(0,d.jsx)(m,{rows:[[`Pushed`,a(v.totalPushed)],[`Pulled`,a(v.totalPulled)],[`Completed`,a(v.totalCompleted)],[`Failed`,a(v.totalFailed)]]})]}),(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`Memory`}),(0,d.jsx)(m,{rows:[[`Heap Used`,l(x.heapUsed*1024*1024)],[`Heap Total`,l(x.heapTotal*1024*1024)],[`RSS`,l(x.rss*1024*1024)]]})]}),(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`Latency — percentiles (ms)`}),(0,d.jsx)(h,{record:C,suffix:`ms`})]}),(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`Latency — averages (ms)`}),(0,d.jsx)(h,{record:b.averages,suffix:`ms`})]})]}),(0,d.jsx)(`div`,{className:`mt-6`,children:(0,d.jsxs)(r,{children:[(0,d.jsx)(t,{title:`In-memory collections`}),(0,d.jsx)(h,{record:S})]})})]})}function m({rows:e}){return(0,d.jsx)(`div`,{className:`grid grid-cols-2 gap-4 sm:grid-cols-4`,children:e.map(([e,t])=>(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e}),(0,d.jsx)(`div`,{className:`mt-1 text-xl font-semibold tnum text-fg`,children:t})]},e))})}function h({record:e,suffix:t}){let n=Object.entries(e??{});return n.length===0?(0,d.jsx)(`p`,{className:`py-4 text-sm text-faint`,children:`No data.`}):(0,d.jsx)(`dl`,{className:`divide-y divide-line`,children:n.map(([e,n])=>(0,d.jsxs)(`div`,{className:`flex items-center justify-between py-2 text-sm`,children:[(0,d.jsx)(`dt`,{className:`font-mono text-xs text-muted`,children:e}),(0,d.jsxs)(`dd`,{className:`tnum font-medium text-fg`,children:[typeof n==`number`?a(Math.round(n*100)/100):String(n),t&&(0,d.jsx)(`span`,{className:`ml-1 text-xs text-faint`,children:t})]})]},e))})}export{p as Metrics};
@@ -1 +1 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{m as n,t as r}from"./react-vendor-CHIHtdAC.js";import{C as i,O as a,S as o,b as s,c,d as l,h as u,i as d,l as f,m as p,n as m,tt as h,x as g}from"./index-DTo6fJH9.js";import{t as _}from"./Pagination-B-6mVPUC.js";import{t as v}from"./AreaChart-DzUXW8u3.js";import{n as y,t as b}from"./useThroughputSeries-D8wylrhf.js";var x=e(n(),1),S=r(),C=[`-60s`,`-45s`,`-30s`,`-15s`,`now`],w=15,T=[`push`,`pull`,`ack`],E={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:{}}};function D(){let e=y(60),[n,r]=(0,x.useState)(0),{data:D,error:j,loading:M,refetch:N}=a(async()=>({details:await h.queuesSummary()}),[]),P=D?.details??[],F=Math.max(1,Math.ceil(P.length/w)),I=Math.min(n,F-1),L=(0,x.useMemo)(()=>P.slice(I*w,I*w+w),[P,I]),R=(0,x.useMemo)(()=>P.reduce((e,t)=>e+(t.counts?.failed??0),0),[P]);if(M&&!D&&!j)return(0,S.jsx)(s,{label:`Loading metrics…`});let{stats:z,throughput:B,latency:V}=e.latest??E,H=m(z.completed,R),U=b(e.depth),W=e.depth.length?e.depth[e.depth.length-1]:0;return(0,S.jsxs)(`div`,{children:[(0,S.jsx)(u,{title:`Metrics`,description:`Real-time performance telemetry for your queues.`,live:!j}),j&&(0,S.jsx)(g,{onRetry:N}),(0,S.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,S.jsx)(p,{label:`Total Completed`,value:d(z.completed),tone:`green`,hint:`recorded jobs`}),(0,S.jsx)(p,{label:`Total Failed`,value:c(R),tone:R?`red`:`default`,hint:`recorded jobs`}),(0,S.jsx)(p,{label:`Push/sec`,value:B.pushPerSec.toFixed(1),tone:`accent`,hint:`jobs/sec`}),(0,S.jsx)(p,{label:`Pull/sec`,value:B.pullPerSec.toFixed(1),tone:`accent`,hint:`jobs/sec`})]}),(0,S.jsxs)(o,{className:`mb-6`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Live Throughput`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Real-time jobs per second (rolling 60s window)`})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-mono text-[11px] text-faint`,children:[(0,S.jsx)(k,{color:`#ec4899`,label:`Pushed`,value:B.pushPerSec}),(0,S.jsx)(k,{color:`#34d399`,label:`Completed`,value:B.completePerSec}),(0,S.jsx)(k,{color:`#f87171`,label:`Failed`,value:B.failPerSec})]})]}),(0,S.jsx)(v,{xLabels:C,series:[{label:`Pushed`,color:`#ec4899`,points:e.push,area:!0},{label:`Completed`,color:`#34d399`,points:e.complete},{label:`Failed`,color:`#f87171`,points:e.fail}]})]}),(0,S.jsxs)(o,{className:`mb-6`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Queue Depth`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Backlog over time (waiting + active + delayed). The trend says whether you're draining or falling behind — more useful than any single gauge.`})]}),(0,S.jsxs)(`div`,{className:`text-right`,children:[(0,S.jsx)(`div`,{className:`tnum text-2xl font-bold text-fg`,children:c(W)}),(0,S.jsx)(`div`,{className:t(`text-xs font-medium`,U.label===`draining`?`text-success`:U.label===`accumulating`?`text-danger`:`text-faint`),children:U.label===`steady`?`steady`:`${U.slope>0?`+`:``}${U.slope.toFixed(1)}/s · ${U.label}`})]})]}),(0,S.jsx)(v,{xLabels:C,ariaLabel:`queue depth chart`,series:[{label:`Depth`,color:U.draining?`#34d399`:`#f59e0b`,points:e.depth,area:!0}]})]}),(0,S.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,S.jsxs)(o,{children:[(0,S.jsx)(i,{title:`Error Rate`}),(0,S.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Failed as percentage of total processed`}),(0,S.jsxs)(`div`,{className:`flex items-center justify-around`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`div`,{className:t(`text-3xl font-bold tnum`,H!=null&&H>.05?`text-danger`:`text-fg`),children:H==null?`—`:f(H)}),(0,S.jsx)(`div`,{className:`text-xs text-faint`,children:`error rate`})]}),(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`div`,{className:t(`text-3xl font-bold tnum`,H==null?`text-fg`:`text-success`),children:H==null?`—`:f(1-H)}),(0,S.jsx)(`div`,{className:`text-xs text-faint`,children:`success rate`})]})]}),H==null?(0,S.jsx)(`div`,{className:`mt-4 h-2 overflow-hidden rounded-full bg-surface-2`}):(0,S.jsx)(`div`,{className:`mt-4 h-2 overflow-hidden rounded-full bg-red-500/40`,children:(0,S.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500`,style:{width:`${(1-H)*100}%`}})}),(0,S.jsxs)(`div`,{className:`mt-2 flex justify-between font-mono text-[11px] text-faint`,children:[(0,S.jsxs)(`span`,{children:[d(z.completed),` completed`]}),(0,S.jsxs)(`span`,{children:[c(R),` failed`]})]})]}),(0,S.jsxs)(o,{children:[(0,S.jsx)(i,{title:`Server Overview`}),(0,S.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Current server-wide statistics`}),(0,S.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,S.jsx)(A,{color:`bg-blue-400`,label:`Queued`,value:c(z.waiting)}),(0,S.jsx)(A,{color:`bg-accent`,label:`Processing`,value:c(z.active)}),(0,S.jsx)(A,{color:`bg-amber-400`,label:`Delayed`,value:c(z.delayed)}),(0,S.jsx)(A,{color:`bg-red-400`,label:`Dead Letter`,value:c(z.dlq)}),(0,S.jsx)(A,{color:`bg-zinc-500`,label:`Pushed (since restart)`,value:d(z.totalPushed)}),(0,S.jsx)(A,{color:`bg-zinc-500`,label:`Pulled (since restart)`,value:d(z.totalPulled)}),(0,S.jsx)(A,{color:`bg-emerald-400`,label:`Uptime`,value:l(z.uptime/1e3)})]})]})]}),(0,S.jsxs)(o,{className:`mb-6`,padded:!1,children:[(0,S.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Operation Latency`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`TCP round-trip per operation (p50 / p95 / p99, milliseconds)`})]}),(0,S.jsx)(`div`,{className:`overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Operation`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Avg`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p50`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p95`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p99`})]})}),(0,S.jsx)(`tbody`,{children:T.map(e=>{let t=V?.percentiles?.[e],n=V?.averages?.[`${e}Ms`];return(0,S.jsxs)(`tr`,{className:`border-b border-line last:border-0`,children:[(0,S.jsx)(`td`,{className:`px-5 py-3 font-medium capitalize text-fg`,children:e}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:O(n)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:O(t?.p50)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:O(t?.p95)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:O(t?.p99)})]},e)})})]})})]}),(0,S.jsxs)(o,{padded:!1,children:[(0,S.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Per-Queue Metrics`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Job counts breakdown by queue`})]}),(0,S.jsx)(`div`,{className:`overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Waiting`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Completed`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`})]})}),(0,S.jsx)(`tbody`,{children:L.length===0?(0,S.jsx)(`tr`,{children:(0,S.jsx)(`td`,{colSpan:6,className:`px-5 py-12 text-center text-sm text-faint`,children:`No queues yet.`})}):L.map(e=>(0,S.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,S.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent`,children:e.name}),(0,S.jsx)(`td`,{className:`px-5 py-3`,children:(0,S.jsx)(`span`,{className:t(`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,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:c(e.counts.waiting)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:c(e.counts.active)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-success`,children:c(e.counts.completed)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-danger`,children:c(e.counts.failed)})]},e.name))})]})}),(0,S.jsx)(`div`,{className:`px-5 pb-4`,children:(0,S.jsx)(_,{page:I,pageSize:w,total:P.length,onPageChange:r,label:`queues`})})]})]})}function O(e){return e==null||!Number.isFinite(e)?`—`:`${e<10?e.toFixed(1):Math.round(e)}ms`}function k({color:e,label:t,value:n}){return(0,S.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:e}}),t,` `,(0,S.jsxs)(`span`,{className:`text-fg`,children:[n.toFixed(1),`/s`]})]})}function A({color:e,label:n,value:r}){return(0,S.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,S.jsxs)(`dt`,{className:`flex items-center gap-2 text-muted`,children:[(0,S.jsx)(`span`,{className:t(`size-2 rounded-full`,e)}),n]}),(0,S.jsx)(`dd`,{className:`font-semibold tnum text-fg`,children:r})]})}export{D as MetricsPro};
1
+ import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r}from"./react-vendor-B68RYDeC.js";import{C as i,O as a,S as o,b as s,c,d as l,h as u,i as d,l as f,m as p,n as m,tt as h,x as g}from"./index-BRcFyrFG.js";import{t as _}from"./Pagination-Bm5HTIE3.js";import{t as v}from"./AreaChart-lY-mk5E1.js";import{n as y,t as b}from"./useThroughputSeries-BhH_0wfd.js";var x=e(n(),1),S=r(),C=[`-60s`,`-45s`,`-30s`,`-15s`,`now`],w=15,T=[`push`,`pull`,`ack`],E={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:{}}};function D(){let e=y(60),[n,r]=(0,x.useState)(0),{data:D,error:j,loading:M,refetch:N}=a(async()=>({details:await h.queuesSummary()}),[]),P=D?.details??[],F=Math.max(1,Math.ceil(P.length/w)),I=Math.min(n,F-1),L=(0,x.useMemo)(()=>P.slice(I*w,I*w+w),[P,I]),R=(0,x.useMemo)(()=>P.reduce((e,t)=>e+(t.counts?.failed??0),0),[P]);if(M&&!D&&!j)return(0,S.jsx)(s,{label:`Loading metrics…`});let{stats:z,throughput:B,latency:V}=e.latest??E,H=m(z.completed,R),U=b(e.depth),W=e.depth.length?e.depth[e.depth.length-1]:0;return(0,S.jsxs)(`div`,{children:[(0,S.jsx)(u,{title:`Metrics`,description:`Real-time performance telemetry for your queues.`,live:!j}),j&&(0,S.jsx)(g,{onRetry:N}),(0,S.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,S.jsx)(p,{label:`Total Completed`,value:d(z.completed),tone:`green`,hint:`recorded jobs`}),(0,S.jsx)(p,{label:`Total Failed`,value:c(R),tone:R?`red`:`default`,hint:`recorded jobs`}),(0,S.jsx)(p,{label:`Push/sec`,value:B.pushPerSec.toFixed(1),tone:`accent`,hint:`jobs/sec`}),(0,S.jsx)(p,{label:`Pull/sec`,value:B.pullPerSec.toFixed(1),tone:`accent`,hint:`jobs/sec`})]}),(0,S.jsxs)(o,{className:`mb-6`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Live Throughput`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Real-time jobs per second (rolling 60s window)`})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-mono text-[11px] text-faint`,children:[(0,S.jsx)(k,{color:`#ec4899`,label:`Pushed`,value:B.pushPerSec}),(0,S.jsx)(k,{color:`#34d399`,label:`Completed`,value:B.completePerSec}),(0,S.jsx)(k,{color:`#f87171`,label:`Failed`,value:B.failPerSec})]})]}),(0,S.jsx)(v,{xLabels:C,series:[{label:`Pushed`,color:`#ec4899`,points:e.push,area:!0},{label:`Completed`,color:`#34d399`,points:e.complete},{label:`Failed`,color:`#f87171`,points:e.fail}]})]}),(0,S.jsxs)(o,{className:`mb-6`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Queue Depth`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Backlog over time (waiting + active + delayed). The trend says whether you're draining or falling behind — more useful than any single gauge.`})]}),(0,S.jsxs)(`div`,{className:`text-right`,children:[(0,S.jsx)(`div`,{className:`tnum text-2xl font-bold text-fg`,children:c(W)}),(0,S.jsx)(`div`,{className:t(`text-xs font-medium`,U.label===`draining`?`text-success`:U.label===`accumulating`?`text-danger`:`text-faint`),children:U.label===`steady`?`steady`:`${U.slope>0?`+`:``}${U.slope.toFixed(1)}/s · ${U.label}`})]})]}),(0,S.jsx)(v,{xLabels:C,ariaLabel:`queue depth chart`,series:[{label:`Depth`,color:U.draining?`#34d399`:`#f59e0b`,points:e.depth,area:!0}]})]}),(0,S.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,S.jsxs)(o,{children:[(0,S.jsx)(i,{title:`Error Rate`}),(0,S.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Failed as percentage of total processed`}),(0,S.jsxs)(`div`,{className:`flex items-center justify-around`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`div`,{className:t(`text-3xl font-bold tnum`,H!=null&&H>.05?`text-danger`:`text-fg`),children:H==null?`—`:f(H)}),(0,S.jsx)(`div`,{className:`text-xs text-faint`,children:`error rate`})]}),(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`div`,{className:t(`text-3xl font-bold tnum`,H==null?`text-fg`:`text-success`),children:H==null?`—`:f(1-H)}),(0,S.jsx)(`div`,{className:`text-xs text-faint`,children:`success rate`})]})]}),H==null?(0,S.jsx)(`div`,{className:`mt-4 h-2 overflow-hidden rounded-full bg-surface-2`}):(0,S.jsx)(`div`,{className:`mt-4 h-2 overflow-hidden rounded-full bg-red-500/40`,children:(0,S.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500`,style:{width:`${(1-H)*100}%`}})}),(0,S.jsxs)(`div`,{className:`mt-2 flex justify-between font-mono text-[11px] text-faint`,children:[(0,S.jsxs)(`span`,{children:[d(z.completed),` completed`]}),(0,S.jsxs)(`span`,{children:[c(R),` failed`]})]})]}),(0,S.jsxs)(o,{children:[(0,S.jsx)(i,{title:`Server Overview`}),(0,S.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Current server-wide statistics`}),(0,S.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,S.jsx)(A,{color:`bg-blue-400`,label:`Queued`,value:c(z.waiting)}),(0,S.jsx)(A,{color:`bg-accent`,label:`Processing`,value:c(z.active)}),(0,S.jsx)(A,{color:`bg-amber-400`,label:`Delayed`,value:c(z.delayed)}),(0,S.jsx)(A,{color:`bg-red-400`,label:`Dead Letter`,value:c(z.dlq)}),(0,S.jsx)(A,{color:`bg-zinc-500`,label:`Pushed (since restart)`,value:d(z.totalPushed)}),(0,S.jsx)(A,{color:`bg-zinc-500`,label:`Pulled (since restart)`,value:d(z.totalPulled)}),(0,S.jsx)(A,{color:`bg-emerald-400`,label:`Uptime`,value:l(z.uptime/1e3)})]})]})]}),(0,S.jsxs)(o,{className:`mb-6`,padded:!1,children:[(0,S.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Operation Latency`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`TCP round-trip per operation (p50 / p95 / p99, milliseconds)`})]}),(0,S.jsx)(`div`,{className:`overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Operation`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Avg`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p50`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p95`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p99`})]})}),(0,S.jsx)(`tbody`,{children:T.map(e=>{let t=V?.percentiles?.[e],n=V?.averages?.[`${e}Ms`];return(0,S.jsxs)(`tr`,{className:`border-b border-line last:border-0`,children:[(0,S.jsx)(`td`,{className:`px-5 py-3 font-medium capitalize text-fg`,children:e}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:O(n)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:O(t?.p50)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:O(t?.p95)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:O(t?.p99)})]},e)})})]})})]}),(0,S.jsxs)(o,{padded:!1,children:[(0,S.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Per-Queue Metrics`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Job counts breakdown by queue`})]}),(0,S.jsx)(`div`,{className:`overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Waiting`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Completed`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`})]})}),(0,S.jsx)(`tbody`,{children:L.length===0?(0,S.jsx)(`tr`,{children:(0,S.jsx)(`td`,{colSpan:6,className:`px-5 py-12 text-center text-sm text-faint`,children:`No queues yet.`})}):L.map(e=>(0,S.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,S.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent`,children:e.name}),(0,S.jsx)(`td`,{className:`px-5 py-3`,children:(0,S.jsx)(`span`,{className:t(`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,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:c(e.counts.waiting)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:c(e.counts.active)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-success`,children:c(e.counts.completed)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-danger`,children:c(e.counts.failed)})]},e.name))})]})}),(0,S.jsx)(`div`,{className:`px-5 pb-4`,children:(0,S.jsx)(_,{page:I,pageSize:w,total:P.length,onPageChange:r,label:`queues`})})]})]})}function O(e){return e==null||!Number.isFinite(e)?`—`:`${e<10?e.toFixed(1):Math.round(e)}ms`}function k({color:e,label:t,value:n}){return(0,S.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:e}}),t,` `,(0,S.jsxs)(`span`,{className:`text-fg`,children:[n.toFixed(1),`/s`]})]})}function A({color:e,label:n,value:r}){return(0,S.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,S.jsxs)(`dt`,{className:`flex items-center gap-2 text-muted`,children:[(0,S.jsx)(`span`,{className:t(`size-2 rounded-full`,e)}),n]}),(0,S.jsx)(`dd`,{className:`font-semibold tnum text-fg`,children:r})]})}export{D as MetricsPro};
@@ -1 +1 @@
1
- import{t as e}from"./react-vendor-CHIHtdAC.js";import{C as t,I as n,O as r,S as i,Y as a,b as o,c as s,d as c,h as l,k as u,l as d,m as f,n as p,r as m,x as h}from"./index-DTo6fJH9.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}=r(()=>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)(t,{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)(t,{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)(t,{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)(t,{title:`Cron Jobs`,icon:(0,g.jsx)(n,{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
+ import{t as e}from"./react-vendor-B68RYDeC.js";import{C as t,I as n,O as r,S as i,Y as a,b as o,c as s,d as c,h as l,k as u,l as d,m as f,n as p,r as m,x as h}from"./index-BRcFyrFG.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}=r(()=>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)(t,{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)(t,{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)(t,{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)(t,{title:`Cron Jobs`,icon:(0,g.jsx)(n,{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 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{c as r}from"./index-DTo6fJH9.js";var i=e(t(),1),a=n();function o({page:e,pageSize:t,total:n,hasNext:o,onPageChange:s,label:c=`items`,className:l}){let u=n!=null,d=u?Math.max(1,Math.ceil(n/t)):void 0;(0,i.useEffect)(()=>{u&&e>d-1&&s(d-1)},[u,e,d,s]);let f=u?Math.min(e,d-1):e,p=f*t,m=f>0,h=u?f<d-1:!!o;if(u&&n<=t&&f===0)return null;let g=u?n===0?`No ${c}`:`${r(p+1)}–${r(Math.min(p+t,n))} of ${r(n)} ${c}`:`Page ${f+1}`;return(0,a.jsxs)(`div`,{className:`mt-4 flex items-center justify-between text-sm text-faint ${l??``}`,children:[(0,a.jsx)(`span`,{children:g}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`button`,{type:`button`,disabled:!m,onClick:()=>s(f-1),className:`rounded-md px-3 py-1 text-xs hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 disabled:hover:text-faint`,children:`Previous`}),(0,a.jsx)(`span`,{className:`rounded-md bg-accent/15 px-2.5 py-1 text-xs font-medium text-accent tnum`,children:u?`${f+1} / ${d}`:f+1}),(0,a.jsx)(`button`,{type:`button`,disabled:!h,onClick:()=>s(f+1),className:`rounded-md px-3 py-1 text-xs hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 disabled:hover:text-faint`,children:`Next`})]})]})}export{o as t};
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}from"./index-BRcFyrFG.js";var i=e(t(),1),a=n();function o({page:e,pageSize:t,total:n,hasNext:o,onPageChange:s,label:c=`items`,className:l}){let u=n!=null,d=u?Math.max(1,Math.ceil(n/t)):void 0;(0,i.useEffect)(()=>{u&&e>d-1&&s(d-1)},[u,e,d,s]);let f=u?Math.min(e,d-1):e,p=f*t,m=f>0,h=u?f<d-1:!!o;if(u&&n<=t&&f===0)return null;let g=u?n===0?`No ${c}`:`${r(p+1)}–${r(Math.min(p+t,n))} of ${r(n)} ${c}`:`Page ${f+1}`;return(0,a.jsxs)(`div`,{className:`mt-4 flex items-center justify-between text-sm text-faint ${l??``}`,children:[(0,a.jsx)(`span`,{children:g}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`button`,{type:`button`,disabled:!m,onClick:()=>s(f-1),className:`rounded-md px-3 py-1 text-xs hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 disabled:hover:text-faint`,children:`Previous`}),(0,a.jsx)(`span`,{className:`rounded-md bg-accent/15 px-2.5 py-1 text-xs font-medium text-accent tnum`,children:u?`${f+1} / ${d}`:f+1}),(0,a.jsx)(`button`,{type:`button`,disabled:!h,onClick:()=>s(f+1),className:`rounded-md px-3 py-1 text-xs hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-40 disabled:hover:text-faint`,children:`Next`})]})]})}export{o as t};
@@ -1 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{C as r,S as i,tt as a,w as o}from"./index-DTo6fJH9.js";import{n as s,o as c,t as l}from"./form-PtDLk33Z.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`,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`,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(`Drained`,()=>a.drain(e),`Drain waiting jobs from "${e}"?`),children:`Drain`}),(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:`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
+ 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,tt as a,w as o}from"./index-BRcFyrFG.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`,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`,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(`Drained`,()=>a.drain(e),`Drain waiting jobs from "${e}"?`),children:`Drain`}),(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:`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 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{O as r,_ as i,b as a,c as o,h as s,m as c,tt as l,x as u}from"./index-DTo6fJH9.js";import{a as d}from"./form-PtDLk33Z.js";import{i as f,n as p,r as m,t as h}from"./QueueActions-DPqmozNf.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,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`,{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
+ import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{O as r,_ as i,b as a,c as o,h as s,m as c,tt as l,x as u}from"./index-BRcFyrFG.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-BvXNsXKQ.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,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`,{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 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{l as t,m as n,r,t as i,u as a}from"./react-vendor-CHIHtdAC.js";import{A as o,B as s,H as c,M as l,O as u,S as d,T as f,U as p,Y as m,_ as h,b as g,c as _,f as v,g as y,k as b,l as x,m as S,n as C,o as w,u as T,w as E,x as D}from"./index-DTo6fJH9.js";import{n as O,t as k}from"./form-PtDLk33Z.js";var A=e(n(),1),j=i();function M({queue:e}){return(0,j.jsxs)(`div`,{className:`mt-8`,children:[(0,j.jsx)(`h2`,{className:`mb-3 text-lg font-semibold text-fg`,children:`Configuration`}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,j.jsx)(P,{queue:e}),(0,j.jsx)(F,{queue:e})]})]})}function N(){let[e,t]=(0,A.useState)(!1),[n,r]=(0,A.useState)(null),[i,a]=(0,A.useState)(!1);return{busy:e,error:n,done:i,run:async e=>{t(!0),r(null),a(!1);try{await e(),a(!0),setTimeout(()=>a(!1),2e3)}catch(e){r(e.message)}finally{t(!1)}}}}function P({queue:e}){let[t,n]=(0,A.useState)(``),{busy:r,error:i,done:a,run:o}=N();return(0,j.jsxs)(d,{children:[(0,j.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,j.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Rate Limit`}),(0,j.jsx)(s,{className:`size-4 text-faint`})]}),(0,j.jsx)(k,{label:`Max jobs / second`,children:(0,j.jsx)(O,{type:`number`,inputMode:`numeric`,placeholder:`100`,value:t,onChange:e=>n(e.target.value)})}),(0,j.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,j.jsx)(E,{variant:`accent`,size:`sm`,disabled:r||!t,onClick:()=>o(()=>b.setRateLimit(e,Number(t))),children:`Set`}),(0,j.jsx)(E,{size:`sm`,disabled:r,onClick:()=>o(()=>b.clearRateLimit(e)),children:`Clear`}),a&&(0,j.jsx)(`span`,{className:`text-xs text-emerald-400`,children:`Saved`}),i&&(0,j.jsx)(`span`,{className:`text-xs text-red-400`,children:i})]})]})}function F({queue:e}){let[t,n]=(0,A.useState)(``),{busy:r,error:i,done:a,run:o}=N();return(0,j.jsxs)(d,{children:[(0,j.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,j.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Concurrency`}),(0,j.jsx)(m,{className:`size-4 text-faint`})]}),(0,j.jsx)(k,{label:`Concurrency`,children:(0,j.jsx)(O,{type:`number`,inputMode:`numeric`,placeholder:`5`,value:t,onChange:e=>n(e.target.value)})}),(0,j.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,j.jsx)(E,{variant:`accent`,size:`sm`,disabled:r||!t,onClick:()=>o(()=>b.setConcurrency(e,Number(t))),children:`Set`}),(0,j.jsx)(E,{size:`sm`,disabled:r,onClick:()=>o(()=>b.clearConcurrency(e)),children:`Clear`}),a&&(0,j.jsx)(`span`,{className:`text-xs text-emerald-400`,children:`Saved`}),i&&(0,j.jsx)(`span`,{className:`text-xs text-red-400`,children:i})]})]})}var I=[`active`,`waiting`,`completed`,`failed`,`delayed`,`paused`],L={detail:{ok:!1,name:``,counts:{waiting:0,active:0,completed:0,failed:0,delayed:0,prioritized:0,paused:0},paused:!1,priorityCounts:{},dlqPreview:[],timestamp:0},jobs:[]};function R(){let{name:e=``}=a(),n=t(),[i,s]=(0,A.useState)(null),[d,m]=(0,A.useState)(null),{data:O,error:k,loading:N,refetch:P}=u((0,A.useCallback)(async()=>{let[t,n]=await Promise.all([b.queueDetail(e,!1),b.jobsList(e,{states:I,limit:12})]);return{detail:t,jobs:n.jobs??[]}},[e]),[e]),F=async(e,t,r)=>{if(!(r&&!window.confirm(r))){s(e),m(null);try{if(await t(),e===`obliterate`){n(`/queues`);return}await P()}catch(e){m(e.message)}finally{s(null)}}};if(N&&!O&&!k)return(0,j.jsx)(g,{label:`Loading ${e}…`});let R=O??L,{detail:z}=R,B=z.counts,V=C(B.completed??0,B.failed??0)??0,H=[...R.jobs].sort((e,t)=>(t.createdAt??0)-(e.createdAt??0));return(0,j.jsxs)(`div`,{children:[k&&(0,j.jsx)(D,{onRetry:P}),(0,j.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-start justify-between gap-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,j.jsx)(f,{"aria-label":`Back to queues`,onClick:()=>n(`/queues`),children:(0,j.jsx)(l,{className:`size-4`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h1`,{className:`font-mono text-2xl font-bold tracking-tight text-fg`,children:e}),(0,j.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-3`,children:[(0,j.jsx)(h,{label:z.paused?`Paused`:`Active`,tone:z.paused?`amber`:`green`}),(0,j.jsx)(h,{label:`Live`,tone:`green`})]})]})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[z.paused?(0,j.jsxs)(E,{variant:`success`,size:`sm`,disabled:i!=null,onClick:()=>F(`resume`,()=>b.resume(e)),children:[(0,j.jsx)(p,{className:`size-3.5`}),` Resume`]}):(0,j.jsxs)(E,{variant:`warning`,size:`sm`,disabled:i!=null,onClick:()=>F(`pause`,()=>b.pause(e)),children:[(0,j.jsx)(c,{className:`size-3.5`}),` Pause`]}),(0,j.jsx)(E,{size:`sm`,disabled:i!=null,onClick:()=>F(`drain`,()=>b.drain(e),`Drain all waiting jobs from "${e}"?`),children:`Drain`}),(0,j.jsx)(E,{variant:`danger`,size:`sm`,disabled:i!=null,onClick:()=>F(`obliterate`,()=>b.obliterate(e),`Obliterate "${e}"? This removes the queue and all its jobs.`),children:`Obliterate`})]})]}),d&&(0,j.jsx)(`div`,{className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-red-400`,children:d}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,j.jsx)(S,{label:`Waiting`,value:_(B.waiting),tone:`amber`}),(0,j.jsx)(S,{label:`Active`,value:_(B.active),tone:`blue`}),(0,j.jsx)(S,{label:`Completed`,value:_(B.completed),tone:`green`}),(0,j.jsx)(S,{label:`Failed`,value:_(B.failed),tone:B.failed?`red`:`default`}),(0,j.jsx)(S,{label:`Delayed`,value:_(B.delayed),tone:`default`}),(0,j.jsx)(S,{label:`Error Rate`,value:x(V),tone:V>.05?`red`:`green`})]}),(0,j.jsxs)(`div`,{className:`mt-8`,children:[(0,j.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,j.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:`Recent Jobs`}),(0,j.jsxs)(r,{to:`/jobs?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 text-sm text-muted hover:text-fg`,children:[`View all jobs `,(0,j.jsx)(o,{className:`size-3.5`})]})]}),(0,j.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-line bg-surface`,children:(0,j.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,j.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`ID`}),(0,j.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,j.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,j.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,j.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Created`})]})}),(0,j.jsx)(`tbody`,{children:H.length===0?(0,j.jsx)(`tr`,{children:(0,j.jsx)(`td`,{colSpan:5,className:`px-5 py-12 text-center text-sm text-faint`,children:`No recent jobs.`})}):H.map(e=>(0,j.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,j.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.id}),(0,j.jsx)(`td`,{className:`px-5 py-3 text-fg`,children:e.data?.name||`unknown`}),(0,j.jsx)(`td`,{className:`px-5 py-3`,children:(0,j.jsx)(y,{status:String(e.state??e.status??`waiting`)})}),(0,j.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:w(v(e.startedAt,e.completedAt))}),(0,j.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:T(e.createdAt)})]},e.id))})]})})]}),(0,j.jsx)(M,{queue:e})]})}export{R as QueueDetail};
1
+ import{r as e}from"./cn-CMFYpumL.js";import{d as t,h as n,r,t as i,u as a}from"./react-vendor-B68RYDeC.js";import{A as o,B as s,H as c,M as l,O as u,S as d,T as f,U as p,Y as m,_ as h,b as g,c as _,f as v,g as y,k as b,l as x,m as S,n as C,o as w,u as T,w as E,x as D}from"./index-BRcFyrFG.js";import{n as O,t as k}from"./form-C-zZyKfB.js";var A=e(n(),1),j=i();function M({queue:e}){return(0,j.jsxs)(`div`,{className:`mt-8`,children:[(0,j.jsx)(`h2`,{className:`mb-3 text-lg font-semibold text-fg`,children:`Configuration`}),(0,j.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,j.jsx)(P,{queue:e}),(0,j.jsx)(F,{queue:e})]})]})}function N(){let[e,t]=(0,A.useState)(!1),[n,r]=(0,A.useState)(null),[i,a]=(0,A.useState)(!1);return{busy:e,error:n,done:i,run:async e=>{t(!0),r(null),a(!1);try{await e(),a(!0),setTimeout(()=>a(!1),2e3)}catch(e){r(e.message)}finally{t(!1)}}}}function P({queue:e}){let[t,n]=(0,A.useState)(``),{busy:r,error:i,done:a,run:o}=N();return(0,j.jsxs)(d,{children:[(0,j.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,j.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Rate Limit`}),(0,j.jsx)(s,{className:`size-4 text-faint`})]}),(0,j.jsx)(k,{label:`Max jobs / second`,children:(0,j.jsx)(O,{type:`number`,inputMode:`numeric`,placeholder:`100`,value:t,onChange:e=>n(e.target.value)})}),(0,j.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,j.jsx)(E,{variant:`accent`,size:`sm`,disabled:r||!t,onClick:()=>o(()=>b.setRateLimit(e,Number(t))),children:`Set`}),(0,j.jsx)(E,{size:`sm`,disabled:r,onClick:()=>o(()=>b.clearRateLimit(e)),children:`Clear`}),a&&(0,j.jsx)(`span`,{className:`text-xs text-emerald-400`,children:`Saved`}),i&&(0,j.jsx)(`span`,{className:`text-xs text-red-400`,children:i})]})]})}function F({queue:e}){let[t,n]=(0,A.useState)(``),{busy:r,error:i,done:a,run:o}=N();return(0,j.jsxs)(d,{children:[(0,j.jsxs)(`div`,{className:`mb-4 flex items-center justify-between`,children:[(0,j.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Concurrency`}),(0,j.jsx)(m,{className:`size-4 text-faint`})]}),(0,j.jsx)(k,{label:`Concurrency`,children:(0,j.jsx)(O,{type:`number`,inputMode:`numeric`,placeholder:`5`,value:t,onChange:e=>n(e.target.value)})}),(0,j.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,j.jsx)(E,{variant:`accent`,size:`sm`,disabled:r||!t,onClick:()=>o(()=>b.setConcurrency(e,Number(t))),children:`Set`}),(0,j.jsx)(E,{size:`sm`,disabled:r,onClick:()=>o(()=>b.clearConcurrency(e)),children:`Clear`}),a&&(0,j.jsx)(`span`,{className:`text-xs text-emerald-400`,children:`Saved`}),i&&(0,j.jsx)(`span`,{className:`text-xs text-red-400`,children:i})]})]})}var I=[`active`,`waiting`,`completed`,`failed`,`delayed`,`paused`],L={detail:{ok:!1,name:``,counts:{waiting:0,active:0,completed:0,failed:0,delayed:0,prioritized:0,paused:0},paused:!1,priorityCounts:{},dlqPreview:[],timestamp:0},jobs:[]};function R(){let{name:e=``}=t(),n=a(),[i,s]=(0,A.useState)(null),[d,m]=(0,A.useState)(null),{data:O,error:k,loading:N,refetch:P}=u((0,A.useCallback)(async()=>{let[t,n]=await Promise.all([b.queueDetail(e,!1),b.jobsList(e,{states:I,limit:12})]);return{detail:t,jobs:n.jobs??[]}},[e]),[e]),F=async(e,t,r)=>{if(!(r&&!window.confirm(r))){s(e),m(null);try{if(await t(),e===`obliterate`){n(`/queues`);return}await P()}catch(e){m(e.message)}finally{s(null)}}};if(N&&!O&&!k)return(0,j.jsx)(g,{label:`Loading ${e}…`});let R=O??L,{detail:z}=R,B=z.counts,V=C(B.completed??0,B.failed??0)??0,H=[...R.jobs].sort((e,t)=>(t.createdAt??0)-(e.createdAt??0));return(0,j.jsxs)(`div`,{children:[k&&(0,j.jsx)(D,{onRetry:P}),(0,j.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-start justify-between gap-4`,children:[(0,j.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,j.jsx)(f,{"aria-label":`Back to queues`,onClick:()=>n(`/queues`),children:(0,j.jsx)(l,{className:`size-4`})}),(0,j.jsxs)(`div`,{children:[(0,j.jsx)(`h1`,{className:`font-mono text-2xl font-bold tracking-tight text-fg`,children:e}),(0,j.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-3`,children:[(0,j.jsx)(h,{label:z.paused?`Paused`:`Active`,tone:z.paused?`amber`:`green`}),(0,j.jsx)(h,{label:`Live`,tone:`green`})]})]})]}),(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[z.paused?(0,j.jsxs)(E,{variant:`success`,size:`sm`,disabled:i!=null,onClick:()=>F(`resume`,()=>b.resume(e)),children:[(0,j.jsx)(p,{className:`size-3.5`}),` Resume`]}):(0,j.jsxs)(E,{variant:`warning`,size:`sm`,disabled:i!=null,onClick:()=>F(`pause`,()=>b.pause(e)),children:[(0,j.jsx)(c,{className:`size-3.5`}),` Pause`]}),(0,j.jsx)(E,{size:`sm`,disabled:i!=null,onClick:()=>F(`drain`,()=>b.drain(e),`Drain all waiting jobs from "${e}"?`),children:`Drain`}),(0,j.jsx)(E,{variant:`danger`,size:`sm`,disabled:i!=null,onClick:()=>F(`obliterate`,()=>b.obliterate(e),`Obliterate "${e}"? This removes the queue and all its jobs.`),children:`Obliterate`})]})]}),d&&(0,j.jsx)(`div`,{className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-red-400`,children:d}),(0,j.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,j.jsx)(S,{label:`Waiting`,value:_(B.waiting),tone:`amber`}),(0,j.jsx)(S,{label:`Active`,value:_(B.active),tone:`blue`}),(0,j.jsx)(S,{label:`Completed`,value:_(B.completed),tone:`green`}),(0,j.jsx)(S,{label:`Failed`,value:_(B.failed),tone:B.failed?`red`:`default`}),(0,j.jsx)(S,{label:`Delayed`,value:_(B.delayed),tone:`default`}),(0,j.jsx)(S,{label:`Error Rate`,value:x(V),tone:V>.05?`red`:`green`})]}),(0,j.jsxs)(`div`,{className:`mt-8`,children:[(0,j.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,j.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:`Recent Jobs`}),(0,j.jsxs)(r,{to:`/jobs?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 text-sm text-muted hover:text-fg`,children:[`View all jobs `,(0,j.jsx)(o,{className:`size-3.5`})]})]}),(0,j.jsx)(`div`,{className:`overflow-hidden rounded-xl border border-line bg-surface`,children:(0,j.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,j.jsx)(`thead`,{children:(0,j.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,j.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`ID`}),(0,j.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,j.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,j.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,j.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Created`})]})}),(0,j.jsx)(`tbody`,{children:H.length===0?(0,j.jsx)(`tr`,{children:(0,j.jsx)(`td`,{colSpan:5,className:`px-5 py-12 text-center text-sm text-faint`,children:`No recent jobs.`})}):H.map(e=>(0,j.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,j.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.id}),(0,j.jsx)(`td`,{className:`px-5 py-3 text-fg`,children:e.data?.name||`unknown`}),(0,j.jsx)(`td`,{className:`px-5 py-3`,children:(0,j.jsx)(y,{status:String(e.state??e.status??`waiting`)})}),(0,j.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:w(v(e.startedAt,e.completedAt))}),(0,j.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:T(e.createdAt)})]},e.id))})]})})]}),(0,j.jsx)(M,{queue:e})]})}export{R as QueueDetail};
@@ -1 +1 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{l as n,m as r,r as i,t as a,u as o}from"./react-vendor-CHIHtdAC.js";import{A as s,C as c,M as l,O 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,tt as S,w as C,x as w}from"./index-DTo6fJH9.js";import{t as T}from"./AreaChart-DzUXW8u3.js";import{t as E}from"./useThroughputSeries-D8wylrhf.js";import{i as D,n as O,r as k,t as A}from"./QueueActions-DPqmozNf.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=``}=o(),r=n(),[a,I]=(0,j.useState)(!1),[L,R]=(0,j.useState)(null),{data:z,error:B,loading:V,refetch:H}=u((0,j.useCallback)(async()=>{if(!e)return null;let[t,n,r,i]=await Promise.all([S.queueDetail(e,!1),S.getStallConfig(e).catch(()=>null),S.getDlqConfig(e).catch(()=>null),S.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]),U=z&&z.queue===e?z:null,[W,G]=(0,j.useState)([]),K=(0,j.useRef)(null);(0,j.useEffect)(()=>{let e=U?.detail?.counts;e&&(K.current=(e.waiting??0)+(e.active??0)+(e.delayed??0))},[U]),(0,j.useEffect)(()=>{K.current=null,G([]);let e=setInterval(()=>{let e=K.current;e!=null&&G(t=>[...t,e].slice(-40))},F);return()=>clearInterval(e)},[e]);let q=(t,n,r)=>{r&&!window.confirm(r)||(I(!0),R(null),n().then(n=>{let r=n?.count,i=`${t}${r==null?` ✓`:`: ${r}`}`;R({ok:!0,text:i}),b.success(i,e),H()}).catch(e=>{let n=e.message;R({ok:!1,text:n}),b.error(`${t} failed`,n)}).finally(()=>I(!1)))},J=()=>{window.confirm(`Obliterate "${e}"? This removes the queue and all its jobs.`)&&(I(!0),S.obliterate(e).then(()=>{b.success(`Queue obliterated`,e),r(`/queues`)}).catch(e=>{let t=e.message;R({ok:!1,text:t}),b.error(`Obliterate failed`,t),I(!1)}))},Y=U?.detail,X=Y?.counts,Z=X?y(X.completed??0,X.failed??0)??0:0,Q=E(W);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)(l,{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)(s,{className:`size-3.5`})]}),(0,M.jsxs)(i,{to:`/dlq`,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)(s,{className:`size-3.5`})]}),(0,M.jsx)(C,{variant:`danger`,size:`sm`,disabled:a,onClick:J,children:`Obliterate`})]})}),B&&(0,M.jsx)(w,{onRetry:H}),V&&!U&&!B?(0,M.jsx)(m,{label:`Loading ${e}…`}):!Y||!X?!B&&(0,M.jsx)(`p`,{className:`text-sm text-faint`,children:`Queue not found.`}):(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:Y.paused?`Paused`:`Active`,tone:Y.paused?`amber`:`green`}),L&&(0,M.jsx)(`span`,{className:L.ok?`text-xs text-success`:`text-xs text-danger`,children:L.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(X[e]),tone:e===`failed`&&X.failed?`red`:`default`,compact:!0},e))}),(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`,Q.draining?`bg-emerald-500/10 text-success`:Q.label===`accumulating`?`bg-red-500/10 text-danger`:`bg-surface-2 text-muted`),children:Q.label})}),W.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)(T,{height:140,ariaLabel:`${e} backlog depth`,series:[{label:`depth`,color:`var(--accent)`,points:W,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 `,_(Z)]})]})]}),(0,M.jsx)(A,{queue:e,paused:Y.paused,busy:a,run:q}),(0,M.jsx)(O,{queue:e,busy:a,run:q}),(0,M.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[U.stall&&(0,M.jsx)(D,{queue:e,config:U.stall,onSaved:()=>{R({ok:!0,text:`Stall config saved ✓`}),b.success(`Stall config saved`,e)}},e),U.dlq&&(0,M.jsx)(k,{queue:e,config:U.dlq,onSaved:()=>{R({ok:!0,text:`DLQ config saved ✓`}),b.success(`DLQ config saved`,e)}},e)]}),(0,M.jsxs)(d,{padded:!1,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)(s,{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`,{className:`px-5 py-3 font-medium`,children:`ID`}),(0,M.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`State`}),(0,M.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Attempts`}),(0,M.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`})]})}),(0,M.jsx)(`tbody`,{children:U.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.`})}):U.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))})]})})]})]})]})}export{I as QueueDetailPro};
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,O 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,tt as S,w as C,x as w}from"./index-BRcFyrFG.js";import{t as T}from"./AreaChart-lY-mk5E1.js";import{t as E}from"./useThroughputSeries-BhH_0wfd.js";import{i as D,n as O,r as k,t as A}from"./QueueActions-BvXNsXKQ.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),[L,R]=(0,j.useState)(null),{data:z,error:B,loading:V,refetch:H}=u((0,j.useCallback)(async()=>{if(!e)return null;let[t,n,r,i]=await Promise.all([S.queueDetail(e,!1),S.getStallConfig(e).catch(()=>null),S.getDlqConfig(e).catch(()=>null),S.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]),U=z&&z.queue===e?z:null,[W,G]=(0,j.useState)([]),K=(0,j.useRef)(null);(0,j.useEffect)(()=>{let e=U?.detail?.counts;e&&(K.current=(e.waiting??0)+(e.active??0)+(e.delayed??0))},[U]),(0,j.useEffect)(()=>{K.current=null,G([]);let e=setInterval(()=>{let e=K.current;e!=null&&G(t=>[...t,e].slice(-40))},F);return()=>clearInterval(e)},[e]);let q=(t,n,r)=>{r&&!window.confirm(r)||(I(!0),R(null),n().then(n=>{let r=n?.count,i=`${t}${r==null?` ✓`:`: ${r}`}`;R({ok:!0,text:i}),b.success(i,e),H()}).catch(e=>{let n=e.message;R({ok:!1,text:n}),b.error(`${t} failed`,n)}).finally(()=>I(!1)))},J=()=>{window.confirm(`Obliterate "${e}"? This removes the queue and all its jobs.`)&&(I(!0),S.obliterate(e).then(()=>{b.success(`Queue obliterated`,e),r(`/queues`)}).catch(e=>{let t=e.message;R({ok:!1,text:t}),b.error(`Obliterate failed`,t),I(!1)}))},Y=U?.detail,X=Y?.counts,Z=X?y(X.completed??0,X.failed??0)??0:0,Q=E(W);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)(l,{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)(s,{className:`size-3.5`})]}),(0,M.jsxs)(i,{to:`/dlq`,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)(s,{className:`size-3.5`})]}),(0,M.jsx)(C,{variant:`danger`,size:`sm`,disabled:a,onClick:J,children:`Obliterate`})]})}),B&&(0,M.jsx)(w,{onRetry:H}),V&&!U&&!B?(0,M.jsx)(m,{label:`Loading ${e}…`}):!Y||!X?!B&&(0,M.jsx)(`p`,{className:`text-sm text-faint`,children:`Queue not found.`}):(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:Y.paused?`Paused`:`Active`,tone:Y.paused?`amber`:`green`}),L&&(0,M.jsx)(`span`,{className:L.ok?`text-xs text-success`:`text-xs text-danger`,children:L.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(X[e]),tone:e===`failed`&&X.failed?`red`:`default`,compact:!0},e))}),(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`,Q.draining?`bg-emerald-500/10 text-success`:Q.label===`accumulating`?`bg-red-500/10 text-danger`:`bg-surface-2 text-muted`),children:Q.label})}),W.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)(T,{height:140,ariaLabel:`${e} backlog depth`,series:[{label:`depth`,color:`var(--accent)`,points:W,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 `,_(Z)]})]})]}),(0,M.jsx)(A,{queue:e,paused:Y.paused,busy:a,run:q}),(0,M.jsx)(O,{queue:e,busy:a,run:q}),(0,M.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[U.stall&&(0,M.jsx)(D,{queue:e,config:U.stall,onSaved:()=>{R({ok:!0,text:`Stall config saved ✓`}),b.success(`Stall config saved`,e)}},e),U.dlq&&(0,M.jsx)(k,{queue:e,config:U.dlq,onSaved:()=>{R({ok:!0,text:`DLQ config saved ✓`}),b.success(`DLQ config saved`,e)}},e)]}),(0,M.jsxs)(d,{padded:!1,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)(s,{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`,{className:`px-5 py-3 font-medium`,children:`ID`}),(0,M.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`State`}),(0,M.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Attempts`}),(0,M.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`})]})}),(0,M.jsx)(`tbody`,{children:U.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.`})}):U.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))})]})})]})]})]})}export{I as QueueDetailPro};
@@ -1 +1 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{l as n,m as r,t as i}from"./react-vendor-CHIHtdAC.js";import{A as a,O as o,W as s,b as c,c as l,h as u,k as d,m as f,q as p,x as m}from"./index-DTo6fJH9.js";import{t as h}from"./Pagination-B-6mVPUC.js";var g=e(r(),1),_=i(),v=20,y={ok:!1,queues:[],total:0,limit:v,offset:0,timestamp:0};function b(){let e=n(),[r,i]=(0,g.useState)(``),[b,x]=(0,g.useState)(0),{data:S,error:C,loading:w,refetch:T}=o(()=>d.queues(v,b*v),[b]),E=S??y,D=(0,g.useMemo)(()=>{let e=E.queues,t=r.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)):e},[E,r]);if(w&&!S&&!C)return(0,_.jsx)(c,{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)(u,{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)(f,{label:`Waiting`,value:l(O.waiting),tone:`amber`,compact:!0}),(0,_.jsx)(f,{label:`Active`,value:l(O.active),tone:`blue`,compact:!0}),(0,_.jsx)(f,{label:`Delayed`,value:l(O.delayed),tone:`default`,compact:!0}),(0,_.jsx)(f,{label:`DLQ`,value:l(O.dlq),tone:O.dlq?`red`:`default`,compact:!0})]}),(0,_.jsxs)(`div`,{className:`relative mb-4 max-w-sm`,children:[(0,_.jsx)(p,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,_.jsx)(`input`,{value:r,onChange:e=>i(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:r?`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)(s,{className:`size-4 text-faint`}),n.name]})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:l(n.waiting)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:l(n.active)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:l(n.delayed)}),(0,_.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,n.dlq?`text-red-400`:`text-muted`),children:l(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)(a,{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
+ 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,O as o,W as s,b as c,c as l,h as u,k as d,m as f,q as p,x as m}from"./index-BRcFyrFG.js";import{t as h}from"./Pagination-Bm5HTIE3.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}=o(()=>d.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)(c,{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)(u,{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)(f,{label:`Waiting`,value:l(O.waiting),tone:`amber`,compact:!0}),(0,_.jsx)(f,{label:`Active`,value:l(O.active),tone:`blue`,compact:!0}),(0,_.jsx)(f,{label:`Delayed`,value:l(O.delayed),tone:`default`,compact:!0}),(0,_.jsx)(f,{label:`DLQ`,value:l(O.dlq),tone:O.dlq?`red`:`default`,compact:!0})]}),(0,_.jsxs)(`div`,{className:`relative mb-4 max-w-sm`,children:[(0,_.jsx)(p,{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)(s,{className:`size-4 text-faint`}),n.name]})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:l(n.waiting)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:l(n.active)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:l(n.delayed)}),(0,_.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,n.dlq?`text-red-400`:`text-muted`),children:l(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)(a,{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};
@@ -0,0 +1 @@
1
+ import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,r,t as i,u as a}from"./react-vendor-B68RYDeC.js";import{A as o,H as s,O as c,T as l,U as u,W as d,b as f,c as p,h as m,m as h,nt as g,q as _,tt as v,w as y,x as b}from"./index-BRcFyrFG.js";import{t as x}from"./Pagination-Bm5HTIE3.js";import{t as S}from"./promisePool-Daxkc1OB.js";var C=e(n(),1),w=i(),T=6,E=15;function D(){let e=a(),[n,i]=(0,C.useState)(``),[D,O]=(0,C.useState)(0),[k,A]=(0,C.useState)(new Set),[j,M]=(0,C.useState)(!1),[N,P]=(0,C.useState)(null),{data:F,error:I,loading:L,refetch:R}=c(()=>v.queuesSummary(),[]),z=F??[],B=(0,C.useMemo)(()=>{let e=n.trim().toLowerCase();return[...e?z.filter(t=>t.name.toLowerCase().includes(e)):z].sort((e,t)=>e.name.localeCompare(t.name))},[z,n]),V=(0,C.useMemo)(()=>z.reduce((e,t)=>(e.waiting+=t.counts.waiting,e.active+=t.counts.active,e.failed+=t.counts.failed,e.paused+=+!!t.paused,e),{waiting:0,active:0,failed:0,paused:0}),[z]),H=Math.max(1,Math.ceil(B.length/E)),U=Math.min(D,H-1),W=B.slice(U*E,U*E+E),G=async e=>{A(t=>new Set(t).add(e.name)),P(null);try{await(e.paused?v.resume(e.name):v.pause(e.name)),P({ok:!0,text:`${e.name} ${e.paused?`resumed`:`paused`} ✓`})}catch(t){P({ok:!1,text:t.message}),g.error(`Failed to ${e.paused?`resume`:`pause`} ${e.name}`,t.message)}finally{A(t=>{let n=new Set(t);return n.delete(e.name),n}),R()}},K=async e=>{let t=z.filter(t=>e===`pause`?!t.paused:t.paused);if(t.length===0){g.info(`No queues to ${e}`);return}if(!window.confirm(`${e===`pause`?`Pause`:`Resume`} ${t.length} queue(s)?`))return;M(!0),P(null);let n=(await S(t,T,t=>e===`pause`?v.pause(t.name):v.resume(t.name))).filter(e=>e.status===`rejected`).length,r=`${e===`pause`?`Paused`:`Resumed`} ${t.length-n}/${t.length} queues${n?`, ${n} failed`:``}`;P({ok:n===0,text:r}),n===0?g.success(r):g.error(r),M(!1),R()};return L&&!F&&!I?(0,w.jsx)(f,{label:`Loading queues…`}):(0,w.jsxs)(`div`,{children:[(0,w.jsx)(m,{title:`Queues`,description:`${z.length} queues`,live:!0,actions:z.length>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(y,{variant:`warning`,size:`sm`,disabled:j||V.paused>=z.length,onClick:()=>K(`pause`),children:[(0,w.jsx)(s,{className:`size-3.5`}),` Pause all`]}),(0,w.jsxs)(y,{variant:`success`,size:`sm`,disabled:j||V.paused===0,onClick:()=>K(`resume`),children:[(0,w.jsx)(u,{className:`size-3.5`}),` Resume all`]})]}):void 0}),I&&(0,w.jsx)(b,{onRetry:R}),(0,w.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,w.jsx)(h,{label:`Waiting`,value:p(V.waiting),tone:`amber`,compact:!0}),(0,w.jsx)(h,{label:`Active`,value:p(V.active),tone:`blue`,compact:!0}),(0,w.jsx)(h,{label:`Failed`,value:p(V.failed),tone:V.failed?`red`:`default`,compact:!0}),(0,w.jsx)(h,{label:`Paused`,value:p(V.paused),tone:V.paused?`amber`:`default`,compact:!0})]}),(0,w.jsxs)(`div`,{className:`relative mb-4 max-w-sm`,children:[(0,w.jsx)(_,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,w.jsx)(`input`,{value:n,onChange:e=>{i(e.target.value),O(0)},placeholder:`Search queues…`,"aria-label":`Filter 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`})]}),N&&(0,w.jsx)(`div`,{className:t(`mb-3 text-sm`,N.ok?`text-success`:`text-danger`),children:N.text}),(0,w.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,w.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,w.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,w.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Waiting`}),(0,w.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,w.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Completed`}),(0,w.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`}),(0,w.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Delayed`}),(0,w.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,w.jsx)(`th`,{className:`w-24 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,w.jsx)(`tbody`,{children:W.length===0?(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:8,className:`px-5 py-12 text-center text-sm text-faint`,children:n?`No queues match your search.`:`No queues yet.`})}):W.map(n=>{let i=k.has(n.name);return(0,w.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,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.jsxs)(r,{to:`/queues/${encodeURIComponent(n.name)}`,onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 rounded font-medium text-fg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[(0,w.jsx)(d,{className:`size-4 text-faint`}),n.name]})}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:p(n.counts.waiting)}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:p(n.counts.active)}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-success`,children:p(n.counts.completed)}),(0,w.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,n.counts.failed?`text-danger`:`text-muted`),children:p(n.counts.failed)}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:p(n.counts.delayed)}),(0,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.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-success`),children:[(0,w.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),n.paused?`Paused`:`Active`]})}),(0,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,w.jsx)(l,{"aria-label":n.paused?`Resume queue`:`Pause queue`,disabled:i,onClick:e=>{e.stopPropagation(),G(n)},children:n.paused?(0,w.jsx)(u,{className:`size-3.5 text-success`}):(0,w.jsx)(s,{className:`size-3.5 text-warning`})}),(0,w.jsx)(o,{className:`size-4 text-faint opacity-0 transition-opacity group-hover:opacity-100`})]})})]},n.name)})})]})}),(0,w.jsx)(x,{page:U,pageSize:E,total:B.length,onPageChange:O,label:`queues`})]})}export{D as QueuesOverview};
@@ -1 +1 @@
1
- import{t as e}from"./react-vendor-CHIHtdAC.js";import{C as t,O as n,S as r,b as i,h as a,k as o,x as s}from"./index-DTo6fJH9.js";var c=e(),l=[[`S3_BACKUP_ENABLED`,`Set to 1 to enable periodic backups`],[`S3_BUCKET`,`Target bucket name`],[`S3_REGION`,`Bucket region (default us-east-1)`],[`S3_ENDPOINT`,`Custom endpoint (for S3-compatible stores)`],[`S3_ACCESS_KEY_ID`,`Access key`],[`S3_SECRET_ACCESS_KEY`,`Secret key`],[`S3_BACKUP_INTERVAL`,`Interval in ms (default 21600000 = 6h)`],[`S3_BACKUP_RETENTION`,`Backups to keep (default 7)`]];function u(){let{data:e,error:u,loading:d,refetch:f}=n(()=>o.storage(),[]);return(0,c.jsxs)(`div`,{children:[u&&(0,c.jsx)(s,{onRetry:f}),(0,c.jsx)(a,{title:`S3 Backup`,description:`SQLite snapshot backups to object storage.`,live:!0}),(0,c.jsx)(`div`,{className:`mb-6 rounded-lg border border-line bg-surface/60 px-4 py-3 text-sm text-muted`,children:`S3 backup runs on the server and is configured via environment variables — it cannot be toggled from the dashboard. The status below reflects the connected server's storage.`}),(0,c.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,c.jsxs)(r,{children:[(0,c.jsx)(t,{title:`Storage status`}),d&&!e&&!u?(0,c.jsx)(i,{}):(0,c.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,c.jsx)(`dt`,{className:`text-muted`,children:`Disk`}),(0,c.jsx)(`dd`,{className:e?.status?.diskFull?`font-medium text-red-400`:`font-medium text-emerald-400`,children:e?.status?.diskFull?`Full`:`Healthy`})]}),(0,c.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,c.jsx)(`dt`,{className:`text-muted`,children:`Path`}),(0,c.jsx)(`dd`,{className:`font-mono text-xs text-fg`,children:String(e?.status?.path??`—`)})]})]})]}),(0,c.jsxs)(r,{children:[(0,c.jsx)(t,{title:`Configuration (server env)`}),(0,c.jsx)(`dl`,{className:`divide-y divide-line text-sm`,children:l.map(([e,t])=>(0,c.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5`,children:[(0,c.jsx)(`dt`,{className:`font-mono text-xs text-accent/90`,children:e}),(0,c.jsx)(`dd`,{className:`text-right text-xs text-faint`,children:t})]},e))})]})]})]})}export{u as S3Backup};
1
+ import{t as e}from"./react-vendor-B68RYDeC.js";import{C as t,O as n,S as r,b as i,h as a,k as o,x as s}from"./index-BRcFyrFG.js";var c=e(),l=[[`S3_BACKUP_ENABLED`,`Set to 1 to enable periodic backups`],[`S3_BUCKET`,`Target bucket name`],[`S3_REGION`,`Bucket region (default us-east-1)`],[`S3_ENDPOINT`,`Custom endpoint (for S3-compatible stores)`],[`S3_ACCESS_KEY_ID`,`Access key`],[`S3_SECRET_ACCESS_KEY`,`Secret key`],[`S3_BACKUP_INTERVAL`,`Interval in ms (default 21600000 = 6h)`],[`S3_BACKUP_RETENTION`,`Backups to keep (default 7)`]];function u(){let{data:e,error:u,loading:d,refetch:f}=n(()=>o.storage(),[]);return(0,c.jsxs)(`div`,{children:[u&&(0,c.jsx)(s,{onRetry:f}),(0,c.jsx)(a,{title:`S3 Backup`,description:`SQLite snapshot backups to object storage.`,live:!0}),(0,c.jsx)(`div`,{className:`mb-6 rounded-lg border border-line bg-surface/60 px-4 py-3 text-sm text-muted`,children:`S3 backup runs on the server and is configured via environment variables — it cannot be toggled from the dashboard. The status below reflects the connected server's storage.`}),(0,c.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,c.jsxs)(r,{children:[(0,c.jsx)(t,{title:`Storage status`}),d&&!e&&!u?(0,c.jsx)(i,{}):(0,c.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,c.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,c.jsx)(`dt`,{className:`text-muted`,children:`Disk`}),(0,c.jsx)(`dd`,{className:e?.status?.diskFull?`font-medium text-red-400`:`font-medium text-emerald-400`,children:e?.status?.diskFull?`Full`:`Healthy`})]}),(0,c.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,c.jsx)(`dt`,{className:`text-muted`,children:`Path`}),(0,c.jsx)(`dd`,{className:`font-mono text-xs text-fg`,children:String(e?.status?.path??`—`)})]})]})]}),(0,c.jsxs)(r,{children:[(0,c.jsx)(t,{title:`Configuration (server env)`}),(0,c.jsx)(`dl`,{className:`divide-y divide-line text-sm`,children:l.map(([e,t])=>(0,c.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5`,children:[(0,c.jsx)(`dt`,{className:`font-mono text-xs text-accent/90`,children:e}),(0,c.jsx)(`dd`,{className:`text-right text-xs text-faint`,children:t})]},e))})]})]})]})}export{u as S3Backup};
@@ -1 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{a as r,o as i}from"./connectionStore-CCopJeU7.js";import{K as a,S as o,h as s,tt as c,w as l,y as u}from"./index-DTo6fJH9.js";import{a as d,n as f,r as p,t as m}from"./form-PtDLk33Z.js";var h=e(t(),1);function g(e){return{endpoint:e.endpoint,region:e.region,bucket:e.bucket,schedule:e.schedule,pathPrefix:e.pathPrefix}}var _=i()(r(e=>({endpoint:``,region:`us-east-1`,bucket:``,accessKeyId:``,secretAccessKey:``,schedule:`disabled`,pathPrefix:``,set:t=>e(t)}),{name:`bq-dash-s3`,partialize:g})),v=n();function y(){let e=_(),[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!1),g=e.bucket.trim()!==``;return(0,v.jsxs)(`div`,{children:[(0,v.jsx)(s,{title:`S3 Backup`,description:`Automatic backups to S3-compatible storage.`}),(0,v.jsxs)(`div`,{className:`mb-6 flex items-center justify-between rounded-xl border border-line bg-surface px-5 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-lg bg-surface-2 text-faint`,children:(0,v.jsx)(a,{className:`size-5`})}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`font-semibold text-fg`,children:g?`Backup configured`:`No backup configured`}),(0,v.jsx)(`div`,{className:`text-xs text-faint`,children:g?`Target: ${e.bucket}`:`Set up S3 to protect your queue data`})]})]}),(0,v.jsx)(`span`,{className:g?`rounded-full bg-emerald-500/10 px-3 py-1 text-xs font-medium text-success`:`rounded-full bg-amber-500/10 px-3 py-1 text-xs font-medium text-warning`,children:g?`Ready`:`Configure`})]}),(0,v.jsx)(`div`,{className:`mb-6 rounded-lg border border-line bg-surface/60 px-4 py-2.5 text-xs text-faint`,children:`bunqueue reads S3 backup settings from server environment variables (S3_BUCKET, S3_REGION, …). This form helps you assemble that configuration; it is stored locally in your browser.`}),(0,v.jsxs)(o,{className:`mb-6`,children:[(0,v.jsx)(`h3`,{className:`mb-1 text-base font-semibold text-fg`,children:`Connection Settings`}),(0,v.jsx)(`p`,{className:`mb-4 text-xs text-faint`,children:`Works with AWS S3, Cloudflare R2, MinIO, DigitalOcean Spaces, and any S3-compatible provider.`}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,v.jsx)(m,{label:`Endpoint`,children:(0,v.jsx)(f,{value:e.endpoint,onChange:t=>e.set({endpoint:t.target.value}),placeholder:`https://s3.amazonaws.com`})}),(0,v.jsx)(m,{label:`Region`,children:(0,v.jsx)(f,{value:e.region,onChange:t=>e.set({region:t.target.value}),placeholder:`us-east-1`})}),(0,v.jsx)(`div`,{className:`md:col-span-2`,children:(0,v.jsx)(m,{label:`Bucket name`,children:(0,v.jsx)(f,{value:e.bucket,onChange:t=>e.set({bucket:t.target.value}),placeholder:`my-bunqueue-backups`})})}),(0,v.jsx)(m,{label:`Access key ID`,children:(0,v.jsx)(f,{value:e.accessKeyId,onChange:t=>e.set({accessKeyId:t.target.value}),placeholder:`AKIA…`})}),(0,v.jsx)(m,{label:`Secret access key`,children:(0,v.jsx)(f,{type:`password`,value:e.secretAccessKey,onChange:t=>e.set({secretAccessKey:t.target.value}),placeholder:`••••••••••••••••`})}),(0,v.jsx)(`p`,{className:`-mt-2 text-xs text-faint md:col-span-2`,children:`Keys are kept in memory only and cleared on reload.`}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(p,{children:`Backup schedule`}),(0,v.jsxs)(d,{value:e.schedule,onChange:t=>e.set({schedule:t.target.value}),className:`mt-1.5`,children:[(0,v.jsx)(`option`,{value:`disabled`,children:`Disabled`}),(0,v.jsx)(`option`,{value:`6h`,children:`Every 6 hours`}),(0,v.jsx)(`option`,{value:`12h`,children:`Every 12 hours`}),(0,v.jsx)(`option`,{value:`24h`,children:`Every 24 hours`})]})]}),(0,v.jsx)(m,{label:`Path prefix (optional)`,children:(0,v.jsx)(f,{value:e.pathPrefix,onChange:t=>e.set({pathPrefix:t.target.value}),placeholder:`backups/production/`})})]}),(0,v.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(l,{variant:`accent`,onClick:()=>{i(!0),setTimeout(()=>i(!1),2e3)},children:`Save Configuration`}),(0,v.jsx)(l,{onClick:async()=>{n(null);try{let e=await c.storage();n({ok:!e.data?.diskFull,msg:e.data?.diskFull?`Server disk is full`:`Server storage reachable`})}catch(e){n({ok:!1,msg:e.message})}},children:`Test Connection`}),(0,v.jsx)(l,{disabled:!0,title:`Trigger a manual backup — requires server-side S3 config`,children:`Backup Now`}),r&&(0,v.jsx)(`span`,{className:`text-xs text-success`,children:`Saved locally (keys excluded)`}),t&&(0,v.jsx)(`span`,{className:t.ok?`text-xs text-success`:`text-xs text-danger`,children:t.msg})]})]}),(0,v.jsxs)(o,{children:[(0,v.jsx)(`h3`,{className:`mb-4 text-base font-semibold text-fg`,children:`Backup History`}),(0,v.jsx)(u,{icon:(0,v.jsx)(a,{}),title:`No backups yet`,hint:`Configure your S3 connection and run a backup to get started.`})]})]})}export{y as S3BackupPro};
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,o as i}from"./connectionStore-B-hNUqwK.js";import{K as a,S as o,h as s,tt as c,w as l,y as u}from"./index-BRcFyrFG.js";import{a as d,n as f,r as p,t as m}from"./form-C-zZyKfB.js";var h=e(t(),1);function g(e){return{endpoint:e.endpoint,region:e.region,bucket:e.bucket,schedule:e.schedule,pathPrefix:e.pathPrefix}}var _=i()(r(e=>({endpoint:``,region:`us-east-1`,bucket:``,accessKeyId:``,secretAccessKey:``,schedule:`disabled`,pathPrefix:``,set:t=>e(t)}),{name:`bq-dash-s3`,partialize:g})),v=n();function y(){let e=_(),[t,n]=(0,h.useState)(null),[r,i]=(0,h.useState)(!1),g=e.bucket.trim()!==``;return(0,v.jsxs)(`div`,{children:[(0,v.jsx)(s,{title:`S3 Backup`,description:`Automatic backups to S3-compatible storage.`}),(0,v.jsxs)(`div`,{className:`mb-6 flex items-center justify-between rounded-xl border border-line bg-surface px-5 py-4`,children:[(0,v.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,v.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-lg bg-surface-2 text-faint`,children:(0,v.jsx)(a,{className:`size-5`})}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`div`,{className:`font-semibold text-fg`,children:g?`Backup configured`:`No backup configured`}),(0,v.jsx)(`div`,{className:`text-xs text-faint`,children:g?`Target: ${e.bucket}`:`Set up S3 to protect your queue data`})]})]}),(0,v.jsx)(`span`,{className:g?`rounded-full bg-emerald-500/10 px-3 py-1 text-xs font-medium text-success`:`rounded-full bg-amber-500/10 px-3 py-1 text-xs font-medium text-warning`,children:g?`Ready`:`Configure`})]}),(0,v.jsx)(`div`,{className:`mb-6 rounded-lg border border-line bg-surface/60 px-4 py-2.5 text-xs text-faint`,children:`bunqueue reads S3 backup settings from server environment variables (S3_BUCKET, S3_REGION, …). This form helps you assemble that configuration; it is stored locally in your browser.`}),(0,v.jsxs)(o,{className:`mb-6`,children:[(0,v.jsx)(`h3`,{className:`mb-1 text-base font-semibold text-fg`,children:`Connection Settings`}),(0,v.jsx)(`p`,{className:`mb-4 text-xs text-faint`,children:`Works with AWS S3, Cloudflare R2, MinIO, DigitalOcean Spaces, and any S3-compatible provider.`}),(0,v.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,v.jsx)(m,{label:`Endpoint`,children:(0,v.jsx)(f,{value:e.endpoint,onChange:t=>e.set({endpoint:t.target.value}),placeholder:`https://s3.amazonaws.com`})}),(0,v.jsx)(m,{label:`Region`,children:(0,v.jsx)(f,{value:e.region,onChange:t=>e.set({region:t.target.value}),placeholder:`us-east-1`})}),(0,v.jsx)(`div`,{className:`md:col-span-2`,children:(0,v.jsx)(m,{label:`Bucket name`,children:(0,v.jsx)(f,{value:e.bucket,onChange:t=>e.set({bucket:t.target.value}),placeholder:`my-bunqueue-backups`})})}),(0,v.jsx)(m,{label:`Access key ID`,children:(0,v.jsx)(f,{value:e.accessKeyId,onChange:t=>e.set({accessKeyId:t.target.value}),placeholder:`AKIA…`})}),(0,v.jsx)(m,{label:`Secret access key`,children:(0,v.jsx)(f,{type:`password`,value:e.secretAccessKey,onChange:t=>e.set({secretAccessKey:t.target.value}),placeholder:`••••••••••••••••`})}),(0,v.jsx)(`p`,{className:`-mt-2 text-xs text-faint md:col-span-2`,children:`Keys are kept in memory only and cleared on reload.`}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(p,{children:`Backup schedule`}),(0,v.jsxs)(d,{value:e.schedule,onChange:t=>e.set({schedule:t.target.value}),className:`mt-1.5`,children:[(0,v.jsx)(`option`,{value:`disabled`,children:`Disabled`}),(0,v.jsx)(`option`,{value:`6h`,children:`Every 6 hours`}),(0,v.jsx)(`option`,{value:`12h`,children:`Every 12 hours`}),(0,v.jsx)(`option`,{value:`24h`,children:`Every 24 hours`})]})]}),(0,v.jsx)(m,{label:`Path prefix (optional)`,children:(0,v.jsx)(f,{value:e.pathPrefix,onChange:t=>e.set({pathPrefix:t.target.value}),placeholder:`backups/production/`})})]}),(0,v.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(l,{variant:`accent`,onClick:()=>{i(!0),setTimeout(()=>i(!1),2e3)},children:`Save Configuration`}),(0,v.jsx)(l,{onClick:async()=>{n(null);try{let e=await c.storage();n({ok:!e.data?.diskFull,msg:e.data?.diskFull?`Server disk is full`:`Server storage reachable`})}catch(e){n({ok:!1,msg:e.message})}},children:`Test Connection`}),(0,v.jsx)(l,{disabled:!0,title:`Trigger a manual backup — requires server-side S3 config`,children:`Backup Now`}),r&&(0,v.jsx)(`span`,{className:`text-xs text-success`,children:`Saved locally (keys excluded)`}),t&&(0,v.jsx)(`span`,{className:t.ok?`text-xs text-success`:`text-xs text-danger`,children:t.msg})]})]}),(0,v.jsxs)(o,{children:[(0,v.jsx)(`h3`,{className:`mb-4 text-base font-semibold text-fg`,children:`Backup History`}),(0,v.jsx)(u,{icon:(0,v.jsx)(a,{}),title:`No backups yet`,hint:`Configure your S3 connection and run a backup to get started.`})]})]})}export{y as S3BackupPro};