bunqueue-dashboard 0.0.18 → 0.0.20

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 (70) hide show
  1. package/dist/.vite/manifest.json +137 -60
  2. package/dist/assets/AddJob-CaPckiUk.js +3 -0
  3. package/dist/assets/Alerts-B2c0ARdJ.js +1 -0
  4. package/dist/assets/Benchmark-BUCKbeuC.js +1 -0
  5. package/dist/assets/BulkAddJobs-BIUVhw79.js +5 -0
  6. package/dist/assets/{CopilotPanel-C9ojQ_8d.js → CopilotPanel-krCimuWQ.js} +1 -1
  7. package/dist/assets/{CopyButton-BC6QECSJ.js → CopyButton-DvGgfSEm.js} +1 -1
  8. package/dist/assets/{Cron-Bbf7mRaK.js → Cron-DtuiCy5T.js} +1 -1
  9. package/dist/assets/CronManager-CorgubVA.js +1 -0
  10. package/dist/assets/Database-D2Kg4jZ5.js +3 -0
  11. package/dist/assets/Diagnostics-B9eXpr9p.js +1 -0
  12. package/dist/assets/{Dlq-Bs1pupY2.js → Dlq-DYBGJHQ7.js} +1 -1
  13. package/dist/assets/DlqControl-VeRgk2sV.js +1 -0
  14. package/dist/assets/DlqPro-D40bX5wt.js +1 -0
  15. package/dist/assets/Flows-H8j_vUf9.js +1 -0
  16. package/dist/assets/JobInspector-CXzDoEVg.js +2 -0
  17. package/dist/assets/Jobs-CTYa9Wq9.js +1 -0
  18. package/dist/assets/JobsPro-9JG9oKsi.js +1 -0
  19. package/dist/assets/{Logs-yn92V_T8.js → Logs-D4_bxWwW.js} +1 -1
  20. package/dist/assets/LogsPro-DjhlPDzs.js +1 -0
  21. package/dist/assets/{McpServer-CNt7kssG.js → McpServer-BcNGlbb8.js} +1 -1
  22. package/dist/assets/{Metrics-CbscCpvx.js → Metrics-DDxWBIBZ.js} +1 -1
  23. package/dist/assets/MetricsPro-DM__uhdn.js +1 -0
  24. package/dist/assets/{Overview-BOuOPWsb.js → Overview-bPieBOHN.js} +1 -1
  25. package/dist/assets/{Pagination-Bj1z6OlD.js → Pagination-B-6mVPUC.js} +1 -1
  26. package/dist/assets/QueueActions-DPqmozNf.js +1 -0
  27. package/dist/assets/QueueControl-Cxl_GKCw.js +1 -0
  28. package/dist/assets/{QueueDetail-BSUH0Nl6.js → QueueDetail-BaehsuiZ.js} +1 -1
  29. package/dist/assets/QueueDetailPro-CDntEb4E.js +1 -0
  30. package/dist/assets/{Queues-BEQlaWVc.js → Queues-BXwcVq8b.js} +1 -1
  31. package/dist/assets/QueuesOverview-CggwfR_n.js +1 -0
  32. package/dist/assets/{S3Backup-BmRt-Z8V.js → S3Backup-DKegjDS2.js} +1 -1
  33. package/dist/assets/S3BackupPro-BPop6lt3.js +1 -0
  34. package/dist/assets/ServerControl-ELjdOfy0.js +3 -0
  35. package/dist/assets/{Settings-46jsrfhd.js → Settings-CeRzvpaS.js} +1 -1
  36. package/dist/assets/{Usage-BFLZC7pV.js → Usage-nsrrx66q.js} +1 -1
  37. package/dist/assets/UsagePro-DTCHLKue.js +1 -0
  38. package/dist/assets/Webhooks-BSxGyZBk.js +1 -0
  39. package/dist/assets/{Workers-DBXrLvfS.js → Workers-4FvLmhA2.js} +1 -1
  40. package/dist/assets/WorkersPro-EbCgSBaw.js +1 -0
  41. package/dist/assets/exportFile-tdUeW5m5.js +2 -0
  42. package/dist/assets/index-C2XEM9ex.css +1 -0
  43. package/dist/assets/index-DTo6fJH9.js +8 -0
  44. package/dist/assets/promisePool-Daxkc1OB.js +1 -0
  45. package/dist/assets/useThroughputSeries-D8wylrhf.js +1 -0
  46. package/dist/index.html +2 -2
  47. package/package.json +1 -1
  48. package/scripts/embedded.gen.ts +110 -96
  49. package/dist/assets/AddJob-vk3jh1Zk.js +0 -3
  50. package/dist/assets/Benchmark-CpViF2ZC.js +0 -1
  51. package/dist/assets/CronManager-CeNUeoOc.js +0 -1
  52. package/dist/assets/Database--bK9pYZF.js +0 -3
  53. package/dist/assets/Diagnostics-CGJPsWZQ.js +0 -1
  54. package/dist/assets/DlqControl-BLKVzYQC.js +0 -1
  55. package/dist/assets/DlqPro-D8SmIQUs.js +0 -1
  56. package/dist/assets/Flows-BOogljnP.js +0 -1
  57. package/dist/assets/JobInspector-Cp4ZuQGI.js +0 -2
  58. package/dist/assets/Jobs-C2HYkZXi.js +0 -1
  59. package/dist/assets/JobsPro-D0uclU0B.js +0 -1
  60. package/dist/assets/LogsPro-DSiV8Ajj.js +0 -1
  61. package/dist/assets/MetricsPro-CBiFDVne.js +0 -1
  62. package/dist/assets/QueueControl-Bl4l9dT6.js +0 -1
  63. package/dist/assets/QueuesOverview-BBjcyzz2.js +0 -1
  64. package/dist/assets/S3BackupPro-Dsq0erDm.js +0 -1
  65. package/dist/assets/ServerControl-Bhr9FEXF.js +0 -3
  66. package/dist/assets/UsagePro-D0k-82eG.js +0 -1
  67. package/dist/assets/Webhooks-DChTcBSv.js +0 -1
  68. package/dist/assets/WorkersPro-B6I9Ilbq.js +0 -1
  69. package/dist/assets/index-BFjeS9FG.js +0 -8
  70. package/dist/assets/index-BWY8Yofc.css +0 -1
@@ -2,106 +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/Overview-BOuOPWsb.js" with { type: 'file' };
6
- import f3 from "../dist/assets/index-BFjeS9FG.js" with { type: 'file' };
7
- import f4 from "../dist/assets/Workers-DBXrLvfS.js" with { type: 'file' };
8
- import f5 from "../dist/assets/AreaChart-DzUXW8u3.js" with { type: 'file' };
9
- import f6 from "../dist/assets/install-C019EM5j.js" with { type: 'file' };
10
- import f7 from "../dist/assets/index-BWY8Yofc.css" with { type: 'file' };
5
+ import f2 from "../dist/assets/MetricsPro-DM__uhdn.js" with { type: 'file' };
6
+ import f3 from "../dist/assets/Diagnostics-B9eXpr9p.js" with { type: 'file' };
7
+ import f4 from "../dist/assets/AreaChart-DzUXW8u3.js" with { type: 'file' };
8
+ import f5 from "../dist/assets/install-C019EM5j.js" with { type: 'file' };
9
+ import f6 from "../dist/assets/CopyButton-DvGgfSEm.js" with { type: 'file' };
10
+ import f7 from "../dist/assets/Metrics-DDxWBIBZ.js" with { type: 'file' };
11
11
  import f8 from "../dist/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2" with { type: 'file' };
12
- import f9 from "../dist/assets/McpServer-CNt7kssG.js" with { type: 'file' };
13
- import f10 from "../dist/assets/QueuesOverview-BBjcyzz2.js" with { type: 'file' };
14
- import f11 from "../dist/assets/Metrics-CbscCpvx.js" with { type: 'file' };
15
- import f12 from "../dist/assets/AddJob-vk3jh1Zk.js" with { type: 'file' };
16
- import f13 from "../dist/assets/DlqControl-BLKVzYQC.js" with { type: 'file' };
17
- import f14 from "../dist/assets/form-PtDLk33Z.js" with { type: 'file' };
18
- import f15 from "../dist/assets/Logs-yn92V_T8.js" with { type: 'file' };
19
- import f16 from "../dist/assets/Usage-BFLZC7pV.js" with { type: 'file' };
20
- import f17 from "../dist/assets/react-vendor-CHIHtdAC.js" with { type: 'file' };
21
- import f18 from "../dist/assets/Webhooks-DChTcBSv.js" with { type: 'file' };
22
- import f19 from "../dist/assets/QueueControl-Bl4l9dT6.js" with { type: 'file' };
23
- import f20 from "../dist/assets/CopilotPanel-C9ojQ_8d.js" with { type: 'file' };
24
- import f21 from "../dist/assets/jobActions-CuOdMglt.js" with { type: 'file' };
25
- import f22 from "../dist/assets/Benchmark-CpViF2ZC.js" with { type: 'file' };
26
- import f23 from "../dist/assets/connectionStore-CCopJeU7.js" with { type: 'file' };
27
- import f24 from "../dist/assets/WorkersPro-B6I9Ilbq.js" with { type: 'file' };
28
- import f25 from "../dist/assets/Queues-BEQlaWVc.js" with { type: 'file' };
29
- import f26 from "../dist/assets/QueueDetail-BSUH0Nl6.js" with { type: 'file' };
30
- import f27 from "../dist/assets/Diagnostics-CGJPsWZQ.js" with { type: 'file' };
31
- import f28 from "../dist/assets/S3Backup-BmRt-Z8V.js" with { type: 'file' };
32
- import f29 from "../dist/assets/ServerControl-Bhr9FEXF.js" with { type: 'file' };
33
- import f30 from "../dist/assets/Flows-BOogljnP.js" with { type: 'file' };
34
- import f31 from "../dist/assets/CopyButton-BC6QECSJ.js" with { type: 'file' };
35
- import f32 from "../dist/assets/cn-CMFYpumL.js" with { type: 'file' };
36
- import f33 from "../dist/assets/LogsPro-DSiV8Ajj.js" with { type: 'file' };
37
- import f34 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
38
- import f35 from "../dist/assets/MetricsPro-CBiFDVne.js" with { type: 'file' };
39
- import f36 from "../dist/assets/S3BackupPro-Dsq0erDm.js" with { type: 'file' };
40
- import f37 from "../dist/assets/Cron-Bbf7mRaK.js" with { type: 'file' };
41
- import f38 from "../dist/assets/JobsPro-D0uclU0B.js" with { type: 'file' };
42
- import f39 from "../dist/assets/UsagePro-D0k-82eG.js" with { type: 'file' };
43
- import f40 from "../dist/assets/Jobs-C2HYkZXi.js" with { type: 'file' };
44
- import f41 from "../dist/assets/DlqPro-D8SmIQUs.js" with { type: 'file' };
45
- import f42 from "../dist/assets/Pagination-Bj1z6OlD.js" with { type: 'file' };
46
- import f43 from "../dist/assets/JobInspector-Cp4ZuQGI.js" with { type: 'file' };
47
- import f44 from "../dist/assets/CronManager-CeNUeoOc.js" with { type: 'file' };
48
- import f45 from "../dist/assets/Settings-46jsrfhd.js" with { type: 'file' };
49
- import f46 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
50
- import f47 from "../dist/assets/Dlq-Bs1pupY2.js" with { type: 'file' };
51
- import f48 from "../dist/assets/Database--bK9pYZF.js" with { type: 'file' };
52
- import f49 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
53
- import f50 from "../dist/index.html" with { type: 'file' };
12
+ import f9 from "../dist/assets/WorkersPro-EbCgSBaw.js" with { type: 'file' };
13
+ import f10 from "../dist/assets/QueueControl-Cxl_GKCw.js" with { type: 'file' };
14
+ import f11 from "../dist/assets/ServerControl-ELjdOfy0.js" with { type: 'file' };
15
+ import f12 from "../dist/assets/QueueDetailPro-CDntEb4E.js" with { type: 'file' };
16
+ import f13 from "../dist/assets/S3Backup-DKegjDS2.js" with { type: 'file' };
17
+ import f14 from "../dist/assets/QueueDetail-BaehsuiZ.js" with { type: 'file' };
18
+ import f15 from "../dist/assets/form-PtDLk33Z.js" with { type: 'file' };
19
+ import f16 from "../dist/assets/Webhooks-BSxGyZBk.js" with { type: 'file' };
20
+ import f17 from "../dist/assets/useThroughputSeries-D8wylrhf.js" with { type: 'file' };
21
+ import f18 from "../dist/assets/react-vendor-CHIHtdAC.js" with { type: 'file' };
22
+ import f19 from "../dist/assets/Queues-BXwcVq8b.js" with { type: 'file' };
23
+ import f20 from "../dist/assets/DlqPro-D40bX5wt.js" with { type: 'file' };
24
+ import f21 from "../dist/assets/Benchmark-BUCKbeuC.js" with { type: 'file' };
25
+ import f22 from "../dist/assets/Usage-nsrrx66q.js" with { type: 'file' };
26
+ import f23 from "../dist/assets/jobActions-CuOdMglt.js" with { type: 'file' };
27
+ import f24 from "../dist/assets/connectionStore-CCopJeU7.js" with { type: 'file' };
28
+ import f25 from "../dist/assets/Pagination-B-6mVPUC.js" with { type: 'file' };
29
+ import f26 from "../dist/assets/Dlq-DYBGJHQ7.js" with { type: 'file' };
30
+ import f27 from "../dist/assets/LogsPro-DjhlPDzs.js" with { type: 'file' };
31
+ import f28 from "../dist/assets/Workers-4FvLmhA2.js" with { type: 'file' };
32
+ import f29 from "../dist/assets/index-C2XEM9ex.css" with { type: 'file' };
33
+ import f30 from "../dist/assets/QueueActions-DPqmozNf.js" with { type: 'file' };
34
+ import f31 from "../dist/assets/Logs-D4_bxWwW.js" with { type: 'file' };
35
+ import f32 from "../dist/assets/exportFile-tdUeW5m5.js" with { type: 'file' };
36
+ import f33 from "../dist/assets/Alerts-B2c0ARdJ.js" with { type: 'file' };
37
+ import f34 from "../dist/assets/Jobs-CTYa9Wq9.js" with { type: 'file' };
38
+ import f35 from "../dist/assets/QueuesOverview-CggwfR_n.js" with { type: 'file' };
39
+ import f36 from "../dist/assets/CopilotPanel-krCimuWQ.js" with { type: 'file' };
40
+ import f37 from "../dist/assets/McpServer-BcNGlbb8.js" with { type: 'file' };
41
+ import f38 from "../dist/assets/cn-CMFYpumL.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/Database-D2Kg4jZ5.js" with { type: 'file' };
45
+ import f42 from "../dist/assets/UsagePro-DTCHLKue.js" with { type: 'file' };
46
+ import f43 from "../dist/assets/Flows-H8j_vUf9.js" with { type: 'file' };
47
+ import f44 from "../dist/assets/AddJob-CaPckiUk.js" with { type: 'file' };
48
+ import f45 from "../dist/assets/index-DTo6fJH9.js" with { type: 'file' };
49
+ import f46 from "../dist/assets/Overview-bPieBOHN.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/DlqControl-VeRgk2sV.js" with { type: 'file' };
52
+ import f49 from "../dist/assets/JobsPro-9JG9oKsi.js" with { type: 'file' };
53
+ import f50 from "../dist/assets/S3BackupPro-BPop6lt3.js" with { type: 'file' };
54
+ import f51 from "../dist/assets/Settings-CeRzvpaS.js" with { type: 'file' };
55
+ import f52 from "../dist/assets/CronManager-CorgubVA.js" with { type: 'file' };
56
+ import f53 from "../dist/assets/BulkAddJobs-BIUVhw79.js" with { type: 'file' };
57
+ import f54 from "../dist/assets/Cron-DtuiCy5T.js" with { type: 'file' };
58
+ import f55 from "../dist/assets/JobInspector-CXzDoEVg.js" with { type: 'file' };
59
+ import f56 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
60
+ import f57 from "../dist/index.html" with { type: 'file' };
54
61
 
55
62
  export const ASSETS: Record<string, string> = {
56
63
  "/.vite/manifest.json": f0,
57
64
  "/favicon.svg": f1,
58
- "/assets/Overview-BOuOPWsb.js": f2,
59
- "/assets/index-BFjeS9FG.js": f3,
60
- "/assets/Workers-DBXrLvfS.js": f4,
61
- "/assets/AreaChart-DzUXW8u3.js": f5,
62
- "/assets/install-C019EM5j.js": f6,
63
- "/assets/index-BWY8Yofc.css": f7,
65
+ "/assets/MetricsPro-DM__uhdn.js": f2,
66
+ "/assets/Diagnostics-B9eXpr9p.js": f3,
67
+ "/assets/AreaChart-DzUXW8u3.js": f4,
68
+ "/assets/install-C019EM5j.js": f5,
69
+ "/assets/CopyButton-DvGgfSEm.js": f6,
70
+ "/assets/Metrics-DDxWBIBZ.js": f7,
64
71
  "/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f8,
65
- "/assets/McpServer-CNt7kssG.js": f9,
66
- "/assets/QueuesOverview-BBjcyzz2.js": f10,
67
- "/assets/Metrics-CbscCpvx.js": f11,
68
- "/assets/AddJob-vk3jh1Zk.js": f12,
69
- "/assets/DlqControl-BLKVzYQC.js": f13,
70
- "/assets/form-PtDLk33Z.js": f14,
71
- "/assets/Logs-yn92V_T8.js": f15,
72
- "/assets/Usage-BFLZC7pV.js": f16,
73
- "/assets/react-vendor-CHIHtdAC.js": f17,
74
- "/assets/Webhooks-DChTcBSv.js": f18,
75
- "/assets/QueueControl-Bl4l9dT6.js": f19,
76
- "/assets/CopilotPanel-C9ojQ_8d.js": f20,
77
- "/assets/jobActions-CuOdMglt.js": f21,
78
- "/assets/Benchmark-CpViF2ZC.js": f22,
79
- "/assets/connectionStore-CCopJeU7.js": f23,
80
- "/assets/WorkersPro-B6I9Ilbq.js": f24,
81
- "/assets/Queues-BEQlaWVc.js": f25,
82
- "/assets/QueueDetail-BSUH0Nl6.js": f26,
83
- "/assets/Diagnostics-CGJPsWZQ.js": f27,
84
- "/assets/S3Backup-BmRt-Z8V.js": f28,
85
- "/assets/ServerControl-Bhr9FEXF.js": f29,
86
- "/assets/Flows-BOogljnP.js": f30,
87
- "/assets/CopyButton-BC6QECSJ.js": f31,
88
- "/assets/cn-CMFYpumL.js": f32,
89
- "/assets/LogsPro-DSiV8Ajj.js": f33,
90
- "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f34,
91
- "/assets/MetricsPro-CBiFDVne.js": f35,
92
- "/assets/S3BackupPro-Dsq0erDm.js": f36,
93
- "/assets/Cron-Bbf7mRaK.js": f37,
94
- "/assets/JobsPro-D0uclU0B.js": f38,
95
- "/assets/UsagePro-D0k-82eG.js": f39,
96
- "/assets/Jobs-C2HYkZXi.js": f40,
97
- "/assets/DlqPro-D8SmIQUs.js": f41,
98
- "/assets/Pagination-Bj1z6OlD.js": f42,
99
- "/assets/JobInspector-Cp4ZuQGI.js": f43,
100
- "/assets/CronManager-CeNUeoOc.js": f44,
101
- "/assets/Settings-46jsrfhd.js": f45,
102
- "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f46,
103
- "/assets/Dlq-Bs1pupY2.js": f47,
104
- "/assets/Database--bK9pYZF.js": f48,
105
- "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f49,
106
- "/index.html": f50,
72
+ "/assets/WorkersPro-EbCgSBaw.js": f9,
73
+ "/assets/QueueControl-Cxl_GKCw.js": f10,
74
+ "/assets/ServerControl-ELjdOfy0.js": f11,
75
+ "/assets/QueueDetailPro-CDntEb4E.js": f12,
76
+ "/assets/S3Backup-DKegjDS2.js": f13,
77
+ "/assets/QueueDetail-BaehsuiZ.js": f14,
78
+ "/assets/form-PtDLk33Z.js": f15,
79
+ "/assets/Webhooks-BSxGyZBk.js": f16,
80
+ "/assets/useThroughputSeries-D8wylrhf.js": f17,
81
+ "/assets/react-vendor-CHIHtdAC.js": f18,
82
+ "/assets/Queues-BXwcVq8b.js": f19,
83
+ "/assets/DlqPro-D40bX5wt.js": f20,
84
+ "/assets/Benchmark-BUCKbeuC.js": f21,
85
+ "/assets/Usage-nsrrx66q.js": f22,
86
+ "/assets/jobActions-CuOdMglt.js": f23,
87
+ "/assets/connectionStore-CCopJeU7.js": f24,
88
+ "/assets/Pagination-B-6mVPUC.js": f25,
89
+ "/assets/Dlq-DYBGJHQ7.js": f26,
90
+ "/assets/LogsPro-DjhlPDzs.js": f27,
91
+ "/assets/Workers-4FvLmhA2.js": f28,
92
+ "/assets/index-C2XEM9ex.css": f29,
93
+ "/assets/QueueActions-DPqmozNf.js": f30,
94
+ "/assets/Logs-D4_bxWwW.js": f31,
95
+ "/assets/exportFile-tdUeW5m5.js": f32,
96
+ "/assets/Alerts-B2c0ARdJ.js": f33,
97
+ "/assets/Jobs-CTYa9Wq9.js": f34,
98
+ "/assets/QueuesOverview-CggwfR_n.js": f35,
99
+ "/assets/CopilotPanel-krCimuWQ.js": f36,
100
+ "/assets/McpServer-BcNGlbb8.js": f37,
101
+ "/assets/cn-CMFYpumL.js": f38,
102
+ "/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f39,
103
+ "/assets/promisePool-Daxkc1OB.js": f40,
104
+ "/assets/Database-D2Kg4jZ5.js": f41,
105
+ "/assets/UsagePro-DTCHLKue.js": f42,
106
+ "/assets/Flows-H8j_vUf9.js": f43,
107
+ "/assets/AddJob-CaPckiUk.js": f44,
108
+ "/assets/index-DTo6fJH9.js": f45,
109
+ "/assets/Overview-bPieBOHN.js": f46,
110
+ "/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f47,
111
+ "/assets/DlqControl-VeRgk2sV.js": f48,
112
+ "/assets/JobsPro-9JG9oKsi.js": f49,
113
+ "/assets/S3BackupPro-BPop6lt3.js": f50,
114
+ "/assets/Settings-CeRzvpaS.js": f51,
115
+ "/assets/CronManager-CorgubVA.js": f52,
116
+ "/assets/BulkAddJobs-BIUVhw79.js": f53,
117
+ "/assets/Cron-DtuiCy5T.js": f54,
118
+ "/assets/JobInspector-CXzDoEVg.js": f55,
119
+ "/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f56,
120
+ "/index.html": f57,
107
121
  };
@@ -1,3 +0,0 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{m as t,t as n}from"./react-vendor-CHIHtdAC.js";import{C as r,O as i,S as a,Z as o,h as s,w as c}from"./index-BFjeS9FG.js";import{n as l,o as u,t as d}from"./form-PtDLk33Z.js";var f=e(t(),1),p=n();function m(){let{data:e}=i(()=>o.queues(),[],{intervalMs:3e4}),[t,n]=(0,f.useState)(``),[u,m]=(0,f.useState)(`{
2
- "hello": "world"
3
- }`),[g,_]=(0,f.useState)(`1`),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(``),[S,C]=(0,f.useState)(``),[w,T]=(0,f.useState)(``),[E,D]=(0,f.useState)(``),[O,k]=(0,f.useState)(``),[A,j]=(0,f.useState)(!1),[M,N]=(0,f.useState)(!1),[P,F]=(0,f.useState)(!1),[I,L]=(0,f.useState)(!1),[R,z]=(0,f.useState)(!1),[B,V]=(0,f.useState)(null),[H,U]=(0,f.useState)(null),W=e=>{let t=Number(e);return e.trim()!==``&&Number.isFinite(t)?t:void 0},G=async()=>{if(V(null),U(null),!t.trim()){V({ok:!1,msg:`Choose a queue`});return}let e;try{e=JSON.parse(u)}catch(e){U(`Invalid JSON: ${e.message}`);return}let n={data:e,priority:W(v),delay:W(b),maxAttempts:W(S),backoff:W(w),timeout:W(E),jobId:O.trim()||void 0,removeOnComplete:A||void 0,removeOnFail:M||void 0,durable:P||void 0,lifo:I||void 0},r=W(g)??1;if(!Number.isInteger(r)||r<1){V({ok:!1,msg:`Count must be an integer of at least 1`});return}if(r>1e4){V({ok:!1,msg:`Count must be 10000 or fewer`});return}z(!0);try{if(r===1)V({ok:!0,msg:`Created job ${(await o.addJob(t,n)).id}`});else{let e=await o.addJobsBulk(t,Array.from({length:r},()=>n)),i=new Set(e.ids).size;V({ok:!0,msg:`Created ${i} job${i===1?``:`s`}`})}}catch(e){V({ok:!1,msg:e.message})}finally{z(!1)}};return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(s,{title:`Add Job`,description:`Enqueue a job with full options.`}),(0,p.jsxs)(`form`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,onSubmit:e=>{e.preventDefault(),G()},children:[(0,p.jsxs)(a,{children:[(0,p.jsx)(r,{title:`Job`}),(0,p.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,p.jsxs)(d,{label:`Queue`,children:[(0,p.jsx)(l,{list:`queue-options`,value:t,onChange:e=>n(e.target.value),placeholder:`queue name (existing or new)`}),(0,p.jsx)(`datalist`,{id:`queue-options`,children:(e?.queues??[]).map(e=>(0,p.jsx)(`option`,{value:e.name},e.name))})]}),(0,p.jsxs)(`div`,{children:[(0,p.jsx)(d,{label:`Data (JSON)`,children:(0,p.jsx)(`textarea`,{value:u,onChange:e=>m(e.target.value),spellCheck:!1,rows:7,className:`w-full rounded-lg border border-line bg-surface-2 p-3 font-mono text-sm text-fg focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})}),H&&(0,p.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:H})]})]})]}),(0,p.jsxs)(a,{children:[(0,p.jsx)(r,{title:`Options`}),(0,p.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3`,children:[(0,p.jsx)(d,{label:`Priority`,children:(0,p.jsx)(l,{type:`number`,value:v,onChange:e=>y(e.target.value),placeholder:`0`})}),(0,p.jsx)(d,{label:`Delay (ms)`,children:(0,p.jsx)(l,{type:`number`,min:0,value:b,onChange:e=>x(e.target.value),placeholder:`0`})}),(0,p.jsx)(d,{label:`Max attempts`,children:(0,p.jsx)(l,{type:`number`,min:1,value:S,onChange:e=>C(e.target.value),placeholder:`3`})}),(0,p.jsx)(d,{label:`Backoff (ms)`,children:(0,p.jsx)(l,{type:`number`,min:0,value:w,onChange:e=>T(e.target.value),placeholder:`1000`})}),(0,p.jsx)(d,{label:`Timeout (ms)`,children:(0,p.jsx)(l,{type:`number`,min:0,value:E,onChange:e=>D(e.target.value),placeholder:`—`})}),(0,p.jsx)(d,{label:`Custom job ID`,children:(0,p.jsx)(l,{value:O,onChange:e=>k(e.target.value),placeholder:`idempotency key`})})]}),(0,p.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-6`,children:[(0,p.jsx)(h,{label:`removeOnComplete`,checked:A,onChange:j}),(0,p.jsx)(h,{label:`removeOnFail`,checked:M,onChange:N}),(0,p.jsx)(h,{label:`durable`,checked:P,onChange:F}),(0,p.jsx)(h,{label:`lifo`,checked:I,onChange:L})]})]}),(0,p.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3 lg:col-span-2`,children:[(0,p.jsx)(`div`,{className:`w-28`,children:(0,p.jsx)(d,{label:`Count`,children:(0,p.jsx)(l,{type:`number`,min:1,value:g,onChange:e=>_(e.target.value)})})}),(0,p.jsx)(c,{type:`submit`,variant:`accent`,disabled:R,children:R?`Adding…`:`Add job`}),B&&(0,p.jsx)(`span`,{className:B.ok?`text-sm text-success`:`text-sm text-danger`,children:B.msg})]})]})]})}function h({label:e,checked:t,onChange:n}){return(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(u,{checked:t,onChange:n,label:e}),(0,p.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:e})]})}export{m as AddJob};
@@ -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{B as i,C as a,O as o,S as s,V as c,Z as l,c as u,h as d,m as f,r as p,s as m,w as h}from"./index-BFjeS9FG.js";import{i as g,n as _,o as v,t as y}from"./form-PtDLk33Z.js";import{t as b}from"./AreaChart-DzUXW8u3.js";import{t as x}from"./CopyButton-BC6QECSJ.js";var S=e(n(),1),C={total:1e6,batch:5e3,producers:64,payload:65536,workers:64,workerBatch:1e3,processMs:6e4,durationS:600},w={queue:`benchmark`,mode:`count`,total:5e3,durationS:30,batch:100,producers:4,payload:128,workers:4,workerBatch:100,processMs:5,durable:!1,removeOnComplete:!0},T={Smoke:{mode:`count`,total:200,batch:50,producers:2,workers:1,workerBatch:50,processMs:0},Standard:{mode:`count`,total:5e3,batch:100,producers:4,workers:4,workerBatch:100,processMs:5},Stress:{mode:`count`,total:5e4,batch:500,producers:16,workers:16,workerBatch:200,processMs:0},Soak:{mode:`duration`,durationS:30,batch:100,producers:4,workers:8,workerBatch:100,processMs:10}},E=(e,t,n)=>Number.isFinite(e)?Math.max(t,Math.min(n,Math.floor(e))):t,D=(e,t)=>e.length?e[Math.min(e.length-1,Math.floor(t/100*e.length))]:0,O=(e,t,n,r,i)=>Array.from({length:t},(t,a)=>({data:{i:e+a,blob:n},durable:r,removeOnComplete:i})),k=e=>new Promise(t=>setTimeout(t,e)),A=async(e,t)=>{let n=performance.now()+e;for(;t()&&performance.now()<n;)await k(Math.min(100,Math.max(0,n-performance.now())))},j=e=>e instanceof Error?e.message:String(e),M=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:`${Math.round(e)}`,N=r();function P({history:e,onClear:t}){if(!e.length)return null;let n=JSON.stringify(e,null,2);return(0,N.jsxs)(s,{padded:!1,className:`mt-6 overflow-hidden`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-5 py-3`,children:[(0,N.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Run history`}),(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(x,{value:n}),(0,N.jsx)(h,{size:`sm`,variant:`ghost`,onClick:()=>{let e=new Blob([n],{type:`application/json`}),t=URL.createObjectURL(e),r=document.createElement(`a`);r.href=t,r.download=`benchmark-history-${Date.now()}.json`,r.click(),URL.revokeObjectURL(t)},children:`Export JSON`}),(0,N.jsx)(h,{size:`sm`,variant:`ghost`,onClick:t,children:`Clear`})]})]}),(0,N.jsx)(`div`,{className:`overflow-x-auto`,children:(0,N.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,N.jsx)(`thead`,{children:(0,N.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,N.jsx)(`th`,{className:`px-5 py-2 font-medium`,children:`Mode`}),(0,N.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Prod`}),(0,N.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Wkr`}),(0,N.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Pushed`}),(0,N.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Done`}),(0,N.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Push/s`}),(0,N.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Done/s`}),(0,N.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`p95`}),(0,N.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Dur`})]})}),(0,N.jsx)(`tbody`,{children:e.map(e=>(0,N.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,N.jsx)(`td`,{className:`px-5 py-2 capitalize text-muted`,children:e.mode}),(0,N.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-muted`,children:e.producers}),(0,N.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-muted`,children:e.workers}),(0,N.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-fg`,children:u(e.pushed)}),(0,N.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-success`,children:u(e.completed)}),(0,N.jsxs)(`td`,{className:`px-5 py-2 text-right tnum text-accent`,children:[M(e.pushPerSec),`/s`]}),(0,N.jsxs)(`td`,{className:`px-5 py-2 text-right tnum text-success`,children:[M(e.donePerSec),`/s`]}),(0,N.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-muted`,children:m(e.p95)}),(0,N.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-muted`,children:m(e.durationMs)})]},e.id))})]})})]})}var F={pushed:0,completed:0,pushFailed:0,ackFailed:0,bytes:0,elapsedMs:0,pushPerSec:0,donePerSec:0,activeWorkers:0,pushSeries:[],doneSeries:[],etaMs:null,error:null},I=()=>({pushed:0,completed:0,pushFailed:0,ackFailed:0,bytes:0,assigned:0,startedAt:0,pushLat:[],activeWorkers:0,error:null,lastAt:0,lastPushed:0,lastDone:0,pushSeries:[],doneSeries:[]}),L=0;function R(){let[e,t]=(0,S.useState)(`idle`),[n,r]=(0,S.useState)(F),[i,a]=(0,S.useState)(null),[o,s]=(0,S.useState)([]),[c,u]=(0,S.useState)(null),d=(0,S.useRef)(!1),f=(0,S.useRef)(!1),p=(0,S.useRef)(!1),m=(0,S.useRef)(null),h=(0,S.useRef)(`idle`);h.current=e;let g=(0,S.useRef)(I());return(0,S.useEffect)(()=>()=>{d.current=!0},[]),(0,S.useEffect)(()=>{if(e!==`running`&&e!==`draining`)return;let t=setInterval(()=>{let e=g.current,t=performance.now(),n=t-e.startedAt,i=(t-e.lastAt)/1e3,a=i>0?Math.max(0,(e.pushed-e.lastPushed)/i):0,o=i>0?Math.max(0,(e.completed-e.lastDone)/i):0;e.lastAt=t,e.lastPushed=e.pushed,e.lastDone=e.completed,e.pushSeries=[...e.pushSeries,a].slice(-60),e.doneSeries=[...e.doneSeries,o].slice(-60);let s=null,c=m.current;if(c&&c.mode===`count`){let t=E(c.total,1,C.total);if(h.current===`draining`){let r=e.doneSeries.slice(-10),i=r.length?r.reduce((e,t)=>e+t,0)/r.length:0;i<=0&&n>0&&(i=e.completed/(n/1e3)),i>0&&(s=Math.max(0,t-e.completed)/i*1e3)}else a>0&&(s=Math.max(0,t-e.pushed)/a*1e3)}else c&&c.mode===`duration`&&(s=Math.max(0,E(c.durationS,1,C.durationS)*1e3-n));r({pushed:e.pushed,completed:e.completed,pushFailed:e.pushFailed,ackFailed:e.ackFailed,bytes:e.bytes,elapsedMs:n,pushPerSec:a,donePerSec:o,activeWorkers:e.activeWorkers,pushSeries:e.pushSeries,doneSeries:e.doneSeries,etaMs:s,error:e.error})},200);return()=>clearInterval(t)},[e]),{phase:e,live:n,summary:i,history:o,runCfg:c,run:async e=>{if(!f.current){f.current=!0;try{a(null);let n=e.queue.trim();if(!n){r({...F,error:`Queue name is required.`}),t(`error`);return}try{await l.overview()}catch(e){r({...F,error:`Server unreachable — start it on the Server page first. (${j(e)})`}),t(`error`);return}let i=E(e.total,1,C.total),o=E(e.durationS,1,C.durationS)*1e3,c=E(e.batch,1,C.batch),f=E(e.producers,e.mode===`duration`?0:1,C.producers),_=E(e.payload,0,C.payload),v=E(e.workers,0,C.workers),y=E(e.workerBatch,1,C.workerBatch),b=E(e.processMs,0,C.processMs);d.current=!1,p.current=!1,m.current=e,u(e),g.current=I(),g.current.startedAt=performance.now(),g.current.lastAt=performance.now(),r({...F}),t(`running`);let x=`x`.repeat(_),S=performance.now()+o,w=async()=>{for(;!d.current;){let t;if(e.mode===`count`){if(g.current.assigned>=i)break;t=Math.min(c,i-g.current.assigned)}else{if(performance.now()>=S)break;t=c}let r=g.current.assigned;g.current.assigned+=t;let a=O(r,t,x,e.durable,e.removeOnComplete),o=performance.now();try{await l.addJobsBulk(n,a),g.current.pushed+=t,g.current.bytes+=t*_}catch(e){g.current.pushFailed+=t,g.current.error??=j(e)}g.current.pushLat.push(performance.now()-o)}},T=async()=>{for(;!d.current&&!(e.mode===`duration`&&performance.now()>=S||e.mode===`count`&&g.current.completed>=i);){g.current.activeWorkers++;let t=[];try{try{t=(await l.pullBatch(n,y)).jobs??[]}catch(e){g.current.error??=j(e)}if(t.length>0){b>0&&await A(b,()=>!d.current);try{await l.ackBatch(t.map(e=>e.id)),g.current.completed+=t.length}catch(e){g.current.ackFailed+=t.length,g.current.error??=j(e)}}}finally{g.current.activeWorkers--}if(t.length===0){if(e.mode===`count`&&p.current)break;await k(50)}}},M=Array.from({length:f},w),N=Array.from({length:v},T),P=Promise.all(M).then(()=>{p.current=!0,!d.current&&e.mode===`count`&&v>0&&h.current===`running`&&t(`draining`)});await Promise.all([P,...N]);let R=g.current,z=performance.now()-R.startedAt,B=z/1e3||1,V=[...R.pushLat].sort((e,t)=>e-t),H={pushed:R.pushed,completed:R.completed,pushFailed:R.pushFailed,ackFailed:R.ackFailed,bytes:R.bytes,durationMs:z,pushPerSec:R.pushed/B,donePerSec:R.completed/B,mbPerSec:R.bytes/B,avg:V.length?V.reduce((e,t)=>e+t,0)/V.length:0,p50:D(V,50),p95:D(V,95),p99:D(V,99),max:V.length?V[V.length-1]:0,error:R.error};a(H),r(e=>({...e,pushed:R.pushed,completed:R.completed,elapsedMs:z,pushPerSec:0,donePerSec:0,activeWorkers:0,etaMs:0})),s(t=>[{...H,id:++L,at:Date.now(),mode:e.mode,producers:f,workers:v},...t].slice(0,12)),t(d.current?`stopped`:`done`)}finally{f.current=!1}}},stop:()=>{d.current=!0,(h.current===`running`||h.current===`draining`)&&t(`stopping`)},reset:()=>{d.current=!0,a(null),r(F),t(`idle`)},clearHistory:()=>s([])}}var z=[`count`,`duration`],B=[`total`,`durationS`,`batch`,`producers`,`payload`,`workers`,`workerBatch`,`processMs`],V=e=>({...e,total:String(e.total),durationS:String(e.durationS),batch:String(e.batch),producers:String(e.producers),payload:String(e.payload),workers:String(e.workers),workerBatch:String(e.workerBatch),processMs:String(e.processMs)}),H=e=>({...e,total:Number(e.total),durationS:Number(e.durationS),batch:Number(e.batch),producers:Number(e.producers),payload:Number(e.payload),workers:Number(e.workers),workerBatch:Number(e.workerBatch),processMs:Number(e.processMs)});function U(){let[e,n]=(0,S.useState)(()=>V(w)),r=R(),{phase:x,live:D,summary:O,history:k}=r,A=x===`running`||x===`draining`||x===`stopping`,j=(e,t)=>n(n=>({...n,[e]:t})),F=e=>t=>j(e,t.target.value),I=e=>n(t=>{let n={...t};for(let[t,r]of Object.entries(e))n[t]=B.includes(t)?String(r):r;return n}),[L,U]=(0,S.useState)(w.queue);(0,S.useEffect)(()=>{let t=setTimeout(()=>U(e.queue.trim()||w.queue),400);return()=>clearTimeout(t)},[e.queue]);let{data:ee,error:te}=o(()=>l.counts(L),[L],{intervalMs:1e3}),K=ee?.counts??null,[q,J]=(0,S.useState)(!1),[Y,X]=(0,S.useState)(null),ne=async()=>{let t=e.queue.trim();if(!(q||!t||!window.confirm(`Remove benchmark jobs from "${t}"?`))){J(!0),X(null);try{let e=null;for(let n of[`waiting`,`completed`,`failed`,`delayed`])try{await l.clean(t,{state:n,limit:C.total})}catch(t){e=t.message}let n=await l.counts(t).catch(t=>(e=t.message,null));X(n==null?{error:e??`server unreachable — could not verify`}:{remaining:n.counts?.active??0})}finally{J(!1)}}},Z=r.runCfg??H(e),Q=E(Z.total,1,C.total),$=E(Z.workers,0,C.workers),re=Z.mode===`count`&&(A||O)?Math.min(100,D.pushed/Q*100):0,ie=Z.mode===`count`&&(A||O)?Math.min(100,D.completed/Q*100):0,ae=Z.mode===`duration`?Math.min(100,D.elapsedMs/(E(Z.durationS,1,C.durationS)*1e3)*100):0,oe=x===`running`?Z.mode===`duration`?`Running…`:`Producing…`:x===`draining`?`Draining…`:x===`stopping`?`Stopping…`:x===`error`?`Error`:O?`Result`:`Ready`,se=(x===`running`||x===`draining`)&&D.etaMs!=null?D.etaMs>0?`ETA ${m(D.etaMs)}`:`finishing…`:x===`stopped`?`stopped early`:x===`done`?`complete`:``;return(0,N.jsxs)(`div`,{children:[(0,N.jsx)(d,{title:`Benchmark`,description:`Drive real load against the server — producers bulk-enqueue jobs while simulated workers pull, process and ack them. Throughput is measured client-side; the queue genuinely fills and drains.`,actions:x===`stopping`?(0,N.jsxs)(h,{variant:`warning`,size:`sm`,disabled:!0,children:[(0,N.jsx)(i,{className:`size-3.5`}),` Stopping…`]}):A?(0,N.jsxs)(h,{variant:`warning`,size:`sm`,onClick:r.stop,children:[(0,N.jsx)(i,{className:`size-3.5`}),` Stop`]}):(0,N.jsxs)(h,{variant:`success`,size:`sm`,onClick:()=>r.run(H(e)),children:[(0,N.jsx)(c,{className:`size-3.5`}),` Run benchmark`]})}),D.error&&(0,N.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.error}),(0,N.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-wider text-faint`,children:`Presets`}),Object.keys(T).map(e=>(0,N.jsx)(`button`,{type:`button`,disabled:A,onClick:()=>I(T[e]),className:`rounded-md border border-line bg-surface-2 px-2.5 py-1 text-xs text-muted transition-colors hover:border-line-strong hover:text-fg disabled:opacity-40`,children:e},e))]}),(0,N.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-3`,children:[(0,N.jsxs)(s,{className:`lg:col-span-1`,children:[(0,N.jsx)(a,{title:`Configuration`}),(0,N.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,N.jsx)(y,{label:`Queue`,hint:`Jobs are enqueued here (created on first push).`,children:(0,N.jsx)(_,{value:e.queue,disabled:A,onChange:e=>j(`queue`,e.target.value)})}),(0,N.jsx)(y,{label:`Mode`,hint:e.mode===`count`?`Push a fixed number of jobs.`:`Run producers + workers for a fixed time.`,children:(0,N.jsx)(g,{options:z,value:e.mode,onChange:e=>j(`mode`,e),disabled:A})}),e.mode===`count`?(0,N.jsx)(y,{label:`Total jobs`,hint:`max ${u(C.total)}`,children:(0,N.jsx)(_,{type:`number`,min:1,max:C.total,value:e.total,disabled:A,onChange:F(`total`)})}):(0,N.jsx)(y,{label:`Duration (s)`,hint:`max ${C.durationS}s`,children:(0,N.jsx)(_,{type:`number`,min:1,max:C.durationS,value:e.durationS,disabled:A,onChange:F(`durationS`)})}),(0,N.jsx)(`div`,{className:`mt-1 text-[11px] font-semibold uppercase tracking-wider text-faint`,children:`Producers`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,N.jsx)(y,{label:`Producers`,hint:`parallel, max ${C.producers}`,children:(0,N.jsx)(_,{type:`number`,min:e.mode===`duration`?0:1,max:C.producers,value:e.producers,disabled:A,onChange:F(`producers`)})}),(0,N.jsx)(y,{label:`Push batch`,hint:`jobs/req, max ${C.batch}`,children:(0,N.jsx)(_,{type:`number`,min:1,max:C.batch,value:e.batch,disabled:A,onChange:F(`batch`)})}),(0,N.jsx)(y,{label:`Payload`,hint:`bytes/job, max ${u(C.payload)}`,children:(0,N.jsx)(_,{type:`number`,min:0,max:C.payload,value:e.payload,disabled:A,onChange:F(`payload`)})})]}),(0,N.jsx)(`div`,{className:`mt-1 text-[11px] font-semibold uppercase tracking-wider text-faint`,children:`Workers (simulated)`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,N.jsx)(y,{label:`Workers`,hint:`0 = produce only, max ${C.workers}`,children:(0,N.jsx)(_,{type:`number`,min:0,max:C.workers,value:e.workers,disabled:A,onChange:F(`workers`)})}),(0,N.jsx)(y,{label:`Pull batch`,hint:`jobs/pull, max ${C.workerBatch}`,children:(0,N.jsx)(_,{type:`number`,min:1,max:C.workerBatch,value:e.workerBatch,disabled:A,onChange:F(`workerBatch`)})}),(0,N.jsx)(y,{label:`Process (ms)`,hint:`simulated work per pull`,children:(0,N.jsx)(_,{type:`number`,min:0,max:C.processMs,value:e.processMs,disabled:A,onChange:F(`processMs`)})})]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,N.jsx)(v,{checked:e.durable,onChange:e=>j(`durable`,e),disabled:A}),(0,N.jsx)(`span`,{className:`text-sm text-muted`,children:`Durable (fsync each job)`})]}),(0,N.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,N.jsx)(v,{checked:e.removeOnComplete,onChange:e=>j(`removeOnComplete`,e),disabled:A}),(0,N.jsx)(`span`,{className:`text-sm text-muted`,children:`Remove on complete`})]}),(0,N.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,N.jsx)(h,{variant:`ghost`,size:`sm`,disabled:A||q,onClick:ne,children:q?`Cleaning…`:`Clean queue`}),Y&&(`error`in Y?(0,N.jsxs)(`span`,{className:`text-xs text-danger`,children:[`Clean unverified — `,Y.error]}):(0,N.jsx)(`span`,{className:t(`text-xs`,Y.remaining>0?`text-warning`:`text-success`),children:Y.remaining>0?`Cleaned — ${u(Y.remaining)} active job(s) remain (requeued after the stall timeout)`:`Cleaned — 0 jobs remain`}))]})]})]}),(0,N.jsxs)(`div`,{className:`flex flex-col gap-6 lg:col-span-2`,children:[(0,N.jsxs)(s,{children:[(0,N.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,N.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:oe}),(0,N.jsx)(`span`,{className:`text-xs text-faint`,children:se})]}),(0,N.jsx)(W,{label:Z.mode===`duration`?`Elapsed`:`Produced`,pct:Z.mode===`duration`?ae:re,tone:`accent`}),$>0&&Z.mode===`count`&&(0,N.jsx)(W,{label:`Completed`,pct:ie,tone:`emerald`}),(0,N.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,N.jsx)(f,{label:`Pushed`,value:u(D.pushed),tone:`accent`,compact:!0}),(0,N.jsx)(f,{label:`Completed`,value:u(D.completed),tone:`green`,compact:!0}),(0,N.jsx)(f,{label:`Push/sec`,value:M(D.pushPerSec),compact:!0}),(0,N.jsx)(f,{label:`Done/sec`,value:M(D.donePerSec),tone:`green`,compact:!0}),(0,N.jsx)(f,{label:`Elapsed`,value:m(D.elapsedMs),compact:!0}),(0,N.jsx)(f,{label:`Active workers`,value:`${D.activeWorkers}/${$}`,tone:`blue`,compact:!0}),(0,N.jsx)(f,{label:`Data`,value:p(O?.bytes??D.bytes),compact:!0}),(0,N.jsx)(f,{label:`Errors`,value:u((O?.pushFailed??D.pushFailed)+(O?.ackFailed??D.ackFailed)),tone:D.pushFailed+D.ackFailed?`red`:`default`,compact:!0})]})]}),(0,N.jsxs)(s,{children:[(0,N.jsx)(a,{title:`Throughput`}),(0,N.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Enqueue (client → server) vs completion (workers) per second`}),(0,N.jsx)(b,{series:[{label:`Push/sec`,color:`#38bdf8`,points:D.pushSeries,area:!0},{label:`Done/sec`,color:`#34d399`,points:D.doneSeries,area:!0}]}),(0,N.jsxs)(`div`,{className:`mt-2 flex items-center gap-4 font-mono text-[11px] text-faint`,children:[(0,N.jsx)(G,{color:`#38bdf8`,label:`Push/sec`,value:D.pushPerSec}),(0,N.jsx)(G,{color:`#34d399`,label:`Done/sec`,value:D.donePerSec})]})]})]})]}),O&&(0,N.jsxs)(s,{className:`mt-6`,children:[(0,N.jsx)(a,{title:`Summary`}),(0,N.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4 xl:grid-cols-8`,children:[(0,N.jsx)(f,{label:`Pushed`,value:u(O.pushed),tone:`accent`,compact:!0}),(0,N.jsx)(f,{label:`Completed`,value:u(O.completed),tone:`green`,compact:!0}),(0,N.jsx)(f,{label:`Duration`,value:m(O.durationMs),compact:!0}),(0,N.jsx)(f,{label:`Avg push/s`,value:M(O.pushPerSec),tone:`accent`,compact:!0}),(0,N.jsx)(f,{label:`Avg done/s`,value:M(O.donePerSec),tone:`green`,compact:!0}),(0,N.jsx)(f,{label:`Data rate`,value:`${p(O.mbPerSec)}/s`,compact:!0}),(0,N.jsx)(f,{label:`Push p95`,value:m(O.p95),compact:!0}),(0,N.jsx)(f,{label:`Push p99`,value:m(O.p99),compact:!0})]}),(0,N.jsxs)(`p`,{className:`mt-3 text-xs text-faint`,children:[`Push-batch latency avg `,m(O.avg),` · p50 `,m(O.p50),` · p95`,` `,m(O.p95),` · p99 `,m(O.p99),` · max `,m(O.max),`.`,O.error?` First error: ${O.error}`:``]})]}),(0,N.jsxs)(s,{className:`mt-6`,children:[(0,N.jsx)(a,{title:`Server queue: ${L}`,action:te?(0,N.jsx)(`span`,{className:`text-xs font-medium text-warning`,children:`stale — server unreachable`}):void 0}),(0,N.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Live counts from the server (poll 1s).`}),K?(0,N.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-5`,children:[(0,N.jsx)(f,{label:`Waiting`,value:u(K.waiting??0),tone:`amber`,compact:!0}),(0,N.jsx)(f,{label:`Active`,value:u(K.active??0),tone:`blue`,compact:!0}),(0,N.jsx)(f,{label:`Completed`,value:u(K.completed??0),tone:`green`,compact:!0}),(0,N.jsx)(f,{label:`Failed`,value:u(K.failed??0),tone:K.failed?`red`:`default`,compact:!0}),(0,N.jsx)(f,{label:`Delayed`,value:u(K.delayed??0),compact:!0})]}):(0,N.jsx)(`p`,{className:`text-sm text-faint`,children:`No counts yet — waiting for the server to answer for this queue.`})]}),(0,N.jsx)(P,{history:k,onClear:r.clearHistory})]})}function W({label:e,pct:n,tone:r}){return(0,N.jsxs)(`div`,{className:`mb-2`,children:[(0,N.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-[11px] text-faint`,children:[(0,N.jsx)(`span`,{children:e}),(0,N.jsxs)(`span`,{className:`tnum`,children:[n.toFixed(0),`%`]})]}),(0,N.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-surface-2`,children:(0,N.jsx)(`div`,{className:t(`h-full rounded-full transition-all`,r===`accent`?`bg-accent`:`bg-emerald-500`),style:{width:`${n}%`}})})]})}function G({color:e,label:t,value:n}){return(0,N.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,N.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:e}}),t,` `,(0,N.jsxs)(`span`,{className:`text-fg`,children:[M(n),`/s`]})]})}export{U as Benchmark};
@@ -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{C as r,F as i,K as a,O as o,S as s,T as c,Z as l,a as u,b as d,c as f,h as p,w as m,x as h,y as g}from"./index-BFjeS9FG.js";import{i as _,n as v,t as y}from"./form-PtDLk33Z.js";import{t as b}from"./Pagination-Bj1z6OlD.js";var x=e(t(),1),S=n();function C(){let{data:e,error:t,loading:n,refetch:m}=o(()=>l.crons(),[]),_=e?.crons??[],[v,y]=(0,x.useState)(0),C=Math.max(1,Math.ceil(_.length/15)),T=Math.min(v,C-1),[E,D]=(0,x.useState)(null),O=async e=>{if(window.confirm(`Delete cron "${e}"?`)){D(null);try{await l.deleteCron(e),m()}catch(e){D(e.message)}}};return(0,S.jsxs)(`div`,{children:[t&&(0,S.jsx)(h,{onRetry:m}),(0,S.jsx)(p,{title:`Cron Manager`,description:`Schedule and manage repeatable jobs.`,live:!0}),E&&(0,S.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:E}),(0,S.jsxs)(s,{className:`mb-6`,children:[(0,S.jsx)(r,{title:`Create schedule`}),(0,S.jsx)(w,{onCreate:async e=>{await l.createCron(e),m()}})]}),n&&!e&&!t?(0,S.jsx)(d,{label:`Loading crons…`}):_.length===0?(0,S.jsx)(g,{icon:(0,S.jsx)(i,{}),title:`No scheduled jobs`,hint:`Create one above.`}):(0,S.jsxs)(S.Fragment,{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-5 py-3 font-medium`,children:`Name`}),(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:`Schedule`}),(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Next Run`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Runs`}),(0,S.jsx)(`th`,{className:`w-12 px-5 py-3`})]})}),(0,S.jsx)(`tbody`,{children:_.slice(T*15,T*15+15).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-medium text-fg`,children:e.name}),(0,S.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queue}),(0,S.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.schedule??(e.repeatEvery?`every ${e.repeatEvery}ms`:`—`)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-faint`,children:u(e.nextRun)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:f(e.executions)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,S.jsx)(c,{"aria-label":`Delete cron`,onClick:()=>O(e.name),children:(0,S.jsx)(a,{className:`size-3.5`})})})]},e.name))})]})}),(0,S.jsx)(b,{page:T,pageSize:15,total:_.length,onPageChange:y,label:`crons`})]})]})}function w({onCreate:e}){let[t,n]=(0,x.useState)(``),[r,i]=(0,x.useState)(``),[a,o]=(0,x.useState)(`cron`),[s,c]=(0,x.useState)(``),[l,u]=(0,x.useState)(``),[d,f]=(0,x.useState)(`{}`),[p,h]=(0,x.useState)(null),[g,b]=(0,x.useState)(!1),[C,w]=(0,x.useState)(!1),T=async()=>{if(g)return;if(h(null),w(!1),!t.trim()||!r.trim()){h(`Name and queue are required`);return}let i={};try{i=d.trim()?JSON.parse(d):{}}catch{h(`Data is not valid JSON`);return}let o={name:t,queue:r,data:i};if(a===`cron`){if(!s.trim()){h(`Cron expression required`);return}o.schedule=s.trim()}else{let e=Number(l);if(!Number.isInteger(e)||e<=0){h(`Interval must be a whole number of milliseconds greater than 0`);return}o.repeatEvery=e}b(!0);try{await e(o),n(``),c(``),u(``),w(!0),setTimeout(()=>w(!1),3e3)}catch(e){h(e.message)}finally{b(!1)}};return(0,S.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),T()},children:[(0,S.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,S.jsx)(y,{label:`Name`,children:(0,S.jsx)(v,{value:t,onChange:e=>n(e.target.value),placeholder:`daily-report`})}),(0,S.jsx)(y,{label:`Queue`,children:(0,S.jsx)(v,{value:r,onChange:e=>i(e.target.value),placeholder:`reports`})})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,S.jsx)(_,{options:[`cron`,`every`],value:a,onChange:o}),a===`cron`?(0,S.jsx)(`div`,{className:`min-w-56 flex-1`,children:(0,S.jsx)(y,{label:`Cron expression`,children:(0,S.jsx)(v,{value:s,onChange:e=>c(e.target.value),placeholder:`0 9 * * *`})})}):(0,S.jsx)(`div`,{className:`w-40`,children:(0,S.jsx)(y,{label:`Every (ms)`,children:(0,S.jsx)(v,{type:`number`,value:l,onChange:e=>u(e.target.value),placeholder:`30000`})})})]}),(0,S.jsx)(y,{label:`Data (JSON)`,children:(0,S.jsx)(v,{value:d,onChange:e=>f(e.target.value),className:`font-mono`})}),(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(m,{type:`submit`,variant:`accent`,size:`sm`,disabled:g,children:g?`Creating…`:`Create`}),p&&(0,S.jsx)(`span`,{className:`text-xs text-danger`,children:p}),C&&(0,S.jsx)(`span`,{className:`text-xs text-success`,children:`Cron created ✓`})]})]})}export{C as CronManager};
@@ -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,G as a,N as o,O as s,S as c,Y as l,Z as u,b as d,c as f,h as p,m,r as h,w as g,x as _,y as v}from"./index-BFjeS9FG.js";import{a as y}from"./form-PtDLk33Z.js";import{t as ee}from"./Pagination-Bj1z6OlD.js";import{t as b}from"./CopyButton-BC6QECSJ.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(()=>u.db.tables(),[],{intervalMs:1e4}),B=(0,x.useMemo)(()=>P?.tables??[],[P]),V=I instanceof l&&I.status===404,{data:H}=s(()=>V?Promise.resolve(null):u.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?u.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 u.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 u.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 ${f(e.length)} rows (export cap reached)`:`Exported ${f(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:f(H.tables),compact:!0}),(0,S.jsx)(m,{label:`Indexes`,value:f(H.indexes),compact:!0})]}),V?(0,S.jsx)(v,{title:`No database yet`,hint:I.message}):re&&B.length===0?(0,S.jsx)(d,{label:`Reading database…`}):(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-4`,children:[(0,S.jsxs)(c,{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:f(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?` (${f(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)(d,{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)(d,{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 u.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)(c,{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)(c,{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),[l,d]=(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 u.db.query(t);if(i!==h.current)return;m(r),n&&d(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)(c,{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.`}),l.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`}),l.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([]),d([])},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?`≥ `:``,f(p.rowCount),` row`,p.rowCount===1?``:`s`,` ·`,` `,f(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{C as r,O as i,S as a,Z as o,b as s,c,d as l,h as u,m as d,r as f,w as p,x as m}from"./index-BFjeS9FG.js";var h=e(t(),1),g=n(),_={health:{},storage:null,stats:null};function v(){let{data:e,error:t,loading:n,refetch:v}=i(async()=>{let[e,t,n]=await Promise.all([o.health(),o.storage().catch(()=>null),o.stats().catch(()=>null)]);return{health:e,storage:t,stats:n}},[]),[x,S]=(0,h.useState)(null),C=async()=>{S(`…`);let e=performance.now();try{await o.ping(),S(`${Math.round(performance.now()-e)} ms`)}catch{S(`unreachable`)}};if(n&&!e&&!t)return(0,g.jsx)(s,{label:`Loading diagnostics…`});let w=e??_,T=w.health,E=w.storage?.data,D=w.stats?.stats;return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(u,{title:`Diagnostics`,description:`Server health, storage, memory and connections.`,live:!t}),t&&(0,g.jsx)(m,{onRetry:v}),(0,g.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,g.jsx)(d,{label:`Status`,value:T.status??(T.ok?`healthy`:`degraded`),tone:T.ok?`green`:`red`,compact:!0}),(0,g.jsx)(d,{label:`Version`,value:T.version?`v${T.version}`:`—`,compact:!0}),(0,g.jsx)(d,{label:`Uptime`,value:l(T.uptime),compact:!0}),(0,g.jsx)(d,{label:`Disk`,value:E?.diskFull?`Full`:`Healthy`,tone:E?.diskFull?`red`:`green`,compact:!0})]}),(0,g.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,g.jsxs)(a,{children:[(0,g.jsx)(r,{title:`Connectivity`,action:(0,g.jsxs)(p,{size:`sm`,onClick:C,children:[`Ping`,x?` · ${x}`:``]})}),(0,g.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,g.jsx)(y,{k:`WebSocket clients`,v:String(T.connections?.ws??0)}),(0,g.jsx)(y,{k:`SSE clients`,v:String(T.connections?.sse??0)}),(0,g.jsx)(y,{k:`Storage error`,v:E?.error?String(E.error):`none`})]})]}),(0,g.jsxs)(a,{children:[(0,g.jsx)(r,{title:`Memory`}),(0,g.jsxs)(`div`,{className:`grid grid-cols-3 gap-4`,children:[(0,g.jsx)(b,{k:`Heap used`,v:f((T.memory?.heapUsed??0)*1024*1024)}),(0,g.jsx)(b,{k:`Heap total`,v:f((T.memory?.heapTotal??0)*1024*1024)}),(0,g.jsx)(b,{k:`RSS`,v:f((T.memory?.rss??0)*1024*1024)})]})]})]}),D&&(0,g.jsxs)(a,{className:`mt-6`,children:[(0,g.jsx)(r,{title:`Totals since restart`}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,g.jsx)(b,{k:`Pushed`,v:c(D.totalPushed)}),(0,g.jsx)(b,{k:`Pulled`,v:c(D.totalPulled)}),(0,g.jsx)(b,{k:`Completed`,v:c(D.totalCompleted)}),(0,g.jsx)(b,{k:`Failed`,v:c(D.totalFailed)})]})]})]})}function y({k:e,v:t}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,g.jsx)(`dt`,{className:`text-muted`,children:e}),(0,g.jsx)(`dd`,{className:`font-medium text-fg`,children:t})]})}function b({k:e,v:t}){return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:e}),(0,g.jsx)(`div`,{className:`mt-1 text-lg font-semibold tnum text-fg`,children:t})]})}export{v as Diagnostics};
@@ -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,U as o,Z as s,b as c,c as l,h as u,m as d,u as f,w as p,x as m,y as h}from"./index-BFjeS9FG.js";import{a as g}from"./form-PtDLk33Z.js";import{t as _}from"./Pagination-Bj1z6OlD.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(()=>s.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 s.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} ${l(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`,()=>s.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`,()=>s.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:l(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)(c,{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`,()=>s.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,O as o,S as s,T as c,U as l,Z as u,b as d,c as f,h as p,u as m,w as h,x as g,y as _}from"./index-BFjeS9FG.js";import{a as v}from"./form-PtDLk33Z.js";import{t as y}from"./Pagination-Bj1z6OlD.js";var b=e(n(),1),x=i(),S=25;function C(){let[e,n]=(0,b.useState)(``),[i,C]=(0,b.useState)(`all`),[w,T]=(0,b.useState)(`newest`),[E,D]=(0,b.useState)(``),[O,k]=(0,b.useState)(0),[A,j]=(0,b.useState)(!1),[M,N]=(0,b.useState)(null),{data:P,refetch:F}=o(()=>u.queues(),[],{intervalMs:1e4}),I=P?.queues??[],L=I.reduce((e,t)=>e+t.dlq,0),{data:R,error:z,loading:B,refetch:V}=o((0,b.useCallback)(async()=>{if(!e)return{queue:e,page:O,entries:[],entriesTotal:0,stats:null};let[t,n]=await Promise.all([u.dlq(e,S,O*S),u.dlqStats(e).catch(()=>null)]);return{queue:e,page:O,entries:t.entries??[],entriesTotal:t.total??0,stats:n?.stats??null}},[e,O]),[e,O]),H=R&&R.queue===e&&R.page===O?R:null;(0,b.useEffect)(()=>{if(!H)return;let e=H.entriesTotal??0;O>0&&O*S>=e&&k(Math.max(0,Math.ceil(e/S)-1))},[H,O]);let U=async(e,t,n)=>{if(window.confirm(e)){j(!0),N(null);try{let e=(await n())?.count??0;N({ok:!0,text:`${t} ${f(e)} ${e===1?`entry`:`entries`}`}),V(),F()}catch(e){N({ok:!1,text:e.message})}finally{j(!1)}}},W=e=>{Y.current=!0,n(e),k(0),C(`all`)},G=H?.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)(()=>I.filter(e=>e.dlq>0).sort((e,t)=>t.dlq-e.dlq),[I]),Y=(0,b.useRef)(!1);(0,b.useEffect)(()=>{Y.current||e||J.length===0||(Y.current=!0,n(J[0].name),k(0),C(`all`))},[e,J]);let X=(0,b.useMemo)(()=>{let e=H?.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)=>w===`newest`?t.enteredAt-e.enteredAt:e.enteredAt-t.enteredAt)},[H,i,E,w]),Z=L===0,Q=i!==`all`||E.trim()!==``,$=(H?.entriesTotal??0)>S;return(0,x.jsxs)(`div`,{children:[(0,x.jsx)(p,{title:`Dead Letter Queue`,description:`Jobs that failed after exhausting all retries. Monitor, retry, or purge.`,live:!0}),z&&(0,x.jsx)(g,{onRetry:V}),(0,x.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,x.jsxs)(s,{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:f(L)})]}),(0,x.jsxs)(s,{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)(s,{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:H?.stats?f(H.stats.pendingRetry??0):`—`}),(0,x.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:e?`in this queue`:`awaiting retry`})]}),(0,x.jsxs)(s,{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:H?.stats?f(K.length):`—`}),(0,x.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`distinct reasons`})]})]}),J.length>0&&(0,x.jsxs)(s,{className:`mb-6`,children:[(0,x.jsx)(`div`,{className:`mb-3 text-[11px] font-medium uppercase tracking-wider text-faint`,children:`DLQ by queue`}),(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)(v,{value:e,onChange:e=>W(e.target.value),children:[(0,x.jsx)(`option`,{value:``,children:`Select a queue…`}),I.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)(v,{value:i,onChange:e=>C(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)(v,{value:w,onChange:e=>T(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=>D(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||A,onClick:()=>U(`Retry all for "${e}"?`,`Retried`,()=>u.retryDlq(e)),children:[(0,x.jsx)(l,{className:`size-3.5`}),` Retry All`]}),(0,x.jsx)(h,{variant:`danger`,size:`sm`,disabled:!e||A,onClick:()=>U(`Purge all for "${e}"?`,`Purged`,()=>u.purgeDlq(e)),children:`Purge All`})]}),M&&(0,x.jsx)(`div`,{className:t(`mb-3 text-sm`,M.ok?`text-success`:`text-danger`),children:M.text}),B&&!H&&!z?(0,x.jsx)(d,{label:`Loading DLQ…`}):e?X.length===0?(0,x.jsx)(_,{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)(c,{"aria-label":`Retry`,disabled:A,onClick:()=>U(`Retry job ${t.job.id.slice(0,8)}… from "${e}"?`,`Retried`,()=>u.retryDlq(e,t.job.id)),children:(0,x.jsx)(l,{className:`size-3.5`})})})]},`${t.job.id}-${t.enteredAt}`))})]})}):(0,x.jsx)(_,{icon:(0,x.jsx)(a,{}),title:`Select a queue`,hint:`Choose a queue from the dropdown to view its dead letter queue entries.`}),e&&H&&(0,x.jsx)(y,{page:O,pageSize:S,total:H.entriesTotal,onPageChange:k,label:`entries`})]})}export{C as DlqPro};
@@ -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{S as o,Z as s,b as c,h as l,v as u,x as d}from"./index-BFjeS9FG.js";var f=e(r(),1),p={nodeWidth:168,nodeHeight:60,colGap:72,rowGap:20,padding:24};function m(e,t){let n=new Map,r=new Map,i=new Map;for(let t of e)n.set(t,0),r.set(t,0),i.set(t,[]);for(let e of t)!n.has(e.from)||!n.has(e.to)||e.from===e.to||(i.get(e.from)?.push(e.to),r.set(e.to,(r.get(e.to)??0)+1));let a=e.filter(e=>(r.get(e)??0)===0),o=0;for(;a.length;){let s=a.shift();o+=1;for(let e of i.get(s)??[]){n.set(e,Math.max(n.get(e)??0,(n.get(s)??0)+1));let t=(r.get(e)??0)-1;r.set(e,t),t===0&&a.push(e)}if(o>e.length+t.length)break}return n}function h(e,t,n={}){let r={...p,...n},i=m(e,t),a=new Map,o=0;for(let t of e){let e=i.get(t)??0;o=Math.max(o,e);let n=a.get(e);n?n.push(t):a.set(e,[t])}let s=0;for(let e of a.values())s=Math.max(s,e.length);let c=s*r.nodeHeight+Math.max(0,s-1)*r.rowGap,l=[];for(let e=0;e<=o;e++){let t=a.get(e)??[],n=t.length*r.nodeHeight+Math.max(0,t.length-1)*r.rowGap,i=r.padding+(c-n)/2;t.forEach((t,n)=>{l.push({id:t,layer:e,x:r.padding+e*(r.nodeWidth+r.colGap),y:i+n*(r.nodeHeight+r.rowGap)})})}return{nodes:l,width:r.padding*2+(o+1)*r.nodeWidth+o*r.colGap,height:r.padding*2+c}}var g=a(),_=168,v=60,y={nodeWidth:_,nodeHeight:v},b=60,x=6,S=`flow-order-9a3f`,C={completed:`border-success/50 bg-success/10 text-success`,failed:`border-danger/50 bg-danger/10 text-danger`,active:`border-blue-400/60 bg-blue-400/10 text-blue-400`,delayed:`border-accent/50 bg-accent/10 text-accent`,waiting:`border-warning/50 bg-warning/10 text-warning`,prioritized:`border-warning/50 bg-warning/10 text-warning`},w=e=>e&&C[e]||`border-line bg-surface-2 text-muted`,T=e=>e.length>12?`${e.slice(0,6)}…${e.slice(-4)}`:e,E=`bq-dash-recent-flows`,D=8;function O(){try{let e=JSON.parse(localStorage.getItem(E)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e?.root==`string`&&typeof e?.nodes==`number`&&typeof e?.at==`number`):[]}catch{return[]}}function k(e,t){let n=[t,...e.filter(e=>e.root!==t.root)].slice(0,D);try{localStorage.setItem(E,JSON.stringify(n))}catch{}return n}async function A(e){let t=e,n=new Set([e]);for(let e=0;e<12;e++){try{let{job:e}=await s.job(t),r=e?.parentId;if(r&&!n.has(r)){n.add(r),t=r;continue}}catch{}break}return t}async function j(e){let t=new Map,n=[],r=new Set,i=[{id:e,depth:0}];for(;i.length&&t.size<b;){let{id:e,depth:a}=i.shift();if(t.has(e))continue;let o=null;try{o=(await s.job(e)).job??null}catch{}if(t.set(e,o??{id:e,state:`unknown`}),!o||a>=x)continue;let c=(e,t,o,s)=>{let c=`${e}->${t}:${o}`;r.has(c)||(r.add(c),n.push({from:e,to:t,kind:o})),i.push({id:s,depth:a+1})};for(let t of o.childrenIds??[])c(e,t,`child`,t);for(let t of o.dependsOn??[])c(t,e,`depends`,t)}return{jobs:t,edges:n}}function M(e,t,n,r){let i=(e+n)/2;return`M${e},${t} C${i},${t} ${i},${r} ${n},${r}`}function N(){let[e,r]=n(),a=e.get(`root`)??(u()?S:``),[s,p]=(0,f.useState)(a),[m,x]=(0,f.useState)(null),[C,E]=(0,f.useState)(null),[D,N]=(0,f.useState)(!1),[F,I]=(0,f.useState)(null),[L,R]=(0,f.useState)(O),z=(0,f.useRef)(0),B=(0,f.useCallback)(async e=>{let t=e.trim();if(!t){x(null);return}let n=++z.current;N(!0),I(null);try{let e=await A(t),r=await j(e);if(n!==z.current)return;x(r),E(e),r.jobs.size>1&&R(t=>k(t,{root:e,nodes:r.jobs.size,at:Date.now()}))}catch(e){if(n!==z.current)return;I(e.message||`Failed to load flow`),x(null)}finally{n===z.current&&N(!1)}},[]);(0,f.useEffect)(()=>{a&&B(a)},[a,B]);let V=e=>{e.preventDefault();let t=s.trim();t&&r(t?{root:t}:{},{replace:!0})},H=m?h([...m.jobs.keys()],m.edges,y):null,U=new Map(H?.nodes.map(e=>[e.id,e])??[]),W=C?m?.jobs.get(C):void 0;return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(l,{title:`Flows`,description:`Visualize a job flow: parent, children, and dependency edges as an interactive graph.`,actions:m&&(0,g.jsx)(`button`,{type:`button`,onClick:()=>B(s||a),className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Refresh`})}),(0,g.jsxs)(o,{className:`mb-6`,children:[(0,g.jsxs)(`form`,{onSubmit:V,className:`flex flex-wrap items-center gap-3`,children:[(0,g.jsx)(`input`,{value:s,onChange:e=>p(e.target.value),placeholder:`Job ID (any node in the flow)`,"aria-label":`Root job ID`,className:`min-w-0 flex-1 rounded-lg border border-line bg-surface-2 px-3 py-2 font-mono text-sm text-fg outline-none placeholder:text-faint focus-visible:ring-2 focus-visible:ring-accent/50`}),(0,g.jsx)(`button`,{type:`submit`,disabled:!s.trim(),className:`rounded-lg bg-accent px-4 py-2 text-sm font-medium text-accent-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 disabled:opacity-50`,children:`Load flow`})]}),(0,g.jsxs)(`p`,{className:`mt-2 text-xs text-faint`,children:[`Paste any job ID from the Job Inspector. The graph climbs to the flow root, then walks children and dependencies (up to `,b,` nodes).`]})]}),F&&(0,g.jsx)(d,{onRetry:()=>B(s||a)}),D&&!m&&(0,g.jsx)(c,{label:`Loading flow…`}),!D&&!m&&!F&&(0,g.jsx)(o,{children:(0,g.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,g.jsx)(`p`,{className:`text-sm text-muted`,children:`No flow loaded.`}),(0,g.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`Enter a job ID above, or open a job that is part of a flow and choose “View flow”.`}),L.length>0&&(0,g.jsxs)(`div`,{className:`mt-6`,children:[(0,g.jsx)(`p`,{className:`mb-2 text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Recently viewed`}),(0,g.jsx)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:L.map(e=>(0,g.jsxs)(`button`,{type:`button`,onClick:()=>{p(e.root),r({root:e.root},{replace:!0})},className:`rounded-lg border border-line bg-surface-2 px-3 py-1.5 font-mono text-xs text-muted transition-colors hover:border-line-strong hover:text-fg`,children:[T(e.root),(0,g.jsxs)(`span`,{className:`ml-2 text-faint`,children:[e.nodes,` nodes`]})]},e.root))})]})]})}),m&&H&&(0,g.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[1fr_260px]`,children:[(0,g.jsx)(o,{padded:!1,className:`overflow-auto p-4`,children:(0,g.jsxs)(`div`,{className:`relative`,style:{width:H.width,height:H.height},children:[(0,g.jsxs)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 text-line`,width:H.width,height:H.height,children:[(0,g.jsx)(`title`,{children:`Flow edges`}),m.edges.map(e=>{let t=U.get(e.from),n=U.get(e.to);return!t||!n?null:(0,g.jsx)(`path`,{d:M(t.x+_,t.y+v/2,n.x,n.y+v/2),fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeDasharray:e.kind===`depends`?`4 4`:void 0,opacity:.5},`${e.from}-${e.to}-${e.kind}`)})]}),H.nodes.map(e=>{let n=m.jobs.get(e.id);return(0,g.jsxs)(`button`,{type:`button`,onClick:()=>E(e.id),style:{left:e.x,top:e.y,width:_,height:v},className:t(`absolute flex flex-col justify-center gap-0.5 rounded-lg border px-3 text-left transition-shadow`,w(n?.state),C===e.id&&`ring-2 ring-accent`),children:[(0,g.jsx)(`span`,{className:`truncate font-mono text-xs text-fg`,children:T(e.id)}),(0,g.jsxs)(`span`,{className:`flex items-center justify-between gap-2 text-[11px]`,children:[(0,g.jsx)(`span`,{className:`truncate`,children:n?.queue??`—`}),(0,g.jsx)(`span`,{className:`font-medium`,children:n?.state??`unknown`})]})]},e.id)})]})}),(0,g.jsxs)(o,{children:[W?(0,g.jsxs)(`div`,{className:`space-y-3 text-sm`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`div`,{className:`text-xs text-faint`,children:`Job`}),(0,g.jsx)(`div`,{className:`break-all font-mono text-xs text-fg`,children:W.id})]}),(0,g.jsx)(P,{label:`Queue`,value:W.queue??`—`}),(0,g.jsx)(P,{label:`State`,value:W.state??`unknown`}),(0,g.jsx)(P,{label:`Priority`,value:String(W.priority??0)}),(0,g.jsx)(P,{label:`Children`,value:String(W.childrenIds?.length??0)}),(0,g.jsx)(P,{label:`Depends on`,value:String(W.dependsOn?.length??0)}),(0,g.jsx)(i,{to:`/job?id=${encodeURIComponent(W.id)}`,className:`inline-block rounded-lg border border-line px-3 py-1.5 text-xs text-muted hover:bg-surface-2 hover:text-fg`,children:`Open in Job Inspector`})]}):(0,g.jsx)(`p`,{className:`text-sm text-muted`,children:`Click a node to inspect it.`}),(0,g.jsxs)(`div`,{className:`mt-4 border-t border-line pt-3 text-xs text-faint`,children:[(0,g.jsxs)(`div`,{className:`mb-1`,children:[m.jobs.size,` node`,m.jobs.size===1?``:`s`,` · `,m.edges.length,` edge`,m.edges.length===1?``:`s`]}),(0,g.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(`span`,{className:`inline-block h-px w-4 bg-current`}),` child`]}),(0,g.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,g.jsx)(`span`,{className:`inline-block h-px w-4 border-t border-dashed border-current`}),` `,`depends`]})]})]})]})]})]})}function P({label:e,value:t}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,g.jsx)(`span`,{className:`text-xs text-faint`,children:e}),(0,g.jsx)(`span`,{className:`text-fg`,children:t})]})}export{N as Flows};
@@ -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,G as o,S as s,Y as c,Z as l,a as u,b as d,g as f,h as p,o as m,w as h,y as g}from"./index-BFjeS9FG.js";import{a as _,n as v}from"./form-PtDLk33Z.js";import{t as y}from"./CopyButton-BC6QECSJ.js";import{t as b}from"./jobActions-CuOdMglt.js";var x=e(n(),1),S=i();function C({job:e,busy:t,act:n}){let r=b(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,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Actions`}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.promote&&(0,S.jsx)(h,{size:`sm`,disabled:t,onClick:()=>n(`Promote`,()=>l.promoteJob(e.id)),children:`Promote (run now)`}),r.retryActive&&(0,S.jsx)(h,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>l.retryJob(e.id)),children:`Retry (move to waiting)`}),r.retryDlq&&(0,S.jsx)(h,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>l.retryDlq(e.queue??``,e.id)),children:`Retry from DLQ`}),r.requeueCompleted&&(0,S.jsx)(h,{size:`sm`,disabled:t,onClick:()=>n(`Requeue`,()=>l.retryCompleted(e.queue??``,e.id)),children:`Requeue`}),r.moveToDelayed&&(0,S.jsx)(w,{label:`Move to delayed (ms)`,cta:`To delayed`,disabled:t,onSubmit:t=>n(`Move to delayed`,()=>l.moveToDelayed(e.id,t))}),r.discard&&(0,S.jsx)(h,{size:`sm`,disabled:t,onClick:()=>n(`Discard`,()=>l.discardJob(e.id)),children:`Discard (to DLQ)`}),r.setPriority&&(0,S.jsx)(w,{label:`Set priority`,cta:`Set`,disabled:t,onSubmit:t=>n(`Priority`,()=>l.changePriority(e.id,t))}),r.setDelay&&(0,S.jsx)(w,{label:`Set delay (ms)`,cta:`Delay`,disabled:t,onSubmit:t=>n(`Delay`,()=>l.changeDelay(e.id,t))}),r.fail&&(0,S.jsx)(T,{label:`Fail reason (optional)`,cta:`Fail`,variant:`warning`,disabled:t,onSubmit:t=>n(`Fail`,()=>l.failJob(e.id,t||void 0),`Force-fail this active job?`)}),r.cancel&&(0,S.jsx)(h,{variant:`danger`,size:`sm`,disabled:t,onClick:()=>n(`Cancel`,()=>l.cancelJob(e.id),`Cancel and remove this job?`),children:`Cancel (delete)`}),!i&&(0,S.jsxs)(`p`,{className:`text-xs text-faint`,children:[`No actions available for a job in state "`,e.state??`unknown`,`".`]})]})]})}function w({label:e,cta:t,disabled:n,onSubmit:r}){let[i,a]=(0,x.useState)(``);return(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(v,{type:`number`,value:i,onChange:e=>a(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,S.jsx)(h,{size:`sm`,disabled:n||i.trim()===``,onClick:()=>r(Number(i)),children:t})]})}function T({label:e,cta:t,disabled:n,variant:r=`default`,onSubmit:i}){let[a,o]=(0,x.useState)(``);return(0,S.jsxs)(`div`,{className:`flex gap-2`,children:[(0,S.jsx)(v,{value:a,onChange:e=>o(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,S.jsx)(h,{size:`sm`,variant:r,disabled:n,onClick:()=>{i(a),o(``)},children:t})]})}var E=36e5,D=10;function O(e){let t=e.maxAttempts??0,n=e.attempts??0,r=e.backoffConfig,i=r?.maxDelay??E,a=r?.delay??e.backoff??1e3,o=[];for(let e=n;e<t&&o.length<D;e++){let t=r?.type===`fixed`?a:a*2**e;o.push({attempt:e+1,delayMs:Math.min(t,i)})}return o}function k({job:e}){let t=e.maxAttempts??0,n=e.attempts??0;if(t<=1)return(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Backoff`}),(0,S.jsxs)(`p`,{className:`text-xs text-faint`,children:[`No retries configured (max attempts = `,t||1,`).`]})]});if(n>=t)return(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Backoff schedule`}),(0,S.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,c=O(e);return(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Backoff schedule`,action:(0,S.jsxs)(`span`,{className:`text-xs capitalize text-faint`,children:[i,r?.maxDelay?` · cap ${m(r.maxDelay)}`:``]})}),(0,S.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:c.map(e=>(0,S.jsxs)(`li`,{className:`flex items-center justify-between text-sm`,children:[(0,S.jsxs)(`span`,{className:`text-muted`,children:[`Attempt `,e.attempt,` / `,t]}),(0,S.jsxs)(`span`,{className:`font-mono text-xs text-fg`,children:[`~`,m(e.delayMs)]})]},e.attempt))}),o>D&&(0,S.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Showing next `,D,` of `,o,` remaining attempts.`]}),(0,S.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Approximate — the server applies ±`,r?.type===`fixed`?`20`:`50`,`% jitter at retry time, capped at `,m(r?.maxDelay??E),`.`]})]})}function A({jobId:e}){let[t,n]=(0,x.useState)(!1),[r,i]=(0,x.useState)(!1),[o,c]=(0,x.useState)(!1),[u,d]=(0,x.useState)(void 0),[f,p]=(0,x.useState)(null),m=async()=>{c(!0),p(null);try{d((await l.jobChildren(e)).data?.values),i(!0)}catch(e){p(e.message)}finally{c(!1)}},g=()=>{let e=!t;n(e),e&&!r&&!o&&m()},_=u&&typeof u==`object`?Array.isArray(u)?u.length:Object.keys(u).length:0;return(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Child values`,action:(0,S.jsx)(h,{size:`sm`,variant:`ghost`,onClick:g,children:t?`Hide`:`Show`})}),t?o?(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Loading child values…`}):f?(0,S.jsx)(`p`,{className:`text-xs text-danger`,children:f}):_===0?(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`No child values available.`}):(0,S.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:JSON.stringify(u,null,2)}):(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Resolved return values from this flow job's children.`})]})}function j({data:e,busy:t,onSave:n}){let[r,i]=(0,x.useState)(()=>JSON.stringify(e??null,null,2)),[o,c]=(0,x.useState)(null),l=(0,x.useRef)(r);return(0,x.useEffect)(()=>{let t=JSON.stringify(e??null,null,2);t!==l.current&&(l.current=t,i(t),c(null))},[e]),(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Edit data`,action:(0,S.jsx)(h,{size:`sm`,disabled:t,onClick:()=>{let e;try{e=JSON.parse(r)}catch(e){c(`Invalid JSON: ${e.message}`);return}c(null),n(e)},children:`Save data`})}),(0,S.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,S.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:o})]})}function M({jobId:e}){let[t,n]=(0,x.useState)([]),[r,i]=(0,x.useState)(0),[o,c]=(0,x.useState)(!1),[u,d]=(0,x.useState)(null),[f,p]=(0,x.useState)(``),[m,g]=(0,x.useState)(`info`),[y,b]=(0,x.useState)(!1),C=(0,x.useCallback)(async()=>{c(!0),d(null);try{let t=await l.jobLogs(e);n(t.data?.logs??[]),i(t.data?.count??0)}catch(e){d(e.message)}finally{c(!1)}},[e]);(0,x.useEffect)(()=>{C()},[C]);let w=async()=>{if(y)return;let t=f.trim();if(t){b(!0),d(null);try{await l.addJobLog(e,t,m),p(``),await C()}catch(e){d(e.message)}finally{b(!1)}}};return(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Logs`,action:(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:r}),(0,S.jsx)(h,{size:`sm`,variant:`ghost`,disabled:o||y,onClick:C,children:`Refresh`}),(0,S.jsx)(h,{size:`sm`,variant:`danger`,disabled:y||t.length===0,onClick:async()=>{if(window.confirm(`Clear all logs for this job?`)){b(!0),d(null);try{await l.clearJobLogs(e),await C()}catch(e){d(e.message)}finally{b(!1)}}},children:`Clear logs`})]})}),u&&(0,S.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:u}),t.length===0?(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`No log lines recorded for this job.`}):(0,S.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,S.jsx)(`li`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-muted`,children:typeof e==`string`?e:JSON.stringify(e)},t))}),(0,S.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,S.jsx)(v,{value:f,onChange:e=>p(e.target.value),onKeyDown:e=>e.key===`Enter`&&w(),placeholder:`Add a log line…`,className:`h-8 flex-1 text-xs`}),(0,S.jsxs)(_,{value:m,onChange:e=>g(e.target.value),className:`h-8 w-24 text-xs`,children:[(0,S.jsx)(`option`,{value:`info`,children:`info`}),(0,S.jsx)(`option`,{value:`warn`,children:`warn`}),(0,S.jsx)(`option`,{value:`error`,children:`error`})]}),(0,S.jsx)(h,{size:`sm`,disabled:y||f.trim()===``,onClick:w,children:`Add`})]})]})}function N({timeline:e}){let t=e??[];return(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Timeline`}),t.length===0?(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`No state transitions recorded yet.`}):(0,S.jsx)(`ol`,{className:`flex flex-col gap-0`,children:t.map((e,t)=>(0,S.jsxs)(`li`,{className:`border-b border-line/60 py-2 last:border-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(f,{status:e.state}),e.attempt!=null&&(0,S.jsxs)(`span`,{className:`font-mono text-[11px] text-faint`,children:[`attempt `,e.attempt]})]}),(0,S.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:u(e.timestamp)})]}),(e.worker||e.error)&&(0,S.jsxs)(`div`,{className:`mt-1 pl-0.5`,children:[e.worker&&(0,S.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.worker}),e.error&&(0,S.jsx)(`div`,{className:`mt-0.5 text-xs text-danger/90`,children:e.error})]})]},t))})]})}function P(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 F(){let[e,n]=t(),[i,v]=(0,x.useState)(e.get(`id`)??``),[b,w]=(0,x.useState)(`id`),[T,E]=(0,x.useState)(null),[D,O]=(0,x.useState)({fetched:!1,value:void 0}),[F,R]=(0,x.useState)(!1),[z,B]=(0,x.useState)(!1),[V,H]=(0,x.useState)(null),[U,W]=(0,x.useState)(!1),G=(0,x.useRef)(0),K=async(e,t=b,r=!1)=>{let i=e.trim();if(!i)return;let a=++G.current;R(!0),B(!1),r||H(null);try{let e=(await(t===`custom`?l.jobByCustomId(i):l.job(i))).job;if(!e){if(a!==G.current)return;E(null),O({fetched:!1,value:void 0}),B(!0),n({},{replace:!0});return}let r=e.state===`completed`?await l.jobResult(e.id).catch(()=>null):null;if(a!==G.current)return;E(e),v(t===`custom`?e.id:i),n({id:e.id},{replace:!0}),O(r?{fetched:!0,value:r.result}:{fetched:!1,value:void 0})}catch(e){if(a!==G.current)return;e instanceof c&&(e.status===404||/not found/i.test(e.message))?(E(null),O({fetched:!1,value:void 0}),B(!0),n({},{replace:!0})):H({ok:!1,text:e.message})}finally{a===G.current&&R(!1)}},q=e.get(`id`);(0,x.useEffect)(()=>{q&&q!==T?.id&&K(q,`id`)},[q,T?.id]);let J=async(e,t,r)=>{if(!(r&&!window.confirm(r))&&T){W(!0),H(null);try{await t(),H({ok:!0,text:`${e} ✓`}),e===`Cancel`?(E(null),O({fetched:!1,value:void 0}),n({},{replace:!0})):await K(T.id,`id`,!0)}catch(e){H({ok:!1,text:e.message})}finally{W(!1)}}},Y=T?.state,X=T?P(T):null,Z=(T?.stacktrace?.length??0)>0,Q=(T?.childrenIds?.length??0)>0;return(0,S.jsxs)(`div`,{children:[(0,S.jsx)(p,{title:`Job Inspector`,description:`Look up any job by ID and drive its full lifecycle.`,actions:T&&(Q||T.parentId)?(0,S.jsx)(r,{to:`/flows?root=${encodeURIComponent(T.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`}):void 0}),(0,S.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-2`,children:[(0,S.jsxs)(_,{value:b,onChange:e=>w(e.target.value),className:`w-40`,children:[(0,S.jsx)(`option`,{value:`id`,children:`By job ID`}),(0,S.jsx)(`option`,{value:`custom`,children:`By custom ID`})]}),(0,S.jsxs)(`div`,{className:`relative min-w-56 flex-1`,children:[(0,S.jsx)(o,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,S.jsx)(`input`,{value:i,onChange:e=>v(e.target.value),onKeyDown:e=>e.key===`Enter`&&K(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,S.jsx)(h,{variant:`accent`,disabled:F,onClick:()=>K(i),children:`Look up`})]}),V&&(0,S.jsx)(`div`,{className:V.ok?`mb-4 text-sm text-success`:`mb-4 text-sm text-danger`,children:V.text}),F&&!T?(0,S.jsx)(d,{label:`Loading job…`}):z?(0,S.jsx)(g,{title:`Job not found`,hint:`Check the ID, or the job may have been removed.`}):T?(0,S.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-3`,children:[(0,S.jsxs)(`div`,{className:`flex flex-col gap-6 lg:col-span-2`,children:[(0,S.jsxs)(s,{children:[(0,S.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,S.jsx)(`div`,{className:`truncate font-mono text-sm text-fg`,children:T.id}),(0,S.jsx)(y,{value:T.id})]}),(0,S.jsx)(`div`,{className:`mt-1 font-mono text-xs text-faint`,children:T.queue})]}),(0,S.jsx)(f,{status:Y??`waiting`})]}),(0,S.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-2 text-sm sm:grid-cols-3`,children:[(0,S.jsx)(I,{k:`Priority`,v:String(T.priority??0)}),(0,S.jsx)(I,{k:`Attempts`,v:`${T.attempts??0} / ${T.maxAttempts??`?`}`}),(0,S.jsx)(I,{k:`Progress`,v:`${T.progress??0}%`}),(0,S.jsx)(I,{k:`Created`,v:u(T.createdAt)}),(0,S.jsx)(I,{k:`Started`,v:u(T.startedAt??void 0)}),(0,S.jsx)(I,{k:`Completed`,v:u(T.completedAt??void 0)}),(0,S.jsx)(I,{k:`Duration`,v:m(T.startedAt&&T.completedAt?T.completedAt-T.startedAt:void 0)}),(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`Custom ID`}),(0,S.jsxs)(`dd`,{className:`flex items-center gap-1 text-fg`,children:[(0,S.jsx)(`span`,{className:`truncate font-mono`,children:T.customId??`—`}),T.customId&&(0,S.jsx)(y,{value:T.customId})]})]})]})]}),(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Data`}),(0,S.jsx)(L,{value:T.data})]}),(0,S.jsx)(j,{data:T.data,busy:U,onSave:e=>J(`Data`,()=>l.updateJobData(T.id,e))}),Y===`completed`&&(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Result`}),D.fetched&&D.value!==void 0&&D.value!==null?(0,S.jsx)(L,{value:D.value}):(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`No result stored for this job.`})]}),(X||Z)&&(0,S.jsxs)(s,{children:[(0,S.jsx)(a,{title:`Error`}),X&&(0,S.jsxs)(`div`,{className:`mb-3`,children:[(0,S.jsx)(`p`,{className:`text-sm text-danger`,children:X.message}),(0,S.jsxs)(`p`,{className:`mt-1 text-[11px] text-faint`,children:[X.attempt==null?``:`Attempt ${X.attempt} · `,u(X.timestamp)]})]}),Z&&(0,S.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:T.stacktrace?.join(`
2
- `)})]}),(0,S.jsx)(M,{jobId:T.id},`logs-${T.id}`),Q&&(0,S.jsx)(A,{jobId:T.id},`children-${T.id}`),(0,S.jsx)(N,{timeline:T.timeline}),(0,S.jsx)(k,{job:T})]}),(0,S.jsx)(C,{job:T,busy:U,act:J})]}):(0,S.jsx)(g,{title:`No job loaded`,hint:`Enter a job ID above to inspect it.`})]})}function I({k:e,v:t}){return(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`dt`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:e}),(0,S.jsx)(`dd`,{className:`text-fg`,children:t})]})}function L({value:e}){return(0,S.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)})}export{F as JobInspector};
@@ -1 +0,0 @@
1
- import{r as e}from"./cn-CMFYpumL.js";import{d as t,m as n,t as r}from"./react-vendor-CHIHtdAC.js";import{G as i,K as a,O as o,T as s,b as c,c as l,f as u,g as d,h as f,k as p,l as m,m as h,n as g,o as _,u as v,x as y}from"./index-BFjeS9FG.js";import{a as b,i as x}from"./form-PtDLk33Z.js";var S=e(n(),1),C=r(),w=`__all__`,T=[`all`,`waiting`,`active`,`completed`,`failed`];function E(){let[e]=t(),[n,r]=(0,S.useState)(e.get(`queue`)??w),[E,D]=(0,S.useState)(`all`),[O,k]=(0,S.useState)(``),{data:A}=o(()=>p.queues(500),[]),{data:j}=o(()=>p.overview(),[]),{data:M,error:N,loading:P,refetch:F}=o((0,S.useCallback)(async()=>{let e=n===w?(A?.queues??[]).map(e=>e.name).slice(0,25):[n],t=E===`all`?void 0:[E];return(await Promise.all(e.map(e=>p.jobsList(e,{states:t,limit:40}).then(t=>(t.jobs??[]).map(t=>({...t,queue:t.queue??e}))).catch(()=>[])))).flat().sort((e,t)=>(t.createdAt??0)-(e.createdAt??0))},[n,E,A]),[n,E]),I=(0,S.useMemo)(()=>{let e=M??[],t=O.trim().toLowerCase();return(t?e.filter(e=>e.id.toLowerCase().includes(t)||(e.name??``).toLowerCase().includes(t)):e).slice(0,100)},[M,O]),L=j?.stats,R=L?g(L.totalCompleted,L.totalFailed)??0:0,z=async e=>{if(window.confirm(`Cancel job ${e}?`))try{await p.cancelJob(e),F()}catch{}};return(0,C.jsxs)(`div`,{children:[N&&(0,C.jsx)(y,{onRetry:F}),(0,C.jsx)(f,{title:`Jobs Explorer`,description:`Browse, inspect, and manage individual jobs.`,live:!0}),(0,C.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,C.jsx)(h,{label:`Total`,value:l((L?.totalCompleted??0)+(L?.totalFailed??0)+(L?.waiting??0)+(L?.active??0)),compact:!0}),(0,C.jsx)(h,{label:`Waiting`,value:l(L?.waiting),tone:`amber`,compact:!0}),(0,C.jsx)(h,{label:`Active`,value:l(L?.active),tone:`blue`,compact:!0}),(0,C.jsx)(h,{label:`Completed`,value:l(L?.totalCompleted),tone:`green`,compact:!0}),(0,C.jsx)(h,{label:`Failed`,value:l(L?.totalFailed),tone:L?.totalFailed?`red`:`default`,compact:!0}),(0,C.jsx)(h,{label:`Error Rate`,value:m(R),tone:R>.05?`red`:`green`,compact:!0})]}),(0,C.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,C.jsx)(`div`,{className:`w-48`,children:(0,C.jsxs)(b,{value:n,onChange:e=>r(e.target.value),children:[(0,C.jsx)(`option`,{value:w,children:`All Queues`}),(A?.queues??[]).map(e=>(0,C.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,C.jsx)(x,{options:T,value:E,onChange:D}),(0,C.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,C.jsx)(i,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,C.jsx)(`input`,{value:O,onChange:e=>k(e.target.value),placeholder:`Search by ID or name…`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),P&&!M&&!N?(0,C.jsx)(c,{label:`Loading jobs…`}):(0,C.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,C.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,C.jsx)(`thead`,{children:(0,C.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Priority`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Created`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,C.jsx)(`th`,{className:`w-12 px-5 py-3`})]})}),(0,C.jsx)(`tbody`,{children:I.length===0?(0,C.jsx)(`tr`,{children:(0,C.jsx)(`td`,{colSpan:8,className:`px-5 py-12 text-center text-sm text-faint`,children:`No jobs found.`})}):I.map(e=>(0,C.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,C.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent/90`,children:e.id}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-fg`,children:e.name||`unknown`}),(0,C.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queue}),(0,C.jsx)(`td`,{className:`px-5 py-3`,children:(0,C.jsx)(d,{status:String(e.state??e.status??`waiting`)})}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:e.priority??0}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:v(e.createdAt)}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:_(u(e.processedOn,e.finishedOn))}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,C.jsx)(s,{"aria-label":`Cancel job`,onClick:()=>z(e.id),children:(0,C.jsx)(a,{className:`size-3.5`})})})]},`${e.queue}:${e.id}`))})]})})]})}export{E as Jobs};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./cn-CMFYpumL.js";import{d as n,m as r,r as i,t as a}from"./react-vendor-CHIHtdAC.js";import{G as o,K as ee,L as s,N as c,O as l,T as u,U as d,V as te,Z as f,a as ne,b as re,c as ie,g as ae,h as p,l as m,m as h,n as oe,o as g,w as _,x as se}from"./index-BFjeS9FG.js";import{a as ce,i as le}from"./form-PtDLk33Z.js";import{t as ue}from"./Pagination-Bj1z6OlD.js";import{t as v}from"./jobActions-CuOdMglt.js";var y=e(r(),1),b=a(),de=[`all`,`waiting`,`active`,`completed`,`failed`],x=25;function S(e=0){return e>=10?{t:`HIGH`,c:`text-warning`}:e>=1?{t:`MEDIUM`,c:`text-blue-400`}:{t:`LOW`,c:`text-faint`}}function C(e){let t=v(e.state);return t.retryActive?f.retryJob(e.id):t.retryDlq?f.retryDlq(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not retryable`))}function w(){let[e]=n(),[r,a]=(0,y.useState)(e.get(`queue`)??``),[w,fe]=(0,y.useState)(`all`),[T,pe]=(0,y.useState)(``),[E,D]=(0,y.useState)(0),[O,k]=(0,y.useState)(new Set),[me,A]=(0,y.useState)(new Set),[j,M]=(0,y.useState)(!1),[N,P]=(0,y.useState)(null),{data:F}=l(()=>f.queuesSummary(),[],{intervalMs:3e4}),{data:I}=l(()=>f.overview(),[],{intervalMs:1e4});(0,y.useEffect)(()=>{!r&&F?.length&&a(F[0].name)},[F,r]);let L=`${r}|${w}|${E}`,{data:R,error:z,loading:B,refetch:V}=l((0,y.useCallback)(async()=>{if(!r)return{view:L,jobs:[]};let e=w===`all`?void 0:[w];return{view:L,jobs:((await f.jobsList(r,e,x,E*x)).jobs??[]).map(e=>({...e,queue:e.queue??r}))}},[r,w,E,L]),[r,w,E]),H=R&&R.view===L?R.jobs:null,he=(H?.length??0)===x,U=(0,y.useMemo)(()=>{let e=T.trim().toLowerCase();return e?(H??[]).filter(t=>t.id.toLowerCase().includes(e)):H??[]},[H,T]),W=I?.stats,G=(0,y.useMemo)(()=>(F??[]).reduce((e,t)=>e+(t.counts?.failed??0),0),[F]),K=W?oe(W.completed,G):null,q=e=>W?ie(e):`—`,J=()=>D(0);(0,y.useEffect)(()=>{k(new Set)},[r,w,E]);let ge=e=>k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Y=U.length>0&&U.every(e=>O.has(e.id)),_e=()=>k(()=>Y?new Set:new Set(U.map(e=>e.id))),X=async(e,t,n,r)=>{if(!(r&&!window.confirm(r))){A(t=>new Set(t).add(e.id)),P(null);try{await n(),P({ok:!0,text:`${t} ✓`})}catch(e){P({ok:!1,text:`${t} failed: ${e.message}`})}finally{A(t=>{let n=new Set(t);return n.delete(e.id),n}),V()}}},Z=async(e,t,n)=>{let r=U.filter(e=>O.has(e.id));if(r.length===0||n&&!window.confirm(n(r.length)))return;M(!0),P(null);let i=await Promise.allSettled(r.map(t)),a=i.filter(e=>e.status===`fulfilled`).length,o=i.length-a;P({ok:o===0,text:`${e}: ${a} succeeded${o?`, ${o} not eligible / failed`:``}`}),k(new Set),M(!1),V()},Q=U.filter(e=>O.has(e.id)),$={retry:Q.some(e=>{let t=v(e.state);return t.retryActive||t.retryDlq}),promote:Q.some(e=>v(e.state).promote),requeue:Q.some(e=>v(e.state).requeueCompleted),fail:Q.some(e=>v(e.state).fail),cancel:Q.some(e=>v(e.state).cancel)};return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(p,{title:`Jobs Explorer`,description:`Browse, inspect, and manage individual jobs.`,live:!0}),(0,b.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,b.jsx)(h,{label:`Total`,value:q((W?.completed??0)+G+(W?.waiting??0)+(W?.active??0)+(W?.delayed??0)),hint:`all queues`,compact:!0}),(0,b.jsx)(h,{label:`Waiting`,value:q(W?.waiting),tone:`amber`,compact:!0}),(0,b.jsx)(h,{label:`Active`,value:q(W?.active),tone:`blue`,compact:!0}),(0,b.jsx)(h,{label:`Completed`,value:q(W?.completed),tone:`green`,compact:!0}),(0,b.jsx)(h,{label:`Failed`,value:q(G),tone:G?`red`:`default`,compact:!0}),(0,b.jsx)(h,{label:`Error Rate`,value:K==null?`—`:m(K),tone:K==null?`default`:K>.05?`red`:`green`,compact:!0})]}),(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,b.jsx)(`div`,{className:`w-48`,children:(0,b.jsx)(ce,{value:r,"aria-label":`Queue`,onChange:e=>{a(e.target.value),J()},children:(F??[]).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),(0,b.jsx)(le,{options:de,value:w,onChange:e=>{fe(e),J()}}),(0,b.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,b.jsx)(o,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,b.jsx)(`input`,{value:T,onChange:e=>pe(e.target.value),placeholder:`Filter this page by ID…`,"aria-label":`Filter by job ID`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),O.size>0&&(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 rounded-lg border border-line bg-surface-2 px-4 py-2 text-sm`,children:[(0,b.jsxs)(`span`,{className:`mr-1 text-muted`,children:[O.size,` selected`]}),$.retry&&(0,b.jsx)(_,{size:`sm`,disabled:j,onClick:()=>Z(`Retry`,C),children:`Retry selected`}),$.promote&&(0,b.jsx)(_,{size:`sm`,disabled:j,onClick:()=>Z(`Promote`,e=>v(e.state).promote?f.promoteJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not delayed`))),children:`Promote selected`}),$.requeue&&(0,b.jsx)(_,{size:`sm`,disabled:j,onClick:()=>Z(`Requeue`,e=>v(e.state).requeueCompleted?f.retryCompleted(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not completed`))),children:`Requeue selected`}),$.fail&&(0,b.jsx)(_,{variant:`warning`,size:`sm`,disabled:j,onClick:()=>Z(`Fail`,e=>v(e.state).fail?f.failJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not active`)),e=>`Force-fail ${e} job(s)?`),children:`Fail selected`}),$.cancel&&(0,b.jsx)(_,{variant:`danger`,size:`sm`,disabled:j,onClick:()=>Z(`Cancel`,e=>v(e.state).cancel?f.cancelJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" cannot be cancelled`)),e=>`Cancel ${e} job(s)? This cannot be undone.`),children:`Cancel selected`}),!$.retry&&!$.promote&&!$.requeue&&!$.fail&&!$.cancel&&(0,b.jsx)(`span`,{className:`text-xs text-faint`,children:`No actions apply to the selected job states.`})]}),N&&(0,b.jsx)(`div`,{className:t(`mb-3 text-sm`,N.ok?`text-success`:`text-danger`),children:N.text}),z&&(0,b.jsx)(se,{onRetry:V}),B&&!H&&!z?(0,b.jsx)(re,{label:`Loading jobs…`}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,b.jsx)(`th`,{className:`w-10 px-5 py-3`,children:(0,b.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:_e,"aria-label":`Select all jobs on page`,className:`accent-accent`})}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Priority`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Created`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,b.jsx)(`th`,{className:`w-28 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,b.jsx)(`tbody`,{children:U.length===0?(0,b.jsx)(`tr`,{children:(0,b.jsx)(`td`,{colSpan:7,className:`px-5 py-12 text-center text-sm text-faint`,children:T.trim()?`No jobs on this page match your ID filter.`:r?`No jobs found.`:`Select a queue.`})}):U.map(e=>{let n=S(e.priority),r=v(e.state),a=me.has(e.id);return(0,b.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(`input`,{type:`checkbox`,checked:O.has(e.id),onChange:()=>ge(e.id),"aria-label":`Select job ${e.id}`,className:`accent-accent`})}),(0,b.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent/90`,children:(0,b.jsx)(`span`,{className:`block max-w-[16rem] truncate`,title:e.id,children:e.id})}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(ae,{status:String(e.state??`waiting`)})}),(0,b.jsx)(`td`,{className:t(`px-5 py-3 text-xs font-semibold`,n.c),children:n.t}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:ne(e.createdAt)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:g(e.startedAt&&e.completedAt?e.completedAt-e.startedAt:void 0)}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,b.jsx)(i,{to:`/job?id=${encodeURIComponent(e.id)}`,children:(0,b.jsx)(u,{"aria-label":`Inspect job`,children:(0,b.jsx)(s,{className:`size-3.5`})})}),r.promote&&(0,b.jsx)(u,{"aria-label":`Promote job`,disabled:a,onClick:()=>X(e,`Promote`,()=>f.promoteJob(e.id)),children:(0,b.jsx)(te,{className:`size-3.5`})}),(r.retryActive||r.retryDlq)&&(0,b.jsx)(u,{"aria-label":`Retry job`,disabled:a,onClick:()=>X(e,`Retry`,()=>C(e)),children:(0,b.jsx)(d,{className:`size-3.5`})}),r.requeueCompleted&&(0,b.jsx)(u,{"aria-label":`Requeue job`,disabled:a,onClick:()=>X(e,`Requeue`,()=>f.retryCompleted(e.queue??``,e.id)),children:(0,b.jsx)(d,{className:`size-3.5`})}),r.fail&&(0,b.jsx)(u,{"aria-label":`Fail job`,disabled:a,onClick:()=>X(e,`Fail`,()=>f.failJob(e.id),`Force-fail this active job?`),children:(0,b.jsx)(c,{className:`size-3.5`})}),r.cancel&&(0,b.jsx)(u,{"aria-label":`Cancel job`,disabled:a,onClick:()=>X(e,`Cancel`,()=>f.cancelJob(e.id),`Cancel this job?`),children:(0,b.jsx)(ee,{className:`size-3.5`})})]})})]},e.id)})})]})}),(0,b.jsx)(ue,{page:E,pageSize:x,hasNext:he,onPageChange:D,label:`jobs`})]})]})}export{w as JobsPro};
@@ -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{G as r,O as i,Z as a,c as o,g as s,h as c,m as l,t as u,u as d,x as f}from"./index-BFjeS9FG.js";import{a as p,i as m}from"./form-PtDLk33Z.js";import{t as h}from"./Pagination-Bj1z6OlD.js";var g=e(t(),1),_=n(),v=`__all__`,y=[`all`,`waiting`,`active`,`completed`,`failed`],b=10;function x(){let[e,t]=(0,g.useState)(v),[n,x]=(0,g.useState)(`all`),[S,C]=(0,g.useState)(``),[w,T]=(0,g.useState)(0),{data:E,error:D,refetch:O}=i(()=>a.queues(),[],{intervalMs:3e4}),{events:k,counters:A,throughput:j,connected:M}=u(e===v?void 0:e),N=(0,g.useMemo)(()=>{let e=S.trim().toLowerCase();return k.filter(t=>n!==`all`&&t.status!==n?!1:e?(t.jobId??``).toLowerCase().includes(e)||(t.queue??``).toLowerCase().includes(e):!0)},[k,n,S]);(0,g.useEffect)(()=>T(0),[e,n,S]);let P=w*b,F=N.slice(P,P+b);return(0,_.jsxs)(`div`,{children:[(0,_.jsx)(c,{title:`Activity Logs`,description:`Real-time job activity across all queues.`,live:M}),D&&(0,_.jsx)(f,{onRetry:O}),(0,_.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,_.jsx)(l,{label:`Total Events`,value:o(A.total),compact:!0}),(0,_.jsx)(l,{label:`Completed`,value:o(A.completed),tone:`green`,compact:!0}),(0,_.jsx)(l,{label:`Failed`,value:o(A.failed),tone:A.failed?`red`:`default`,compact:!0}),(0,_.jsx)(l,{label:`Waiting`,value:o(A.waiting),tone:`amber`,compact:!0}),(0,_.jsx)(l,{label:`Active`,value:o(A.active),tone:`blue`,compact:!0}),(0,_.jsx)(l,{label:`Throughput`,value:`${j.toFixed(1)}/s`,tone:`accent`,compact:!0})]}),(0,_.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`w-48`,children:(0,_.jsxs)(p,{"aria-label":`Filter by queue`,value:e,onChange:e=>t(e.target.value),children:[(0,_.jsx)(`option`,{value:v,children:`All Queues`}),(E?.queues??[]).map(e=>(0,_.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,_.jsx)(m,{options:y,value:n,onChange:x}),(0,_.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,_.jsx)(r,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,_.jsx)(`input`,{"aria-label":`Search by job ID or queue`,value:S,onChange:e=>C(e.target.value),placeholder:`Search by job ID or queue…`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Event`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Timestamp`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`ID`})]})}),(0,_.jsx)(`tbody`,{children:F.length===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{colSpan:5,className:`px-5 py-12 text-center text-sm text-faint`,children:M?k.length>0?`No events match the current filters.`:`Waiting for activity…`:`Connecting to the event stream…`})}):F.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(s,{status:e.status})}),(0,_.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-fg`,children:e.event}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-0.5 font-mono text-xs text-muted`,children:e.queue||`—`})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:d(e.timestamp)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right font-mono text-xs text-faint`,children:e.jobId||`—`})]},e.seq))})]})}),(0,_.jsx)(h,{page:w,pageSize:b,total:N.length,onPageChange:T,label:`events`})]})}export{x as LogsPro};
@@ -1 +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,D as a,O as o,S as s,Z as c,b as l,c as u,d,h as f,i as p,l as m,m as h,n as g,x as _}from"./index-BFjeS9FG.js";import{t as v}from"./Pagination-Bj1z6OlD.js";import{t as y}from"./AreaChart-DzUXW8u3.js";var b=e(n(),1);function x(e=60){let[t,n]=(0,b.useState)({push:[],complete:[],fail:[],depth:[]}),[r,i]=(0,b.useState)(null),o=(0,b.useRef)(!0),s=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{o.current=!0;let t=a(()=>typeof document<`u`&&document.hidden),r=async()=>{if(!s.current&&t()){s.current=!0;try{let t=await c.overview();if(!o.current)return;i(t);let r=(t.stats.waiting??0)+(t.stats.active??0)+(t.stats.delayed??0);n(n=>({push:[...n.push,t.throughput.pushPerSec].slice(-e),complete:[...n.complete,t.throughput.completePerSec].slice(-e),fail:[...n.fail,t.throughput.failPerSec].slice(-e),depth:[...n.depth,r].slice(-e)}))}catch{}finally{s.current=!1}}};r();let l=setInterval(r,1e3);return()=>{o.current=!1,clearInterval(l)}},[e]),{...t,latest:r}}function S(e){if(e.length<2)return{slope:0,label:`steady`,draining:!1};let t=e.length,n=(t-1)/2,r=e.reduce((e,t)=>e+t,0)/t,i=0,a=0;for(let o=0;o<t;o++)i+=(o-n)*(e[o]-r),a+=(o-n)**2;let o=a===0?0:i/a,s=o<-.05;return{slope:o,label:s?`draining`:o>.05?`accumulating`:`steady`,draining:s}}var C=r(),w=[`-60s`,`-45s`,`-30s`,`-15s`,`now`],T=15,E=[`push`,`pull`,`ack`],D={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 O(){let e=x(60),[n,r]=(0,b.useState)(0),{data:a,error:O,loading:M,refetch:N}=o(async()=>({details:await c.queuesSummary()}),[]),P=a?.details??[],F=Math.max(1,Math.ceil(P.length/T)),I=Math.min(n,F-1),L=(0,b.useMemo)(()=>P.slice(I*T,I*T+T),[P,I]),R=(0,b.useMemo)(()=>P.reduce((e,t)=>e+(t.counts?.failed??0),0),[P]);if(M&&!a&&!O)return(0,C.jsx)(l,{label:`Loading metrics…`});let{stats:z,throughput:B,latency:V}=e.latest??D,H=g(z.completed,R),U=S(e.depth),W=e.depth.length?e.depth[e.depth.length-1]:0;return(0,C.jsxs)(`div`,{children:[(0,C.jsx)(f,{title:`Metrics`,description:`Real-time performance telemetry for your queues.`,live:!O}),O&&(0,C.jsx)(_,{onRetry:N}),(0,C.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,C.jsx)(h,{label:`Total Completed`,value:p(z.completed),tone:`green`,hint:`recorded jobs`}),(0,C.jsx)(h,{label:`Total Failed`,value:u(R),tone:R?`red`:`default`,hint:`recorded jobs`}),(0,C.jsx)(h,{label:`Push/sec`,value:B.pushPerSec.toFixed(1),tone:`accent`,hint:`jobs/sec`}),(0,C.jsx)(h,{label:`Pull/sec`,value:B.pullPerSec.toFixed(1),tone:`accent`,hint:`jobs/sec`})]}),(0,C.jsxs)(s,{className:`mb-6`,children:[(0,C.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Live Throughput`}),(0,C.jsx)(`p`,{className:`text-xs text-faint`,children:`Real-time jobs per second (rolling 60s window)`})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-mono text-[11px] text-faint`,children:[(0,C.jsx)(A,{color:`#ec4899`,label:`Pushed`,value:B.pushPerSec}),(0,C.jsx)(A,{color:`#34d399`,label:`Completed`,value:B.completePerSec}),(0,C.jsx)(A,{color:`#f87171`,label:`Failed`,value:B.failPerSec})]})]}),(0,C.jsx)(y,{xLabels:w,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,C.jsxs)(s,{className:`mb-6`,children:[(0,C.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-3`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Queue Depth`}),(0,C.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,C.jsxs)(`div`,{className:`text-right`,children:[(0,C.jsx)(`div`,{className:`tnum text-2xl font-bold text-fg`,children:u(W)}),(0,C.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,C.jsx)(y,{xLabels:w,ariaLabel:`queue depth chart`,series:[{label:`Depth`,color:U.draining?`#34d399`:`#f59e0b`,points:e.depth,area:!0}]})]}),(0,C.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,C.jsxs)(s,{children:[(0,C.jsx)(i,{title:`Error Rate`}),(0,C.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Failed as percentage of total processed`}),(0,C.jsxs)(`div`,{className:`flex items-center justify-around`,children:[(0,C.jsxs)(`div`,{className:`text-center`,children:[(0,C.jsx)(`div`,{className:t(`text-3xl font-bold tnum`,H!=null&&H>.05?`text-danger`:`text-fg`),children:H==null?`—`:m(H)}),(0,C.jsx)(`div`,{className:`text-xs text-faint`,children:`error rate`})]}),(0,C.jsxs)(`div`,{className:`text-center`,children:[(0,C.jsx)(`div`,{className:t(`text-3xl font-bold tnum`,H==null?`text-fg`:`text-success`),children:H==null?`—`:m(1-H)}),(0,C.jsx)(`div`,{className:`text-xs text-faint`,children:`success rate`})]})]}),H==null?(0,C.jsx)(`div`,{className:`mt-4 h-2 overflow-hidden rounded-full bg-surface-2`}):(0,C.jsx)(`div`,{className:`mt-4 h-2 overflow-hidden rounded-full bg-red-500/40`,children:(0,C.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500`,style:{width:`${(1-H)*100}%`}})}),(0,C.jsxs)(`div`,{className:`mt-2 flex justify-between font-mono text-[11px] text-faint`,children:[(0,C.jsxs)(`span`,{children:[p(z.completed),` completed`]}),(0,C.jsxs)(`span`,{children:[u(R),` failed`]})]})]}),(0,C.jsxs)(s,{children:[(0,C.jsx)(i,{title:`Server Overview`}),(0,C.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Current server-wide statistics`}),(0,C.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,C.jsx)(j,{color:`bg-blue-400`,label:`Queued`,value:u(z.waiting)}),(0,C.jsx)(j,{color:`bg-accent`,label:`Processing`,value:u(z.active)}),(0,C.jsx)(j,{color:`bg-amber-400`,label:`Delayed`,value:u(z.delayed)}),(0,C.jsx)(j,{color:`bg-red-400`,label:`Dead Letter`,value:u(z.dlq)}),(0,C.jsx)(j,{color:`bg-zinc-500`,label:`Pushed (since restart)`,value:p(z.totalPushed)}),(0,C.jsx)(j,{color:`bg-zinc-500`,label:`Pulled (since restart)`,value:p(z.totalPulled)}),(0,C.jsx)(j,{color:`bg-emerald-400`,label:`Uptime`,value:d(z.uptime/1e3)})]})]})]}),(0,C.jsxs)(s,{className:`mb-6`,padded:!1,children:[(0,C.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,C.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Operation Latency`}),(0,C.jsx)(`p`,{className:`text-xs text-faint`,children:`TCP round-trip per operation (p50 / p95 / p99, milliseconds)`})]}),(0,C.jsx)(`div`,{className:`overflow-x-auto`,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:`Operation`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Avg`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p50`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p95`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p99`})]})}),(0,C.jsx)(`tbody`,{children:E.map(e=>{let t=V?.percentiles?.[e],n=V?.averages?.[`${e}Ms`];return(0,C.jsxs)(`tr`,{className:`border-b border-line last:border-0`,children:[(0,C.jsx)(`td`,{className:`px-5 py-3 font-medium capitalize text-fg`,children:e}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:k(n)}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:k(t?.p50)}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:k(t?.p95)}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:k(t?.p99)})]},e)})})]})})]}),(0,C.jsxs)(s,{padded:!1,children:[(0,C.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,C.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Per-Queue Metrics`}),(0,C.jsx)(`p`,{className:`text-xs text-faint`,children:`Job counts breakdown by queue`})]}),(0,C.jsx)(`div`,{className:`overflow-x-auto`,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:`Queue`}),(0,C.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Waiting`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Completed`}),(0,C.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`})]})}),(0,C.jsx)(`tbody`,{children:L.length===0?(0,C.jsx)(`tr`,{children:(0,C.jsx)(`td`,{colSpan:6,className:`px-5 py-12 text-center text-sm text-faint`,children:`No queues yet.`})}):L.map(e=>(0,C.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,C.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent`,children:e.name}),(0,C.jsx)(`td`,{className:`px-5 py-3`,children:(0,C.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,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:u(e.counts.waiting)}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:u(e.counts.active)}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-success`,children:u(e.counts.completed)}),(0,C.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-danger`,children:u(e.counts.failed)})]},e.name))})]})}),(0,C.jsx)(`div`,{className:`px-5 pb-4`,children:(0,C.jsx)(v,{page:I,pageSize:T,total:P.length,onPageChange:r,label:`queues`})})]})]})}function k(e){return e==null||!Number.isFinite(e)?`—`:`${e<10?e.toFixed(1):Math.round(e)}ms`}function A({color:e,label:t,value:n}){return(0,C.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,C.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:e}}),t,` `,(0,C.jsxs)(`span`,{className:`text-fg`,children:[n.toFixed(1),`/s`]})]})}function j({color:e,label:n,value:r}){return(0,C.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,C.jsxs)(`dt`,{className:`flex items-center gap-2 text-muted`,children:[(0,C.jsx)(`span`,{className:t(`size-2 rounded-full`,e)}),n]}),(0,C.jsx)(`dd`,{className:`font-semibold tnum text-fg`,children:r})]})}export{O as MetricsPro};
@@ -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{C as r,O as i,S as a,Z as o,_ as s,b as c,c as l,h as u,m as d,w as f,x as p}from"./index-BFjeS9FG.js";import{a as m,n as h,o as g,t as _}from"./form-PtDLk33Z.js";var v=e(t(),1),y=n();function b(e){let[t,n]=(0,v.useState)(e),r=(0,v.useRef)(JSON.stringify(e));return(0,v.useEffect)(()=>{let t=JSON.stringify(e);t!==r.current&&(r.current=t,n(e))},[e]),[t,n]}function x(e){let t=String(e).trim();if(t===``)return null;let n=Number(t);return Number.isFinite(n)?n:null}function S({queue:e,config:t,onSaved:n}){let[i,s]=b(t),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),[p,m]=(0,v.useState)(!1);return(0,y.jsxs)(a,{children:[(0,y.jsx)(r,{title:`Stall detection`}),(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,y.jsxs)(`div`,{className:`col-span-2 flex items-center gap-2`,children:[(0,y.jsx)(g,{checked:i.enabled,onChange:e=>s({...i,enabled:e}),label:`enabled`}),(0,y.jsx)(`span`,{className:`text-sm text-muted`,children:`enabled`})]}),(0,y.jsx)(_,{label:`Stall interval (ms)`,children:(0,y.jsx)(h,{type:`number`,value:i.stallInterval,onChange:e=>s({...i,stallInterval:e.target.value})})}),(0,y.jsx)(_,{label:`Max stalls`,children:(0,y.jsx)(h,{type:`number`,value:i.maxStalls,onChange:e=>s({...i,maxStalls:e.target.value})})}),(0,y.jsx)(_,{label:`Grace period (ms)`,children:(0,y.jsx)(h,{type:`number`,value:i.gracePeriod,onChange:e=>s({...i,gracePeriod:e.target.value})})})]}),(0,y.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,y.jsx)(f,{variant:`accent`,size:`sm`,disabled:u,onClick:async()=>{let t=x(i.stallInterval),r=x(i.maxStalls),a=x(i.gracePeriod);if(t==null||r==null||a==null){l(`All numeric fields must be filled in`);return}d(!0),m(!1);try{l(null),await o.setStallConfig(e,{...i,stallInterval:t,maxStalls:r,gracePeriod:a}),n(),m(!0),window.setTimeout(()=>m(!1),2e3)}catch(e){l(e.message)}finally{d(!1)}},children:`Save`}),p&&(0,y.jsx)(`span`,{className:`text-xs text-success`,children:`Saved ✓`}),c&&(0,y.jsx)(`span`,{className:`text-xs text-danger`,children:c})]})]})}function C({queue:e,config:t,onSaved:n}){let[i,s]=b(t),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(!1),[p,m]=(0,v.useState)(!1);return(0,y.jsxs)(a,{children:[(0,y.jsx)(r,{title:`DLQ policy`}),(0,y.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,y.jsxs)(`div`,{className:`col-span-2 flex items-center gap-2`,children:[(0,y.jsx)(g,{checked:i.autoRetry,onChange:e=>s({...i,autoRetry:e}),label:`auto-retry`}),(0,y.jsx)(`span`,{className:`text-sm text-muted`,children:`auto-retry`})]}),(0,y.jsx)(_,{label:`Retry interval (ms)`,children:(0,y.jsx)(h,{type:`number`,value:i.autoRetryInterval,onChange:e=>s({...i,autoRetryInterval:e.target.value})})}),(0,y.jsx)(_,{label:`Max auto-retries`,children:(0,y.jsx)(h,{type:`number`,value:i.maxAutoRetries,onChange:e=>s({...i,maxAutoRetries:e.target.value})})}),(0,y.jsx)(_,{label:`Max age (ms)`,children:(0,y.jsx)(h,{type:`number`,value:i.maxAge??``,onChange:e=>s({...i,maxAge:e.target.value})})}),(0,y.jsx)(_,{label:`Max entries`,children:(0,y.jsx)(h,{type:`number`,value:i.maxEntries,onChange:e=>s({...i,maxEntries:e.target.value})})})]}),(0,y.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,y.jsx)(f,{variant:`accent`,size:`sm`,disabled:u,onClick:async()=>{let t=x(i.autoRetryInterval),r=x(i.maxAutoRetries),a=x(i.maxEntries),s=i.maxAge==null?null:x(i.maxAge);if(t==null||r==null||a==null){l(`All numeric fields must be filled in`);return}d(!0),m(!1);try{l(null),await o.setDlqConfig(e,{...i,autoRetryInterval:t,maxAutoRetries:r,maxAge:s,maxEntries:a}),n(),m(!0),window.setTimeout(()=>m(!1),2e3)}catch(e){l(e.message)}finally{d(!1)}},children:`Save`}),p&&(0,y.jsx)(`span`,{className:`text-xs text-success`,children:`Saved ✓`}),c&&(0,y.jsx)(`span`,{className:`text-xs text-danger`,children:c})]})]})}function w({queue:e,paused:t,busy:n,run:i}){let[s,c]=(0,v.useState)(`0`),[l,u]=(0,v.useState)(`1000`),[d,p]=(0,v.useState)(``);return(0,y.jsxs)(a,{className:`mb-6`,children:[(0,y.jsx)(r,{title:`Lifecycle`}),(0,y.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[t?(0,y.jsx)(f,{variant:`success`,size:`sm`,disabled:n,onClick:()=>i(`Resumed`,()=>o.resume(e)),children:`Resume`}):(0,y.jsx)(f,{variant:`warning`,size:`sm`,disabled:n,onClick:()=>i(`Paused`,()=>o.pause(e)),children:`Pause`}),(0,y.jsx)(f,{size:`sm`,disabled:n,onClick:()=>i(`Drained`,()=>o.drain(e),`Drain waiting jobs from "${e}"?`),children:`Drain`}),(0,y.jsx)(f,{size:`sm`,disabled:n,onClick:()=>i(`Retried completed`,()=>o.retryCompleted(e)),children:`Retry completed`}),(0,y.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,y.jsx)(`div`,{className:`w-24`,children:(0,y.jsx)(_,{label:`Promote N`,children:(0,y.jsx)(h,{type:`number`,value:d,onChange:e=>p(e.target.value),placeholder:`all`})})}),(0,y.jsx)(f,{size:`sm`,disabled:n,onClick:()=>i(`Promoted`,()=>o.promoteJobs(e,d?Number(d):void 0)),children:`Promote delayed`})]}),(0,y.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,y.jsx)(`div`,{className:`w-24`,children:(0,y.jsx)(_,{label:`Grace (ms)`,children:(0,y.jsx)(h,{type:`number`,value:s,onChange:e=>c(e.target.value)})})}),(0,y.jsx)(`div`,{className:`w-24`,children:(0,y.jsx)(_,{label:`Limit`,children:(0,y.jsx)(h,{type:`number`,value:l,onChange:e=>u(e.target.value)})})}),(0,y.jsx)(f,{variant:`danger`,size:`sm`,disabled:n,onClick:()=>i(`Cleaned`,()=>o.clean(e,{grace:Number(s),limit:Number(l)}),`Permanently delete up to ${l} completed/failed jobs older than ${s}ms from "${e}"?`),children:`Clean`})]})]})]})}function T({queue:e,busy:t,run:n}){let[i,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(``);return(0,y.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,y.jsxs)(a,{children:[(0,y.jsx)(r,{title:`Rate limit`}),(0,y.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,y.jsx)(`div`,{className:`flex-1`,children:(0,y.jsx)(_,{label:`Limit`,children:(0,y.jsx)(h,{type:`number`,value:i,onChange:e=>s(e.target.value),placeholder:`max per window`})})}),(0,y.jsx)(f,{variant:`accent`,size:`sm`,disabled:t||!i,onClick:()=>n(`Rate limit set`,()=>o.setRateLimit(e,Number(i))),children:`Set`}),(0,y.jsx)(f,{size:`sm`,disabled:t,onClick:()=>n(`Rate limit cleared`,()=>o.clearRateLimit(e)),children:`Clear`})]})]}),(0,y.jsxs)(a,{children:[(0,y.jsx)(r,{title:`Concurrency`}),(0,y.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,y.jsx)(`div`,{className:`flex-1`,children:(0,y.jsx)(_,{label:`Concurrency`,children:(0,y.jsx)(h,{type:`number`,value:c,onChange:e=>l(e.target.value),placeholder:`max in-flight`})})}),(0,y.jsx)(f,{variant:`accent`,size:`sm`,disabled:t||!c,onClick:()=>n(`Concurrency set`,()=>o.setConcurrency(e,Number(c))),children:`Set`}),(0,y.jsx)(f,{size:`sm`,disabled:t,onClick:()=>n(`Concurrency cleared`,()=>o.clearConcurrency(e)),children:`Clear`})]})]})]})}var E=[`waiting`,`active`,`completed`,`failed`,`delayed`,`paused`];function D(){let[e,t]=(0,v.useState)(``),[n,r]=(0,v.useState)(!1),[a,f]=(0,v.useState)(null),{data:h}=i(()=>o.queues(),[],{intervalMs:3e4});(0,v.useEffect)(()=>{!e&&h?.queues?.length&&t(h.queues[0].name)},[h,e]);let{data:g,error:_,loading:b,refetch:x}=i((0,v.useCallback)(async()=>{if(!e)return null;let[t,n,r]=await Promise.all([o.queueDetail(e,!1),o.getStallConfig(e).catch(()=>null),o.getDlqConfig(e).catch(()=>null)]);return{queue:e,detail:t,stall:n?.config??null,dlq:r?.config??null}},[e]),[e]),D=g&&g.queue===e?g:null,O=(e,t,n)=>{n&&!window.confirm(n)||(r(!0),f(null),t().then(t=>{let n=t?.count;f({ok:!0,text:`${e}${n==null?` ✓`:`: ${n}`}`}),x()}).catch(e=>f({ok:!1,text:e.message})).finally(()=>r(!1)))};return(0,y.jsxs)(`div`,{children:[(0,y.jsx)(u,{title:`Queue Control`,description:`Full per-queue operations and configuration.`,live:!0}),(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)(m,{value:e,onChange:e=>t(e.target.value),children:(h?.queues??[]).map(e=>(0,y.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),D?.detail&&(0,y.jsx)(s,{label:D.detail.paused?`Paused`:`Active`,tone:D.detail.paused?`amber`:`green`}),a&&(0,y.jsx)(`span`,{className:a.ok?`text-xs text-success`:`text-xs text-danger`,children:a.text})]}),_&&(0,y.jsx)(p,{onRetry:x}),b&&!D&&!_?(0,y.jsx)(c,{}):D?.detail?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`div`,{className:`mb-6 grid grid-cols-3 gap-3 md:grid-cols-6`,children:E.map(e=>(0,y.jsx)(d,{label:e,value:l(D.detail.counts[e]),compact:!0},e))}),(0,y.jsx)(w,{queue:e,paused:D.detail.paused,busy:n,run:O}),(0,y.jsx)(T,{queue:e,busy:n,run:O}),(0,y.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[D.stall&&(0,y.jsx)(S,{queue:e,config:D.stall,onSaved:()=>f({ok:!0,text:`Stall config saved ✓`})},e),D.dlq&&(0,y.jsx)(C,{queue:e,config:D.dlq,onSaved:()=>f({ok:!0,text:`DLQ config saved ✓`})},e)]})]}):!_&&(0,y.jsx)(`p`,{className:`text-sm text-faint`,children:`Select a queue.`})]})}export{D as QueueControl};