bunqueue-dashboard 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/.vite/manifest.json +151 -149
  2. package/dist/assets/{AddJob-pXSBfCte.js → AddJob-BdBKp1lA.js} +2 -2
  3. package/dist/assets/{Alerts-DdXuzRJe.js → Alerts-CBtbj7VF.js} +1 -1
  4. package/dist/assets/{AreaChart-DzUXW8u3.js → AreaChart-lY-mk5E1.js} +1 -1
  5. package/dist/assets/{Benchmark-DFdrF54C.js → Benchmark-CWd91fdV.js} +1 -1
  6. package/dist/assets/{BulkAddJobs-BrCaYvgB.js → BulkAddJobs-Db2Jz08R.js} +2 -2
  7. package/dist/assets/{CopilotPanel-BQrRrGXD.js → CopilotPanel-Bo9KvCt-.js} +1 -1
  8. package/dist/assets/{CopyButton-D39F1wIH.js → CopyButton-DhNun7Gi.js} +1 -1
  9. package/dist/assets/Cron-CgniaW__.js +1 -0
  10. package/dist/assets/{CronManager-tK96LeNt.js → CronManager-BfjJ7XRX.js} +1 -1
  11. package/dist/assets/Database-m_cAcr3W.js +3 -0
  12. package/dist/assets/{Diagnostics-Wbdmc5hx.js → Diagnostics-DuuR1jQB.js} +1 -1
  13. package/dist/assets/{Dlq-B2QZSDU6.js → Dlq-Mcb5cK1V.js} +1 -1
  14. package/dist/assets/DlqControl-982fUv41.js +1 -0
  15. package/dist/assets/DlqPro-CuC9E0_L.js +1 -0
  16. package/dist/assets/{Flows-Bb2WdFa0.js → Flows-DHM7TGds.js} +1 -1
  17. package/dist/assets/JobInspector-BH5O-C3Y.js +2 -0
  18. package/dist/assets/{Jobs-CUWqc7-2.js → Jobs-BStpSQDW.js} +1 -1
  19. package/dist/assets/JobsPro-blsDl4Et.js +1 -0
  20. package/dist/assets/{Logs-D5EqmgBR.js → Logs-4alJwdiF.js} +1 -1
  21. package/dist/assets/{LogsPro-C14Lju7q.js → LogsPro-B9T-oqAb.js} +1 -1
  22. package/dist/assets/{McpServer-CQh8KRNo.js → McpServer-EIQ0MSuW.js} +1 -1
  23. package/dist/assets/{Metrics-BjNcCmTp.js → Metrics-vxs3mcKS.js} +1 -1
  24. package/dist/assets/MetricsPro-BbuSRbxq.js +1 -0
  25. package/dist/assets/{Overview-CkMHyr1F.js → Overview-HdSe2zeO.js} +1 -1
  26. package/dist/assets/{Pagination-DYMlK0Hm.js → Pagination-Bm5HTIE3.js} +1 -1
  27. package/dist/assets/{QueueActions-Cg2hdDsu.js → QueueActions-BvXNsXKQ.js} +1 -1
  28. package/dist/assets/{QueueControl-BY9w4OuO.js → QueueControl-C1lfn3lP.js} +1 -1
  29. package/dist/assets/{QueueDetail-BbtTrGuU.js → QueueDetail-Bx8hx-5F.js} +1 -1
  30. package/dist/assets/{QueueDetailPro-25QnEp1Q.js → QueueDetailPro-C-DCfrRT.js} +1 -1
  31. package/dist/assets/{Queues-MXia1p1i.js → Queues-C_Pt7-K2.js} +1 -1
  32. package/dist/assets/QueuesOverview-BT4B6ls7.js +1 -0
  33. package/dist/assets/{S3Backup-ChWVmznV.js → S3Backup-FzxBXfKG.js} +1 -1
  34. package/dist/assets/{S3BackupPro-JU_hxhXm.js → S3BackupPro-BBx94VGs.js} +1 -1
  35. package/dist/assets/ServerControl-B7iVlX8g.js +3 -0
  36. package/dist/assets/{Settings-D0XEFZj5.js → Settings-DNh5PdAt.js} +1 -1
  37. package/dist/assets/{Usage-vvNehwcX.js → Usage-DYa7HsgK.js} +1 -1
  38. package/dist/assets/UsagePro-CNwxz-Dm.js +1 -0
  39. package/dist/assets/Webhooks-Da3dnRY3.js +1 -0
  40. package/dist/assets/{Workers-CvV7eZrD.js → Workers-B72sL29I.js} +1 -1
  41. package/dist/assets/WorkersPro-D-p_yJi6.js +1 -0
  42. package/dist/assets/{connectionStore-CCopJeU7.js → connectionStore-B-hNUqwK.js} +1 -1
  43. package/dist/assets/{form-PtDLk33Z.js → form-C-zZyKfB.js} +1 -1
  44. package/dist/assets/index-BRcFyrFG.js +8 -0
  45. package/dist/assets/index-C2XEM9ex.css +1 -0
  46. package/dist/assets/react-vendor-B68RYDeC.js +11 -0
  47. package/dist/assets/{useThroughputSeries-B6m-M93j.js → useThroughputSeries-BhH_0wfd.js} +1 -1
  48. package/dist/index.html +4 -4
  49. package/package.json +2 -1
  50. package/scripts/embedded.gen.ts +106 -106
  51. package/dist/assets/Cron-Ctas3GOV.js +0 -1
  52. package/dist/assets/Database-CLUujevy.js +0 -3
  53. package/dist/assets/DlqControl-D9xzve29.js +0 -1
  54. package/dist/assets/DlqPro-ByRwkv1s.js +0 -1
  55. package/dist/assets/JobInspector-BTZS6pI-.js +0 -2
  56. package/dist/assets/JobsPro-BWweJCnr.js +0 -1
  57. package/dist/assets/MetricsPro-CcK7hYQf.js +0 -1
  58. package/dist/assets/QueuesOverview-Rai_zPUB.js +0 -1
  59. package/dist/assets/ServerControl-Dirs9r5Q.js +0 -3
  60. package/dist/assets/UsagePro-D_-jHCJY.js +0 -1
  61. package/dist/assets/Webhooks-B4DugS-x.js +0 -1
  62. package/dist/assets/WorkersPro-t5SD6hbP.js +0 -1
  63. package/dist/assets/index-C3t3ByS-.css +0 -1
  64. package/dist/assets/index-C5VVVkqi.js +0 -8
  65. package/dist/assets/react-vendor-CHIHtdAC.js +0 -11
package/dist/index.html CHANGED
@@ -18,11 +18,11 @@
18
18
  </script>
19
19
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
20
20
  <title>bunqueue · dashboard (beta)</title>
21
- <script type="module" crossorigin src="/assets/index-C5VVVkqi.js"></script>
21
+ <script type="module" crossorigin src="/assets/index-BRcFyrFG.js"></script>
22
22
  <link rel="modulepreload" crossorigin href="/assets/cn-CMFYpumL.js">
23
- <link rel="modulepreload" crossorigin href="/assets/react-vendor-CHIHtdAC.js">
24
- <link rel="modulepreload" crossorigin href="/assets/connectionStore-CCopJeU7.js">
25
- <link rel="stylesheet" crossorigin href="/assets/index-C3t3ByS-.css">
23
+ <link rel="modulepreload" crossorigin href="/assets/react-vendor-B68RYDeC.js">
24
+ <link rel="modulepreload" crossorigin href="/assets/connectionStore-B-hNUqwK.js">
25
+ <link rel="stylesheet" crossorigin href="/assets/index-C2XEM9ex.css">
26
26
  </head>
27
27
  <body>
28
28
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunqueue-dashboard",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "type": "module",
5
5
  "description": "Web dashboard for a bunqueue server (queues, jobs, DLQ, cron, metrics, workers, live activity). Run with `bunx bunqueue-dashboard` (requires Bun).",
6
6
  "bin": {
@@ -51,6 +51,7 @@
51
51
  "build:bin": "bun run build && bun run scripts/gen-embed.ts && bun build scripts/serve.ts --compile --minify --outfile bunqueue-dashboard",
52
52
  "preview": "vite preview",
53
53
  "test": "bun test",
54
+ "test:coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov --coverage-dir=coverage && bun scripts/check-coverage.ts",
54
55
  "check": "biome check .",
55
56
  "check:fix": "biome check --write .",
56
57
  "format": "biome format --write ."
@@ -2,120 +2,120 @@
2
2
  // AUTO-GENERATED by scripts/gen-embed.ts — do not edit, not committed.
3
3
  import f0 from "../dist/.vite/manifest.json" with { type: 'file' };
4
4
  import f1 from "../dist/favicon.svg" with { type: 'file' };
5
- import f2 from "../dist/assets/DlqControl-D9xzve29.js" with { type: 'file' };
6
- import f3 from "../dist/assets/CopyButton-D39F1wIH.js" with { type: 'file' };
7
- import f4 from "../dist/assets/UsagePro-D_-jHCJY.js" with { type: 'file' };
8
- import f5 from "../dist/assets/LogsPro-C14Lju7q.js" with { type: 'file' };
9
- import f6 from "../dist/assets/Logs-D5EqmgBR.js" with { type: 'file' };
10
- import f7 from "../dist/assets/Pagination-DYMlK0Hm.js" with { type: 'file' };
11
- import f8 from "../dist/assets/S3Backup-ChWVmznV.js" with { type: 'file' };
12
- import f9 from "../dist/assets/AreaChart-DzUXW8u3.js" with { type: 'file' };
13
- import f10 from "../dist/assets/install-C019EM5j.js" with { type: 'file' };
14
- import f11 from "../dist/assets/Cron-Ctas3GOV.js" with { type: 'file' };
15
- import f12 from "../dist/assets/QueueActions-Cg2hdDsu.js" with { type: 'file' };
16
- import f13 from "../dist/assets/DlqPro-ByRwkv1s.js" with { type: 'file' };
17
- import f14 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
18
- import f15 from "../dist/assets/JobInspector-BTZS6pI-.js" with { type: 'file' };
19
- import f16 from "../dist/assets/BulkAddJobs-BrCaYvgB.js" with { type: 'file' };
20
- import f17 from "../dist/assets/form-PtDLk33Z.js" with { type: 'file' };
21
- import f18 from "../dist/assets/index-C3t3ByS-.css" with { type: 'file' };
22
- import f19 from "../dist/assets/Usage-vvNehwcX.js" with { type: 'file' };
23
- import f20 from "../dist/assets/index-C5VVVkqi.js" with { type: 'file' };
24
- import f21 from "../dist/assets/MetricsPro-CcK7hYQf.js" with { type: 'file' };
25
- import f22 from "../dist/assets/Settings-D0XEFZj5.js" with { type: 'file' };
26
- import f23 from "../dist/assets/react-vendor-CHIHtdAC.js" with { type: 'file' };
27
- import f24 from "../dist/assets/Queues-MXia1p1i.js" with { type: 'file' };
28
- import f25 from "../dist/assets/jobActions-CuOdMglt.js" with { type: 'file' };
29
- import f26 from "../dist/assets/connectionStore-CCopJeU7.js" with { type: 'file' };
30
- import f27 from "../dist/assets/Webhooks-B4DugS-x.js" with { type: 'file' };
31
- import f28 from "../dist/assets/useThroughputSeries-B6m-M93j.js" with { type: 'file' };
32
- import f29 from "../dist/assets/AddJob-pXSBfCte.js" with { type: 'file' };
33
- import f30 from "../dist/assets/WorkersPro-t5SD6hbP.js" with { type: 'file' };
34
- import f31 from "../dist/assets/ServerControl-Dirs9r5Q.js" with { type: 'file' };
5
+ import f2 from "../dist/assets/form-C-zZyKfB.js" with { type: 'file' };
6
+ import f3 from "../dist/assets/QueueActions-BvXNsXKQ.js" with { type: 'file' };
7
+ import f4 from "../dist/assets/Flows-DHM7TGds.js" with { type: 'file' };
8
+ import f5 from "../dist/assets/Workers-B72sL29I.js" with { type: 'file' };
9
+ import f6 from "../dist/assets/Usage-DYa7HsgK.js" with { type: 'file' };
10
+ import f7 from "../dist/assets/install-C019EM5j.js" with { type: 'file' };
11
+ import f8 from "../dist/assets/CopyButton-DhNun7Gi.js" with { type: 'file' };
12
+ import f9 from "../dist/assets/Metrics-vxs3mcKS.js" with { type: 'file' };
13
+ import f10 from "../dist/assets/AddJob-BdBKp1lA.js" with { type: 'file' };
14
+ import f11 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
15
+ import f12 from "../dist/assets/MetricsPro-BbuSRbxq.js" with { type: 'file' };
16
+ import f13 from "../dist/assets/connectionStore-B-hNUqwK.js" with { type: 'file' };
17
+ import f14 from "../dist/assets/QueuesOverview-BT4B6ls7.js" with { type: 'file' };
18
+ import f15 from "../dist/assets/useThroughputSeries-BhH_0wfd.js" with { type: 'file' };
19
+ import f16 from "../dist/assets/Logs-4alJwdiF.js" with { type: 'file' };
20
+ import f17 from "../dist/assets/WorkersPro-D-p_yJi6.js" with { type: 'file' };
21
+ import f18 from "../dist/assets/AreaChart-lY-mk5E1.js" with { type: 'file' };
22
+ import f19 from "../dist/assets/QueueDetail-Bx8hx-5F.js" with { type: 'file' };
23
+ import f20 from "../dist/assets/Settings-DNh5PdAt.js" with { type: 'file' };
24
+ import f21 from "../dist/assets/QueueDetailPro-C-DCfrRT.js" with { type: 'file' };
25
+ import f22 from "../dist/assets/Jobs-BStpSQDW.js" with { type: 'file' };
26
+ import f23 from "../dist/assets/CopilotPanel-Bo9KvCt-.js" with { type: 'file' };
27
+ import f24 from "../dist/assets/Database-m_cAcr3W.js" with { type: 'file' };
28
+ import f25 from "../dist/assets/Pagination-Bm5HTIE3.js" with { type: 'file' };
29
+ import f26 from "../dist/assets/jobActions-CuOdMglt.js" with { type: 'file' };
30
+ import f27 from "../dist/assets/Overview-HdSe2zeO.js" with { type: 'file' };
31
+ import f28 from "../dist/assets/DlqControl-982fUv41.js" with { type: 'file' };
32
+ import f29 from "../dist/assets/Dlq-Mcb5cK1V.js" with { type: 'file' };
33
+ import f30 from "../dist/assets/index-C2XEM9ex.css" with { type: 'file' };
34
+ import f31 from "../dist/assets/LogsPro-B9T-oqAb.js" with { type: 'file' };
35
35
  import f32 from "../dist/assets/exportFile-tdUeW5m5.js" with { type: 'file' };
36
- import f33 from "../dist/assets/Alerts-DdXuzRJe.js" with { type: 'file' };
37
- import f34 from "../dist/assets/Overview-CkMHyr1F.js" with { type: 'file' };
38
- import f35 from "../dist/assets/cn-CMFYpumL.js" with { type: 'file' };
39
- import f36 from "../dist/assets/QueueDetailPro-25QnEp1Q.js" with { type: 'file' };
40
- import f37 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
41
- import f38 from "../dist/assets/QueueDetail-BbtTrGuU.js" with { type: 'file' };
42
- import f39 from "../dist/assets/promisePool-Daxkc1OB.js" with { type: 'file' };
43
- import f40 from "../dist/assets/CronManager-tK96LeNt.js" with { type: 'file' };
44
- import f41 from "../dist/assets/Benchmark-DFdrF54C.js" with { type: 'file' };
45
- import f42 from "../dist/assets/Diagnostics-Wbdmc5hx.js" with { type: 'file' };
46
- import f43 from "../dist/assets/CopilotPanel-BQrRrGXD.js" with { type: 'file' };
47
- import f44 from "../dist/assets/Flows-Bb2WdFa0.js" with { type: 'file' };
48
- import f45 from "../dist/assets/JobsPro-BWweJCnr.js" with { type: 'file' };
49
- import f46 from "../dist/assets/Dlq-B2QZSDU6.js" with { type: 'file' };
50
- import f47 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
51
- import f48 from "../dist/assets/QueuesOverview-Rai_zPUB.js" with { type: 'file' };
52
- import f49 from "../dist/assets/Workers-CvV7eZrD.js" with { type: 'file' };
53
- import f50 from "../dist/assets/S3BackupPro-JU_hxhXm.js" with { type: 'file' };
54
- import f51 from "../dist/assets/McpServer-CQh8KRNo.js" with { type: 'file' };
55
- import f52 from "../dist/assets/Metrics-BjNcCmTp.js" with { type: 'file' };
56
- import f53 from "../dist/assets/QueueControl-BY9w4OuO.js" with { type: 'file' };
36
+ import f33 from "../dist/assets/QueueControl-C1lfn3lP.js" with { type: 'file' };
37
+ import f34 from "../dist/assets/S3BackupPro-BBx94VGs.js" with { type: 'file' };
38
+ import f35 from "../dist/assets/BulkAddJobs-Db2Jz08R.js" with { type: 'file' };
39
+ import f36 from "../dist/assets/McpServer-EIQ0MSuW.js" with { type: 'file' };
40
+ import f37 from "../dist/assets/cn-CMFYpumL.js" with { type: 'file' };
41
+ import f38 from "../dist/assets/react-vendor-B68RYDeC.js" with { type: 'file' };
42
+ import f39 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
43
+ import f40 from "../dist/assets/promisePool-Daxkc1OB.js" with { type: 'file' };
44
+ import f41 from "../dist/assets/Alerts-CBtbj7VF.js" with { type: 'file' };
45
+ import f42 from "../dist/assets/DlqPro-CuC9E0_L.js" with { type: 'file' };
46
+ import f43 from "../dist/assets/Benchmark-CWd91fdV.js" with { type: 'file' };
47
+ import f44 from "../dist/assets/UsagePro-CNwxz-Dm.js" with { type: 'file' };
48
+ import f45 from "../dist/assets/Queues-C_Pt7-K2.js" with { type: 'file' };
49
+ import f46 from "../dist/assets/JobsPro-blsDl4Et.js" with { type: 'file' };
50
+ import f47 from "../dist/assets/Cron-CgniaW__.js" with { type: 'file' };
51
+ import f48 from "../dist/assets/index-BRcFyrFG.js" with { type: 'file' };
52
+ import f49 from "../dist/assets/Diagnostics-DuuR1jQB.js" with { type: 'file' };
53
+ import f50 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
54
+ import f51 from "../dist/assets/ServerControl-B7iVlX8g.js" with { type: 'file' };
55
+ import f52 from "../dist/assets/S3Backup-FzxBXfKG.js" with { type: 'file' };
56
+ import f53 from "../dist/assets/JobInspector-BH5O-C3Y.js" with { type: 'file' };
57
57
  import f54 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
58
- import f55 from "../dist/assets/Jobs-CUWqc7-2.js" with { type: 'file' };
59
- import f56 from "../dist/assets/Database-CLUujevy.js" with { type: 'file' };
58
+ import f55 from "../dist/assets/CronManager-BfjJ7XRX.js" with { type: 'file' };
59
+ import f56 from "../dist/assets/Webhooks-Da3dnRY3.js" with { type: 'file' };
60
60
  import f57 from "../dist/index.html" with { type: 'file' };
61
61
 
62
62
  export const ASSETS: Record<string, string> = {
63
63
  "/.vite/manifest.json": f0,
64
64
  "/favicon.svg": f1,
65
- "/assets/DlqControl-D9xzve29.js": f2,
66
- "/assets/CopyButton-D39F1wIH.js": f3,
67
- "/assets/UsagePro-D_-jHCJY.js": f4,
68
- "/assets/LogsPro-C14Lju7q.js": f5,
69
- "/assets/Logs-D5EqmgBR.js": f6,
70
- "/assets/Pagination-DYMlK0Hm.js": f7,
71
- "/assets/S3Backup-ChWVmznV.js": f8,
72
- "/assets/AreaChart-DzUXW8u3.js": f9,
73
- "/assets/install-C019EM5j.js": f10,
74
- "/assets/Cron-Ctas3GOV.js": f11,
75
- "/assets/QueueActions-Cg2hdDsu.js": f12,
76
- "/assets/DlqPro-ByRwkv1s.js": f13,
77
- "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f14,
78
- "/assets/JobInspector-BTZS6pI-.js": f15,
79
- "/assets/BulkAddJobs-BrCaYvgB.js": f16,
80
- "/assets/form-PtDLk33Z.js": f17,
81
- "/assets/index-C3t3ByS-.css": f18,
82
- "/assets/Usage-vvNehwcX.js": f19,
83
- "/assets/index-C5VVVkqi.js": f20,
84
- "/assets/MetricsPro-CcK7hYQf.js": f21,
85
- "/assets/Settings-D0XEFZj5.js": f22,
86
- "/assets/react-vendor-CHIHtdAC.js": f23,
87
- "/assets/Queues-MXia1p1i.js": f24,
88
- "/assets/jobActions-CuOdMglt.js": f25,
89
- "/assets/connectionStore-CCopJeU7.js": f26,
90
- "/assets/Webhooks-B4DugS-x.js": f27,
91
- "/assets/useThroughputSeries-B6m-M93j.js": f28,
92
- "/assets/AddJob-pXSBfCte.js": f29,
93
- "/assets/WorkersPro-t5SD6hbP.js": f30,
94
- "/assets/ServerControl-Dirs9r5Q.js": f31,
65
+ "/assets/form-C-zZyKfB.js": f2,
66
+ "/assets/QueueActions-BvXNsXKQ.js": f3,
67
+ "/assets/Flows-DHM7TGds.js": f4,
68
+ "/assets/Workers-B72sL29I.js": f5,
69
+ "/assets/Usage-DYa7HsgK.js": f6,
70
+ "/assets/install-C019EM5j.js": f7,
71
+ "/assets/CopyButton-DhNun7Gi.js": f8,
72
+ "/assets/Metrics-vxs3mcKS.js": f9,
73
+ "/assets/AddJob-BdBKp1lA.js": f10,
74
+ "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f11,
75
+ "/assets/MetricsPro-BbuSRbxq.js": f12,
76
+ "/assets/connectionStore-B-hNUqwK.js": f13,
77
+ "/assets/QueuesOverview-BT4B6ls7.js": f14,
78
+ "/assets/useThroughputSeries-BhH_0wfd.js": f15,
79
+ "/assets/Logs-4alJwdiF.js": f16,
80
+ "/assets/WorkersPro-D-p_yJi6.js": f17,
81
+ "/assets/AreaChart-lY-mk5E1.js": f18,
82
+ "/assets/QueueDetail-Bx8hx-5F.js": f19,
83
+ "/assets/Settings-DNh5PdAt.js": f20,
84
+ "/assets/QueueDetailPro-C-DCfrRT.js": f21,
85
+ "/assets/Jobs-BStpSQDW.js": f22,
86
+ "/assets/CopilotPanel-Bo9KvCt-.js": f23,
87
+ "/assets/Database-m_cAcr3W.js": f24,
88
+ "/assets/Pagination-Bm5HTIE3.js": f25,
89
+ "/assets/jobActions-CuOdMglt.js": f26,
90
+ "/assets/Overview-HdSe2zeO.js": f27,
91
+ "/assets/DlqControl-982fUv41.js": f28,
92
+ "/assets/Dlq-Mcb5cK1V.js": f29,
93
+ "/assets/index-C2XEM9ex.css": f30,
94
+ "/assets/LogsPro-B9T-oqAb.js": f31,
95
95
  "/assets/exportFile-tdUeW5m5.js": f32,
96
- "/assets/Alerts-DdXuzRJe.js": f33,
97
- "/assets/Overview-CkMHyr1F.js": f34,
98
- "/assets/cn-CMFYpumL.js": f35,
99
- "/assets/QueueDetailPro-25QnEp1Q.js": f36,
100
- "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f37,
101
- "/assets/QueueDetail-BbtTrGuU.js": f38,
102
- "/assets/promisePool-Daxkc1OB.js": f39,
103
- "/assets/CronManager-tK96LeNt.js": f40,
104
- "/assets/Benchmark-DFdrF54C.js": f41,
105
- "/assets/Diagnostics-Wbdmc5hx.js": f42,
106
- "/assets/CopilotPanel-BQrRrGXD.js": f43,
107
- "/assets/Flows-Bb2WdFa0.js": f44,
108
- "/assets/JobsPro-BWweJCnr.js": f45,
109
- "/assets/Dlq-B2QZSDU6.js": f46,
110
- "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f47,
111
- "/assets/QueuesOverview-Rai_zPUB.js": f48,
112
- "/assets/Workers-CvV7eZrD.js": f49,
113
- "/assets/S3BackupPro-JU_hxhXm.js": f50,
114
- "/assets/McpServer-CQh8KRNo.js": f51,
115
- "/assets/Metrics-BjNcCmTp.js": f52,
116
- "/assets/QueueControl-BY9w4OuO.js": f53,
96
+ "/assets/QueueControl-C1lfn3lP.js": f33,
97
+ "/assets/S3BackupPro-BBx94VGs.js": f34,
98
+ "/assets/BulkAddJobs-Db2Jz08R.js": f35,
99
+ "/assets/McpServer-EIQ0MSuW.js": f36,
100
+ "/assets/cn-CMFYpumL.js": f37,
101
+ "/assets/react-vendor-B68RYDeC.js": f38,
102
+ "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f39,
103
+ "/assets/promisePool-Daxkc1OB.js": f40,
104
+ "/assets/Alerts-CBtbj7VF.js": f41,
105
+ "/assets/DlqPro-CuC9E0_L.js": f42,
106
+ "/assets/Benchmark-CWd91fdV.js": f43,
107
+ "/assets/UsagePro-CNwxz-Dm.js": f44,
108
+ "/assets/Queues-C_Pt7-K2.js": f45,
109
+ "/assets/JobsPro-blsDl4Et.js": f46,
110
+ "/assets/Cron-CgniaW__.js": f47,
111
+ "/assets/index-BRcFyrFG.js": f48,
112
+ "/assets/Diagnostics-DuuR1jQB.js": f49,
113
+ "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f50,
114
+ "/assets/ServerControl-B7iVlX8g.js": f51,
115
+ "/assets/S3Backup-FzxBXfKG.js": f52,
116
+ "/assets/JobInspector-BH5O-C3Y.js": f53,
117
117
  "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f54,
118
- "/assets/Jobs-CUWqc7-2.js": f55,
119
- "/assets/Database-CLUujevy.js": f56,
118
+ "/assets/CronManager-BfjJ7XRX.js": f55,
119
+ "/assets/Webhooks-Da3dnRY3.js": f56,
120
120
  "/index.html": f57,
121
121
  };
@@ -1 +0,0 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{F as r,O as i,T as a,a as o,b as s,c,h as l,k as u,q as d,x as f,y as p}from"./index-C5VVVkqi.js";import{t as m}from"./Pagination-DYMlK0Hm.js";var h=e(t(),1),g=n();function _(){let{data:e,error:t,loading:n,refetch:_}=i(()=>u.crons(),[]),v=(e?.crons??[]).slice(),[y,b]=(0,h.useState)(0),x=Math.max(1,Math.ceil(v.length/15)),S=Math.min(y,x-1),C=async e=>{if(window.confirm(`Delete cron "${e}"?`))try{await u.deleteCron(e),_()}catch{}};return(0,g.jsxs)(`div`,{children:[t&&(0,g.jsx)(f,{onRetry:_}),(0,g.jsx)(l,{title:`Cron Jobs`,description:`${v.length} scheduled`,live:!0}),n&&!e&&!t?(0,g.jsx)(s,{label:`Loading cron jobs…`}):v.length===0?(0,g.jsx)(p,{icon:(0,g.jsx)(r,{}),title:`No scheduled jobs`,hint:`Repeatable jobs created with upsertJobScheduler appear here.`}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,g.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,g.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,g.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Schedule`}),(0,g.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Next Run`}),(0,g.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Runs`}),(0,g.jsx)(`th`,{className:`w-12 px-5 py-3`})]})}),(0,g.jsx)(`tbody`,{children:v.slice(S*15,S*15+15).map(e=>(0,g.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,g.jsx)(`td`,{className:`px-5 py-3 font-medium text-fg`,children:e.name}),(0,g.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queue??`—`}),(0,g.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.schedule??(e.repeatEvery?`every ${e.repeatEvery}ms`:`—`)}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-faint`,children:o(e.nextRun)}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:c(e.executions??0)}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,g.jsx)(a,{"aria-label":`Delete cron`,onClick:()=>C(e.name),children:(0,g.jsx)(d,{className:`size-3.5`})})})]},e.name))})]})}),(0,g.jsx)(m,{page:S,pageSize:15,total:v.length,onPageChange:b,label:`crons`})]})]})}export{_ as Cron};
@@ -1,3 +0,0 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{m as n,t as r}from"./react-vendor-CHIHtdAC.js";import{C as i,K as a,N as o,O as s,Q as c,S as l,b as u,c as d,et as f,h as p,m,r as h,w as g,x as _,y as v}from"./index-C5VVVkqi.js";import{a as y}from"./form-PtDLk33Z.js";import{t as ee}from"./Pagination-DYMlK0Hm.js";import{t as b}from"./CopyButton-D39F1wIH.js";var x=e(n(),1),S=r(),C=50,w=500,te=2e5,T=`bq-dash-db-history`,E=10;function D(e){let t=e==null?``:String(e);return/[",\n]/.test(t)?`"${t.replaceAll(`"`,`""`)}"`:t}function O(e,t){return[e.map(D).join(`,`),...t.map(e=>e.map(D).join(`,`))].join(`
2
- `)}function k(e,t,n){let r=URL.createObjectURL(new Blob([n],{type:t})),i=document.createElement(`a`);i.href=r,i.download=e,i.click(),URL.revokeObjectURL(r)}function A(){try{let e=JSON.parse(localStorage.getItem(T)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function j(e){try{localStorage.setItem(T,JSON.stringify(e))}catch{}return e}function M(e){return j([e,...A().filter(t=>t!==e)].slice(0,E))}function N(e){if(e==null)return`NULL`;let t=typeof e==`string`?e:String(e);try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function P({value:e,align:n}){if(e==null)return(0,S.jsx)(`span`,{className:`italic text-faint`,children:`NULL`});let r=typeof e==`string`?e:String(e);return(0,S.jsx)(`span`,{className:t(`block max-w-[24rem] truncate`,n===`right`&&`text-right tabular-nums`),title:r,children:r})}function F({columns:e,rows:n,truncatedCells:r,colMeta:i,sort:a,onSort:o,onRowClick:s,dimmed:c}){let l=(0,x.useMemo)(()=>e.map((e,t)=>{let r=i?.[e]?.type?.toUpperCase()??``;if(/INT|REAL|NUM|DEC|DOUB|FLOA/.test(r))return!0;let a=!1;for(let e of n){let n=e[t];if(n!=null&&(a=!0,typeof n!=`number`))return!1}return a}),[e,n,i]);return(0,S.jsx)(`div`,{className:t(`max-h-[70vh] overflow-auto rounded-xl border border-line bg-surface transition-opacity`,c&&`pointer-events-none opacity-50`),children:(0,S.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsx)(`tr`,{className:`text-left text-[11px] uppercase tracking-wider text-faint`,children:e.map((e,n)=>{let r=i?.[e];return(0,S.jsx)(`th`,{className:t(`sticky top-0 z-10 whitespace-nowrap border-b border-line bg-surface px-4 py-3 font-medium`,l[n]&&`text-right`),"aria-sort":a?.col===e?a.dir===`asc`?`ascending`:`descending`:void 0,children:o?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>o(e),"aria-label":`Sort by ${e}`,className:`inline-flex items-center gap-1 uppercase tracking-wider hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[e,r?.primaryKey&&(0,S.jsx)(`span`,{className:`rounded bg-accent/15 px-1 py-0.5 text-[9px] font-semibold text-accent`,children:`PK`}),r?.type&&(0,S.jsx)(`span`,{className:`text-faint/70`,children:r.type.toLowerCase()}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`text-accent`,children:a?.col===e?a.dir===`asc`?`▲`:`▼`:``})]}):e},e)})})}),(0,S.jsx)(`tbody`,{children:n.map((e,n)=>(0,S.jsx)(`tr`,{onClick:s?()=>s(n):void 0,className:t(`border-b border-line font-mono text-xs last:border-0 hover:bg-surface-2/40`,s&&`cursor-pointer`),children:e.map((e,t)=>(0,S.jsx)(`td`,{className:`whitespace-nowrap px-4 py-2 text-muted`,children:(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(P,{value:e,align:l[t]?`right`:`left`}),r?.[n]?.[t]&&(0,S.jsx)(`span`,{title:`Value truncated — click the row to view it in full`,className:`shrink-0 rounded bg-warning/15 px-1 text-[9px] font-semibold text-warning`,children:`…`})]})},t))},n))})]})})}function I(){let[e,n]=(0,x.useState)(``),[r,i]=(0,x.useState)(0),[a,o]=(0,x.useState)(null),[y,b]=(0,x.useState)(`data`),[T,E]=(0,x.useState)(null),[D,A]=(0,x.useState)(null),[j,M]=(0,x.useState)(`SELECT name FROM sqlite_master WHERE type = 'table'`),N=(0,x.useRef)(null),{data:P,error:I,loading:re,refetch:ie}=s(()=>f.db.tables(),[],{intervalMs:1e4}),B=(0,x.useMemo)(()=>P?.tables??[],[P]),V=I instanceof c&&I.status===404,{data:H}=s(()=>V?Promise.resolve(null):f.db.info(),[V],{intervalMs:15e3}),U=e||B[0]?.name||``;(0,x.useEffect)(()=>{!e&&B[0]&&n(B[0].name)},[e,B]);let{data:W}=s(()=>U?f.db.schema(U):Promise.resolve(null),[U],{intervalMs:3e4}),ae=(0,x.useMemo)(()=>{let e={};if(W?.table===U)for(let t of W.columns)e[t.name]={type:t.type,primaryKey:t.primaryKey};return e},[W,U]),G=T?`${T.column}|${T.op}|${T.value}`:``,{data:K,error:q,loading:J}=s((0,x.useCallback)(async()=>U?{...await f.db.rows(U,C,r*C,a?.col,a?.dir,T??void 0),page:r,filterKey:G}:null,[U,r,a,T,G]),[U,r,a,G],{intervalMs:6e3}),Y=K&&K.table===U&&K.page===r&&K.orderBy===(a?.col??null)&&(!a||K.dir===a.dir)&&K.filterKey===G?K:null;(0,x.useEffect)(()=>{Y&&Y.total>0&&Y.rows.length===0&&r>0&&i(Math.max(0,Math.ceil(Y.total/C)-1))},[Y,r]);let[X,Z]=(0,x.useState)(!1),[Q,$]=(0,x.useState)(null),oe=()=>{i(0),o(null),E(null),A(null)},se=e=>{n(e),b(`data`),oe()},ce=e=>{i(0),A(null),o(t=>t?.col===e?t.dir===`asc`?{col:e,dir:`desc`}:null:{col:e,dir:`asc`})},le=()=>{Y&&k(`${Y.table}-page${r+1}.csv`,`text/csv`,O(Y.columns,Y.rows))},ue=async()=>{if(!(!U||X)){Z(!0),$(null);try{let e=[],t=[],n=0,r=!1;for(;;){let i=await f.db.rows(U,w,n,a?.col,a?.dir,T??void 0);if(t=i.columns,e.push(...i.rows),n+=w,e.length>=te){r=!0;break}if(i.rows.length<w||n>=i.total)break}k(`${U}.csv`,`text/csv`,O(t,e)),$(r?`Exported the first ${d(e.length)} rows (export cap reached)`:`Exported ${d(e.length)} rows`)}catch(e){$(`Export failed: ${e.message}`)}finally{Z(!1)}}},de=()=>{M(`SELECT * FROM "${U.replaceAll(`"`,`""`)}" LIMIT 100`),requestAnimationFrame(()=>{N.current?.focus(),N.current?.scrollIntoView({behavior:`smooth`,block:`center`})})},fe=!!Y?.truncatedCells.some(e=>e.some(Boolean));return(0,S.jsxs)(`div`,{children:[(0,S.jsx)(p,{title:`Database`,description:`SQLite inspector — schema, data and queries over a read-only connection.`,actions:(0,S.jsx)(`span`,{className:`rounded-full bg-emerald-500/10 px-2.5 py-1 text-[11px] font-medium text-success`,children:`read-only`})}),I&&!V&&(0,S.jsx)(_,{message:`Could not read the database — ${I.message}`,onRetry:ie}),H&&(0,S.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-5`,children:[(0,S.jsx)(m,{label:`SQLite`,value:H.sqliteVersion,compact:!0}),(0,S.jsx)(m,{label:`On disk`,value:h(H.fileSize+H.walSize),compact:!0}),(0,S.jsx)(m,{label:`Journal`,value:H.journalMode.toUpperCase(),compact:!0}),(0,S.jsx)(m,{label:`Tables`,value:d(H.tables),compact:!0}),(0,S.jsx)(m,{label:`Indexes`,value:d(H.indexes),compact:!0})]}),V?(0,S.jsx)(v,{title:`No database yet`,hint:I.message}):re&&B.length===0?(0,S.jsx)(u,{label:`Reading database…`}):(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-4`,children:[(0,S.jsxs)(l,{padded:!1,className:`self-start overflow-hidden`,children:[(0,S.jsxs)(`div`,{className:`border-b border-line px-4 py-3 text-[11px] font-medium uppercase tracking-wider text-faint`,children:[`Tables (`,B.length,`)`]}),(0,S.jsxs)(`ul`,{className:`max-h-[28rem] overflow-y-auto`,children:[B.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsxs)(`button`,{type:`button`,onClick:()=>se(e.name),className:t(`flex w-full items-center justify-between gap-2 px-4 py-2 text-left text-sm transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,U===e.name?`bg-surface-2 text-fg`:`text-muted hover:bg-surface-2/60 hover:text-fg`),children:[(0,S.jsx)(`span`,{className:`min-w-0 truncate font-mono text-xs`,children:e.name}),(0,S.jsx)(`span`,{className:`shrink-0 text-[11px] text-faint tabular-nums`,children:d(e.rows)})]})},e.name)),B.length===0&&(0,S.jsx)(`li`,{className:`px-4 py-6 text-center text-xs text-faint`,children:`No tables.`})]})]}),(0,S.jsx)(`div`,{className:`min-w-0 lg:col-span-3`,children:B.length===0?(0,S.jsx)(v,{title:`No tables`,hint:`This database has no user tables yet.`}):(0,S.jsxs)(S.Fragment,{children:[U&&(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`mr-auto min-w-0 truncate font-mono text-sm text-fg`,title:U,children:U}),(0,S.jsx)(g,{size:`sm`,variant:`ghost`,onClick:de,children:`Query`}),(0,S.jsx)(`div`,{className:`inline-flex items-center gap-1 rounded-lg border border-line bg-surface p-1`,children:[`data`,`schema`].map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>b(e),"aria-pressed":y===e,className:t(`rounded-md px-3 py-1 text-xs font-medium capitalize transition-colors`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,y===e?`bg-surface-2 text-fg`:`text-muted hover:text-fg`),children:e},e))}),y===`data`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(g,{size:`sm`,disabled:!Y||Y.rows.length===0,title:Y?`Exports the ${Y.rows.length} rows on this page only`:void 0,onClick:le,children:[`Export page`,Y?` (${Y.rows.length})`:``]}),(0,S.jsx)(g,{size:`sm`,variant:`accent`,disabled:X||!Y||Y.total===0,onClick:ue,children:X?`Exporting…`:`Export table${Y?` (${d(Y.total)})`:``}`})]})]}),y===`data`&&U&&(0,S.jsx)(L,{columns:Y?.columns??W?.columns.map(e=>e.name)??[],filter:T,onChange:e=>{E(e),i(0),A(null)}}),Q&&(0,S.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:Q}),y===`schema`?W?.table===U?(0,S.jsx)(z,{schema:W}):(0,S.jsx)(u,{label:`Reading schema of ${U}…`}):q&&!Y?(0,S.jsx)(v,{title:`Could not read table`,hint:q.message}):J&&!Y&&K?.table!==U?(0,S.jsx)(u,{label:`Reading ${U}…`}):!Y&&!K?(0,S.jsx)(v,{title:`Select a table`,hint:`Pick a table on the left to browse its rows.`}):(Y??K)&&(Y??K)?.total===0?(0,S.jsx)(v,{title:T?`No matching rows`:`Empty table`,hint:T?`No rows match the current filter.`:`"${(Y??K)?.table}" has no rows.`}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(F,{columns:(Y??K)?.columns??[],rows:(Y??K)?.rows??[],truncatedCells:(Y??K)?.truncatedCells,colMeta:ae,sort:a,onSort:ce,onRowClick:e=>A(e),dimmed:J&&!Y}),fe&&(0,S.jsx)(`p`,{className:`mt-2 text-[11px] text-faint`,children:`Cells over 2000 chars and BLOBs are abbreviated in the grid and CSV — click a row to view the full value.`}),(0,S.jsx)(ee,{page:r,pageSize:C,total:(Y??K)?.total??0,onPageChange:e=>{i(e),A(null)},label:`rows`})]}),(0,S.jsx)(ne,{sql:j,setSql:M,editorRef:N})]})})]}),Y&&D!=null&&Y.rows[D]&&(0,S.jsx)(R,{table:Y.table,columns:Y.columns,row:Y.rows[D],rowid:Y.rowids[D],truncated:Y.truncatedCells[D],onClose:()=>A(null)})]})}function L({columns:e,filter:t,onChange:n}){let[r,i]=(0,x.useState)(t?.column??``),[o,s]=(0,x.useState)(t?.op??`contains`),[c,l]=(0,x.useState)(t?.value??``),u=r||e[0]||``,d=()=>n(c.trim()?{column:u,op:o,value:c.trim()}:null);return e.length===0?null:(0,S.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(`div`,{className:`w-40`,children:(0,S.jsx)(y,{value:u,"aria-label":`Filter column`,onChange:e=>i(e.target.value),children:e.map(e=>(0,S.jsx)(`option`,{value:e,children:e},e))})}),(0,S.jsx)(`div`,{className:`w-32`,children:(0,S.jsxs)(y,{value:o,"aria-label":`Filter operator`,onChange:e=>s(e.target.value),children:[(0,S.jsx)(`option`,{value:`contains`,children:`contains`}),(0,S.jsx)(`option`,{value:`eq`,children:`=`}),(0,S.jsx)(`option`,{value:`ne`,children:`≠`})]})}),(0,S.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,S.jsx)(a,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),(0,S.jsx)(`input`,{value:c,onChange:e=>l(e.target.value),onKeyDown:e=>e.key===`Enter`&&d(),"aria-label":`Filter value`,placeholder:`value — Enter to filter`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-8 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,S.jsx)(g,{size:`sm`,onClick:d,disabled:!c.trim(),children:`Filter`}),t&&(0,S.jsx)(g,{size:`sm`,variant:`ghost`,onClick:()=>{l(``),n(null)},children:`Clear`})]})}function R({table:e,columns:t,row:n,rowid:r,truncated:i,onClose:a}){let[s,c]=(0,x.useState)({});return(0,x.useEffect)(()=>{let e=e=>e.key===`Escape`&&a();return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[a]),(0,x.useEffect)(()=>{if(r==null)return;let n=!1;return(async()=>{for(let a=0;a<t.length;a++)if(i[a])try{let i=await f.db.cell(e,r,t[a]);n||c(e=>({...e,[t[a]]:i.value}))}catch{}})(),()=>{n=!0}},[e,r,t,i]),(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`button`,{type:`button`,"aria-label":`Close row detail`,onClick:a,className:`fixed inset-0 z-40 bg-black/50`}),(0,S.jsxs)(`aside`,{className:`fixed inset-y-0 right-0 z-50 flex w-full max-w-xl flex-col border-l border-line bg-surface shadow-xl`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-5 py-4`,children:[(0,S.jsxs)(`h2`,{className:`font-mono text-sm text-fg`,children:[e,` · row detail`]}),(0,S.jsx)(`button`,{type:`button`,"aria-label":`Close`,onClick:a,className:`flex size-8 items-center justify-center rounded-lg text-muted hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:(0,S.jsx)(o,{className:`size-4`})})]}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto p-5`,children:(0,S.jsx)(`dl`,{className:`flex flex-col gap-4`,children:t.map((e,t)=>{let r=e in s?s[e]:n[t],a=N(r),o=a.includes(`
3
- `)||a.length>80;return(0,S.jsxs)(`div`,{children:[(0,S.jsxs)(`dt`,{className:`mb-1 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-faint`,children:[e,r!=null&&(0,S.jsx)(b,{value:String(r)}),i[t]&&!(e in s)&&(0,S.jsx)(`span`,{className:`text-warning`,children:`(loading full value…)`})]}),(0,S.jsx)(`dd`,{children:r==null?(0,S.jsx)(`span`,{className:`italic text-faint`,children:`NULL`}):o?(0,S.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:a}):(0,S.jsx)(`span`,{className:`break-words font-mono text-sm text-fg`,children:a})})]},e)})})})]})]})}function z({schema:e}){return(0,S.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,S.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,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-4 py-3 font-medium`,children:`Column`}),(0,S.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Type`}),(0,S.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Constraints`}),(0,S.jsx)(`th`,{className:`px-4 py-3 font-medium`,children:`Default`})]})}),(0,S.jsx)(`tbody`,{children:e.columns.map(e=>(0,S.jsxs)(`tr`,{className:`border-b border-line last:border-0`,children:[(0,S.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-fg`,children:e.name}),(0,S.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-muted`,children:e.type}),(0,S.jsxs)(`td`,{className:`px-4 py-2 text-xs`,children:[e.primaryKey&&(0,S.jsx)(`span`,{className:`mr-1 rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold text-accent`,children:`PK`}),e.notNull&&(0,S.jsx)(`span`,{className:`rounded-md bg-surface-2 px-1.5 py-0.5 text-[10px] font-semibold text-muted`,children:`NOT NULL`})]}),(0,S.jsx)(`td`,{className:`px-4 py-2 font-mono text-xs text-faint`,children:e.defaultValue??`—`})]},e.name))})]})}),(0,S.jsxs)(l,{children:[(0,S.jsx)(i,{title:`Indexes (${e.indexes.length})`}),e.indexes.length===0?(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`No indexes on this table.`}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.indexes.map(e=>(0,S.jsxs)(`li`,{className:`flex flex-wrap items-center gap-2 font-mono text-xs`,children:[(0,S.jsx)(`span`,{className:`text-fg`,children:e.name}),e.unique&&(0,S.jsx)(`span`,{className:`rounded-md bg-accent/15 px-1.5 py-0.5 text-[10px] font-semibold text-accent`,children:`UNIQUE`}),(0,S.jsxs)(`span`,{className:`text-faint`,children:[`(`,e.columns.join(`, `),`)`]})]},e.name))})]}),e.sql&&(0,S.jsxs)(l,{children:[(0,S.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`DDL`}),(0,S.jsx)(b,{value:e.sql})]}),(0,S.jsx)(`pre`,{className:`overflow-x-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:e.sql})]})]})}function ne({sql:e,setSql:t,editorRef:n}){let[r,a]=(0,x.useState)(!1),[o,s]=(0,x.useState)(null),[c,u]=(0,x.useState)(A),[p,m]=(0,x.useState)(null),h=(0,x.useRef)(0);(0,x.useEffect)(()=>()=>{h.current++},[]);let _=async(t=e,n=!0)=>{if(!t.trim()||r)return;let i=++h.current;a(!0),s(null);try{let r=await f.db.query(t);if(i!==h.current)return;m(r),n&&u(M(e.trim()))}catch(e){if(i!==h.current)return;m(null),s(e.message)}finally{i===h.current&&a(!1)}};return(0,S.jsxs)(l,{className:`mt-6`,children:[(0,S.jsx)(i,{title:`Query`,action:(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,S.jsx)(g,{size:`sm`,disabled:r||!e.trim(),onClick:()=>{let t=e.trim();t&&_(`EXPLAIN QUERY PLAN ${t}`,!1)},children:`Explain`}),(0,S.jsx)(g,{size:`sm`,variant:`accent`,disabled:r||!e.trim(),onClick:()=>_(),children:r?`Running…`:`Run`})]})}),(0,S.jsx)(`textarea`,{ref:n,value:e,onChange:e=>t(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&_()},rows:3,spellCheck:!1,"aria-label":`SQL query`,placeholder:`SELECT … — read-only: writes are rejected by the engine`,className:`w-full resize-y rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),(0,S.jsx)(`p`,{className:`mt-1 text-[11px] text-faint`,children:`⌘/Ctrl+Enter runs. Connection is read-only.`}),c.length>0&&(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`History`}),c.map(e=>(0,S.jsx)(`button`,{type:`button`,onClick:()=>t(e),title:e,className:`max-w-56 truncate 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 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:e},e)),(0,S.jsx)(`button`,{type:`button`,onClick:()=>{j([]),u([])},className:`rounded-md px-2 py-1 text-[11px] text-faint transition-colors hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:`Clear`})]}),(0,S.jsxs)(`div`,{"aria-live":`polite`,children:[o&&(0,S.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:o}),p&&!o&&(0,S.jsxs)(`div`,{className:`mt-4`,children:[(0,S.jsxs)(`div`,{className:`mb-2 flex flex-wrap items-center gap-3`,children:[(0,S.jsxs)(`p`,{className:`text-xs text-faint`,children:[p.truncated?`≥ `:``,d(p.rowCount),` row`,p.rowCount===1?``:`s`,` ·`,` `,d(p.ms),` ms`,p.truncated&&(0,S.jsxs)(`span`,{className:`text-warning`,children:[` — showing first `,p.rows.length]})]}),p.rows.length>0&&(0,S.jsxs)(`div`,{className:`ml-auto flex gap-2`,children:[(0,S.jsx)(g,{size:`sm`,onClick:()=>k(`query-results.csv`,`text/csv`,O(p.columns,p.rows)),children:`CSV`}),(0,S.jsx)(g,{size:`sm`,onClick:()=>k(`query-results.json`,`application/json`,JSON.stringify(p.rows.map(e=>Object.fromEntries(p.columns.map((t,n)=>[t,e[n]]))),null,2)),children:`JSON`})]})]}),p.rows.length>0?(0,S.jsx)(F,{columns:p.columns,rows:p.rows}):(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Query returned no rows.`})]})]})]})}export{I as Database};
@@ -1 +0,0 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{I as r,O as i,T as a,W as o,b as s,c,et as l,h as u,m as d,u as f,w as p,x as m,y as h}from"./index-C5VVVkqi.js";import{a as g}from"./form-PtDLk33Z.js";import{t as _}from"./Pagination-DYMlK0Hm.js";var v=e(t(),1),y=n(),b=25;function x(){let[e,t]=(0,v.useState)(``),[n,x]=(0,v.useState)(0),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)(null),{data:E}=i(()=>l.queues(),[],{intervalMs:3e4});(0,v.useEffect)(()=>{e||!E?.queues?.length||t((E.queues.find(e=>e.dlq>0)??E.queues[0]).name)},[E,e]);let{data:D,error:O,loading:k,refetch:A}=i((0,v.useCallback)(async()=>{if(!e)return{queue:e,page:n,entries:[],total:0};let t=await l.dlq(e,b,n*b);return{queue:e,page:n,entries:t.entries??[],total:t.total??0}},[e,n]),[e,n]),j=D&&D.queue===e&&D.page===n?D:null;(0,v.useEffect)(()=>{if(!j)return;let e=Math.max(0,Math.ceil((j.total??0)/b)-1);n>e&&x(e)},[j,n]);let M=async(e,t,n)=>{if(!(n&&!window.confirm(n))){C(!0),T(null);try{let n=(await t())?.count??0;T({ok:!0,text:`${e} ${c(n)} ${n===1?`entry`:`entries`}`}),A()}catch(e){T({ok:!1,text:e.message})}finally{C(!1)}}},N=j?.entries??[];return(0,y.jsxs)(`div`,{children:[(0,y.jsx)(u,{title:`Dead Letter Queue`,description:`Inspect and replay jobs that exhausted their retries.`,live:!0,actions:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(p,{size:`sm`,disabled:!e||S,onClick:()=>M(`Retried`,()=>l.retryDlq(e),`Retry all ${j?.total??0} DLQ entries for "${e}"?`),children:[(0,y.jsx)(o,{className:`size-3.5`}),` Retry all`]}),(0,y.jsx)(p,{variant:`danger`,size:`sm`,disabled:!e||S,onClick:()=>M(`Purged`,()=>l.purgeDlq(e),`Purge all ${j?.total??0} DLQ entries for "${e}"?`),children:`Purge`})]})}),O&&(0,y.jsx)(m,{onRetry:A}),(0,y.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[(0,y.jsx)(`div`,{className:`w-56`,children:(0,y.jsx)(g,{value:e,"aria-label":`Queue`,onChange:e=>{t(e.target.value),x(0)},children:(E?.queues??[]).map(e=>(0,y.jsxs)(`option`,{value:e.name,children:[e.name,` `,e.dlq?`(${e.dlq})`:``]},e.name))})}),(0,y.jsx)(`div`,{className:`w-40`,children:(0,y.jsx)(d,{label:`Entries`,value:c(j?.total),tone:j?.total?`red`:`default`,compact:!0})}),w&&(0,y.jsx)(`span`,{className:w.ok?`text-sm text-success`:`text-sm text-danger`,children:w.text})]}),k&&!j&&!O?(0,y.jsx)(s,{label:`Loading DLQ…`}):N.length===0?(0,y.jsx)(h,{icon:(0,y.jsx)(r,{}),title:`Dead letter queue is empty`,hint:`Failed jobs that exhaust their retries land here.`}):(0,y.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,y.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,y.jsx)(`thead`,{children:(0,y.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,y.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,y.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Reason`}),(0,y.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Error`}),(0,y.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Attempts`}),(0,y.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Entered`}),(0,y.jsx)(`th`,{className:`w-20 px-5 py-3`})]})}),(0,y.jsx)(`tbody`,{children:N.map(t=>(0,y.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,y.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:t.job.id}),(0,y.jsx)(`td`,{className:`px-5 py-3`,children:(0,y.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs text-danger`,children:t.reason})}),(0,y.jsx)(`td`,{className:`max-w-md px-5 py-3 text-xs text-danger/80`,children:t.error||`—`}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:t.job.attempts??t.attempts?.length??`—`}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:f(t.enteredAt)}),(0,y.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,y.jsx)(a,{"aria-label":`Retry job`,disabled:S,onClick:()=>M(`Retried`,()=>l.retryDlq(e,t.job.id)),children:(0,y.jsx)(o,{className:`size-3.5`})})})]},`${t.job.id}-${t.enteredAt}`))})]})}),j&&(0,y.jsx)(_,{page:n,pageSize:b,total:j.total,onPageChange:x,label:`entries`})]})}export{x as DlqControl};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{m as n,r,t as i}from"./react-vendor-CHIHtdAC.js";import{I as a,L as o,O as s,S as c,T as l,W as u,b as ee,c as d,et as f,h as te,tt as p,u as m,w as h,x as ne,y as g}from"./index-C5VVVkqi.js";import{a as _}from"./form-PtDLk33Z.js";import{t as re}from"./Pagination-DYMlK0Hm.js";import{t as v}from"./exportFile-tdUeW5m5.js";import{t as y}from"./promisePool-Daxkc1OB.js";var b=e(n(),1),x=i(),S=6,C=25;function w(){let[e,n]=(0,b.useState)(``),[i,w]=(0,b.useState)(`all`),[T,ie]=(0,b.useState)(`newest`),[E,ae]=(0,b.useState)(``),[D,O]=(0,b.useState)(0),[k,A]=(0,b.useState)(!1),[j,M]=(0,b.useState)(null),{data:N,refetch:P}=s(()=>f.queues(),[],{intervalMs:1e4}),F=N?.queues??[],I=F.reduce((e,t)=>e+t.dlq,0),{data:L,error:R,loading:oe,refetch:z}=s((0,b.useCallback)(async()=>{if(!e)return{queue:e,page:D,entries:[],entriesTotal:0,stats:null};let[t,n]=await Promise.all([f.dlq(e,C,D*C),f.dlqStats(e).catch(()=>null)]);return{queue:e,page:D,entries:t.entries??[],entriesTotal:t.total??0,stats:n?.stats??null}},[e,D]),[e,D]),B=L&&L.queue===e&&L.page===D?L:null;(0,b.useEffect)(()=>{if(!B)return;let e=B.entriesTotal??0;D>0&&D*C>=e&&O(Math.max(0,Math.ceil(e/C)-1))},[B,D]);let V=async(e,t,n)=>{if(window.confirm(e)){A(!0),M(null);try{let e=(await n())?.count??0,r=`${t} ${d(e)} ${e===1?`entry`:`entries`}`;M({ok:!0,text:r}),p.success(r),z(),P()}catch(e){M({ok:!1,text:e.message}),p.error(`${t} failed`,e.message)}finally{A(!1)}}},H=async e=>{let t=J.map(e=>e.name);if(t.length===0||!window.confirm(`${e} the dead letter queue across ${t.length} queue(s) (${d(I)} entries)?`))return;A(!0),M(null);let n=await y(t,S,t=>e===`Retry`?f.retryDlq(t):f.purgeDlq(t)),r=0,i=0;for(let e of n)e.status===`fulfilled`?r+=e.value?.count??0:i++;let a=`${e===`Retry`?`Retried`:`Purged`} ${d(r)} across ${t.length-i}/${t.length} queues${i?`, ${i} failed`:``}`;M({ok:i===0,text:a}),i===0?p.success(a):p.error(a),z(),P(),A(!1)},U=()=>{let t=(B?.entries??[]).map(e=>({jobId:e.job.id,reason:e.reason,error:e.error??``,enteredAt:new Date(e.enteredAt).toISOString(),attempts:e.attempts?.length??0}));if(t.length===0){p.info(`Nothing to export on this page`);return}v(`dlq-${e}`,t,[`jobId`,`reason`,`error`,`enteredAt`,`attempts`])},W=e=>{Y.current=!0,n(e),O(0),w(`all`)},G=B?.stats?.byReason??{},K=Object.keys(G).filter(e=>G[e]>0),q=[...K].sort((e,t)=>(G[t]??0)-(G[e]??0))[0],J=(0,b.useMemo)(()=>F.filter(e=>e.dlq>0).sort((e,t)=>t.dlq-e.dlq),[F]),Y=(0,b.useRef)(!1);(0,b.useEffect)(()=>{Y.current||e||J.length===0||(Y.current=!0,n(J[0].name),O(0),w(`all`))},[e,J]);let X=(0,b.useMemo)(()=>{let e=B?.entries??[];i!==`all`&&(e=e.filter(e=>e.reason===i));let t=E.trim().toLowerCase();return t&&(e=e.filter(e=>e.job.id.toLowerCase().includes(t))),[...e].sort((e,t)=>T===`newest`?t.enteredAt-e.enteredAt:e.enteredAt-t.enteredAt)},[B,i,E,T]),Z=I===0,Q=i!==`all`||E.trim()!==``,$=(B?.entriesTotal??0)>C;return(0,x.jsxs)(`div`,{children:[(0,x.jsx)(te,{title:`Dead Letter Queue`,description:`Jobs that failed after exhausting all retries. Monitor, retry, or purge.`,live:!0}),R&&(0,x.jsx)(ne,{onRetry:z}),(0,x.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,x.jsxs)(c,{children:[(0,x.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,x.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Total in DLQ`}),(0,x.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,Z?`bg-emerald-500/10 text-success`:`bg-red-500/10 text-danger`),children:Z?`Healthy`:`Attention`})]}),(0,x.jsx)(`div`,{className:t(`mt-2 text-3xl font-bold tnum`,Z?`text-success`:`text-danger`),children:d(I)})]}),(0,x.jsxs)(c,{children:[(0,x.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Top Reason`}),(0,x.jsx)(`div`,{className:`mt-2 text-lg font-semibold text-fg`,children:e?q??`No failures`:`Select a queue`})]}),(0,x.jsxs)(c,{children:[(0,x.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Pending Retry`}),(0,x.jsx)(`div`,{className:`mt-2 text-3xl font-bold tnum text-fg`,children:B?.stats?d(B.stats.pendingRetry??0):`—`}),(0,x.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:e?`in this queue`:`awaiting retry`})]}),(0,x.jsxs)(c,{children:[(0,x.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Failure Types`}),(0,x.jsx)(`div`,{className:`mt-2 text-3xl font-bold tnum text-fg`,children:B?.stats?d(K.length):`—`}),(0,x.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`distinct reasons`})]})]}),J.length>0&&(0,x.jsxs)(c,{className:`mb-6`,children:[(0,x.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-2`,children:[(0,x.jsx)(`span`,{className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:`DLQ by queue`}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsxs)(h,{size:`sm`,disabled:k,onClick:()=>H(`Retry`),children:[(0,x.jsx)(u,{className:`size-3.5`}),` Retry all (`,J.length,` queues)`]}),(0,x.jsxs)(h,{variant:`danger`,size:`sm`,disabled:k,onClick:()=>H(`Purge`),children:[`Purge all (`,J.length,` queues)`]})]})]}),(0,x.jsx)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-4 xl:grid-cols-5`,children:J.map(n=>(0,x.jsxs)(`button`,{type:`button`,onClick:()=>W(n.name),className:t(`rounded-lg border p-3 text-left transition-colors`,e===n.name?`border-accent/50 bg-surface-2`:`border-line hover:border-line-strong`),children:[(0,x.jsx)(`div`,{className:`truncate font-mono text-xs text-muted`,children:n.name}),(0,x.jsx)(`div`,{className:`mt-1 text-xl font-bold tnum text-danger`,children:n.dlq})]},n.name))})]}),(0,x.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,x.jsx)(`div`,{className:`w-48`,children:(0,x.jsxs)(_,{value:e,onChange:e=>W(e.target.value),children:[(0,x.jsx)(`option`,{value:``,children:`Select a queue…`}),F.map(e=>(0,x.jsxs)(`option`,{value:e.name,children:[e.name,e.dlq?` (${e.dlq})`:``]},e.name))]})}),(0,x.jsx)(`div`,{className:`w-40`,children:(0,x.jsxs)(_,{value:i,onChange:e=>w(e.target.value),"aria-label":`Filter by reason`,children:[(0,x.jsx)(`option`,{value:`all`,children:`All Reasons`}),K.map(e=>(0,x.jsx)(`option`,{value:e,children:e},e))]})}),(0,x.jsx)(`div`,{className:`w-36`,children:(0,x.jsxs)(_,{value:T,onChange:e=>ie(e.target.value),"aria-label":$?`Sort this page`:`Sort`,children:[(0,x.jsxs)(`option`,{value:`newest`,children:[`Newest First`,$?` (this page)`:``]}),(0,x.jsxs)(`option`,{value:`oldest`,children:[`Oldest First`,$?` (this page)`:``]})]})}),(0,x.jsx)(`input`,{value:E,onChange:e=>ae(e.target.value),placeholder:`Filter this page by job ID…`,"aria-label":`Filter this page by job ID`,className:`h-9 min-w-40 flex-1 rounded-lg border border-line bg-surface px-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),(0,x.jsxs)(h,{size:`sm`,disabled:!e||k,onClick:()=>V(`Retry all for "${e}"?`,`Retried`,()=>f.retryDlq(e)),children:[(0,x.jsx)(u,{className:`size-3.5`}),` Retry All`]}),(0,x.jsx)(h,{variant:`danger`,size:`sm`,disabled:!e||k,onClick:()=>V(`Purge all for "${e}"?`,`Purged`,()=>f.purgeDlq(e)),children:`Purge All`}),(0,x.jsx)(l,{"aria-label":`Export this page to CSV`,title:`Export this page to CSV`,disabled:!e,onClick:U,children:(0,x.jsx)(o,{className:`size-3.5`})})]}),j&&(0,x.jsx)(`div`,{className:t(`mb-3 text-sm`,j.ok?`text-success`:`text-danger`),children:j.text}),oe&&!B&&!R?(0,x.jsx)(ee,{label:`Loading DLQ…`}):e?X.length===0?(0,x.jsx)(g,{icon:(0,x.jsx)(a,{}),title:Q?`No matches on this page`:`No dead letter entries`,hint:Q?`No entries on this page match your filter — the filter is page-scoped. Use the pager below to check other pages.`:`This queue has no dead letter entries.`}):(0,x.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,x.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,x.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,x.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Reason`}),(0,x.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Error`}),(0,x.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Entered`}),(0,x.jsx)(`th`,{className:`w-16 px-5 py-3`})]})}),(0,x.jsx)(`tbody`,{children:X.map(t=>(0,x.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,x.jsx)(`td`,{className:`px-5 py-3`,children:(0,x.jsx)(r,{to:`/job?id=${encodeURIComponent(t.job.id)}`,className:`font-mono text-xs text-accent hover:underline`,children:t.job.id})}),(0,x.jsx)(`td`,{className:`px-5 py-3`,children:(0,x.jsx)(`span`,{className:`rounded-md bg-red-500/10 px-2 py-0.5 text-xs text-danger`,children:t.reason})}),(0,x.jsx)(`td`,{className:`max-w-md px-5 py-3 text-xs text-danger/80`,children:t.error||`—`}),(0,x.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:m(t.enteredAt)}),(0,x.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,x.jsx)(l,{"aria-label":`Retry`,disabled:k,onClick:()=>V(`Retry job ${t.job.id.slice(0,8)}… from "${e}"?`,`Retried`,()=>f.retryDlq(e,t.job.id)),children:(0,x.jsx)(u,{className:`size-3.5`})})})]},`${t.job.id}-${t.enteredAt}`))})]})}):(0,x.jsx)(g,{icon:(0,x.jsx)(a,{}),title:`Select a queue`,hint:`Choose a queue from the dropdown to view its dead letter queue entries.`}),e&&B&&(0,x.jsx)(re,{page:D,pageSize:C,total:B.entriesTotal,onPageChange:O,label:`entries`})]})}export{w as DlqPro};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{d as t,m as n,r,t as i}from"./react-vendor-CHIHtdAC.js";import{C as a,K as o,L as s,Q as c,S as l,T as u,a as d,b as f,et as p,g as m,h,o as g,w as _,y as v}from"./index-C5VVVkqi.js";import{a as y,n as b}from"./form-PtDLk33Z.js";import{t as x}from"./CopyButton-D39F1wIH.js";import{n as S}from"./exportFile-tdUeW5m5.js";import{t as C}from"./jobActions-CuOdMglt.js";var w=e(n(),1);function T(e){let t={};return typeof e.priority==`number`&&(t.priority=e.priority),typeof e.maxAttempts==`number`&&(t.maxAttempts=e.maxAttempts),typeof e.backoff==`number`&&(t.backoff=e.backoff),typeof e.timeout==`number`&&(t.timeout=e.timeout),typeof e.removeOnComplete==`boolean`&&(t.removeOnComplete=e.removeOnComplete),typeof e.removeOnFail==`boolean`&&(t.removeOnFail=e.removeOnFail),{clone:{queue:e.queue??``,dataText:JSON.stringify(e.data??{},null,2),options:t}}}var E=i();function ee({job:e,busy:t,act:n}){let r=C(e.state),i=r.cancel||r.discard||r.promote||r.retryActive||r.retryDlq||r.requeueCompleted||r.setPriority||r.setDelay||r.fail||r.moveToDelayed;return(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Actions`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.promote&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Promote`,()=>p.promoteJob(e.id)),children:`Promote (run now)`}),r.retryActive&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>p.retryJob(e.id)),children:`Retry (move to waiting)`}),r.retryDlq&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>p.retryDlq(e.queue??``,e.id)),children:`Retry from DLQ`}),r.requeueCompleted&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Requeue`,()=>p.retryCompleted(e.queue??``,e.id)),children:`Requeue`}),r.moveToDelayed&&(0,E.jsx)(D,{label:`Move to delayed (ms)`,cta:`To delayed`,disabled:t,onSubmit:t=>n(`Move to delayed`,()=>p.moveToDelayed(e.id,t))}),r.discard&&(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>n(`Discard`,()=>p.discardJob(e.id)),children:`Discard (to DLQ)`}),r.setPriority&&(0,E.jsx)(D,{label:`Set priority`,cta:`Set`,disabled:t,onSubmit:t=>n(`Priority`,()=>p.changePriority(e.id,t))}),r.setDelay&&(0,E.jsx)(D,{label:`Set delay (ms)`,cta:`Delay`,disabled:t,onSubmit:t=>n(`Delay`,()=>p.changeDelay(e.id,t))}),r.fail&&(0,E.jsx)(O,{label:`Fail reason (optional)`,cta:`Fail`,variant:`warning`,disabled:t,onSubmit:t=>n(`Fail`,()=>p.failJob(e.id,t||void 0),`Force-fail this active job?`)}),r.cancel&&(0,E.jsx)(_,{variant:`danger`,size:`sm`,disabled:t,onClick:()=>n(`Cancel`,()=>p.cancelJob(e.id),`Cancel and remove this job?`),children:`Cancel (delete)`}),!i&&(0,E.jsxs)(`p`,{className:`text-xs text-faint`,children:[`No actions available for a job in state "`,e.state??`unknown`,`".`]})]})]})}function D({label:e,cta:t,disabled:n,onSubmit:r}){let[i,a]=(0,w.useState)(``);return(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(b,{type:`number`,value:i,onChange:e=>a(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(_,{size:`sm`,disabled:n||i.trim()===``,onClick:()=>r(Number(i)),children:t})]})}function O({label:e,cta:t,disabled:n,variant:r=`default`,onSubmit:i}){let[a,o]=(0,w.useState)(``);return(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(b,{value:a,onChange:e=>o(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(_,{size:`sm`,variant:r,disabled:n,onClick:()=>{i(a),o(``)},children:t})]})}var k=36e5,A=10;function j(e){let t=e.maxAttempts??0,n=e.attempts??0,r=e.backoffConfig,i=r?.maxDelay??k,a=r?.delay??e.backoff??1e3,o=[];for(let e=n;e<t&&o.length<A;e++){let t=r?.type===`fixed`?a:a*2**e;o.push({attempt:e+1,delayMs:Math.min(t,i)})}return o}function M({job:e}){let t=e.maxAttempts??0,n=e.attempts??0;if(t<=1)return(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Backoff`}),(0,E.jsxs)(`p`,{className:`text-xs text-faint`,children:[`No retries configured (max attempts = `,t||1,`).`]})]});if(n>=t)return(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Backoff schedule`}),(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`Max attempts reached — no further retries will be scheduled.`})]});let r=e.backoffConfig,i=r?r.type:`exponential (default)`,o=t-n,s=j(e);return(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Backoff schedule`,action:(0,E.jsxs)(`span`,{className:`text-xs capitalize text-faint`,children:[i,r?.maxDelay?` · cap ${g(r.maxDelay)}`:``]})}),(0,E.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:s.map(e=>(0,E.jsxs)(`li`,{className:`flex items-center justify-between text-sm`,children:[(0,E.jsxs)(`span`,{className:`text-muted`,children:[`Attempt `,e.attempt,` / `,t]}),(0,E.jsxs)(`span`,{className:`font-mono text-xs text-fg`,children:[`~`,g(e.delayMs)]})]},e.attempt))}),o>A&&(0,E.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Showing next `,A,` of `,o,` remaining attempts.`]}),(0,E.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Approximate — the server applies ±`,r?.type===`fixed`?`20`:`50`,`% jitter at retry time, capped at `,g(r?.maxDelay??k),`.`]})]})}function N({jobId:e}){let[t,n]=(0,w.useState)(!1),[r,i]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[c,u]=(0,w.useState)(void 0),[d,f]=(0,w.useState)(null),m=async()=>{s(!0),f(null);try{u((await p.jobChildren(e)).data?.values),i(!0)}catch(e){f(e.message)}finally{s(!1)}},h=()=>{let e=!t;n(e),e&&!r&&!o&&m()},g=c&&typeof c==`object`?Array.isArray(c)?c.length:Object.keys(c).length:0;return(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Child values`,action:(0,E.jsx)(_,{size:`sm`,variant:`ghost`,onClick:h,children:t?`Hide`:`Show`})}),t?o?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`Loading child values…`}):d?(0,E.jsx)(`p`,{className:`text-xs text-danger`,children:d}):g===0?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No child values available.`}):(0,E.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:JSON.stringify(c,null,2)}):(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`Resolved return values from this flow job's children.`})]})}function P({data:e,busy:t,onSave:n}){let[r,i]=(0,w.useState)(()=>JSON.stringify(e??null,null,2)),[o,s]=(0,w.useState)(null),c=(0,w.useRef)(r);return(0,w.useEffect)(()=>{let t=JSON.stringify(e??null,null,2);t!==c.current&&(c.current=t,i(t),s(null))},[e]),(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Edit data`,action:(0,E.jsx)(_,{size:`sm`,disabled:t,onClick:()=>{let e;try{e=JSON.parse(r)}catch(e){s(`Invalid JSON: ${e.message}`);return}s(null),n(e)},children:`Save data`})}),(0,E.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),spellCheck:!1,rows:8,className:`w-full resize-y rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),o&&(0,E.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:o})]})}function F({jobId:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(0),[o,s]=(0,w.useState)(!1),[c,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(``),[m,h]=(0,w.useState)(`info`),[g,v]=(0,w.useState)(!1),x=(0,w.useCallback)(async()=>{s(!0),u(null);try{let t=await p.jobLogs(e);n(t.data?.logs??[]),i(t.data?.count??0)}catch(e){u(e.message)}finally{s(!1)}},[e]);(0,w.useEffect)(()=>{x()},[x]);let S=async()=>{if(g)return;let t=d.trim();if(t){v(!0),u(null);try{await p.addJobLog(e,t,m),f(``),await x()}catch(e){u(e.message)}finally{v(!1)}}};return(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Logs`,action:(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:r}),(0,E.jsx)(_,{size:`sm`,variant:`ghost`,disabled:o||g,onClick:x,children:`Refresh`}),(0,E.jsx)(_,{size:`sm`,variant:`danger`,disabled:g||t.length===0,onClick:async()=>{if(window.confirm(`Clear all logs for this job?`)){v(!0),u(null);try{await p.clearJobLogs(e),await x()}catch(e){u(e.message)}finally{v(!1)}}},children:`Clear logs`})]})}),c&&(0,E.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:c}),t.length===0?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No log lines recorded for this job.`}):(0,E.jsx)(`ol`,{className:`flex max-h-64 flex-col gap-1 overflow-auto rounded-lg bg-surface-2 p-3`,children:t.map((e,t)=>(0,E.jsx)(`li`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-muted`,children:typeof e==`string`?e:JSON.stringify(e)},t))}),(0,E.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,E.jsx)(b,{value:d,onChange:e=>f(e.target.value),onKeyDown:e=>e.key===`Enter`&&S(),placeholder:`Add a log line…`,className:`h-8 flex-1 text-xs`}),(0,E.jsxs)(y,{value:m,onChange:e=>h(e.target.value),className:`h-8 w-24 text-xs`,children:[(0,E.jsx)(`option`,{value:`info`,children:`info`}),(0,E.jsx)(`option`,{value:`warn`,children:`warn`}),(0,E.jsx)(`option`,{value:`error`,children:`error`})]}),(0,E.jsx)(_,{size:`sm`,disabled:g||d.trim()===``,onClick:S,children:`Add`})]})]})}function I({timeline:e}){let t=e??[];return(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Timeline`}),t.length===0?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No state transitions recorded yet.`}):(0,E.jsx)(`ol`,{className:`flex flex-col gap-0`,children:t.map((e,t)=>(0,E.jsxs)(`li`,{className:`border-b border-line/60 py-2 last:border-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(m,{status:e.state}),e.attempt!=null&&(0,E.jsxs)(`span`,{className:`font-mono text-[11px] text-faint`,children:[`attempt `,e.attempt]})]}),(0,E.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:d(e.timestamp)})]}),(e.worker||e.error)&&(0,E.jsxs)(`div`,{className:`mt-1 pl-0.5`,children:[e.worker&&(0,E.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.worker}),e.error&&(0,E.jsx)(`div`,{className:`mt-0.5 text-xs text-danger/90`,children:e.error})]})]},t))})]})}function te(e){let t=e.timeline??[];for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.state===`failed`&&n.error)return{message:n.error,attempt:n.attempt,timestamp:n.timestamp}}return null}function L(){let[e,n]=t(),[i,u]=(0,w.useState)(e.get(`id`)??``),[b,C]=(0,w.useState)(`id`),[D,O]=(0,w.useState)(null),[k,A]=(0,w.useState)({fetched:!1,value:void 0}),[j,L]=(0,w.useState)(!1),[re,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(null),[W,G]=(0,w.useState)(!1),K=(0,w.useRef)(0),q=async(e,t=b,r=!1)=>{let i=e.trim();if(!i)return;let a=++K.current;L(!0),V(!1),r||U(null);try{let e=(await(t===`custom`?p.jobByCustomId(i):p.job(i))).job;if(!e){if(a!==K.current)return;O(null),A({fetched:!1,value:void 0}),V(!0),n({},{replace:!0});return}let r=e.state===`completed`?await p.jobResult(e.id).catch(()=>null):null;if(a!==K.current)return;O(e),u(t===`custom`?e.id:i),n({id:e.id},{replace:!0}),A(r?{fetched:!0,value:r.result}:{fetched:!1,value:void 0})}catch(e){if(a!==K.current)return;e instanceof c&&(e.status===404||/not found/i.test(e.message))?(O(null),A({fetched:!1,value:void 0}),V(!0),n({},{replace:!0})):U({ok:!1,text:e.message})}finally{a===K.current&&L(!1)}},J=e.get(`id`);(0,w.useEffect)(()=>{J&&J!==D?.id&&q(J,`id`)},[J,D?.id]);let Y=async(e,t,r)=>{if(!(r&&!window.confirm(r))&&D){G(!0),U(null);try{await t(),U({ok:!0,text:`${e} ✓`}),e===`Cancel`?(O(null),A({fetched:!1,value:void 0}),n({},{replace:!0})):await q(D.id,`id`,!0)}catch(e){U({ok:!1,text:e.message})}finally{G(!1)}}},X=D?.state,Z=D?te(D):null,Q=(D?.stacktrace?.length??0)>0,$=(D?.childrenIds?.length??0)>0;return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(h,{title:`Job Inspector`,description:`Look up any job by ID and drive its full lifecycle.`,actions:D?(0,E.jsxs)(E.Fragment,{children:[($||D.parentId)&&(0,E.jsx)(r,{to:`/flows?root=${encodeURIComponent(D.id)}`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`View flow`}),(0,E.jsx)(r,{to:`/add-job`,state:T(D),title:`Enqueue a new job pre-filled from this one`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Clone`}),(0,E.jsxs)(_,{size:`sm`,onClick:()=>S(`job-${D.id}`,k.fetched?{...D,result:k.value}:D),children:[(0,E.jsx)(s,{className:`size-3.5`}),` Download JSON`]})]}):void 0}),(0,E.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-2`,children:[(0,E.jsxs)(y,{value:b,onChange:e=>C(e.target.value),className:`w-40`,children:[(0,E.jsx)(`option`,{value:`id`,children:`By job ID`}),(0,E.jsx)(`option`,{value:`custom`,children:`By custom ID`})]}),(0,E.jsxs)(`div`,{className:`relative min-w-56 flex-1`,children:[(0,E.jsx)(o,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,E.jsx)(`input`,{value:i,onChange:e=>u(e.target.value),onKeyDown:e=>e.key===`Enter`&&q(i),placeholder:b===`custom`?`custom / idempotency id — Enter to look up`:`job id (UUID) — Enter to look up`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 font-mono text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,E.jsx)(_,{variant:`accent`,disabled:j,onClick:()=>q(i),children:`Look up`})]}),H&&(0,E.jsx)(`div`,{className:H.ok?`mb-4 text-sm text-success`:`mb-4 text-sm text-danger`,children:H.text}),j&&!D?(0,E.jsx)(f,{label:`Loading job…`}):re?(0,E.jsx)(v,{title:`Job not found`,hint:`Check the ID, or the job may have been removed.`}):D?(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-6 lg:col-span-2`,children:[(0,E.jsxs)(l,{children:[(0,E.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(`div`,{className:`truncate font-mono text-sm text-fg`,children:D.id}),(0,E.jsx)(x,{value:D.id})]}),(0,E.jsx)(`div`,{className:`mt-1 font-mono text-xs text-faint`,children:D.queue})]}),(0,E.jsx)(m,{status:X??`waiting`})]}),(0,E.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-2 text-sm sm:grid-cols-3`,children:[(0,E.jsx)(R,{k:`Priority`,v:String(D.priority??0)}),(0,E.jsx)(R,{k:`Attempts`,v:`${D.attempts??0} / ${D.maxAttempts??`?`}`}),(0,E.jsx)(R,{k:`Progress`,v:`${D.progress??0}%`}),(0,E.jsx)(R,{k:`Created`,v:d(D.createdAt)}),(0,E.jsx)(R,{k:`Started`,v:d(D.startedAt??void 0)}),(0,E.jsx)(R,{k:`Completed`,v:d(D.completedAt??void 0)}),(0,E.jsx)(R,{k:`Duration`,v:g(D.startedAt&&D.completedAt?D.completedAt-D.startedAt:void 0)}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`dt`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`Custom ID`}),(0,E.jsxs)(`dd`,{className:`flex items-center gap-1 text-fg`,children:[(0,E.jsx)(`span`,{className:`truncate font-mono`,children:D.customId??`—`}),D.customId&&(0,E.jsx)(x,{value:D.customId})]})]})]})]}),(0,E.jsx)(ne,{title:`Data`,value:D.data,filename:`job-${D.id}-data`}),(0,E.jsx)(P,{data:D.data,busy:W,onSave:e=>Y(`Data`,()=>p.updateJobData(D.id,e))}),X===`completed`&&(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Result`,action:k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(B,{value:k.value,filename:`job-${D.id}-result`}):void 0}),k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(z,{value:k.value}):(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No result stored for this job.`})]}),(Z||Q)&&(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:`Error`}),Z&&(0,E.jsxs)(`div`,{className:`mb-3`,children:[(0,E.jsx)(`p`,{className:`text-sm text-danger`,children:Z.message}),(0,E.jsxs)(`p`,{className:`mt-1 text-[11px] text-faint`,children:[Z.attempt==null?``:`Attempt ${Z.attempt} · `,d(Z.timestamp)]})]}),Q&&(0,E.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap rounded-lg bg-surface-2 p-3 font-mono text-xs text-danger/90`,children:D.stacktrace?.join(`
2
- `)})]}),(0,E.jsx)(F,{jobId:D.id},`logs-${D.id}`),$&&(0,E.jsx)(N,{jobId:D.id},`children-${D.id}`),(0,E.jsx)(I,{timeline:D.timeline}),(0,E.jsx)(M,{job:D})]}),(0,E.jsx)(ee,{job:D,busy:W,act:Y})]}):(0,E.jsx)(v,{title:`No job loaded`,hint:`Enter a job ID above to inspect it.`})]})}function R({k:e,v:t}){return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`dt`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:e}),(0,E.jsx)(`dd`,{className:`text-fg`,children:t})]})}function z({value:e}){return(0,E.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:JSON.stringify(e??null,null,2)})}function B({value:e,filename:t}){return(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(x,{value:JSON.stringify(e??null,null,2)}),(0,E.jsx)(u,{"aria-label":`Download JSON`,title:`Download JSON`,onClick:()=>S(t,e??null),children:(0,E.jsx)(s,{className:`size-3.5`})})]})}function ne({title:e,value:t,filename:n}){return(0,E.jsxs)(l,{children:[(0,E.jsx)(a,{title:e,action:(0,E.jsx)(B,{value:t,filename:n})}),(0,E.jsx)(z,{value:t})]})}export{L as JobInspector};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{d as n,m as r,r as i,t as a}from"./react-vendor-CHIHtdAC.js";import{H as o,K as ee,L as s,N as c,O as l,R as te,T as u,W as d,a as f,b as ne,c as re,et as p,g as ie,h as ae,l as m,m as h,n as g,o as _,q as oe,tt as se,w as v,x as ce}from"./index-C5VVVkqi.js";import{a as le,i as ue}from"./form-PtDLk33Z.js";import{t as de}from"./Pagination-DYMlK0Hm.js";import{t as fe}from"./exportFile-tdUeW5m5.js";import{t as y}from"./jobActions-CuOdMglt.js";var b=e(r(),1),x=a(),pe=[`all`,`waiting`,`active`,`completed`,`failed`],S=25;function me(e=0){return e>=10?{t:`HIGH`,c:`text-warning`}:e>=1?{t:`MEDIUM`,c:`text-blue-400`}:{t:`LOW`,c:`text-faint`}}function C(e){let t=y(e.state);return t.retryActive?p.retryJob(e.id):t.retryDlq?p.retryDlq(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not retryable`))}function w(){let[e]=n(),[r,a]=(0,b.useState)(e.get(`queue`)??``),[w,T]=(0,b.useState)(`all`),[E,D]=(0,b.useState)(``),[O,k]=(0,b.useState)(0),[A,j]=(0,b.useState)(new Set),[he,M]=(0,b.useState)(new Set),[N,P]=(0,b.useState)(!1),[F,I]=(0,b.useState)(null),{data:L}=l(()=>p.queuesSummary(),[],{intervalMs:3e4}),{data:ge}=l(()=>p.overview(),[],{intervalMs:1e4});(0,b.useEffect)(()=>{!r&&L?.length&&a(L[0].name)},[L,r]);let R=`${r}|${w}|${O}`,{data:z,error:B,loading:_e,refetch:V}=l((0,b.useCallback)(async()=>{if(!r)return{view:R,jobs:[]};let e=w===`all`?void 0:[w];return{view:R,jobs:((await p.jobsList(r,e,S,O*S)).jobs??[]).map(e=>({...e,queue:e.queue??r}))}},[r,w,O,R]),[r,w,O]),H=z&&z.view===R?z.jobs:null,ve=(H?.length??0)===S,U=(0,b.useMemo)(()=>{let e=E.trim().toLowerCase();return e?(H??[]).filter(t=>t.id.toLowerCase().includes(e)):H??[]},[H,E]),W=ge?.stats,G=(0,b.useMemo)(()=>(L??[]).reduce((e,t)=>e+(t.counts?.failed??0),0),[L]),K=W?g(W.completed,G):null,q=e=>W?re(e):`—`,J=()=>k(0);(0,b.useEffect)(()=>{j(new Set)},[r,w,O]);let ye=e=>j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Y=U.length>0&&U.every(e=>A.has(e.id)),be=()=>j(()=>Y?new Set:new Set(U.map(e=>e.id))),X=async(e,t,n,r)=>{if(!(r&&!window.confirm(r))){M(t=>new Set(t).add(e.id)),I(null);try{await n(),I({ok:!0,text:`${t} ✓`})}catch(e){I({ok:!1,text:`${t} failed: ${e.message}`})}finally{M(t=>{let n=new Set(t);return n.delete(e.id),n}),V()}}},Z=async(e,t,n)=>{let r=U.filter(e=>A.has(e.id));if(r.length===0||n&&!window.confirm(n(r.length)))return;P(!0),I(null);let i=await Promise.allSettled(r.map(t)),a=i.filter(e=>e.status===`fulfilled`).length,o=i.length-a;I({ok:o===0,text:`${e}: ${a} succeeded${o?`, ${o} not eligible / failed`:``}`}),j(new Set),P(!1),V()},Q=U.filter(e=>A.has(e.id)),$={retry:Q.some(e=>{let t=y(e.state);return t.retryActive||t.retryDlq}),promote:Q.some(e=>y(e.state).promote),requeue:Q.some(e=>y(e.state).requeueCompleted),fail:Q.some(e=>y(e.state).fail),cancel:Q.some(e=>y(e.state).cancel)};return(0,x.jsxs)(`div`,{children:[(0,x.jsx)(ae,{title:`Jobs Explorer`,description:`Browse, inspect, and manage individual jobs.`,live:!0,actions:(0,x.jsxs)(v,{size:`sm`,disabled:!H||U.length===0,onClick:()=>{if(U.length===0){se.info(`No jobs to export on this page`);return}let e=U.map(e=>({id:e.id,queue:e.queue??r,state:e.state??``,priority:e.priority??0,attempts:e.attempts??0,maxAttempts:e.maxAttempts??``,createdAt:e.createdAt?new Date(e.createdAt).toISOString():``,durationMs:e.startedAt&&e.completedAt?e.completedAt-e.startedAt:``}));fe(`jobs-${r}-${w}`,e,[`id`,`queue`,`state`,`priority`,`attempts`,`maxAttempts`,`createdAt`,`durationMs`])},children:[(0,x.jsx)(s,{className:`size-3.5`}),` Export CSV`]})}),(0,x.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,x.jsx)(h,{label:`Total`,value:q((W?.completed??0)+G+(W?.waiting??0)+(W?.active??0)+(W?.delayed??0)),hint:`all queues`,compact:!0}),(0,x.jsx)(h,{label:`Waiting`,value:q(W?.waiting),tone:`amber`,compact:!0}),(0,x.jsx)(h,{label:`Active`,value:q(W?.active),tone:`blue`,compact:!0}),(0,x.jsx)(h,{label:`Completed`,value:q(W?.completed),tone:`green`,compact:!0}),(0,x.jsx)(h,{label:`Failed`,value:q(G),tone:G?`red`:`default`,compact:!0}),(0,x.jsx)(h,{label:`Error Rate`,value:K==null?`—`:m(K),tone:K==null?`default`:K>.05?`red`:`green`,compact:!0})]}),(0,x.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,x.jsx)(`div`,{className:`w-48`,children:(0,x.jsx)(le,{value:r,"aria-label":`Queue`,onChange:e=>{a(e.target.value),J()},children:(L??[]).map(e=>(0,x.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),(0,x.jsx)(ue,{options:pe,value:w,onChange:e=>{T(e),J()}}),(0,x.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,x.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,x.jsx)(`input`,{value:E,onChange:e=>D(e.target.value),placeholder:`Filter this page by ID…`,"aria-label":`Filter by job ID`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),A.size>0&&(0,x.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 rounded-lg border border-line bg-surface-2 px-4 py-2 text-sm`,children:[(0,x.jsxs)(`span`,{className:`mr-1 text-muted`,children:[A.size,` selected`]}),$.retry&&(0,x.jsx)(v,{size:`sm`,disabled:N,onClick:()=>Z(`Retry`,C),children:`Retry selected`}),$.promote&&(0,x.jsx)(v,{size:`sm`,disabled:N,onClick:()=>Z(`Promote`,e=>y(e.state).promote?p.promoteJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not delayed`))),children:`Promote selected`}),$.requeue&&(0,x.jsx)(v,{size:`sm`,disabled:N,onClick:()=>Z(`Requeue`,e=>y(e.state).requeueCompleted?p.retryCompleted(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not completed`))),children:`Requeue selected`}),$.fail&&(0,x.jsx)(v,{variant:`warning`,size:`sm`,disabled:N,onClick:()=>Z(`Fail`,e=>y(e.state).fail?p.failJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not active`)),e=>`Force-fail ${e} job(s)?`),children:`Fail selected`}),$.cancel&&(0,x.jsx)(v,{variant:`danger`,size:`sm`,disabled:N,onClick:()=>Z(`Cancel`,e=>y(e.state).cancel?p.cancelJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" cannot be cancelled`)),e=>`Cancel ${e} job(s)? This cannot be undone.`),children:`Cancel selected`}),!$.retry&&!$.promote&&!$.requeue&&!$.fail&&!$.cancel&&(0,x.jsx)(`span`,{className:`text-xs text-faint`,children:`No actions apply to the selected job states.`})]}),F&&(0,x.jsx)(`div`,{className:t(`mb-3 text-sm`,F.ok?`text-success`:`text-danger`),children:F.text}),B&&(0,x.jsx)(ce,{onRetry:V}),_e&&!H&&!B?(0,x.jsx)(ne,{label:`Loading jobs…`}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,x.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,x.jsx)(`thead`,{children:(0,x.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,x.jsx)(`th`,{className:`w-10 px-5 py-3`,children:(0,x.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:be,"aria-label":`Select all jobs on page`,className:`accent-accent`})}),(0,x.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,x.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,x.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Priority`}),(0,x.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Created`}),(0,x.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,x.jsx)(`th`,{className:`w-28 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,x.jsx)(`tbody`,{children:U.length===0?(0,x.jsx)(`tr`,{children:(0,x.jsx)(`td`,{colSpan:7,className:`px-5 py-12 text-center text-sm text-faint`,children:E.trim()?`No jobs on this page match your ID filter.`:r?`No jobs found.`:`Select a queue.`})}):U.map(e=>{let n=me(e.priority),r=y(e.state),a=he.has(e.id);return(0,x.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,x.jsx)(`td`,{className:`px-5 py-3`,children:(0,x.jsx)(`input`,{type:`checkbox`,checked:A.has(e.id),onChange:()=>ye(e.id),"aria-label":`Select job ${e.id}`,className:`accent-accent`})}),(0,x.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent/90`,children:(0,x.jsx)(`span`,{className:`block max-w-[16rem] truncate`,title:e.id,children:e.id})}),(0,x.jsx)(`td`,{className:`px-5 py-3`,children:(0,x.jsx)(ie,{status:String(e.state??`waiting`)})}),(0,x.jsx)(`td`,{className:t(`px-5 py-3 text-xs font-semibold`,n.c),children:n.t}),(0,x.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:f(e.createdAt)}),(0,x.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:_(e.startedAt&&e.completedAt?e.completedAt-e.startedAt:void 0)}),(0,x.jsx)(`td`,{className:`px-5 py-3`,children:(0,x.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,x.jsx)(i,{to:`/job?id=${encodeURIComponent(e.id)}`,children:(0,x.jsx)(u,{"aria-label":`Inspect job`,children:(0,x.jsx)(te,{className:`size-3.5`})})}),r.promote&&(0,x.jsx)(u,{"aria-label":`Promote job`,disabled:a,onClick:()=>X(e,`Promote`,()=>p.promoteJob(e.id)),children:(0,x.jsx)(o,{className:`size-3.5`})}),(r.retryActive||r.retryDlq)&&(0,x.jsx)(u,{"aria-label":`Retry job`,disabled:a,onClick:()=>X(e,`Retry`,()=>C(e)),children:(0,x.jsx)(d,{className:`size-3.5`})}),r.requeueCompleted&&(0,x.jsx)(u,{"aria-label":`Requeue job`,disabled:a,onClick:()=>X(e,`Requeue`,()=>p.retryCompleted(e.queue??``,e.id)),children:(0,x.jsx)(d,{className:`size-3.5`})}),r.fail&&(0,x.jsx)(u,{"aria-label":`Fail job`,disabled:a,onClick:()=>X(e,`Fail`,()=>p.failJob(e.id),`Force-fail this active job?`),children:(0,x.jsx)(c,{className:`size-3.5`})}),r.cancel&&(0,x.jsx)(u,{"aria-label":`Cancel job`,disabled:a,onClick:()=>X(e,`Cancel`,()=>p.cancelJob(e.id),`Cancel this job?`),children:(0,x.jsx)(oe,{className:`size-3.5`})})]})})]},e.id)})})]})}),(0,x.jsx)(de,{page:O,pageSize:S,hasNext:ve,onPageChange:k,label:`jobs`})]})]})}export{w as JobsPro};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{m as n,t as r}from"./react-vendor-CHIHtdAC.js";import{C as i,O as a,S as o,b as s,c,d as l,et as u,h as d,i as f,l as p,m,n as h,x as g}from"./index-C5VVVkqi.js";import{t as _}from"./Pagination-DYMlK0Hm.js";import{t as v}from"./AreaChart-DzUXW8u3.js";import{n as y,t as b}from"./useThroughputSeries-B6m-M93j.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 u.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=h(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)(d,{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)(m,{label:`Total Completed`,value:f(z.completed),tone:`green`,hint:`recorded jobs`}),(0,S.jsx)(m,{label:`Total Failed`,value:c(R),tone:R?`red`:`default`,hint:`recorded jobs`}),(0,S.jsx)(m,{label:`Push/sec`,value:B.pushPerSec.toFixed(1),tone:`accent`,hint:`jobs/sec`}),(0,S.jsx)(m,{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?`—`:p(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?`—`:p(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:[f(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:f(z.totalPushed)}),(0,S.jsx)(A,{color:`bg-zinc-500`,label:`Pulled (since restart)`,value:f(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 +0,0 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{l as n,m as r,r as i,t as a}from"./react-vendor-CHIHtdAC.js";import{A as o,H as s,K as c,O as l,T as u,U as d,V as f,b as p,c as m,et as h,h as g,m as _,tt as v,w as y,x as b}from"./index-C5VVVkqi.js";import{t as x}from"./Pagination-DYMlK0Hm.js";import{t as S}from"./promisePool-Daxkc1OB.js";var C=e(r(),1),w=a(),T=6,E=15;function D(){let e=n(),[r,a]=(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}=l(()=>h.queuesSummary(),[]),z=F??[],B=(0,C.useMemo)(()=>{let e=r.trim().toLowerCase();return[...e?z.filter(t=>t.name.toLowerCase().includes(e)):z].sort((e,t)=>e.name.localeCompare(t.name))},[z,r]),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?h.resume(e.name):h.pause(e.name)),P({ok:!0,text:`${e.name} ${e.paused?`resumed`:`paused`} ✓`})}catch(t){P({ok:!1,text:t.message}),v.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){v.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`?h.pause(t.name):h.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?v.success(r):v.error(r),M(!1),R()};return L&&!F&&!I?(0,w.jsx)(p,{label:`Loading queues…`}):(0,w.jsxs)(`div`,{children:[(0,w.jsx)(g,{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)(f,{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)(s,{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)(_,{label:`Waiting`,value:m(V.waiting),tone:`amber`,compact:!0}),(0,w.jsx)(_,{label:`Active`,value:m(V.active),tone:`blue`,compact:!0}),(0,w.jsx)(_,{label:`Failed`,value:m(V.failed),tone:V.failed?`red`:`default`,compact:!0}),(0,w.jsx)(_,{label:`Paused`,value:m(V.paused),tone:V.paused?`amber`:`default`,compact:!0})]}),(0,w.jsxs)(`div`,{className:`relative mb-4 max-w-sm`,children:[(0,w.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,w.jsx)(`input`,{value:r,onChange:e=>{a(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:r?`No queues match your search.`:`No queues yet.`})}):W.map(n=>{let r=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)(i,{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:m(n.counts.waiting)}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:m(n.counts.active)}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-success`,children:m(n.counts.completed)}),(0,w.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,n.counts.failed?`text-danger`:`text-muted`),children:m(n.counts.failed)}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:m(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)(u,{"aria-label":n.paused?`Resume queue`:`Pause queue`,disabled:r,onClick:e=>{e.stopPropagation(),G(n)},children:n.paused?(0,w.jsx)(s,{className:`size-3.5 text-success`}):(0,w.jsx)(f,{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,3 +0,0 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{m as n,t as r}from"./react-vendor-CHIHtdAC.js";import{C as i,H as a,K as o,O as s,S as c,V as l,W as u,a as d,d as f,et as p,h as m,p as h,r as g,u as _,w as v,x as y}from"./index-C5VVVkqi.js";import{i as b,n as x,t as S}from"./form-PtDLk33Z.js";import{t as C}from"./CopyButton-D39F1wIH.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,s]=(0,w.useState)(``),[l,u]=(0,w.useState)(!0),[d,f]=(0,w.useState)(!1),p=(0,w.useRef)(null),m=(0,w.useMemo)(()=>{let e=a.trim().toLowerCase();return n.map(e=>e.line.includes(`\x1B`)?{...e,line:h(e.line)}:e).filter(t=>(r===`all`||t.stream===r)&&(!e||t.line.toLowerCase().includes(e)))},[n,r,a]);(0,w.useEffect)(()=>{if(!l)return;let e=p.current;e&&(e.scrollTop=e.scrollHeight)},[m.length,l]);let g=(0,w.useMemo)(()=>m.map(e=>d?`${P(e.ts)} [${e.stream}] ${e.line}`:e.line).join(`
2
- `),[m,d]);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)(o,{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=>s(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:l,onClick:()=>u(e=>!e),label:`Follow`}),(0,T.jsx)(L,{on:d,onClick:()=>f(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:m.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:p,className:`max-h-80 min-h-40 overflow-y-auto p-4 font-mono text-xs leading-relaxed`,children:m.length===0?(0,T.jsx)(`p`,{className:`text-faint`,children:n.length===0?`No output yet.`:`No lines match the current filter.`}):m.map(e=>(0,T.jsxs)(`div`,{className:t(`whitespace-pre-wrap`,F(e.stream)),children:[d&&(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:m.length===n.length?`${n.length} lines`:`${m.length} of ${n.length} lines`}),(0,T.jsx)(`span`,{children:l?`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(()=>p.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:f((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:o=null,busy:s,onStart:c,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&&s?`${s}…`: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:c,children:[(0,T.jsx)(a,{className:`size-4`}),` Start`]}),(0,T.jsxs)(v,{variant:`warning`,disabled:!h||r||i,onClick:f,children:[(0,T.jsx)(l,{className:`size-4`}),` Stop`]}),(0,T.jsxs)(v,{disabled:r||i,onClick:p,children:[(0,T.jsx)(u,{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:o?.memory?.rss==null?(0,T.jsx)(`span`,{className:`text-faint`,children:`—`}):(0,T.jsxs)(`span`,{title:`heap ${o.memory.heapUsed??`?`} / ${o.memory.heapTotal??`?`} MB`,children:[o.memory.rss,` MB rss`]})}),(0,T.jsx)(V,{label:`Connections`,children:o?.connections?`${o.connections.tcp??0} tcp · ${o.connections.ws??0} ws · ${o.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?d(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?`${g(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}: ${g(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:g(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(()=>p.control.status(),[]),[r,a]=(0,w.useState)(null),[o,l]=(0,w.useState)(null),u=e?.status===`running`,{data:d}=s(()=>u?p.health():Promise.resolve(null),[u]),f=u?d??null:null,h=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)(m,{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:p.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
- `,`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 g=e?.status??`stopped`,_=g===`running`,v=g===`starting`||g===`stopping`||r!=null,b=t!=null&&e!=null;return(0,T.jsxs)(`div`,{children:[(0,T.jsx)(m,{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:p.agentBase,stale:b,vitals:f,transitioning:v,busy:r,onStart:()=>h(`starting`,()=>p.control.start()),onStop:()=>h(`stopping`,()=>p.control.stop(),`Stop the bunqueue server?`),onRestart:()=>h(`restarting`,()=>p.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:p.agentBase})})]})}function K({status:e,onSaved:t,running:n,transitioning:r}){let[a,o]=(0,w.useState)(null),[s,l]=(0,w.useState)(!1),[d,f]=(0,w.useState)(!1),[m,h]=(0,w.useState)(null);(0,w.useEffect)(()=>{e?.config&&!a&&o(e.config)},[e,a]);let g=a??e?.config??null;if(!g)return(0,T.jsx)(c,{children:`Loading…`});let _=e=>o({...g,...e}),y=e?.runningConfig??null,b=(e={})=>JSON.stringify(Object.keys(e).sort().map(t=>[t,e[t]])),C=n&&y!=null&&(y.command!==g.command||y.httpPort!==g.httpPort||y.tcpPort!==g.tcpPort||y.dataPath!==g.dataPath||b(y.extraEnv)!==b(g.extraEnv)),E=r||d,D=()=>{l(!0),setTimeout(()=>l(!1),2e3)},O=()=>{let e=e=>Number.isInteger(e)&&e>=1&&e<=65535;return e(g.httpPort)?e(g.tcpPort)?g.httpPort===g.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:g.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:g.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:g.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:g.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:g.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){h(e);return}h(null);try{await p.control.setConfig(g),D(),t()}catch(e){h(e.message)}},children:`Save config`}),n&&(0,T.jsxs)(v,{variant:`warning`,size:`sm`,disabled:E,onClick:async()=>{let e=O();if(e){h(e);return}if(window.confirm(`Save configuration and restart the server to apply it?`)){h(null),f(!0);try{await p.control.setConfig(g),await p.control.restart(),D(),t()}catch(e){h(e.message)}finally{f(!1)}}},children:[(0,T.jsx)(u,{className:`size-3.5`}),` Save & restart`]}),C&&!s&&(0,T.jsx)(`span`,{className:`text-xs text-warning`,children:`Restart to apply changes`}),s&&(0,T.jsx)(`span`,{className:`text-xs text-success`,children:`Saved`}),m&&(0,T.jsx)(`span`,{className:`text-xs text-danger`,children:m})]})]})]})}export{G as ServerControl};
@@ -1 +0,0 @@
1
- import{t as e}from"./react-vendor-CHIHtdAC.js";import{C as t,O as n,S as r,b as i,c as a,d as o,et as s,h as c,l,m as u,n as d,r as f,u as p,x as m}from"./index-C5VVVkqi.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([s.overview(),s.storage(),s.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=d(S.completed,E),O=S.uptime?o(S.uptime/1e3):`—`;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(c,{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)(u,{label:`Completed`,value:a(S.completed),tone:`green`}),(0,h.jsx)(u,{label:`Failed`,value:a(E),tone:E?`red`:`default`}),(0,h.jsx)(u,{label:`Waiting`,value:a(S.waiting),tone:`amber`}),(0,h.jsx)(u,{label:`Active`,value:a(S.active),tone:`blue`}),(0,h.jsx)(u,{label:`Error Rate`,value:D==null?`—`:l(D),tone:D==null?`default`:D>.05?`red`:`green`}),(0,h.jsx)(u,{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:f(C.heapUsed*1024*1024)}),(0,h.jsx)(v,{label:`RSS`,value:f(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 +0,0 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{$ as r,C as i,O as a,S as o,T as s,b as c,c as l,et as u,h as d,q as f,u as p,w as m,x as h,y as g,z as _}from"./index-C5VVVkqi.js";import{n as v,o as y,t as b}from"./form-PtDLk33Z.js";import{t as x}from"./Pagination-DYMlK0Hm.js";var S=e(t(),1),C=n();function w(){let{data:e,error:t,loading:n,refetch:r}=a(()=>u.webhooks(),[]),m=e?.data?.webhooks??[],[v,b]=(0,S.useState)(0),w=Math.max(1,Math.ceil(m.length/15)),E=Math.min(v,w-1),[D,O]=(0,S.useState)(null),k=async e=>{O(null);try{await e(),r()}catch(e){O(e.message)}};return(0,C.jsxs)(`div`,{children:[(0,C.jsx)(d,{title:`Webhooks`,description:`HTTP callbacks fired on job events.`,live:!0}),t&&(0,C.jsx)(h,{onRetry:r}),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)(o,{className:`mb-6`,children:[(0,C.jsx)(i,{title:`Add webhook`}),(0,C.jsx)(T,{onAdd:async e=>{await u.addWebhook(e),r()}})]}),n&&!e&&!t?(0,C.jsx)(c,{label:`Loading webhooks…`}):m.length===0?(0,C.jsx)(g,{icon:(0,C.jsx)(_,{}),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:m.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:l(e.successCount)}),` / `,(0,C.jsx)(`span`,{className:e.failureCount?`text-danger`:``,children:l(e.failureCount)})]}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:p(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(()=>u.setWebhookEnabled(e.id,t))})}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,C.jsx)(s,{"aria-label":`Remove webhook`,onClick:()=>window.confirm(`Remove webhook for ${e.url}?`)&&k(()=>u.removeWebhook(e.id)),children:(0,C.jsx)(f,{className:`size-3.5`})})})]},e.id))})]})}),(0,C.jsx)(x,{page:E,pageSize:15,total:m.length,onPageChange:b,label:`webhooks`})]})]})}function T({onAdd:e}){let[t,n]=(0,S.useState)(``),[i,a]=(0,S.useState)(``),[o,s]=(0,S.useState)(``),[c,l]=(0,S.useState)([`job.completed`,`job.failed`]),[u,d]=(0,S.useState)(null),[f,p]=(0,S.useState)(!1),h=e=>l(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),g=async()=>{if(!f){if(d(null),!t.trim()||c.length===0){d(`URL and at least one event are required`);return}p(!0);try{await e({url:t,events:c,queue:i.trim()||void 0,secret:o.trim()||void 0}),n(``),s(``)}catch(e){d(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:i,onChange:e=>a(e.target.value),placeholder:`all queues`})}),(0,C.jsx)(b,{label:`Secret (optional)`,children:(0,C.jsx)(v,{type:`password`,autoComplete:`new-password`,value:o,onChange:e=>s(e.target.value),placeholder:`HMAC signing secret`})})]}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>(0,C.jsx)(`button`,{type:`button`,"aria-pressed":c.includes(e),onClick:()=>h(e),className:c.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)(m,{type:`submit`,variant:`accent`,size:`sm`,disabled:f,children:f?`Adding…`:`Add webhook`}),u&&(0,C.jsx)(`span`,{className:`text-xs text-danger`,children:u})]})]})}export{w as Webhooks};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{m as n,t as r}from"./react-vendor-CHIHtdAC.js";import{J as i,O as a,T as o,b as s,c,et as l,h as u,m as d,q as f,u as p,x as m,y as h}from"./index-C5VVVkqi.js";var g=e(n(),1),_=r(),v=100;function y(){let{data:e,error:n,loading:r,refetch:y}=a(async()=>(await l.workers()).data?.workers??[],[]),[b,x]=(0,g.useState)(new Set),[S,C]=(0,g.useState)(null);if(r&&!e&&!n)return(0,_.jsx)(s,{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 l.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:c(w.length),compact:!0}),(0,_.jsx)(d,{label:`Active`,value:c(E),tone:`green`,compact:!0}),(0,_.jsx)(d,{label:`Stale`,value:c(D),tone:D?`amber`:`default`,compact:!0}),(0,_.jsx)(d,{label:`Active Jobs`,value:c(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)(i,{}),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:c(e.activeJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:c(e.processedJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:c(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)(f,{className:`size-3.5`})})})})]},e.id))})]})}),w.length>v&&(0,_.jsxs)(`p`,{className:`mt-3 text-xs text-warning`,children:[`Showing first `,c(v),` of `,c(w.length),` workers.`]})]})}export{y as WorkersPro};