bunqueue-dashboard 0.0.21 → 0.0.23

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 (47) hide show
  1. package/dist/.vite/manifest.json +70 -70
  2. package/dist/assets/{AddJob-BdBKp1lA.js → AddJob-C-p_fUxU.js} +1 -1
  3. package/dist/assets/{Alerts-CBtbj7VF.js → Alerts-DHUQoHrO.js} +1 -1
  4. package/dist/assets/{Benchmark-CWd91fdV.js → Benchmark-9UTONKIr.js} +1 -1
  5. package/dist/assets/{BulkAddJobs-Db2Jz08R.js → BulkAddJobs-DOlzFFNp.js} +1 -1
  6. package/dist/assets/{CopilotPanel-Bo9KvCt-.js → CopilotPanel-05UREVXq.js} +1 -1
  7. package/dist/assets/{CopyButton-DhNun7Gi.js → CopyButton-BjMe8rqo.js} +1 -1
  8. package/dist/assets/{Cron-CgniaW__.js → Cron-BVu2xGBX.js} +1 -1
  9. package/dist/assets/{CronManager-BfjJ7XRX.js → CronManager-pAbkEMqi.js} +1 -1
  10. package/dist/assets/{Database-m_cAcr3W.js → Database-Q_X_NR2I.js} +1 -1
  11. package/dist/assets/{Diagnostics-DuuR1jQB.js → Diagnostics-DbncxLB8.js} +1 -1
  12. package/dist/assets/{Dlq-Mcb5cK1V.js → Dlq-Dht-XE8I.js} +1 -1
  13. package/dist/assets/{DlqControl-982fUv41.js → DlqControl-BdW51Eje.js} +1 -1
  14. package/dist/assets/{DlqPro-CuC9E0_L.js → DlqPro-Bc5dBrfL.js} +1 -1
  15. package/dist/assets/{Flows-DHM7TGds.js → Flows-BgUrkVp9.js} +1 -1
  16. package/dist/assets/{JobInspector-BH5O-C3Y.js → JobInspector-cr-oB9MB.js} +1 -1
  17. package/dist/assets/{Jobs-BStpSQDW.js → Jobs-HgcrHTuA.js} +1 -1
  18. package/dist/assets/{JobsPro-blsDl4Et.js → JobsPro-CHgECoqr.js} +1 -1
  19. package/dist/assets/{Logs-4alJwdiF.js → Logs-BXITESJ-.js} +1 -1
  20. package/dist/assets/{LogsPro-B9T-oqAb.js → LogsPro-D0trm52t.js} +1 -1
  21. package/dist/assets/{McpServer-EIQ0MSuW.js → McpServer-DaYWa4Es.js} +1 -1
  22. package/dist/assets/{Metrics-vxs3mcKS.js → Metrics-BMGLcgiU.js} +1 -1
  23. package/dist/assets/{MetricsPro-BbuSRbxq.js → MetricsPro-4SzRtKMO.js} +1 -1
  24. package/dist/assets/{Overview-HdSe2zeO.js → Overview-Bex4G7ch.js} +1 -1
  25. package/dist/assets/{Pagination-Bm5HTIE3.js → Pagination-CTSsxJT4.js} +1 -1
  26. package/dist/assets/{QueueActions-BvXNsXKQ.js → QueueActions--MLQejui.js} +1 -1
  27. package/dist/assets/{QueueControl-C1lfn3lP.js → QueueControl-D62X3ifm.js} +1 -1
  28. package/dist/assets/{QueueDetail-Bx8hx-5F.js → QueueDetail-ZRFUt3mH.js} +1 -1
  29. package/dist/assets/{QueueDetailPro-C-DCfrRT.js → QueueDetailPro-DY_XL6iK.js} +1 -1
  30. package/dist/assets/{Queues-C_Pt7-K2.js → Queues-DkPMFOIm.js} +1 -1
  31. package/dist/assets/{QueuesOverview-BT4B6ls7.js → QueuesOverview-BJaVSLW9.js} +1 -1
  32. package/dist/assets/{S3Backup-FzxBXfKG.js → S3Backup-DDpYyr9K.js} +1 -1
  33. package/dist/assets/{S3BackupPro-BBx94VGs.js → S3BackupPro-DD7fYduD.js} +1 -1
  34. package/dist/assets/{ServerControl-B7iVlX8g.js → ServerControl-BzpGcDMa.js} +1 -1
  35. package/dist/assets/{Settings-DNh5PdAt.js → Settings-BhNwQcDj.js} +1 -1
  36. package/dist/assets/{Usage-DYa7HsgK.js → Usage-C50S2SA2.js} +1 -1
  37. package/dist/assets/{UsagePro-CNwxz-Dm.js → UsagePro-VGYI-JGk.js} +1 -1
  38. package/dist/assets/{Webhooks-Da3dnRY3.js → Webhooks-WT9fT_UK.js} +1 -1
  39. package/dist/assets/{Workers-B72sL29I.js → Workers-RzwwzTJK.js} +1 -1
  40. package/dist/assets/{WorkersPro-D-p_yJi6.js → WorkersPro-C-Rl2JGa.js} +1 -1
  41. package/dist/assets/{index-BRcFyrFG.js → index-DtMgfAiz.js} +3 -3
  42. package/dist/assets/install-Bo6DRivH.js +3 -0
  43. package/dist/assets/{useThroughputSeries-BhH_0wfd.js → useThroughputSeries-PGVgpwVj.js} +1 -1
  44. package/dist/index.html +1 -1
  45. package/package.json +2 -1
  46. package/scripts/embedded.gen.ts +104 -104
  47. package/dist/assets/install-C019EM5j.js +0 -3
@@ -1 +1 @@
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
+ 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-DtMgfAiz.js";import{a as p,i as m}from"./form-C-zZyKfB.js";import{t as h}from"./Pagination-CTSsxJT4.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-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=`{
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-DtMgfAiz.js";import{t as a}from"./CopyButton-BjMe8rqo.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-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
+ 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-DtMgfAiz.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{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
+ 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-DtMgfAiz.js";import{t as _}from"./Pagination-CTSsxJT4.js";import{t as v}from"./AreaChart-lY-mk5E1.js";import{n as y,t as b}from"./useThroughputSeries-PGVgpwVj.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-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
+ 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-DtMgfAiz.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{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
+ 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-DtMgfAiz.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{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
+ 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-DtMgfAiz.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{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
+ 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-DtMgfAiz.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--MLQejui.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{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
+ 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-DtMgfAiz.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{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
+ 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-DtMgfAiz.js";import{t as T}from"./AreaChart-lY-mk5E1.js";import{t as E}from"./useThroughputSeries-PGVgpwVj.js";import{i as D,n as O,r as k,t as A}from"./QueueActions--MLQejui.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{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};
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-DtMgfAiz.js";import{t as h}from"./Pagination-CTSsxJT4.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};
@@ -1 +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
+ 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-DtMgfAiz.js";import{t as x}from"./Pagination-CTSsxJT4.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-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
+ 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-DtMgfAiz.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{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};
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-DtMgfAiz.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};
@@ -1,3 +1,3 @@
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,G as a,H as o,O as s,S as c,U as l,a as u,d,h as f,p,q as m,r as h,tt as g,u as _,w as v,x as y}from"./index-BRcFyrFG.js";import{i as b,n as x,t as S}from"./form-C-zZyKfB.js";import{t as C}from"./CopyButton-DhNun7Gi.js";var w=e(n(),1),T=r();function E({children:e}){return(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1.5 py-0.5 text-xs text-fg`,children:e})}function D({agentBase:e}){return(0,T.jsx)(c,{children:(0,T.jsxs)(`details`,{className:`group`,children:[(0,T.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2`,children:[(0,T.jsx)(`span`,{className:`text-base font-semibold text-fg`,children:`How server control works`}),(0,T.jsx)(`span`,{className:`text-xs text-muted transition-transform group-open:rotate-90`,children:`▶`})]}),(0,T.jsxs)(`div`,{className:`mt-4 space-y-4 text-sm leading-relaxed text-muted`,children:[(0,T.jsxs)(`p`,{children:[`A browser can't start or stop an OS process, so the dashboard talks to a small local`,` `,(0,T.jsx)(`span`,{className:`font-medium text-fg`,children:`control agent`}),` (`,(0,T.jsx)(E,{children:e}),`) that supervises the bunqueue server process — start, stop and restart — and streams its logs back here.`]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Launch & environment`}),(0,T.jsxs)(`p`,{children:[`The agent runs your `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Command`}),` and injects`,` `,(0,T.jsx)(E,{children:`HTTP_PORT`}),`, `,(0,T.jsx)(E,{children:`TCP_PORT`}),` and `,(0,T.jsx)(E,{children:`BUNQUEUE_DATA_PATH`}),` — plus any `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Environment variables`}),` you add — into its environment. The default `,(0,T.jsx)(E,{children:`bunqueue start`}),` needs a globally-installed binary; pointing the command at a local entry (e.g.`,` `,(0,T.jsx)(E,{children:`bun run /path/to/bunqueue/src/main.ts`}),`) works without one.`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`When changes apply`}),(0,T.jsxs)(`p`,{children:[`Config is editable any time, but `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Command`}),`, ports and data path only take effect on the `,(0,T.jsx)(`span`,{className:`text-fg`,children:`next start/restart`}),` `,`— the running process keeps the config it launched with until then.`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Data path`}),(0,T.jsxs)(`p`,{children:[`Relative paths resolve against the `,(0,T.jsx)(`span`,{className:`text-fg`,children:`agent's`}),` working directory. SQLite creates the database `,(0,T.jsx)(`span`,{className:`text-fg`,children:`file`}),` but not its parent `,(0,T.jsx)(`span`,{className:`text-fg`,children:`folder`}),` — if start fails with`,` `,(0,T.jsx)(E,{children:`SQLITE_CANTOPEN`}),`, create the directory first or use a path whose folder already exists.`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Security`}),(0,T.jsxs)(`p`,{children:[`The agent can spawn processes, so it binds `,(0,T.jsx)(E,{children:`127.0.0.1`}),` only, locks CORS to an allowlist (never `,(0,T.jsx)(E,{children:`*`}),`), rejects any disallowed `,(0,T.jsx)(E,{children:`Origin`}),` or`,` `,(0,T.jsx)(E,{children:`Host`}),` with a `,(0,T.jsx)(E,{children:`403`}),` (the latter blocks DNS-rebinding reads), and honours an optional `,(0,T.jsx)(E,{children:`AGENT_TOKEN`}),` on state-changing requests. Keep its port on loopback.`]}),(0,T.jsxs)(`p`,{children:[`If you started the agent with `,(0,T.jsx)(E,{children:`AGENT_TOKEN`}),`, enter that token under`,` `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Settings → Agent token`}),` (or when the lock screen prompts) so start / stop / restart and config changes are authorized.`]})]})]})]})})}var O=0,k=e=>Object.entries(e).map(([e,t])=>({id:O++,key:e,value:t})),A=e=>{let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return t},j=[`AUTH_TOKENS`,`LOG_LEVEL`,`S3_BACKUP_ENABLED`,`S3_BUCKET`,`METRICS_ENABLED`];function M({value:e,onChange:t,disabled:n}){let[r,i]=(0,w.useState)(()=>k(e)),a=e=>{i(e),t(A(e))},o=(e,t)=>a(r.map(n=>n.id===e?{...n,...t}:n)),s=(e=``)=>a([...r,{id:O++,key:e,value:``}]),c=e=>a(r.filter(t=>t.id!==e)),l=new Set(r.map(e=>e.key.trim()).filter(Boolean)),u=r.map(e=>e.key.trim()).filter((e,t,n)=>e&&n.indexOf(e)!==t);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.length===0&&(0,T.jsxs)(`p`,{className:`text-xs leading-relaxed text-faint`,children:[`No custom variables. The agent already injects`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`HTTP_PORT`}),`,`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`TCP_PORT`}),` and`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`BUNQUEUE_DATA_PATH`}),`.`]}),r.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`w-2/5 shrink-0`,children:(0,T.jsx)(x,{className:`font-mono`,placeholder:`KEY`,value:e.key,disabled:n,onChange:t=>o(e.id,{key:t.target.value})})}),(0,T.jsx)(`span`,{className:`text-faint`,children:`=`}),(0,T.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,T.jsx)(x,{className:`font-mono`,placeholder:`value`,value:e.value,disabled:n,onChange:t=>o(e.id,{value:t.target.value})})}),(0,T.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.key||`variable`}`,disabled:n,onClick:()=>c(e.id),className:`shrink-0 rounded-md px-2 py-1 text-xs text-faint transition-colors hover:text-danger disabled:opacity-40`,children:`✕`})]},e.id)),u.length>0&&(0,T.jsxs)(`p`,{className:`text-xs text-warning`,children:[`Duplicate key`,u.length>1?`s`:``,` — the last value wins: `,u.join(`, `)]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,T.jsx)(v,{size:`sm`,variant:`ghost`,disabled:n,onClick:()=>s(),children:`+ Add variable`}),j.filter(e=>!l.has(e)).map(e=>(0,T.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>s(e),className:`rounded-md border border-line bg-surface-2 px-2 py-1 font-mono text-[11px] text-muted transition-colors hover:border-line-strong hover:text-fg disabled:opacity-40`,children:[`+ `,e]},e))]})]})}var N=[`all`,`stdout`,`stderr`,`sys`],P=e=>`${new Date(e).toLocaleTimeString([],{hour12:!1})}.${String(e%1e3).padStart(3,`0`)}`,F=e=>e===`stderr`?`text-danger/90`:e===`sys`?`text-accent/80`:`text-muted`;function I(){let{data:e}=R(),n=(0,w.useMemo)(()=>e?.lines??[],[e]),[r,i]=(0,w.useState)(`all`),[a,o]=(0,w.useState)(``),[s,l]=(0,w.useState)(!0),[u,d]=(0,w.useState)(!1),f=(0,w.useRef)(null),h=(0,w.useMemo)(()=>{let e=a.trim().toLowerCase();return n.map(e=>e.line.includes(`\x1B`)?{...e,line:p(e.line)}:e).filter(t=>(r===`all`||t.stream===r)&&(!e||t.line.toLowerCase().includes(e)))},[n,r,a]);(0,w.useEffect)(()=>{if(!s)return;let e=f.current;e&&(e.scrollTop=e.scrollHeight)},[h.length,s]);let g=(0,w.useMemo)(()=>h.map(e=>u?`${P(e.ts)} [${e.stream}] ${e.line}`:e.line).join(`
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,G as a,H as o,O as s,S as c,U as l,a as u,d,h as f,p,q as m,r as h,tt as g,u as _,w as v,x as y}from"./index-DtMgfAiz.js";import{i as b,n as x,t as S}from"./form-C-zZyKfB.js";import{t as C}from"./CopyButton-BjMe8rqo.js";var w=e(n(),1),T=r();function E({children:e}){return(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1.5 py-0.5 text-xs text-fg`,children:e})}function D({agentBase:e}){return(0,T.jsx)(c,{children:(0,T.jsxs)(`details`,{className:`group`,children:[(0,T.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2`,children:[(0,T.jsx)(`span`,{className:`text-base font-semibold text-fg`,children:`How server control works`}),(0,T.jsx)(`span`,{className:`text-xs text-muted transition-transform group-open:rotate-90`,children:`▶`})]}),(0,T.jsxs)(`div`,{className:`mt-4 space-y-4 text-sm leading-relaxed text-muted`,children:[(0,T.jsxs)(`p`,{children:[`A browser can't start or stop an OS process, so the dashboard talks to a small local`,` `,(0,T.jsx)(`span`,{className:`font-medium text-fg`,children:`control agent`}),` (`,(0,T.jsx)(E,{children:e}),`) that supervises the bunqueue server process — start, stop and restart — and streams its logs back here.`]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Launch & environment`}),(0,T.jsxs)(`p`,{children:[`The agent runs your `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Command`}),` and injects`,` `,(0,T.jsx)(E,{children:`HTTP_PORT`}),`, `,(0,T.jsx)(E,{children:`TCP_PORT`}),` and `,(0,T.jsx)(E,{children:`BUNQUEUE_DATA_PATH`}),` — plus any `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Environment variables`}),` you add — into its environment. The default `,(0,T.jsx)(E,{children:`bunqueue start`}),` needs a globally-installed binary; pointing the command at a local entry (e.g.`,` `,(0,T.jsx)(E,{children:`bun run /path/to/bunqueue/src/main.ts`}),`) works without one.`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`When changes apply`}),(0,T.jsxs)(`p`,{children:[`Config is editable any time, but `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Command`}),`, ports and data path only take effect on the `,(0,T.jsx)(`span`,{className:`text-fg`,children:`next start/restart`}),` `,`— the running process keeps the config it launched with until then.`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Data path`}),(0,T.jsxs)(`p`,{children:[`Relative paths resolve against the `,(0,T.jsx)(`span`,{className:`text-fg`,children:`agent's`}),` working directory. SQLite creates the database `,(0,T.jsx)(`span`,{className:`text-fg`,children:`file`}),` but not its parent `,(0,T.jsx)(`span`,{className:`text-fg`,children:`folder`}),` — if start fails with`,` `,(0,T.jsx)(E,{children:`SQLITE_CANTOPEN`}),`, create the directory first or use a path whose folder already exists.`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Security`}),(0,T.jsxs)(`p`,{children:[`The agent can spawn processes, so it binds `,(0,T.jsx)(E,{children:`127.0.0.1`}),` only, locks CORS to an allowlist (never `,(0,T.jsx)(E,{children:`*`}),`), rejects any disallowed `,(0,T.jsx)(E,{children:`Origin`}),` or`,` `,(0,T.jsx)(E,{children:`Host`}),` with a `,(0,T.jsx)(E,{children:`403`}),` (the latter blocks DNS-rebinding reads), and honours an optional `,(0,T.jsx)(E,{children:`AGENT_TOKEN`}),` on state-changing requests. Keep its port on loopback.`]}),(0,T.jsxs)(`p`,{children:[`If you started the agent with `,(0,T.jsx)(E,{children:`AGENT_TOKEN`}),`, enter that token under`,` `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Settings → Agent token`}),` (or when the lock screen prompts) so start / stop / restart and config changes are authorized.`]})]})]})]})})}var O=0,k=e=>Object.entries(e).map(([e,t])=>({id:O++,key:e,value:t})),A=e=>{let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return t},j=[`AUTH_TOKENS`,`LOG_LEVEL`,`S3_BACKUP_ENABLED`,`S3_BUCKET`,`METRICS_ENABLED`];function M({value:e,onChange:t,disabled:n}){let[r,i]=(0,w.useState)(()=>k(e)),a=e=>{i(e),t(A(e))},o=(e,t)=>a(r.map(n=>n.id===e?{...n,...t}:n)),s=(e=``)=>a([...r,{id:O++,key:e,value:``}]),c=e=>a(r.filter(t=>t.id!==e)),l=new Set(r.map(e=>e.key.trim()).filter(Boolean)),u=r.map(e=>e.key.trim()).filter((e,t,n)=>e&&n.indexOf(e)!==t);return(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.length===0&&(0,T.jsxs)(`p`,{className:`text-xs leading-relaxed text-faint`,children:[`No custom variables. The agent already injects`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`HTTP_PORT`}),`,`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`TCP_PORT`}),` and`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`BUNQUEUE_DATA_PATH`}),`.`]}),r.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`w-2/5 shrink-0`,children:(0,T.jsx)(x,{className:`font-mono`,placeholder:`KEY`,value:e.key,disabled:n,onChange:t=>o(e.id,{key:t.target.value})})}),(0,T.jsx)(`span`,{className:`text-faint`,children:`=`}),(0,T.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,T.jsx)(x,{className:`font-mono`,placeholder:`value`,value:e.value,disabled:n,onChange:t=>o(e.id,{value:t.target.value})})}),(0,T.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.key||`variable`}`,disabled:n,onClick:()=>c(e.id),className:`shrink-0 rounded-md px-2 py-1 text-xs text-faint transition-colors hover:text-danger disabled:opacity-40`,children:`✕`})]},e.id)),u.length>0&&(0,T.jsxs)(`p`,{className:`text-xs text-warning`,children:[`Duplicate key`,u.length>1?`s`:``,` — the last value wins: `,u.join(`, `)]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,T.jsx)(v,{size:`sm`,variant:`ghost`,disabled:n,onClick:()=>s(),children:`+ Add variable`}),j.filter(e=>!l.has(e)).map(e=>(0,T.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>s(e),className:`rounded-md border border-line bg-surface-2 px-2 py-1 font-mono text-[11px] text-muted transition-colors hover:border-line-strong hover:text-fg disabled:opacity-40`,children:[`+ `,e]},e))]})]})}var N=[`all`,`stdout`,`stderr`,`sys`],P=e=>`${new Date(e).toLocaleTimeString([],{hour12:!1})}.${String(e%1e3).padStart(3,`0`)}`,F=e=>e===`stderr`?`text-danger/90`:e===`sys`?`text-accent/80`:`text-muted`;function I(){let{data:e}=R(),n=(0,w.useMemo)(()=>e?.lines??[],[e]),[r,i]=(0,w.useState)(`all`),[a,o]=(0,w.useState)(``),[s,l]=(0,w.useState)(!0),[u,d]=(0,w.useState)(!1),f=(0,w.useRef)(null),h=(0,w.useMemo)(()=>{let e=a.trim().toLowerCase();return n.map(e=>e.line.includes(`\x1B`)?{...e,line:p(e.line)}:e).filter(t=>(r===`all`||t.stream===r)&&(!e||t.line.toLowerCase().includes(e)))},[n,r,a]);(0,w.useEffect)(()=>{if(!s)return;let e=f.current;e&&(e.scrollTop=e.scrollHeight)},[h.length,s]);let g=(0,w.useMemo)(()=>h.map(e=>u?`${P(e.ts)} [${e.stream}] ${e.line}`:e.line).join(`
2
2
  `),[h,u]);return(0,T.jsxs)(c,{padded:!1,className:`overflow-hidden`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line px-4 py-3`,children:[(0,T.jsx)(`h3`,{className:`mr-1 text-base font-semibold text-fg`,children:`Process logs`}),(0,T.jsx)(b,{options:N,value:r,onChange:i}),(0,T.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,T.jsx)(m,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),(0,T.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),"aria-label":`Filter log lines`,placeholder:`Filter…`,className:`h-8 w-full rounded-lg border border-line bg-surface-2 pl-8 pr-2 text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,T.jsx)(L,{on:s,onClick:()=>l(e=>!e),label:`Follow`}),(0,T.jsx)(L,{on:u,onClick:()=>d(e=>!e),label:`Times`}),(0,T.jsx)(C,{value:g}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>{let e=new Blob([g],{type:`text/plain`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`bunqueue-logs-${Date.now()}.log`,n.click(),URL.revokeObjectURL(t)},disabled:h.length===0,className:`rounded-md border border-line bg-surface-2 px-2 py-1 text-xs text-muted transition-colors hover:text-fg disabled:opacity-40`,children:`Download`})]}),(0,T.jsx)(`div`,{ref:f,className:`max-h-80 min-h-40 overflow-y-auto p-4 font-mono text-xs leading-relaxed`,children:h.length===0?(0,T.jsx)(`p`,{className:`text-faint`,children:n.length===0?`No output yet.`:`No lines match the current filter.`}):h.map(e=>(0,T.jsxs)(`div`,{className:t(`whitespace-pre-wrap`,F(e.stream)),children:[u&&(0,T.jsx)(`span`,{className:`mr-2 text-faint`,children:P(e.ts)}),e.line]},e.seq))}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between border-t border-line px-4 py-2 text-[11px] text-faint`,children:[(0,T.jsx)(`span`,{children:h.length===n.length?`${n.length} lines`:`${h.length} of ${n.length} lines`}),(0,T.jsx)(`span`,{children:s?`following tail`:`paused`})]})]})}function L({on:e,onClick:n,label:r}){return(0,T.jsx)(`button`,{type:`button`,onClick:n,"aria-pressed":e,className:t(`rounded-md border px-2 py-1 text-xs transition-colors`,e?`border-accent/40 bg-accent/10 text-accent`:`border-line bg-surface-2 text-muted hover:text-fg`),children:r})}function R(){return s(()=>g.control.logs(),[])}var z={running:{label:`Running`,tone:`text-success`,dot:`bg-emerald-400`},starting:{label:`Starting`,tone:`text-warning`,dot:`bg-amber-400`},stopping:{label:`Stopping`,tone:`text-warning`,dot:`bg-amber-400`},stopped:{label:`Stopped`,tone:`text-danger`,dot:`bg-red-400`}};function B({startedAt:e}){let[,t]=(0,w.useState)(0);return(0,w.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,T.jsx)(T.Fragment,{children:d((Date.now()-e)/1e3)})}function V({label:e,children:t,title:n}){return(0,T.jsxs)(`div`,{className:`min-w-0`,title:n,children:[(0,T.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-faint`,children:e}),(0,T.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-sm text-fg`,children:t})]})}function H({status:e,agentBase:n,transitioning:r,stale:i=!1,vitals:s=null,busy:c,onStart:d,onStop:f,onRestart:p}){let m=e?.status??`stopped`,h=m===`running`,g=z[m]??z.stopped,_=!!e?.healthy&&!i,y=!h&&e?.exitCode!=null&&e.exitCode!==0,b=e?.runningConfig??e?.config??null,x=`http://localhost:${b?.httpPort??6790}`;return(0,T.jsxs)(`section`,{className:`mb-6 overflow-hidden rounded-xl border border-line bg-surface`,children:[(0,T.jsx)(`div`,{className:t(`h-0.5 bg-gradient-to-r to-transparent`,h&&_?`from-emerald-400/80 via-emerald-400/25`:h||r?`from-amber-400/80 via-amber-400/25`:`from-red-400/70 via-red-400/20`)}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-5 p-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,T.jsxs)(`span`,{className:`relative flex size-3.5 shrink-0`,children:[h&&_&&(0,T.jsx)(`span`,{className:`absolute inline-flex size-full rounded-full bg-emerald-400 opacity-50 motion-safe:animate-ping`}),(0,T.jsx)(`span`,{className:t(`relative inline-flex size-3.5 rounded-full`,g.dot)})]}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,T.jsx)(`span`,{className:t(`text-2xl font-bold tracking-tight`,g.tone),children:r&&c?`${c}…`:g.label}),e?.version&&(0,T.jsxs)(`span`,{className:`font-mono text-xs text-muted`,children:[`bunqueue v`,e.version]}),y&&(0,T.jsxs)(`span`,{className:`rounded-full bg-red-500/15 px-2 py-0.5 font-mono text-[11px] font-medium text-danger`,children:[`crashed · exit `,e?.exitCode]})]}),(0,T.jsx)(`div`,{className:`mt-1 font-mono text-xs text-muted`,children:i?(0,T.jsxs)(`span`,{className:`text-warning`,children:[`last known: pid `,e?.pid??`—`,` — agent unreachable, state may have changed`]}):h?(0,T.jsxs)(T.Fragment,{children:[_?`healthy`:`waiting for health…`,` · pid `,e?.pid??`—`,` · up`,` `,e?.startedAt?(0,T.jsx)(B,{startedAt:e.startedAt}):`—`]}):`process not running — start it below or point the dashboard at an external server`})]})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,T.jsxs)(v,{variant:`success`,disabled:h||r||i,onClick:d,children:[(0,T.jsx)(l,{className:`size-4`}),` Start`]}),(0,T.jsxs)(v,{variant:`warning`,disabled:!h||r||i,onClick:f,children:[(0,T.jsx)(o,{className:`size-4`}),` Stop`]}),(0,T.jsxs)(v,{disabled:r||i,onClick:p,children:[(0,T.jsx)(a,{className:`size-4`}),` Restart`]})]})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 border-t border-line bg-surface-2/30 px-5 py-4 md:grid-cols-3 xl:grid-cols-7`,children:[(0,T.jsx)(V,{label:`Memory`,children:s?.memory?.rss==null?(0,T.jsx)(`span`,{className:`text-faint`,children:`—`}):(0,T.jsxs)(`span`,{title:`heap ${s.memory.heapUsed??`?`} / ${s.memory.heapTotal??`?`} MB`,children:[s.memory.rss,` MB rss`]})}),(0,T.jsx)(V,{label:`Connections`,children:s?.connections?`${s.connections.tcp??0} tcp · ${s.connections.ws??0} ws · ${s.connections.sse??0} sse`:(0,T.jsx)(`span`,{className:`text-faint`,children:`—`})}),(0,T.jsx)(V,{label:`API endpoint`,title:x,children:h?(0,T.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,T.jsx)(`a`,{href:`${x}/health`,target:`_blank`,rel:`noreferrer`,className:`truncate text-accent hover:underline`,children:x}),(0,T.jsx)(C,{value:x})]}):(0,T.jsx)(`span`,{className:`text-faint`,children:x})}),(0,T.jsx)(V,{label:`Ports`,children:b?`${b.httpPort} http · ${b.tcpPort} tcp`:`—`}),(0,T.jsx)(V,{label:`Started`,children:h&&e?.startedAt?u(e.startedAt):`—`}),(0,T.jsx)(V,{label:`Control agent`,title:n,children:n.replace(/^https?:\/\//,``)}),(0,T.jsx)(V,{label:`Launch command`,title:b?.command,children:b?.command??`—`})]})]})}var U=[{key:`size`,label:`Database`,color:`bg-accent`},{key:`walSize`,label:`WAL`,color:`bg-amber-400`},{key:`shmSize`,label:`SHM`,color:`bg-zinc-500`}];function W({db:e}){let n=e.totalSize||0;return(0,T.jsxs)(c,{children:[(0,T.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Storage`}),(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:e.exists?`${h(n)} on disk`:`not created yet`})]}),(0,T.jsxs)(`p`,{className:`mb-4 flex items-center gap-1.5 truncate font-mono text-xs text-faint`,title:e.path,children:[(0,T.jsx)(`span`,{className:`truncate`,children:e.path}),(0,T.jsx)(C,{value:e.path})]}),e.exists&&n>0?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`flex h-2.5 overflow-hidden rounded-full bg-surface-2`,children:U.map(r=>{let i=e[r.key];return i?(0,T.jsx)(`div`,{className:t(`h-full`,r.color),style:{width:`${i/n*100}%`},title:`${r.label}: ${h(i)}`},r.key):null})}),(0,T.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-5 gap-y-1.5 font-mono text-[11px] text-faint`,children:[U.map(n=>(0,T.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,T.jsx)(`span`,{className:t(`size-2 rounded-full`,n.color)}),n.label,` `,(0,T.jsx)(`span`,{className:`text-fg`,children:h(e[n.key])})]},n.key)),e.mtimeMs?(0,T.jsxs)(`span`,{className:`ml-auto`,children:[`written `,_(e.mtimeMs)]}):null]})]}):(0,T.jsx)(`p`,{className:`rounded-lg border border-dashed border-line px-4 py-6 text-center text-sm text-faint`,children:`The database appears here after the first start — SQLite creates the file at the configured data path.`})]})}function G(){let{data:e,error:t,refetch:n}=s(()=>g.control.status(),[]),[r,a]=(0,w.useState)(null),[o,l]=(0,w.useState)(null),u=e?.status===`running`,{data:d}=s(()=>u?g.health():Promise.resolve(null),[u]),p=u?d??null:null,m=async(e,t,r)=>{if(!(r&&!window.confirm(r))){a(e),l(null);try{await t(),await n()}catch(e){l(e.message)}finally{a(null)}}};if(t&&!e)return(0,T.jsxs)(`div`,{children:[(0,T.jsx)(f,{title:`Server`,description:`Start, stop and restart the bunqueue server.`}),(0,T.jsx)(y,{message:`Control agent unreachable — server lifecycle controls are unavailable.`,onRetry:n}),(0,T.jsxs)(c,{children:[(0,T.jsx)(i,{title:`Control agent not running`}),(0,T.jsxs)(`p`,{className:`text-sm text-muted`,children:[`The local control agent is unreachable at`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1.5 py-0.5 text-xs`,children:g.agentBase}),`. It manages the bunqueue server process (start / stop / restart). Start it with:`]}),(0,T.jsxs)(`pre`,{className:`mt-3 overflow-x-auto rounded-lg border border-line bg-surface-2 px-3 py-2 text-xs`,children:[`bun start`,` `,`# agent + dashboard together (recommended)`,`
3
3
  `,`bun run agent`,` `,`# agent only, if the dashboard is already running`]}),(0,T.jsx)(`p`,{className:`mt-3 text-xs text-faint`,children:`This page reconnects automatically once the agent is up — no reload needed.`})]})]});let h=e?.status??`stopped`,_=h===`running`,v=h===`starting`||h===`stopping`||r!=null,b=t!=null&&e!=null;return(0,T.jsxs)(`div`,{children:[(0,T.jsx)(f,{title:`Server`,description:`Supervise the bunqueue server process — lifecycle, configuration, storage and logs.`}),o&&(0,T.jsx)(`div`,{className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-danger`,children:o}),b&&(0,T.jsx)(`div`,{className:`mb-4 rounded-lg border border-amber-500/20 bg-amber-500/5 px-4 py-2 text-sm text-warning`,children:`Control agent unreachable — showing last known state. Lifecycle actions are disabled until it responds again.`}),(0,T.jsx)(H,{status:e,agentBase:g.agentBase,stale:b,vitals:p,transitioning:v,busy:r,onStart:()=>m(`starting`,()=>g.control.start()),onStop:()=>m(`stopping`,()=>g.control.stop(),`Stop the bunqueue server?`),onRestart:()=>m(`restarting`,()=>g.control.restart(),`Restart the bunqueue server?`)}),(0,T.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,T.jsx)(K,{status:e,onSaved:n,running:_,transitioning:v}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e?.db&&(0,T.jsx)(W,{db:e.db}),(0,T.jsx)(I,{})]})]}),(0,T.jsx)(`div`,{className:`mt-6`,children:(0,T.jsx)(D,{agentBase:g.agentBase})})]})}function K({status:e,onSaved:t,running:n,transitioning:r}){let[o,s]=(0,w.useState)(null),[l,u]=(0,w.useState)(!1),[d,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(null);(0,w.useEffect)(()=>{e?.config&&!o&&s(e.config)},[e,o]);let h=o??e?.config??null;if(!h)return(0,T.jsx)(c,{children:`Loading…`});let _=e=>s({...h,...e}),y=e?.runningConfig??null,b=(e={})=>JSON.stringify(Object.keys(e).sort().map(t=>[t,e[t]])),C=n&&y!=null&&(y.command!==h.command||y.httpPort!==h.httpPort||y.tcpPort!==h.tcpPort||y.dataPath!==h.dataPath||b(y.extraEnv)!==b(h.extraEnv)),E=r||d,D=()=>{u(!0),setTimeout(()=>u(!1),2e3)},O=()=>{let e=e=>Number.isInteger(e)&&e>=1&&e<=65535;return e(h.httpPort)?e(h.tcpPort)?h.httpPort===h.tcpPort?`HTTP and TCP ports must differ`:null:`TCP port must be an integer between 1 and 65535`:`HTTP port must be an integer between 1 and 65535`};return(0,T.jsxs)(c,{children:[(0,T.jsx)(i,{title:`Configuration`}),(0,T.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:n?`Ports and data path apply on the next restart — edit freely, then restart.`:`Edit and save; the config is used the next time the server starts.`}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,T.jsx)(S,{label:`Command`,hint:`The exact command the agent runs to launch bunqueue. It receives HTTP_PORT, TCP_PORT and BUNQUEUE_DATA_PATH in its environment. The default needs a global 'bunqueue' binary — or point it at a local entry, e.g. bun run /path/to/bunqueue/src/main.ts.`,children:(0,T.jsx)(x,{value:h.command,disabled:E,onChange:e=>_({command:e.target.value}),placeholder:`bunqueue start`})}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsx)(S,{label:`HTTP port`,hint:`Dashboard API + SSE.`,children:(0,T.jsx)(x,{type:`number`,min:1,max:65535,value:h.httpPort,disabled:E,onChange:e=>_({httpPort:Number(e.target.value)})})}),(0,T.jsx)(S,{label:`TCP port`,hint:`Binary protocol. Must differ from HTTP.`,children:(0,T.jsx)(x,{type:`number`,min:1,max:65535,value:h.tcpPort,disabled:E,onChange:e=>_({tcpPort:Number(e.target.value)})})})]}),(0,T.jsx)(S,{label:`Data path`,hint:`SQLite database file, relative to the agent's working directory. The parent folder must already exist — SQLite creates the file, not the directory.`,children:(0,T.jsx)(x,{value:h.dataPath,disabled:E,onChange:e=>_({dataPath:e.target.value})})}),(0,T.jsx)(S,{label:`Environment variables`,hint:`Injected into the server process on start, on top of the ports + data path. Applies on the next restart.`,children:(0,T.jsx)(M,{value:h.extraEnv??{},onChange:e=>_({extraEnv:e}),disabled:E})}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(v,{variant:`accent`,size:`sm`,disabled:E,onClick:async()=>{let e=O();if(e){m(e);return}m(null);try{await g.control.setConfig(h),D(),t()}catch(e){m(e.message)}},children:`Save config`}),n&&(0,T.jsxs)(v,{variant:`warning`,size:`sm`,disabled:E,onClick:async()=>{let e=O();if(e){m(e);return}if(window.confirm(`Save configuration and restart the server to apply it?`)){m(null),f(!0);try{await g.control.setConfig(h),await g.control.restart(),D(),t()}catch(e){m(e.message)}finally{f(!1)}}},children:[(0,T.jsx)(a,{className:`size-3.5`}),` Save & restart`]}),C&&!l&&(0,T.jsx)(`span`,{className:`text-xs text-warning`,children:`Restart to apply changes`}),l&&(0,T.jsx)(`span`,{className:`text-xs text-success`,children:`Saved`}),p&&(0,T.jsx)(`span`,{className:`text-xs text-danger`,children:p})]})]})]})}export{G as ServerControl};
@@ -1 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{i as r}from"./connectionStore-B-hNUqwK.js";import{C as i,S as a,T as o,X as s,h as c,k as l,w as u,z as d}from"./index-BRcFyrFG.js";import{a as f,n as p,t as m}from"./form-C-zZyKfB.js";var h=e(t(),1),g=n(),_=[[`1000`,`1 second`],[`2000`,`2 seconds`],[`3000`,`3 seconds`],[`5000`,`5 seconds`],[`10000`,`10 seconds`]];function v(e){if(e.startsWith(`/`))return!0;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function y(){let{baseUrl:e,token:t,agentToken:n,refreshMs:y,setBaseUrl:b,setToken:x,setAgentToken:S,setRefreshMs:C}=r(),{theme:w,setTheme:T}=s(),[E,D]=(0,h.useState)(!1),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(e),[M,N]=(0,h.useState)(t),[P,F]=(0,h.useState)(n),[I,L]=(0,h.useState)(!1),[R,z]=(0,h.useState)(null),[B,V]=(0,h.useState)(!1);return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(c,{title:`Settings`,description:`Connection and appearance.`}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,g.jsxs)(a,{children:[(0,g.jsx)(i,{title:`Connection`}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,g.jsx)(m,{label:`Server URL`,children:(0,g.jsx)(p,{value:A,onChange:e=>{j(e.target.value),z(null)},placeholder:`/api or https://queue.example.com`})}),R&&(0,g.jsx)(`p`,{className:`-mt-2 text-xs text-danger`,children:R}),(0,g.jsxs)(`p`,{className:`-mt-2 text-xs text-faint`,children:[`Use `,(0,g.jsx)(`code`,{className:`font-mono`,children:`/api`}),` in dev (proxied to localhost:6790), or the server origin in production.`]}),(0,g.jsx)(m,{label:`Bearer token (optional)`,hint:`Kept in memory only — re-enter after reload, or set VITE_BUNQUEUE_TOKEN.`,children:(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p,{type:I?`text`:`password`,value:M,onChange:e=>N(e.target.value),placeholder:`only if AUTH_TOKENS is set`,className:`pr-10`}),(0,g.jsx)(o,{"aria-label":I?`Hide token`:`Show token`,className:`absolute right-0.5 top-1/2 -translate-y-1/2`,onClick:()=>L(e=>!e),children:(0,g.jsx)(d,{className:`size-4`})})]})}),(0,g.jsx)(m,{label:`Agent token (optional)`,hint:`Only if the control agent runs with AGENT_TOKEN. Memory only — or set VITE_BUNQUEUE_AGENT_TOKEN.`,children:(0,g.jsx)(p,{type:I?`text`:`password`,value:P,onChange:e=>F(e.target.value),placeholder:`only if AGENT_TOKEN is set`})}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,g.jsx)(u,{variant:`accent`,onClick:()=>{let e=A.trim();if(!v(e)){z(`Must be an http(s) URL or a path starting with '/'.`);return}z(null),b(e),x(M),S(P),V(!0),setTimeout(()=>V(!1),2e3)},children:`Save`}),(0,g.jsx)(u,{onClick:async()=>{D(!0),k(null);let e=performance.now();try{let t=await l.health(),n=Math.round(performance.now()-e);k({ok:t.ok!==!1,msg:`Connected in ${n}ms${t.version?` · bunqueue v${t.version}`:``}`})}catch(e){k({ok:!1,msg:e.message})}finally{D(!1)}},disabled:E,children:E?`Testing…`:`Test connection`}),B&&(0,g.jsx)(`span`,{className:`text-sm text-success`,children:`Saved ✓`}),O&&(0,g.jsx)(`span`,{className:O.ok?`text-sm text-success`:`text-sm text-danger`,children:O.msg})]})]})]}),(0,g.jsxs)(a,{children:[(0,g.jsx)(i,{title:`Appearance & refresh`}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsx)(m,{label:`Theme`,children:(0,g.jsxs)(f,{value:w,onChange:e=>T(e.target.value),children:[(0,g.jsx)(`option`,{value:`dark`,children:`Dark`}),(0,g.jsx)(`option`,{value:`light`,children:`Light`})]})}),(0,g.jsx)(m,{label:`Refresh interval`,children:(0,g.jsx)(f,{value:String(y),onChange:e=>C(Number(e.target.value)),children:_.map(([e,t])=>(0,g.jsx)(`option`,{value:e,children:t},e))})})]})]})]})]})}export{y as Settings};
1
+ import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{i as r}from"./connectionStore-B-hNUqwK.js";import{C as i,S as a,T as o,X as s,h as c,k as l,w as u,z as d}from"./index-DtMgfAiz.js";import{a as f,n as p,t as m}from"./form-C-zZyKfB.js";var h=e(t(),1),g=n(),_=[[`1000`,`1 second`],[`2000`,`2 seconds`],[`3000`,`3 seconds`],[`5000`,`5 seconds`],[`10000`,`10 seconds`]];function v(e){if(e.startsWith(`/`))return!0;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function y(){let{baseUrl:e,token:t,agentToken:n,refreshMs:y,setBaseUrl:b,setToken:x,setAgentToken:S,setRefreshMs:C}=r(),{theme:w,setTheme:T}=s(),[E,D]=(0,h.useState)(!1),[O,k]=(0,h.useState)(null),[A,j]=(0,h.useState)(e),[M,N]=(0,h.useState)(t),[P,F]=(0,h.useState)(n),[I,L]=(0,h.useState)(!1),[R,z]=(0,h.useState)(null),[B,V]=(0,h.useState)(!1);return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(c,{title:`Settings`,description:`Connection and appearance.`}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,g.jsxs)(a,{children:[(0,g.jsx)(i,{title:`Connection`}),(0,g.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,g.jsx)(m,{label:`Server URL`,children:(0,g.jsx)(p,{value:A,onChange:e=>{j(e.target.value),z(null)},placeholder:`/api or https://queue.example.com`})}),R&&(0,g.jsx)(`p`,{className:`-mt-2 text-xs text-danger`,children:R}),(0,g.jsxs)(`p`,{className:`-mt-2 text-xs text-faint`,children:[`Use `,(0,g.jsx)(`code`,{className:`font-mono`,children:`/api`}),` in dev (proxied to localhost:6790), or the server origin in production.`]}),(0,g.jsx)(m,{label:`Bearer token (optional)`,hint:`Kept in memory only — re-enter after reload, or set VITE_BUNQUEUE_TOKEN.`,children:(0,g.jsxs)(`div`,{className:`relative`,children:[(0,g.jsx)(p,{type:I?`text`:`password`,value:M,onChange:e=>N(e.target.value),placeholder:`only if AUTH_TOKENS is set`,className:`pr-10`}),(0,g.jsx)(o,{"aria-label":I?`Hide token`:`Show token`,className:`absolute right-0.5 top-1/2 -translate-y-1/2`,onClick:()=>L(e=>!e),children:(0,g.jsx)(d,{className:`size-4`})})]})}),(0,g.jsx)(m,{label:`Agent token (optional)`,hint:`Only if the control agent runs with AGENT_TOKEN. Memory only — or set VITE_BUNQUEUE_AGENT_TOKEN.`,children:(0,g.jsx)(p,{type:I?`text`:`password`,value:P,onChange:e=>F(e.target.value),placeholder:`only if AGENT_TOKEN is set`})}),(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,g.jsx)(u,{variant:`accent`,onClick:()=>{let e=A.trim();if(!v(e)){z(`Must be an http(s) URL or a path starting with '/'.`);return}z(null),b(e),x(M),S(P),V(!0),setTimeout(()=>V(!1),2e3)},children:`Save`}),(0,g.jsx)(u,{onClick:async()=>{D(!0),k(null);let e=performance.now();try{let t=await l.health(),n=Math.round(performance.now()-e);k({ok:t.ok!==!1,msg:`Connected in ${n}ms${t.version?` · bunqueue v${t.version}`:``}`})}catch(e){k({ok:!1,msg:e.message})}finally{D(!1)}},disabled:E,children:E?`Testing…`:`Test connection`}),B&&(0,g.jsx)(`span`,{className:`text-sm text-success`,children:`Saved ✓`}),O&&(0,g.jsx)(`span`,{className:O.ok?`text-sm text-success`:`text-sm text-danger`,children:O.msg})]})]})]}),(0,g.jsxs)(a,{children:[(0,g.jsx)(i,{title:`Appearance & refresh`}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,g.jsx)(m,{label:`Theme`,children:(0,g.jsxs)(f,{value:w,onChange:e=>T(e.target.value),children:[(0,g.jsx)(`option`,{value:`dark`,children:`Dark`}),(0,g.jsx)(`option`,{value:`light`,children:`Light`})]})}),(0,g.jsx)(m,{label:`Refresh interval`,children:(0,g.jsx)(f,{value:String(y),onChange:e=>C(Number(e.target.value)),children:_.map(([e,t])=>(0,g.jsx)(`option`,{value:e,children:t},e))})})]})]})]})]})}export{y as Settings};
@@ -1 +1 @@
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,d as o,h as s,k as c,m as l,r as u,x as d}from"./index-BRcFyrFG.js";var f=e(),p={stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},memory:{heapUsed:0,heapTotal:0,rss:0},workers:{total:0,active:0},crons:{total:0},storage:{}};function m(){let{data:e,error:m,loading:g,refetch:_}=n(()=>c.overview(),[]);if(g&&!e&&!m)return(0,f.jsx)(i,{label:`Loading usage…`});let{stats:v,memory:y,workers:b,crons:x,storage:S}=e??p;return(0,f.jsxs)(`div`,{children:[(0,f.jsx)(s,{title:`Usage`,description:`Cumulative resource usage on the connected server.`,live:!0}),m&&(0,f.jsx)(d,{onRetry:_}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,f.jsx)(l,{label:`Jobs Pushed`,value:a(v.totalPushed)}),(0,f.jsx)(l,{label:`Jobs Completed`,value:a(v.totalCompleted),tone:`green`}),(0,f.jsx)(l,{label:`Jobs Failed`,value:a(v.totalFailed),tone:v.totalFailed?`red`:`default`}),(0,f.jsx)(l,{label:`Jobs Pulled`,value:a(v.totalPulled),tone:`blue`})]}),(0,f.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,f.jsxs)(r,{children:[(0,f.jsx)(t,{title:`Runtime`}),(0,f.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,f.jsx)(h,{label:`Uptime`,value:o(v.uptime)}),(0,f.jsx)(h,{label:`Heap used`,value:u(y.heapUsed*1024*1024)}),(0,f.jsx)(h,{label:`RSS`,value:u(y.rss*1024*1024)}),(0,f.jsx)(h,{label:`Workers`,value:`${b.active} active / ${b.total}`}),(0,f.jsx)(h,{label:`Cron jobs`,value:String(x.total)})]})]}),(0,f.jsxs)(r,{children:[(0,f.jsx)(t,{title:`Storage`}),(0,f.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,f.jsx)(h,{label:`Status`,value:S.diskFull?`Disk full`:`Healthy`}),(0,f.jsx)(h,{label:`Path`,value:String(S.path??`—`),mono:!0}),S.error?(0,f.jsx)(h,{label:`Error`,value:String(S.error)}):null]})]})]})]})}function h({label:e,value:t,mono:n}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,f.jsx)(`dt`,{className:`text-muted`,children:e}),(0,f.jsx)(`dd`,{className:n?`font-mono text-xs text-fg`:`font-medium text-fg`,children:t})]})}export{m as Usage};
1
+ 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,d as o,h as s,k as c,m as l,r as u,x as d}from"./index-DtMgfAiz.js";var f=e(),p={stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},memory:{heapUsed:0,heapTotal:0,rss:0},workers:{total:0,active:0},crons:{total:0},storage:{}};function m(){let{data:e,error:m,loading:g,refetch:_}=n(()=>c.overview(),[]);if(g&&!e&&!m)return(0,f.jsx)(i,{label:`Loading usage…`});let{stats:v,memory:y,workers:b,crons:x,storage:S}=e??p;return(0,f.jsxs)(`div`,{children:[(0,f.jsx)(s,{title:`Usage`,description:`Cumulative resource usage on the connected server.`,live:!0}),m&&(0,f.jsx)(d,{onRetry:_}),(0,f.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,f.jsx)(l,{label:`Jobs Pushed`,value:a(v.totalPushed)}),(0,f.jsx)(l,{label:`Jobs Completed`,value:a(v.totalCompleted),tone:`green`}),(0,f.jsx)(l,{label:`Jobs Failed`,value:a(v.totalFailed),tone:v.totalFailed?`red`:`default`}),(0,f.jsx)(l,{label:`Jobs Pulled`,value:a(v.totalPulled),tone:`blue`})]}),(0,f.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,f.jsxs)(r,{children:[(0,f.jsx)(t,{title:`Runtime`}),(0,f.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,f.jsx)(h,{label:`Uptime`,value:o(v.uptime)}),(0,f.jsx)(h,{label:`Heap used`,value:u(y.heapUsed*1024*1024)}),(0,f.jsx)(h,{label:`RSS`,value:u(y.rss*1024*1024)}),(0,f.jsx)(h,{label:`Workers`,value:`${b.active} active / ${b.total}`}),(0,f.jsx)(h,{label:`Cron jobs`,value:String(x.total)})]})]}),(0,f.jsxs)(r,{children:[(0,f.jsx)(t,{title:`Storage`}),(0,f.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,f.jsx)(h,{label:`Status`,value:S.diskFull?`Disk full`:`Healthy`}),(0,f.jsx)(h,{label:`Path`,value:String(S.path??`—`),mono:!0}),S.error?(0,f.jsx)(h,{label:`Error`,value:String(S.error)}):null]})]})]})]})}function h({label:e,value:t,mono:n}){return(0,f.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,f.jsx)(`dt`,{className:`text-muted`,children:e}),(0,f.jsx)(`dd`,{className:n?`font-mono text-xs text-fg`:`font-medium text-fg`,children:t})]})}export{m as Usage};
@@ -1 +1 @@
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,d as o,h as s,l as c,m as l,n as u,r as d,tt as f,u as p,x as m}from"./index-BRcFyrFG.js";var h=e(),g={overview:{stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},memory:{heapUsed:0,heapTotal:0,rss:0},crons:{total:0}},storage:{},failedTotal:0};function _(){let{data:e,error:_,loading:y,refetch:b}=n(async()=>{let[e,t,n]=await Promise.all([f.overview(),f.storage(),f.queuesSummary()]),r=n.reduce((e,t)=>e+(t.counts?.failed??0),0);return{overview:e,storage:t.data??{},failedTotal:r}},[]);if(y&&!e&&!_)return(0,h.jsx)(i,{label:`Loading usage…`});let x=e??g,{stats:S,memory:C,crons:w}=x.overview,{storage:T,failedTotal:E}=x,D=u(S.completed,E),O=S.uptime?o(S.uptime/1e3):`—`;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(s,{title:`Usage`,description:`Cumulative resource usage on the connected server.`,live:!0}),_&&(0,h.jsx)(m,{onRetry:b}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,h.jsx)(l,{label:`Completed`,value:a(S.completed),tone:`green`}),(0,h.jsx)(l,{label:`Failed`,value:a(E),tone:E?`red`:`default`}),(0,h.jsx)(l,{label:`Waiting`,value:a(S.waiting),tone:`amber`}),(0,h.jsx)(l,{label:`Active`,value:a(S.active),tone:`blue`}),(0,h.jsx)(l,{label:`Error Rate`,value:D==null?`—`:c(D),tone:D==null?`default`:D>.05?`red`:`green`}),(0,h.jsx)(l,{label:`Uptime`,value:O})]}),(0,h.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,h.jsxs)(r,{children:[(0,h.jsx)(t,{title:`Runtime`}),(0,h.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,h.jsx)(v,{label:`Jobs pushed (since restart)`,value:a(S.totalPushed)}),(0,h.jsx)(v,{label:`Jobs pulled (since restart)`,value:a(S.totalPulled)}),(0,h.jsx)(v,{label:`Heap used`,value:d(C.heapUsed*1024*1024)}),(0,h.jsx)(v,{label:`RSS`,value:d(C.rss*1024*1024)}),(0,h.jsx)(v,{label:`Cron jobs`,value:String(w.total)})]})]}),(0,h.jsxs)(r,{children:[(0,h.jsx)(t,{title:`Storage`}),T.diskFull?(0,h.jsxs)(`div`,{className:`rounded-lg border border-red-500/25 bg-red-500/[0.06] px-4 py-3`,children:[(0,h.jsx)(`div`,{className:`font-semibold text-danger`,children:`Disk full — writes suspended`}),T.error&&(0,h.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:T.error}),T.since!=null&&(0,h.jsxs)(`div`,{className:`mt-1 text-xs text-faint`,children:[`since `,p(T.since)]})]}):(0,h.jsxs)(`div`,{className:`rounded-lg border border-emerald-500/25 bg-emerald-500/[0.06] px-4 py-3`,children:[(0,h.jsx)(`div`,{className:`font-semibold text-success`,children:`Healthy`}),(0,h.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`Disk writes are being accepted.`})]})]})]})]})}function v({label:e,value:t}){return(0,h.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,h.jsx)(`dt`,{className:`text-muted`,children:e}),(0,h.jsx)(`dd`,{className:`font-medium text-fg`,children:t})]})}export{_ as UsagePro};
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,d as o,h as s,l as c,m as l,n as u,r as d,tt as f,u as p,x as m}from"./index-DtMgfAiz.js";var h=e(),g={overview:{stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},memory:{heapUsed:0,heapTotal:0,rss:0},crons:{total:0}},storage:{},failedTotal:0};function _(){let{data:e,error:_,loading:y,refetch:b}=n(async()=>{let[e,t,n]=await Promise.all([f.overview(),f.storage(),f.queuesSummary()]),r=n.reduce((e,t)=>e+(t.counts?.failed??0),0);return{overview:e,storage:t.data??{},failedTotal:r}},[]);if(y&&!e&&!_)return(0,h.jsx)(i,{label:`Loading usage…`});let x=e??g,{stats:S,memory:C,crons:w}=x.overview,{storage:T,failedTotal:E}=x,D=u(S.completed,E),O=S.uptime?o(S.uptime/1e3):`—`;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(s,{title:`Usage`,description:`Cumulative resource usage on the connected server.`,live:!0}),_&&(0,h.jsx)(m,{onRetry:b}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,h.jsx)(l,{label:`Completed`,value:a(S.completed),tone:`green`}),(0,h.jsx)(l,{label:`Failed`,value:a(E),tone:E?`red`:`default`}),(0,h.jsx)(l,{label:`Waiting`,value:a(S.waiting),tone:`amber`}),(0,h.jsx)(l,{label:`Active`,value:a(S.active),tone:`blue`}),(0,h.jsx)(l,{label:`Error Rate`,value:D==null?`—`:c(D),tone:D==null?`default`:D>.05?`red`:`green`}),(0,h.jsx)(l,{label:`Uptime`,value:O})]}),(0,h.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,h.jsxs)(r,{children:[(0,h.jsx)(t,{title:`Runtime`}),(0,h.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,h.jsx)(v,{label:`Jobs pushed (since restart)`,value:a(S.totalPushed)}),(0,h.jsx)(v,{label:`Jobs pulled (since restart)`,value:a(S.totalPulled)}),(0,h.jsx)(v,{label:`Heap used`,value:d(C.heapUsed*1024*1024)}),(0,h.jsx)(v,{label:`RSS`,value:d(C.rss*1024*1024)}),(0,h.jsx)(v,{label:`Cron jobs`,value:String(w.total)})]})]}),(0,h.jsxs)(r,{children:[(0,h.jsx)(t,{title:`Storage`}),T.diskFull?(0,h.jsxs)(`div`,{className:`rounded-lg border border-red-500/25 bg-red-500/[0.06] px-4 py-3`,children:[(0,h.jsx)(`div`,{className:`font-semibold text-danger`,children:`Disk full — writes suspended`}),T.error&&(0,h.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:T.error}),T.since!=null&&(0,h.jsxs)(`div`,{className:`mt-1 text-xs text-faint`,children:[`since `,p(T.since)]})]}):(0,h.jsxs)(`div`,{className:`rounded-lg border border-emerald-500/25 bg-emerald-500/[0.06] px-4 py-3`,children:[(0,h.jsx)(`div`,{className:`font-semibold text-success`,children:`Healthy`}),(0,h.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`Disk writes are being accepted.`})]})]})]})]})}function v({label:e,value:t}){return(0,h.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,h.jsx)(`dt`,{className:`text-muted`,children:e}),(0,h.jsx)(`dd`,{className:`font-medium text-fg`,children:t})]})}export{_ as UsagePro};
@@ -1 +1 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{B as r,C as i,J as a,O as o,S as s,T as c,b as l,c as u,et as d,h as f,tt as p,u as m,w as h,x as g,y as _}from"./index-BRcFyrFG.js";import{n as v,o as y,t as b}from"./form-C-zZyKfB.js";import{t as x}from"./Pagination-Bm5HTIE3.js";var S=e(t(),1),C=n();function w(){let{data:e,error:t,loading:n,refetch:d}=o(()=>p.webhooks(),[]),h=e?.data?.webhooks??[],[v,b]=(0,S.useState)(0),w=Math.max(1,Math.ceil(h.length/15)),E=Math.min(v,w-1),[D,O]=(0,S.useState)(null),k=async e=>{O(null);try{await e(),d()}catch(e){O(e.message)}};return(0,C.jsxs)(`div`,{children:[(0,C.jsx)(f,{title:`Webhooks`,description:`HTTP callbacks fired on job events.`,live:!0}),t&&(0,C.jsx)(g,{onRetry:d}),D&&(0,C.jsx)(`div`,{className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-danger`,children:D}),(0,C.jsxs)(s,{className:`mb-6`,children:[(0,C.jsx)(i,{title:`Add webhook`}),(0,C.jsx)(T,{onAdd:async e=>{await p.addWebhook(e),d()}})]}),n&&!e&&!t?(0,C.jsx)(l,{label:`Loading webhooks…`}):h.length===0?(0,C.jsx)(_,{icon:(0,C.jsx)(r,{}),title:`No webhooks`,hint:`Add one above to receive job-event callbacks.`}):(0,C.jsxs)(C.Fragment,{children:[(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:`URL`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Events`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Success / Fail`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Last`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Enabled`}),(0,C.jsx)(`th`,{className:`w-12 px-5 py-3`})]})}),(0,C.jsx)(`tbody`,{children:h.slice(E*15,E*15+15).map(e=>(0,C.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,C.jsx)(`td`,{className:`max-w-xs truncate px-5 py-3 font-mono text-xs text-fg`,children:e.url}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-xs text-muted`,children:e.events.join(`, `)}),(0,C.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queue??`all`}),(0,C.jsxs)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:[(0,C.jsx)(`span`,{className:`text-success`,children:u(e.successCount)}),` / `,(0,C.jsx)(`span`,{className:e.failureCount?`text-danger`:``,children:u(e.failureCount)})]}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:m(e.lastTriggered)}),(0,C.jsx)(`td`,{className:`px-5 py-3`,children:(0,C.jsx)(y,{checked:e.enabled,label:`${e.enabled?`Disable`:`Enable`} webhook`,onChange:t=>k(()=>p.setWebhookEnabled(e.id,t))})}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,C.jsx)(c,{"aria-label":`Remove webhook`,onClick:()=>window.confirm(`Remove webhook for ${e.url}?`)&&k(()=>p.removeWebhook(e.id)),children:(0,C.jsx)(a,{className:`size-3.5`})})})]},e.id))})]})}),(0,C.jsx)(x,{page:E,pageSize:15,total:h.length,onPageChange:b,label:`webhooks`})]})]})}function T({onAdd:e}){let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(``),[s,c]=(0,S.useState)([`job.completed`,`job.failed`]),[l,u]=(0,S.useState)(null),[f,p]=(0,S.useState)(!1),m=e=>c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),g=async()=>{if(!f){if(u(null),!t.trim()||s.length===0){u(`URL and at least one event are required`);return}p(!0);try{await e({url:t,events:s,queue:r.trim()||void 0,secret:a.trim()||void 0}),n(``),o(``)}catch(e){u(e.message)}finally{p(!1)}}};return(0,C.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-3`,children:[(0,C.jsx)(`div`,{className:`md:col-span-1`,children:(0,C.jsx)(b,{label:`URL`,children:(0,C.jsx)(v,{value:t,onChange:e=>n(e.target.value),placeholder:`https://example.com/hook`})})}),(0,C.jsx)(b,{label:`Queue (optional)`,children:(0,C.jsx)(v,{value:r,onChange:e=>i(e.target.value),placeholder:`all queues`})}),(0,C.jsx)(b,{label:`Secret (optional)`,children:(0,C.jsx)(v,{type:`password`,autoComplete:`new-password`,value:a,onChange:e=>o(e.target.value),placeholder:`HMAC signing secret`})})]}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:d.map(e=>(0,C.jsx)(`button`,{type:`button`,"aria-pressed":s.includes(e),onClick:()=>m(e),className:s.includes(e)?`rounded-full bg-accent/15 px-3 py-1 text-xs font-medium text-accent`:`rounded-full border border-line px-3 py-1 text-xs font-medium text-muted hover:text-fg`,children:e},e))}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(h,{type:`submit`,variant:`accent`,size:`sm`,disabled:f,children:f?`Adding…`:`Add webhook`}),l&&(0,C.jsx)(`span`,{className:`text-xs text-danger`,children:l})]})]})}export{w as Webhooks};
1
+ import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{B as r,C as i,J as a,O as o,S as s,T as c,b as l,c as u,et as d,h as f,tt as p,u as m,w as h,x as g,y as _}from"./index-DtMgfAiz.js";import{n as v,o as y,t as b}from"./form-C-zZyKfB.js";import{t as x}from"./Pagination-CTSsxJT4.js";var S=e(t(),1),C=n();function w(){let{data:e,error:t,loading:n,refetch:d}=o(()=>p.webhooks(),[]),h=e?.data?.webhooks??[],[v,b]=(0,S.useState)(0),w=Math.max(1,Math.ceil(h.length/15)),E=Math.min(v,w-1),[D,O]=(0,S.useState)(null),k=async e=>{O(null);try{await e(),d()}catch(e){O(e.message)}};return(0,C.jsxs)(`div`,{children:[(0,C.jsx)(f,{title:`Webhooks`,description:`HTTP callbacks fired on job events.`,live:!0}),t&&(0,C.jsx)(g,{onRetry:d}),D&&(0,C.jsx)(`div`,{className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-danger`,children:D}),(0,C.jsxs)(s,{className:`mb-6`,children:[(0,C.jsx)(i,{title:`Add webhook`}),(0,C.jsx)(T,{onAdd:async e=>{await p.addWebhook(e),d()}})]}),n&&!e&&!t?(0,C.jsx)(l,{label:`Loading webhooks…`}):h.length===0?(0,C.jsx)(_,{icon:(0,C.jsx)(r,{}),title:`No webhooks`,hint:`Add one above to receive job-event callbacks.`}):(0,C.jsxs)(C.Fragment,{children:[(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:`URL`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Events`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Success / Fail`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Last`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Enabled`}),(0,C.jsx)(`th`,{className:`w-12 px-5 py-3`})]})}),(0,C.jsx)(`tbody`,{children:h.slice(E*15,E*15+15).map(e=>(0,C.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,C.jsx)(`td`,{className:`max-w-xs truncate px-5 py-3 font-mono text-xs text-fg`,children:e.url}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-xs text-muted`,children:e.events.join(`, `)}),(0,C.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queue??`all`}),(0,C.jsxs)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:[(0,C.jsx)(`span`,{className:`text-success`,children:u(e.successCount)}),` / `,(0,C.jsx)(`span`,{className:e.failureCount?`text-danger`:``,children:u(e.failureCount)})]}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:m(e.lastTriggered)}),(0,C.jsx)(`td`,{className:`px-5 py-3`,children:(0,C.jsx)(y,{checked:e.enabled,label:`${e.enabled?`Disable`:`Enable`} webhook`,onChange:t=>k(()=>p.setWebhookEnabled(e.id,t))})}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,C.jsx)(c,{"aria-label":`Remove webhook`,onClick:()=>window.confirm(`Remove webhook for ${e.url}?`)&&k(()=>p.removeWebhook(e.id)),children:(0,C.jsx)(a,{className:`size-3.5`})})})]},e.id))})]})}),(0,C.jsx)(x,{page:E,pageSize:15,total:h.length,onPageChange:b,label:`webhooks`})]})]})}function T({onAdd:e}){let[t,n]=(0,S.useState)(``),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(``),[s,c]=(0,S.useState)([`job.completed`,`job.failed`]),[l,u]=(0,S.useState)(null),[f,p]=(0,S.useState)(!1),m=e=>c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),g=async()=>{if(!f){if(u(null),!t.trim()||s.length===0){u(`URL and at least one event are required`);return}p(!0);try{await e({url:t,events:s,queue:r.trim()||void 0,secret:a.trim()||void 0}),n(``),o(``)}catch(e){u(e.message)}finally{p(!1)}}};return(0,C.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),g()},children:[(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-3`,children:[(0,C.jsx)(`div`,{className:`md:col-span-1`,children:(0,C.jsx)(b,{label:`URL`,children:(0,C.jsx)(v,{value:t,onChange:e=>n(e.target.value),placeholder:`https://example.com/hook`})})}),(0,C.jsx)(b,{label:`Queue (optional)`,children:(0,C.jsx)(v,{value:r,onChange:e=>i(e.target.value),placeholder:`all queues`})}),(0,C.jsx)(b,{label:`Secret (optional)`,children:(0,C.jsx)(v,{type:`password`,autoComplete:`new-password`,value:a,onChange:e=>o(e.target.value),placeholder:`HMAC signing secret`})})]}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:d.map(e=>(0,C.jsx)(`button`,{type:`button`,"aria-pressed":s.includes(e),onClick:()=>m(e),className:s.includes(e)?`rounded-full bg-accent/15 px-3 py-1 text-xs font-medium text-accent`:`rounded-full border border-line px-3 py-1 text-xs font-medium text-muted hover:text-fg`,children:e},e))}),(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(h,{type:`submit`,variant:`accent`,size:`sm`,disabled:f,children:f?`Adding…`:`Add webhook`}),l&&(0,C.jsx)(`span`,{className:`text-xs text-danger`,children:l})]})]})}export{w as Webhooks};
@@ -1 +1 @@
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,Y as i,b as a,c as o,h as s,k as c,m as l,u,x as d,y as f}from"./index-BRcFyrFG.js";import{t as p}from"./Pagination-Bm5HTIE3.js";var m=e(t(),1),h=n(),g=20,_={workers:{total:0,active:0,list:[],truncated:!1}};function v(){let{data:e,error:t,loading:n,refetch:v}=r(()=>c.overview(),[]),[y,b]=(0,m.useState)(0);if(n&&!e&&!t)return(0,h.jsx)(a,{label:`Loading workers…`});let{workers:x}=e??_,S=Math.max(1,Math.ceil(x.list.length/g)),C=Math.min(y,S-1),w=x.list.slice(C*g,C*g+g);return(0,h.jsxs)(`div`,{children:[t&&(0,h.jsx)(d,{onRetry:v}),(0,h.jsx)(s,{title:`Workers`,description:`Registered workers and their throughput.`,live:!0}),(0,h.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,h.jsx)(l,{label:`Total`,value:o(x.total),compact:!0}),(0,h.jsx)(l,{label:`Active`,value:o(x.active),tone:`green`,compact:!0})]}),x.list.length===0?(0,h.jsx)(f,{icon:(0,h.jsx)(i,{}),title:`No workers registered`,hint:`Workers appear here once they connect and register with the server.`}):(0,h.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,h.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,h.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Worker`}),(0,h.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queues`}),(0,h.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,h.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Processed`}),(0,h.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`}),(0,h.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Last Seen`})]})}),(0,h.jsx)(`tbody`,{children:w.map(e=>(0,h.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,h.jsxs)(`td`,{className:`px-5 py-3`,children:[(0,h.jsx)(`div`,{className:`font-medium text-fg`,children:e.name||`worker`}),(0,h.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.id})]}),(0,h.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queues.join(`, `)||`—`}),(0,h.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:o(e.activeJobs)}),(0,h.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:o(e.processedJobs)}),(0,h.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:o(e.failedJobs)}),(0,h.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:u(e.lastSeen)})]},e.id))})]})}),x.truncated&&(0,h.jsxs)(`p`,{className:`mt-3 text-xs text-amber-400`,children:[`Showing first `,o(x.list.length),` of `,o(x.total),` `,`workers.`]}),(0,h.jsx)(p,{page:C,pageSize:g,total:x.list.length,onPageChange:b,label:`workers`})]})}export{v as Workers};
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,Y as i,b as a,c as o,h as s,k as c,m as l,u,x as d,y as f}from"./index-DtMgfAiz.js";import{t as p}from"./Pagination-CTSsxJT4.js";var m=e(t(),1),h=n(),g=20,_={workers:{total:0,active:0,list:[],truncated:!1}};function v(){let{data:e,error:t,loading:n,refetch:v}=r(()=>c.overview(),[]),[y,b]=(0,m.useState)(0);if(n&&!e&&!t)return(0,h.jsx)(a,{label:`Loading workers…`});let{workers:x}=e??_,S=Math.max(1,Math.ceil(x.list.length/g)),C=Math.min(y,S-1),w=x.list.slice(C*g,C*g+g);return(0,h.jsxs)(`div`,{children:[t&&(0,h.jsx)(d,{onRetry:v}),(0,h.jsx)(s,{title:`Workers`,description:`Registered workers and their throughput.`,live:!0}),(0,h.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,h.jsx)(l,{label:`Total`,value:o(x.total),compact:!0}),(0,h.jsx)(l,{label:`Active`,value:o(x.active),tone:`green`,compact:!0})]}),x.list.length===0?(0,h.jsx)(f,{icon:(0,h.jsx)(i,{}),title:`No workers registered`,hint:`Workers appear here once they connect and register with the server.`}):(0,h.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,h.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,h.jsx)(`thead`,{children:(0,h.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,h.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Worker`}),(0,h.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queues`}),(0,h.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,h.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Processed`}),(0,h.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`}),(0,h.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Last Seen`})]})}),(0,h.jsx)(`tbody`,{children:w.map(e=>(0,h.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,h.jsxs)(`td`,{className:`px-5 py-3`,children:[(0,h.jsx)(`div`,{className:`font-medium text-fg`,children:e.name||`worker`}),(0,h.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.id})]}),(0,h.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queues.join(`, `)||`—`}),(0,h.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:o(e.activeJobs)}),(0,h.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:o(e.processedJobs)}),(0,h.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:o(e.failedJobs)}),(0,h.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:u(e.lastSeen)})]},e.id))})]})}),x.truncated&&(0,h.jsxs)(`p`,{className:`mt-3 text-xs text-amber-400`,children:[`Showing first `,o(x.list.length),` of `,o(x.total),` `,`workers.`]}),(0,h.jsx)(p,{page:C,pageSize:g,total:x.list.length,onPageChange:b,label:`workers`})]})}export{v as Workers};
@@ -1 +1 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r}from"./react-vendor-B68RYDeC.js";import{J as i,O as a,T as o,Y as s,b as c,c as l,h as u,m as d,tt as f,u as p,x as m,y as h}from"./index-BRcFyrFG.js";var g=e(n(),1),_=r(),v=100;function y(){let{data:e,error:n,loading:r,refetch:y}=a(async()=>(await f.workers()).data?.workers??[],[]),[b,x]=(0,g.useState)(new Set),[S,C]=(0,g.useState)(null);if(r&&!e&&!n)return(0,_.jsx)(c,{label:`Loading workers…`});let w=e??[],T=w.slice(0,v),E=w.filter(e=>e.status===`active`).length,D=w.length-E,O=w.reduce((e,t)=>e+(t.activeJobs??0),0),k=async e=>{if(window.confirm(`Unregister worker "${e.id}"? It can re-register on its next heartbeat.`)){x(t=>new Set(t).add(e.id)),C(null);try{await f.unregisterWorker(e.id),C({ok:!0,text:`Unregistered ${e.id} ✓`})}catch(e){C({ok:!1,text:`Unregister failed: ${e.message}`})}finally{x(t=>{let n=new Set(t);return n.delete(e.id),n}),y()}}};return(0,_.jsxs)(`div`,{children:[(0,_.jsx)(u,{title:`Workers`,description:`Registered workers and their throughput.`,live:!n}),n&&(0,_.jsx)(m,{onRetry:y}),(0,_.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,_.jsx)(d,{label:`Total`,value:l(w.length),compact:!0}),(0,_.jsx)(d,{label:`Active`,value:l(E),tone:`green`,compact:!0}),(0,_.jsx)(d,{label:`Stale`,value:l(D),tone:D?`amber`:`default`,compact:!0}),(0,_.jsx)(d,{label:`Active Jobs`,value:l(O),tone:`blue`,compact:!0})]}),S&&(0,_.jsx)(`div`,{className:t(`mb-3 text-sm`,S.ok?`text-success`:`text-danger`),children:S.text}),w.length===0?(0,_.jsx)(h,{icon:(0,_.jsx)(s,{}),title:`No workers registered`,hint:`Workers appear here once they connect and register with the server.`}):(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:`Worker`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queues`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(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:`Processed`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Last Seen`}),(0,_.jsx)(`th`,{className:`w-16 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,_.jsx)(`tbody`,{children:T.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,_.jsxs)(`td`,{className:`px-5 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-fg`,children:e.name||`worker`}),(0,_.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.id})]}),(0,_.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queues.join(`, `)||`—`}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.status===`active`?`bg-emerald-500/10 text-success`:`bg-amber-500/10 text-warning`),children:e.status})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:l(e.activeJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:l(e.processedJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:l(e.failedJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:p(e.lastSeen)}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(`div`,{className:`flex justify-end`,children:(0,_.jsx)(o,{"aria-label":`Unregister worker ${e.id}`,disabled:b.has(e.id),onClick:()=>k(e),children:(0,_.jsx)(i,{className:`size-3.5`})})})})]},e.id))})]})}),w.length>v&&(0,_.jsxs)(`p`,{className:`mt-3 text-xs text-warning`,children:[`Showing first `,l(v),` of `,l(w.length),` workers.`]})]})}export{y as WorkersPro};
1
+ import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r}from"./react-vendor-B68RYDeC.js";import{J as i,O as a,T as o,Y as s,b as c,c as l,h as u,m as d,tt as f,u as p,x as m,y as h}from"./index-DtMgfAiz.js";var g=e(n(),1),_=r(),v=100;function y(){let{data:e,error:n,loading:r,refetch:y}=a(async()=>(await f.workers()).data?.workers??[],[]),[b,x]=(0,g.useState)(new Set),[S,C]=(0,g.useState)(null);if(r&&!e&&!n)return(0,_.jsx)(c,{label:`Loading workers…`});let w=e??[],T=w.slice(0,v),E=w.filter(e=>e.status===`active`).length,D=w.length-E,O=w.reduce((e,t)=>e+(t.activeJobs??0),0),k=async e=>{if(window.confirm(`Unregister worker "${e.id}"? It can re-register on its next heartbeat.`)){x(t=>new Set(t).add(e.id)),C(null);try{await f.unregisterWorker(e.id),C({ok:!0,text:`Unregistered ${e.id} ✓`})}catch(e){C({ok:!1,text:`Unregister failed: ${e.message}`})}finally{x(t=>{let n=new Set(t);return n.delete(e.id),n}),y()}}};return(0,_.jsxs)(`div`,{children:[(0,_.jsx)(u,{title:`Workers`,description:`Registered workers and their throughput.`,live:!n}),n&&(0,_.jsx)(m,{onRetry:y}),(0,_.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,_.jsx)(d,{label:`Total`,value:l(w.length),compact:!0}),(0,_.jsx)(d,{label:`Active`,value:l(E),tone:`green`,compact:!0}),(0,_.jsx)(d,{label:`Stale`,value:l(D),tone:D?`amber`:`default`,compact:!0}),(0,_.jsx)(d,{label:`Active Jobs`,value:l(O),tone:`blue`,compact:!0})]}),S&&(0,_.jsx)(`div`,{className:t(`mb-3 text-sm`,S.ok?`text-success`:`text-danger`),children:S.text}),w.length===0?(0,_.jsx)(h,{icon:(0,_.jsx)(s,{}),title:`No workers registered`,hint:`Workers appear here once they connect and register with the server.`}):(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:`Worker`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queues`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(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:`Processed`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Last Seen`}),(0,_.jsx)(`th`,{className:`w-16 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,_.jsx)(`tbody`,{children:T.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,_.jsxs)(`td`,{className:`px-5 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-fg`,children:e.name||`worker`}),(0,_.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.id})]}),(0,_.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queues.join(`, `)||`—`}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.status===`active`?`bg-emerald-500/10 text-success`:`bg-amber-500/10 text-warning`),children:e.status})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:l(e.activeJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:l(e.processedJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:l(e.failedJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:p(e.lastSeen)}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(`div`,{className:`flex justify-end`,children:(0,_.jsx)(o,{"aria-label":`Unregister worker ${e.id}`,disabled:b.has(e.id),onClick:()=>k(e),children:(0,_.jsx)(i,{className:`size-3.5`})})})})]},e.id))})]})}),w.length>v&&(0,_.jsxs)(`p`,{className:`mt-3 text-xs text-warning`,children:[`Showing first `,l(v),` of `,l(w.length),` workers.`]})]})}export{y as WorkersPro};