bunqueue-dashboard 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/.vite/manifest.json +65 -81
- package/dist/assets/{AddJob-B6DB3nLS.js → AddJob-kPPv3bPb.js} +2 -2
- package/dist/assets/{Alerts-CWgn7JKK.js → Alerts-DyA39_uq.js} +1 -1
- package/dist/assets/Benchmark-B3KDk7ue.js +1 -0
- package/dist/assets/{BulkAddJobs-D5A-56qh.js → BulkAddJobs-tL300nBi.js} +2 -2
- package/dist/assets/{CopilotPanel-C4u8nJMr.js → CopilotPanel-PMVR2Cd3.js} +1 -1
- package/dist/assets/{Cron-D8Cl1VQg.js → Cron-C_gbmPNI.js} +1 -1
- package/dist/assets/{CronManager-DkpnKkUk.js → CronManager-DC9YMFWw.js} +1 -1
- package/dist/assets/{Database-BmdixnFB.js → Database-LKuDZO6v.js} +3 -3
- package/dist/assets/{Diagnostics-DNCcEQZe.js → Diagnostics-02P8kK0A.js} +1 -1
- package/dist/assets/Dlq-Bz22b8rz.js +1 -0
- package/dist/assets/DlqControl-bZK1IQiC.js +1 -0
- package/dist/assets/{DlqPro-CkDrvA_m.js → DlqPro-7QuH6aNZ.js} +1 -1
- package/dist/assets/{Flows-tVpaOy-A.js → Flows-DpehOAzf.js} +1 -1
- package/dist/assets/JobInspector-D9cxknvv.js +2 -0
- package/dist/assets/{Jobs-CBoU-CeR.js → Jobs-DHJqAWws.js} +1 -1
- package/dist/assets/JobsPro-COyxqkNn.js +1 -0
- package/dist/assets/{Logs-BWq4h_tj.js → Logs-DoaPBM7P.js} +1 -1
- package/dist/assets/LogsPro-CnAAAWPH.js +1 -0
- package/dist/assets/{McpServer-DZD7-dyS.js → McpServer-XBSHRJpK.js} +2 -2
- package/dist/assets/{Metrics-Cu1CHLHF.js → Metrics-qqHBt5Mq.js} +1 -1
- package/dist/assets/MetricsPro-1p0Rpacn.js +1 -0
- package/dist/assets/{Overview-BSqH2VRL.js → Overview-DWCFawq-.js} +1 -1
- package/dist/assets/{Pagination-C-6yLcP3.js → Pagination-vdXIy1LL.js} +1 -1
- package/dist/assets/{QueueActions-Dhy0KXjr.js → QueueActions-CzenZmRB.js} +1 -1
- package/dist/assets/{QueueControl-2x3FDkR9.js → QueueControl-BNW57gvM.js} +1 -1
- package/dist/assets/{QueueDetail-Nfc8Zu5b.js → QueueDetail-w7VUvfk9.js} +1 -1
- package/dist/assets/QueueDetailPro-C6Ztytkp.js +1 -0
- package/dist/assets/{Queues-JsB6NujG.js → Queues-Bie4azaQ.js} +1 -1
- package/dist/assets/QueuesOverview-BUTDdZ1o.js +1 -0
- package/dist/assets/{S3Backup-CLizitSQ.js → S3Backup-BFA23J_Y.js} +1 -1
- package/dist/assets/{S3BackupPro-CoSFg6KF.js → S3BackupPro-I_YK8ufb.js} +1 -1
- package/dist/assets/ServerControl-CuAmFqD3.js +3 -0
- package/dist/assets/{Settings-Czzagq5p.js → Settings-BOTyxPXb.js} +1 -1
- package/dist/assets/{Usage-DGv7A2XQ.js → Usage-DP6SPxu5.js} +1 -1
- package/dist/assets/UsagePro-DteL5Ez5.js +1 -0
- package/dist/assets/{Webhooks-C0ByRD8k.js → Webhooks-LwgtwNkr.js} +1 -1
- package/dist/assets/{Workers-BB9o9IJ6.js → Workers-C-5dO7Go.js} +1 -1
- package/dist/assets/WorkersPro-DFhuR9f0.js +1 -0
- package/dist/assets/index-D9IOUE5C.js +8 -0
- package/dist/assets/index-KoYkT_4d.css +1 -0
- package/dist/assets/{useThroughputSeries-lWDIzQ4F.js → useThroughputSeries-D-_zB_EP.js} +1 -1
- package/dist/index.html +31 -3
- package/dist/og.png +0 -0
- package/package.json +15 -7
- package/scripts/embedded.gen.ts +108 -108
- package/dist/assets/Benchmark-C6eJlf21.js +0 -1
- package/dist/assets/CopyButton-B2gM7BeT.js +0 -1
- package/dist/assets/Dlq-ChFKsJwc.js +0 -1
- package/dist/assets/DlqControl-C0RX-JRF.js +0 -1
- package/dist/assets/JobInspector-B6RmHnFF.js +0 -2
- package/dist/assets/JobsPro-WiZ3UHGN.js +0 -1
- package/dist/assets/LogsPro-Bf9Ihrkj.js +0 -1
- package/dist/assets/MetricsPro-Bs-Rwic_.js +0 -1
- package/dist/assets/QueueDetailPro-CnuNbKyk.js +0 -1
- package/dist/assets/QueuesOverview-BB8UL0nT.js +0 -1
- package/dist/assets/ServerControl-DcP14j8m.js +0 -3
- package/dist/assets/UsagePro-Cre49W5i.js +0 -1
- package/dist/assets/WorkersPro-DgjEEM9Y.js +0 -1
- package/dist/assets/index-BovL_it0.css +0 -1
- package/dist/assets/index-Dlr2PaZ6.js +0 -8
package/scripts/embedded.gen.ts
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
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
|
-
import f1 from "../dist/
|
|
5
|
-
import f2 from "../dist/
|
|
6
|
-
import f3 from "../dist/assets/
|
|
7
|
-
import f4 from "../dist/assets/
|
|
8
|
-
import f5 from "../dist/assets/
|
|
9
|
-
import f6 from "../dist/assets/
|
|
10
|
-
import f7 from "../dist/assets/
|
|
4
|
+
import f1 from "../dist/og.png" with { type: 'file' };
|
|
5
|
+
import f2 from "../dist/favicon.svg" with { type: 'file' };
|
|
6
|
+
import f3 from "../dist/assets/form-C-zZyKfB.js" with { type: 'file' };
|
|
7
|
+
import f4 from "../dist/assets/QueueDetail-w7VUvfk9.js" with { type: 'file' };
|
|
8
|
+
import f5 from "../dist/assets/Cron-C_gbmPNI.js" with { type: 'file' };
|
|
9
|
+
import f6 from "../dist/assets/install-Bo6DRivH.js" with { type: 'file' };
|
|
10
|
+
import f7 from "../dist/assets/Pagination-vdXIy1LL.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/
|
|
13
|
-
import f10 from "../dist/assets/
|
|
14
|
-
import f11 from "../dist/assets/
|
|
15
|
-
import f12 from "../dist/assets/
|
|
16
|
-
import f13 from "../dist/assets/
|
|
17
|
-
import f14 from "../dist/assets/
|
|
18
|
-
import f15 from "../dist/assets/
|
|
19
|
-
import f16 from "../dist/assets/
|
|
20
|
-
import f17 from "../dist/assets/
|
|
21
|
-
import f18 from "../dist/assets/
|
|
22
|
-
import f19 from "../dist/assets/
|
|
23
|
-
import f20 from "../dist/assets/
|
|
24
|
-
import f21 from "../dist/assets/
|
|
25
|
-
import f22 from "../dist/assets/
|
|
26
|
-
import f23 from "../dist/assets/
|
|
12
|
+
import f9 from "../dist/assets/ServerControl-CuAmFqD3.js" with { type: 'file' };
|
|
13
|
+
import f10 from "../dist/assets/Metrics-qqHBt5Mq.js" with { type: 'file' };
|
|
14
|
+
import f11 from "../dist/assets/QueueDetailPro-C6Ztytkp.js" with { type: 'file' };
|
|
15
|
+
import f12 from "../dist/assets/connectionStore-B-hNUqwK.js" with { type: 'file' };
|
|
16
|
+
import f13 from "../dist/assets/Settings-BOTyxPXb.js" with { type: 'file' };
|
|
17
|
+
import f14 from "../dist/assets/UsagePro-DteL5Ez5.js" with { type: 'file' };
|
|
18
|
+
import f15 from "../dist/assets/QueueControl-BNW57gvM.js" with { type: 'file' };
|
|
19
|
+
import f16 from "../dist/assets/JobInspector-D9cxknvv.js" with { type: 'file' };
|
|
20
|
+
import f17 from "../dist/assets/QueueActions-CzenZmRB.js" with { type: 'file' };
|
|
21
|
+
import f18 from "../dist/assets/QueuesOverview-BUTDdZ1o.js" with { type: 'file' };
|
|
22
|
+
import f19 from "../dist/assets/AddJob-kPPv3bPb.js" with { type: 'file' };
|
|
23
|
+
import f20 from "../dist/assets/CronManager-DC9YMFWw.js" with { type: 'file' };
|
|
24
|
+
import f21 from "../dist/assets/MetricsPro-1p0Rpacn.js" with { type: 'file' };
|
|
25
|
+
import f22 from "../dist/assets/AreaChart-Dl_9G6GH.js" with { type: 'file' };
|
|
26
|
+
import f23 from "../dist/assets/Diagnostics-02P8kK0A.js" with { type: 'file' };
|
|
27
27
|
import f24 from "../dist/assets/jobActions-CuOdMglt.js" with { type: 'file' };
|
|
28
|
-
import f25 from "../dist/assets/
|
|
29
|
-
import f26 from "../dist/assets/
|
|
30
|
-
import f27 from "../dist/assets/
|
|
31
|
-
import f28 from "../dist/assets/
|
|
32
|
-
import f29 from "../dist/assets/
|
|
33
|
-
import f30 from "../dist/assets/
|
|
34
|
-
import f31 from "../dist/assets/
|
|
35
|
-
import f32 from "../dist/assets/
|
|
36
|
-
import f33 from "../dist/assets/
|
|
37
|
-
import f34 from "../dist/assets/
|
|
38
|
-
import f35 from "../dist/assets/
|
|
39
|
-
import f36 from "../dist/assets/
|
|
40
|
-
import f37 from "../dist/assets/
|
|
41
|
-
import f38 from "../dist/assets/Workers-
|
|
42
|
-
import f39 from "../dist/assets/
|
|
43
|
-
import f40 from "../dist/assets/
|
|
44
|
-
import f41 from "../dist/assets/
|
|
45
|
-
import f42 from "../dist/assets/
|
|
46
|
-
import f43 from "../dist/assets/
|
|
47
|
-
import f44 from "../dist/assets/
|
|
48
|
-
import f45 from "../dist/assets/
|
|
49
|
-
import f46 from "../dist/assets/
|
|
50
|
-
import f47 from "../dist/assets/
|
|
51
|
-
import f48 from "../dist/assets/
|
|
52
|
-
import f49 from "../dist/assets/
|
|
53
|
-
import f50 from "../dist/assets/
|
|
54
|
-
import f51 from "../dist/assets/
|
|
55
|
-
import f52 from "../dist/assets/
|
|
56
|
-
import f53 from "../dist/assets/
|
|
57
|
-
import f54 from "../dist/assets/
|
|
58
|
-
import f55 from "../dist/assets/
|
|
59
|
-
import f56 from "../dist/assets/
|
|
28
|
+
import f25 from "../dist/assets/CopilotPanel-PMVR2Cd3.js" with { type: 'file' };
|
|
29
|
+
import f26 from "../dist/assets/Queues-Bie4azaQ.js" with { type: 'file' };
|
|
30
|
+
import f27 from "../dist/assets/DlqControl-bZK1IQiC.js" with { type: 'file' };
|
|
31
|
+
import f28 from "../dist/assets/Flows-DpehOAzf.js" with { type: 'file' };
|
|
32
|
+
import f29 from "../dist/assets/BulkAddJobs-tL300nBi.js" with { type: 'file' };
|
|
33
|
+
import f30 from "../dist/assets/useThroughputSeries-D-_zB_EP.js" with { type: 'file' };
|
|
34
|
+
import f31 from "../dist/assets/Database-LKuDZO6v.js" with { type: 'file' };
|
|
35
|
+
import f32 from "../dist/assets/exportFile-tdUeW5m5.js" with { type: 'file' };
|
|
36
|
+
import f33 from "../dist/assets/S3Backup-BFA23J_Y.js" with { type: 'file' };
|
|
37
|
+
import f34 from "../dist/assets/Jobs-DHJqAWws.js" with { type: 'file' };
|
|
38
|
+
import f35 from "../dist/assets/Logs-DoaPBM7P.js" with { type: 'file' };
|
|
39
|
+
import f36 from "../dist/assets/JobsPro-COyxqkNn.js" with { type: 'file' };
|
|
40
|
+
import f37 from "../dist/assets/Dlq-Bz22b8rz.js" with { type: 'file' };
|
|
41
|
+
import f38 from "../dist/assets/Workers-C-5dO7Go.js" with { type: 'file' };
|
|
42
|
+
import f39 from "../dist/assets/cn-CMFYpumL.js" with { type: 'file' };
|
|
43
|
+
import f40 from "../dist/assets/LogsPro-CnAAAWPH.js" with { type: 'file' };
|
|
44
|
+
import f41 from "../dist/assets/WorkersPro-DFhuR9f0.js" with { type: 'file' };
|
|
45
|
+
import f42 from "../dist/assets/react-vendor-B68RYDeC.js" with { type: 'file' };
|
|
46
|
+
import f43 from "../dist/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2" with { type: 'file' };
|
|
47
|
+
import f44 from "../dist/assets/McpServer-XBSHRJpK.js" with { type: 'file' };
|
|
48
|
+
import f45 from "../dist/assets/promisePool-Daxkc1OB.js" with { type: 'file' };
|
|
49
|
+
import f46 from "../dist/assets/Webhooks-LwgtwNkr.js" with { type: 'file' };
|
|
50
|
+
import f47 from "../dist/assets/index-D9IOUE5C.js" with { type: 'file' };
|
|
51
|
+
import f48 from "../dist/assets/S3BackupPro-I_YK8ufb.js" with { type: 'file' };
|
|
52
|
+
import f49 from "../dist/assets/Benchmark-B3KDk7ue.js" with { type: 'file' };
|
|
53
|
+
import f50 from "../dist/assets/index-KoYkT_4d.css" with { type: 'file' };
|
|
54
|
+
import f51 from "../dist/assets/DlqPro-7QuH6aNZ.js" with { type: 'file' };
|
|
55
|
+
import f52 from "../dist/assets/inter-latin-wght-normal-Dx4kXJAl.woff2" with { type: 'file' };
|
|
56
|
+
import f53 from "../dist/assets/Alerts-DyA39_uq.js" with { type: 'file' };
|
|
57
|
+
import f54 from "../dist/assets/Usage-DP6SPxu5.js" with { type: 'file' };
|
|
58
|
+
import f55 from "../dist/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2" with { type: 'file' };
|
|
59
|
+
import f56 from "../dist/assets/Overview-DWCFawq-.js" with { type: 'file' };
|
|
60
60
|
import f57 from "../dist/index.html" with { type: 'file' };
|
|
61
61
|
|
|
62
62
|
export const ASSETS: Record<string, string> = {
|
|
63
63
|
"/.vite/manifest.json": f0,
|
|
64
|
-
"/
|
|
65
|
-
"/
|
|
66
|
-
"/assets/
|
|
67
|
-
"/assets/
|
|
68
|
-
"/assets/
|
|
69
|
-
"/assets/
|
|
70
|
-
"/assets/
|
|
64
|
+
"/og.png": f1,
|
|
65
|
+
"/favicon.svg": f2,
|
|
66
|
+
"/assets/form-C-zZyKfB.js": f3,
|
|
67
|
+
"/assets/QueueDetail-w7VUvfk9.js": f4,
|
|
68
|
+
"/assets/Cron-C_gbmPNI.js": f5,
|
|
69
|
+
"/assets/install-Bo6DRivH.js": f6,
|
|
70
|
+
"/assets/Pagination-vdXIy1LL.js": f7,
|
|
71
71
|
"/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2": f8,
|
|
72
|
-
"/assets/
|
|
73
|
-
"/assets/
|
|
74
|
-
"/assets/
|
|
75
|
-
"/assets/
|
|
76
|
-
"/assets/
|
|
77
|
-
"/assets/
|
|
78
|
-
"/assets/
|
|
79
|
-
"/assets/
|
|
80
|
-
"/assets/
|
|
81
|
-
"/assets/
|
|
82
|
-
"/assets/
|
|
83
|
-
"/assets/
|
|
84
|
-
"/assets/
|
|
85
|
-
"/assets/
|
|
86
|
-
"/assets/
|
|
72
|
+
"/assets/ServerControl-CuAmFqD3.js": f9,
|
|
73
|
+
"/assets/Metrics-qqHBt5Mq.js": f10,
|
|
74
|
+
"/assets/QueueDetailPro-C6Ztytkp.js": f11,
|
|
75
|
+
"/assets/connectionStore-B-hNUqwK.js": f12,
|
|
76
|
+
"/assets/Settings-BOTyxPXb.js": f13,
|
|
77
|
+
"/assets/UsagePro-DteL5Ez5.js": f14,
|
|
78
|
+
"/assets/QueueControl-BNW57gvM.js": f15,
|
|
79
|
+
"/assets/JobInspector-D9cxknvv.js": f16,
|
|
80
|
+
"/assets/QueueActions-CzenZmRB.js": f17,
|
|
81
|
+
"/assets/QueuesOverview-BUTDdZ1o.js": f18,
|
|
82
|
+
"/assets/AddJob-kPPv3bPb.js": f19,
|
|
83
|
+
"/assets/CronManager-DC9YMFWw.js": f20,
|
|
84
|
+
"/assets/MetricsPro-1p0Rpacn.js": f21,
|
|
85
|
+
"/assets/AreaChart-Dl_9G6GH.js": f22,
|
|
86
|
+
"/assets/Diagnostics-02P8kK0A.js": f23,
|
|
87
87
|
"/assets/jobActions-CuOdMglt.js": f24,
|
|
88
|
-
"/assets/
|
|
89
|
-
"/assets/
|
|
90
|
-
"/assets/
|
|
91
|
-
"/assets/
|
|
92
|
-
"/assets/
|
|
93
|
-
"/assets/
|
|
94
|
-
"/assets/
|
|
95
|
-
"/assets/
|
|
96
|
-
"/assets/
|
|
97
|
-
"/assets/
|
|
98
|
-
"/assets/
|
|
99
|
-
"/assets/
|
|
100
|
-
"/assets/
|
|
101
|
-
"/assets/Workers-
|
|
102
|
-
"/assets/
|
|
103
|
-
"/assets/
|
|
104
|
-
"/assets/
|
|
105
|
-
"/assets/
|
|
106
|
-
"/assets/
|
|
107
|
-
"/assets/
|
|
108
|
-
"/assets/
|
|
109
|
-
"/assets/
|
|
110
|
-
"/assets/
|
|
111
|
-
"/assets/
|
|
112
|
-
"/assets/
|
|
113
|
-
"/assets/
|
|
114
|
-
"/assets/
|
|
115
|
-
"/assets/
|
|
116
|
-
"/assets/
|
|
117
|
-
"/assets/
|
|
118
|
-
"/assets/
|
|
119
|
-
"/assets/
|
|
88
|
+
"/assets/CopilotPanel-PMVR2Cd3.js": f25,
|
|
89
|
+
"/assets/Queues-Bie4azaQ.js": f26,
|
|
90
|
+
"/assets/DlqControl-bZK1IQiC.js": f27,
|
|
91
|
+
"/assets/Flows-DpehOAzf.js": f28,
|
|
92
|
+
"/assets/BulkAddJobs-tL300nBi.js": f29,
|
|
93
|
+
"/assets/useThroughputSeries-D-_zB_EP.js": f30,
|
|
94
|
+
"/assets/Database-LKuDZO6v.js": f31,
|
|
95
|
+
"/assets/exportFile-tdUeW5m5.js": f32,
|
|
96
|
+
"/assets/S3Backup-BFA23J_Y.js": f33,
|
|
97
|
+
"/assets/Jobs-DHJqAWws.js": f34,
|
|
98
|
+
"/assets/Logs-DoaPBM7P.js": f35,
|
|
99
|
+
"/assets/JobsPro-COyxqkNn.js": f36,
|
|
100
|
+
"/assets/Dlq-Bz22b8rz.js": f37,
|
|
101
|
+
"/assets/Workers-C-5dO7Go.js": f38,
|
|
102
|
+
"/assets/cn-CMFYpumL.js": f39,
|
|
103
|
+
"/assets/LogsPro-CnAAAWPH.js": f40,
|
|
104
|
+
"/assets/WorkersPro-DFhuR9f0.js": f41,
|
|
105
|
+
"/assets/react-vendor-B68RYDeC.js": f42,
|
|
106
|
+
"/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2": f43,
|
|
107
|
+
"/assets/McpServer-XBSHRJpK.js": f44,
|
|
108
|
+
"/assets/promisePool-Daxkc1OB.js": f45,
|
|
109
|
+
"/assets/Webhooks-LwgtwNkr.js": f46,
|
|
110
|
+
"/assets/index-D9IOUE5C.js": f47,
|
|
111
|
+
"/assets/S3BackupPro-I_YK8ufb.js": f48,
|
|
112
|
+
"/assets/Benchmark-B3KDk7ue.js": f49,
|
|
113
|
+
"/assets/index-KoYkT_4d.css": f50,
|
|
114
|
+
"/assets/DlqPro-7QuH6aNZ.js": f51,
|
|
115
|
+
"/assets/inter-latin-wght-normal-Dx4kXJAl.woff2": f52,
|
|
116
|
+
"/assets/Alerts-DyA39_uq.js": f53,
|
|
117
|
+
"/assets/Usage-DP6SPxu5.js": f54,
|
|
118
|
+
"/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2": f55,
|
|
119
|
+
"/assets/Overview-DWCFawq-.js": f56,
|
|
120
120
|
"/index.html": f57,
|
|
121
121
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r}from"./react-vendor-B68RYDeC.js";import{r as i}from"./connectionStore-B-hNUqwK.js";import{C as a,T as o,U as s,W as c,c as l,h as u,k as d,m as f,nt as p,r as m,s as h,w as g}from"./index-Dlr2PaZ6.js";import{i as _,n as v,o as y,t as b}from"./form-C-zZyKfB.js";import{t as x}from"./AreaChart-Dl_9G6GH.js";import{t as S}from"./CopyButton-B2gM7BeT.js";var C=e(n(),1),w={total:1e6,batch:5e3,producers:64,payload:65536,workers:64,workerBatch:1e3,processMs:6e4,durationS:600},T={queue:`benchmark`,mode:`count`,total:5e3,durationS:30,batch:100,producers:4,payload:128,workers:4,workerBatch:100,processMs:5,durable:!1,removeOnComplete:!0},E={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}},D=(e,t,n)=>Number.isFinite(e)?Math.max(t,Math.min(n,Math.floor(e))):t,O=(e,t)=>e.length?e[Math.min(e.length-1,Math.floor(t/100*e.length))]:0,k=(e,t,n,r,i)=>Array.from({length:t},(t,a)=>({data:{i:e+a,blob:n},durable:r,removeOnComplete:i})),A=e=>new Promise(t=>setTimeout(t,e)),j=async(e,t)=>{let n=performance.now()+e;for(;t()&&performance.now()<n;)await A(Math.min(100,Math.max(0,n-performance.now())))},M=e=>e instanceof Error?e.message:String(e),N=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:`${Math.round(e)}`,P=r();function F({history:e,onClear:t}){if(!e.length)return null;let n=JSON.stringify(e,null,2);return(0,P.jsxs)(a,{padded:!1,className:`mt-6 overflow-hidden`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between border-b border-line px-5 py-3`,children:[(0,P.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Run history`}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(S,{value:n}),(0,P.jsx)(o,{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,P.jsx)(o,{size:`sm`,variant:`ghost`,onClick:t,children:`Clear`})]})]}),(0,P.jsx)(`div`,{className:`overflow-x-auto`,children:(0,P.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,P.jsx)(`th`,{className:`px-5 py-2 font-medium`,children:`Mode`}),(0,P.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Prod`}),(0,P.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Wkr`}),(0,P.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Pushed`}),(0,P.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Done`}),(0,P.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Push/s`}),(0,P.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Done/s`}),(0,P.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`p95`}),(0,P.jsx)(`th`,{className:`px-5 py-2 text-right font-medium`,children:`Dur`})]})}),(0,P.jsx)(`tbody`,{children:e.map(e=>(0,P.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,P.jsx)(`td`,{className:`px-5 py-2 capitalize text-muted`,children:e.mode}),(0,P.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-muted`,children:e.producers}),(0,P.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-muted`,children:e.workers}),(0,P.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-fg`,children:l(e.pushed)}),(0,P.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-success`,children:l(e.completed)}),(0,P.jsxs)(`td`,{className:`px-5 py-2 text-right tnum text-accent`,children:[N(e.pushPerSec),`/s`]}),(0,P.jsxs)(`td`,{className:`px-5 py-2 text-right tnum text-success`,children:[N(e.donePerSec),`/s`]}),(0,P.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-muted`,children:h(e.p95)}),(0,P.jsx)(`td`,{className:`px-5 py-2 text-right tnum text-muted`,children:h(e.durationMs)})]},e.id))})]})})]})}var I={pushed:0,completed:0,pushFailed:0,ackFailed:0,bytes:0,elapsedMs:0,pushPerSec:0,donePerSec:0,activeWorkers:0,pushSeries:[],doneSeries:[],etaMs:null,error:null},L=()=>({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:[]}),R=0;function z(){let[e,t]=(0,C.useState)(`idle`),[n,r]=(0,C.useState)(I),[i,a]=(0,C.useState)(null),[o,s]=(0,C.useState)([]),[c,l]=(0,C.useState)(null),u=(0,C.useRef)(!1),d=(0,C.useRef)(!1),f=(0,C.useRef)(!1),m=(0,C.useRef)(null),h=(0,C.useRef)(`idle`);h.current=e;let g=(0,C.useRef)(L());return(0,C.useEffect)(()=>()=>{u.current=!0},[]),(0,C.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=D(c.total,1,w.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,D(c.durationS,1,w.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(!d.current){d.current=!0;try{a(null);let n=e.queue.trim();if(!n){r({...I,error:`Queue name is required.`}),t(`error`);return}try{await p.overview()}catch(e){r({...I,error:`Server unreachable — start it on the Server page first. (${M(e)})`}),t(`error`);return}let i=D(e.total,1,w.total),o=D(e.durationS,1,w.durationS)*1e3,c=D(e.batch,1,w.batch),d=D(e.producers,e.mode===`duration`?0:1,w.producers),_=D(e.payload,0,w.payload),v=D(e.workers,0,w.workers),y=D(e.workerBatch,1,w.workerBatch),b=D(e.processMs,0,w.processMs);u.current=!1,f.current=!1,m.current=e,l(e),g.current=L(),g.current.startedAt=performance.now(),g.current.lastAt=performance.now(),r({...I}),t(`running`);let x=`x`.repeat(_),S=performance.now()+o,C=async()=>{for(;!u.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=k(r,t,x,e.durable,e.removeOnComplete),o=performance.now();try{await p.addJobsBulk(n,a),g.current.pushed+=t,g.current.bytes+=t*_}catch(e){g.current.pushFailed+=t,g.current.error??=M(e)}g.current.pushLat.push(performance.now()-o)}},T=async()=>{for(;!u.current&&!(e.mode===`duration`&&performance.now()>=S||e.mode===`count`&&g.current.completed>=i);){g.current.activeWorkers++;let t=[];try{try{t=(await p.pullBatch(n,y)).jobs??[]}catch(e){g.current.error??=M(e)}if(t.length>0){b>0&&await j(b,()=>!u.current);try{await p.ackBatch(t.map(e=>e.id)),g.current.completed+=t.length}catch(e){g.current.ackFailed+=t.length,g.current.error??=M(e)}}}finally{g.current.activeWorkers--}if(t.length===0){if(e.mode===`count`&&f.current)break;await A(50)}}},E=Array.from({length:d},C),N=Array.from({length:v},T),P=Promise.all(E).then(()=>{f.current=!0,!u.current&&e.mode===`count`&&v>0&&h.current===`running`&&t(`draining`)});await Promise.all([P,...N]);let F=g.current,z=performance.now()-F.startedAt,B=z/1e3||1,V=[...F.pushLat].sort((e,t)=>e-t),H={pushed:F.pushed,completed:F.completed,pushFailed:F.pushFailed,ackFailed:F.ackFailed,bytes:F.bytes,durationMs:z,pushPerSec:F.pushed/B,donePerSec:F.completed/B,mbPerSec:F.bytes/B,avg:V.length?V.reduce((e,t)=>e+t,0)/V.length:0,p50:O(V,50),p95:O(V,95),p99:O(V,99),max:V.length?V[V.length-1]:0,error:F.error};a(H),r(e=>({...e,pushed:F.pushed,completed:F.completed,elapsedMs:z,pushPerSec:0,donePerSec:0,activeWorkers:0,etaMs:0})),s(t=>[{...H,id:++R,at:Date.now(),mode:e.mode,producers:d,workers:v},...t].slice(0,12)),t(u.current?`stopped`:`done`)}finally{d.current=!1}}},stop:()=>{u.current=!0,(h.current===`running`||h.current===`draining`)&&t(`stopping`)},reset:()=>{u.current=!0,a(null),r(I),t(`idle`)},clearHistory:()=>s([])}}var B=[`count`,`duration`],V=[`total`,`durationS`,`batch`,`producers`,`payload`,`workers`,`workerBatch`,`processMs`],H=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)}),U=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 W(){let[e,n]=(0,C.useState)(()=>H(T)),r=z(),{phase:S,live:O,summary:k,history:A}=r,j=S===`running`||S===`draining`||S===`stopping`,M=(e,t)=>n(n=>({...n,[e]:t})),I=e=>t=>M(e,t.target.value),L=e=>n(t=>{let n={...t};for(let[t,r]of Object.entries(e))n[t]=V.includes(t)?String(r):r;return n}),[R,W]=(0,C.useState)(T.queue);(0,C.useEffect)(()=>{let t=setTimeout(()=>W(e.queue.trim()||T.queue),400);return()=>clearTimeout(t)},[e.queue]);let{data:ee,error:te}=d(()=>p.counts(R),[R],{intervalMs:1e3}),q=ee?.counts??null,[J,Y]=(0,C.useState)(!1),[X,Z]=(0,C.useState)(null),ne=async()=>{let t=e.queue.trim();if(J||!t)return;let n=q&&R===t?` Currently ${l(q.waiting??0)} waiting / ${l(q.completed??0)} completed.`:``;if(window.confirm(`Remove benchmark jobs from "${t}"?${n}`)){Y(!0),Z(null);try{let e=null;for(let n of[`waiting`,`completed`,`failed`,`delayed`])try{await p.clean(t,{state:n,limit:w.total})}catch(t){e=t.message}let n=await p.counts(t).catch(t=>(e=t.message,null));Z(n==null?{error:e??`server unreachable — could not verify`}:{remaining:n.counts?.active??0})}finally{Y(!1)}}},Q=r.runCfg??U(e),$=D(Q.total,1,w.total),re=D(Q.workers,0,w.workers),ie=Q.mode===`count`&&(j||k)?Math.min(100,O.pushed/$*100):0,ae=Q.mode===`count`&&(j||k)?Math.min(100,O.completed/$*100):0,oe=Q.mode===`duration`?Math.min(100,O.elapsedMs/(D(Q.durationS,1,w.durationS)*1e3)*100):0,se=S===`running`?Q.mode===`duration`?`Running…`:`Producing…`:S===`draining`?`Draining…`:S===`stopping`?`Stopping…`:S===`error`?`Error`:k?`Result`:`Ready`,ce=(S===`running`||S===`draining`)&&O.etaMs!=null?O.etaMs>0?`ETA ${h(O.etaMs)}`:`finishing…`:S===`stopped`?`stopped early`:S===`done`?`complete`:``;return(0,P.jsxs)(`div`,{children:[(0,P.jsx)(u,{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:S===`stopping`?(0,P.jsxs)(o,{variant:`warning`,size:`sm`,disabled:!0,children:[(0,P.jsx)(s,{className:`size-3.5`}),` Stopping…`]}):j?(0,P.jsxs)(o,{variant:`warning`,size:`sm`,onClick:r.stop,children:[(0,P.jsx)(s,{className:`size-3.5`}),` Stop`]}):(0,P.jsxs)(o,{variant:`success`,size:`sm`,onClick:()=>{let t=U(e),n=t.queue.trim()||T.queue;window.confirm(`Enqueue real jobs into "${n}" on ${i()}?`)&&r.run(t)},children:[(0,P.jsx)(c,{className:`size-3.5`}),` Run benchmark`]})}),O.error&&(0,P.jsx)(`div`,{className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-danger`,children:O.error}),(0,P.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`text-xs font-medium uppercase tracking-wider text-faint`,children:`Presets`}),Object.keys(E).map(e=>(0,P.jsx)(`button`,{type:`button`,disabled:j,onClick:()=>L(E[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,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-3`,children:[(0,P.jsxs)(a,{className:`lg:col-span-1`,children:[(0,P.jsx)(g,{title:`Configuration`}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,P.jsx)(b,{label:`Queue`,hint:`Jobs are enqueued here (created on first push).`,children:(0,P.jsx)(v,{value:e.queue,disabled:j,onChange:e=>M(`queue`,e.target.value)})}),(0,P.jsx)(b,{label:`Mode`,hint:e.mode===`count`?`Push a fixed number of jobs.`:`Run producers + workers for a fixed time.`,children:(0,P.jsx)(_,{options:B,value:e.mode,onChange:e=>M(`mode`,e),disabled:j})}),e.mode===`count`?(0,P.jsx)(b,{label:`Total jobs`,hint:`max ${l(w.total)}`,children:(0,P.jsx)(v,{type:`number`,min:1,max:w.total,value:e.total,disabled:j,onChange:I(`total`)})}):(0,P.jsx)(b,{label:`Duration (s)`,hint:`max ${w.durationS}s`,children:(0,P.jsx)(v,{type:`number`,min:1,max:w.durationS,value:e.durationS,disabled:j,onChange:I(`durationS`)})}),(0,P.jsx)(`div`,{className:`mt-1 text-[11px] font-semibold uppercase tracking-wider text-faint`,children:`Producers`}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,P.jsx)(b,{label:`Producers`,hint:`parallel, max ${w.producers}`,children:(0,P.jsx)(v,{type:`number`,min:e.mode===`duration`?0:1,max:w.producers,value:e.producers,disabled:j,onChange:I(`producers`)})}),(0,P.jsx)(b,{label:`Push batch`,hint:`jobs/req, max ${w.batch}`,children:(0,P.jsx)(v,{type:`number`,min:1,max:w.batch,value:e.batch,disabled:j,onChange:I(`batch`)})}),(0,P.jsx)(b,{label:`Payload`,hint:`bytes/job, max ${l(w.payload)}`,children:(0,P.jsx)(v,{type:`number`,min:0,max:w.payload,value:e.payload,disabled:j,onChange:I(`payload`)})})]}),(0,P.jsx)(`div`,{className:`mt-1 text-[11px] font-semibold uppercase tracking-wider text-faint`,children:`Workers (simulated)`}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,P.jsx)(b,{label:`Workers`,hint:`0 = produce only, max ${w.workers}`,children:(0,P.jsx)(v,{type:`number`,min:0,max:w.workers,value:e.workers,disabled:j,onChange:I(`workers`)})}),(0,P.jsx)(b,{label:`Pull batch`,hint:`jobs/pull, max ${w.workerBatch}`,children:(0,P.jsx)(v,{type:`number`,min:1,max:w.workerBatch,value:e.workerBatch,disabled:j,onChange:I(`workerBatch`)})}),(0,P.jsx)(b,{label:`Process (ms)`,hint:`simulated work per pull`,children:(0,P.jsx)(v,{type:`number`,min:0,max:w.processMs,value:e.processMs,disabled:j,onChange:I(`processMs`)})})]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,P.jsx)(y,{checked:e.durable,onChange:e=>M(`durable`,e),disabled:j}),(0,P.jsx)(`span`,{className:`text-sm text-muted`,children:`Durable (fsync each job)`})]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2`,children:[(0,P.jsx)(y,{checked:e.removeOnComplete,onChange:e=>M(`removeOnComplete`,e),disabled:j}),(0,P.jsx)(`span`,{className:`text-sm text-muted`,children:`Remove on complete`})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-3 pt-1`,children:[(0,P.jsx)(o,{variant:`ghost`,size:`sm`,disabled:j||J,onClick:ne,children:J?`Cleaning…`:`Clean queue`}),X&&(`error`in X?(0,P.jsxs)(`span`,{className:`text-xs text-danger`,children:[`Clean unverified — `,X.error]}):(0,P.jsx)(`span`,{className:t(`text-xs`,X.remaining>0?`text-warning`:`text-success`),children:X.remaining>0?`Cleaned — ${l(X.remaining)} active job(s) remain (requeued after the stall timeout)`:`Cleaned — 0 jobs remain`}))]})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-6 lg:col-span-2`,children:[(0,P.jsxs)(a,{children:[(0,P.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,P.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:se}),(0,P.jsx)(`span`,{className:`text-xs text-faint`,children:ce})]}),(0,P.jsx)(G,{label:Q.mode===`duration`?`Elapsed`:`Produced`,pct:Q.mode===`duration`?oe:ie,tone:`accent`}),re>0&&Q.mode===`count`&&(0,P.jsx)(G,{label:`Completed`,pct:ae,tone:`emerald`}),(0,P.jsxs)(`div`,{className:`mt-4 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,P.jsx)(f,{label:`Pushed`,value:l(O.pushed),tone:`accent`,compact:!0}),(0,P.jsx)(f,{label:`Completed`,value:l(O.completed),tone:`green`,compact:!0}),(0,P.jsx)(f,{label:`Push/sec`,value:N(O.pushPerSec),compact:!0}),(0,P.jsx)(f,{label:`Done/sec`,value:N(O.donePerSec),tone:`green`,compact:!0}),(0,P.jsx)(f,{label:`Elapsed`,value:h(O.elapsedMs),compact:!0}),(0,P.jsx)(f,{label:`Active workers`,value:`${O.activeWorkers}/${re}`,tone:`blue`,compact:!0}),(0,P.jsx)(f,{label:`Data`,value:m(k?.bytes??O.bytes),compact:!0}),(0,P.jsx)(f,{label:`Errors`,value:l((k?.pushFailed??O.pushFailed)+(k?.ackFailed??O.ackFailed)),tone:O.pushFailed+O.ackFailed?`red`:`default`,compact:!0})]})]}),(0,P.jsxs)(a,{children:[(0,P.jsx)(g,{title:`Throughput`}),(0,P.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Enqueue (client → server) vs completion (workers) per second`}),(0,P.jsx)(x,{series:[{label:`Push/sec`,color:`#38bdf8`,points:O.pushSeries,area:!0},{label:`Done/sec`,color:`#34d399`,points:O.doneSeries,area:!0}]}),(0,P.jsxs)(`div`,{className:`mt-2 flex items-center gap-4 font-mono text-[11px] text-faint`,children:[(0,P.jsx)(K,{color:`#38bdf8`,label:`Push/sec`,value:O.pushPerSec}),(0,P.jsx)(K,{color:`#34d399`,label:`Done/sec`,value:O.donePerSec})]})]})]})]}),k&&(0,P.jsxs)(a,{className:`mt-6`,children:[(0,P.jsx)(g,{title:`Summary`}),(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4 xl:grid-cols-8`,children:[(0,P.jsx)(f,{label:`Pushed`,value:l(k.pushed),tone:`accent`,compact:!0}),(0,P.jsx)(f,{label:`Completed`,value:l(k.completed),tone:`green`,compact:!0}),(0,P.jsx)(f,{label:`Duration`,value:h(k.durationMs),compact:!0}),(0,P.jsx)(f,{label:`Avg push/s`,value:N(k.pushPerSec),tone:`accent`,compact:!0}),(0,P.jsx)(f,{label:`Avg done/s`,value:N(k.donePerSec),tone:`green`,compact:!0}),(0,P.jsx)(f,{label:`Data rate`,value:`${m(k.mbPerSec)}/s`,compact:!0}),(0,P.jsx)(f,{label:`Push p95`,value:h(k.p95),compact:!0}),(0,P.jsx)(f,{label:`Push p99`,value:h(k.p99),compact:!0})]}),(0,P.jsxs)(`p`,{className:`mt-3 text-xs text-faint`,children:[`Push-batch latency avg `,h(k.avg),` · p50 `,h(k.p50),` · p95`,` `,h(k.p95),` · p99 `,h(k.p99),` · max `,h(k.max),`.`,k.error?` First error: ${k.error}`:``]})]}),(0,P.jsxs)(a,{className:`mt-6`,children:[(0,P.jsx)(g,{title:`Server queue: ${R}`,action:te?(0,P.jsx)(`span`,{className:`text-xs font-medium text-warning`,children:`stale — server unreachable`}):void 0}),(0,P.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Live counts from the server (poll 1s).`}),q?(0,P.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-5`,children:[(0,P.jsx)(f,{label:`Waiting`,value:l(q.waiting??0),tone:`amber`,compact:!0}),(0,P.jsx)(f,{label:`Active`,value:l(q.active??0),tone:`blue`,compact:!0}),(0,P.jsx)(f,{label:`Completed`,value:l(q.completed??0),tone:`green`,compact:!0}),(0,P.jsx)(f,{label:`Failed`,value:l(q.failed??0),tone:q.failed?`red`:`default`,compact:!0}),(0,P.jsx)(f,{label:`Delayed`,value:l(q.delayed??0),compact:!0})]}):(0,P.jsx)(`p`,{className:`text-sm text-faint`,children:`No counts yet — waiting for the server to answer for this queue.`})]}),(0,P.jsx)(F,{history:A,onClear:r.clearHistory})]})}function G({label:e,pct:n,tone:r}){return(0,P.jsxs)(`div`,{className:`mb-2`,children:[(0,P.jsxs)(`div`,{className:`mb-1 flex items-center justify-between text-[11px] text-faint`,children:[(0,P.jsx)(`span`,{children:e}),(0,P.jsxs)(`span`,{className:`tnum`,children:[n.toFixed(0),`%`]})]}),(0,P.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-surface-2`,children:(0,P.jsx)(`div`,{className:t(`h-full rounded-full transition-all`,r===`accent`?`bg-accent`:`bg-emerald-500`),style:{width:`${n}%`}})})]})}function K({color:e,label:t,value:n}){return(0,P.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,P.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:e}}),t,` `,(0,P.jsxs)(`span`,{className:`text-fg`,children:[N(n),`/s`]})]})}export{W as Benchmark};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r}from"./react-vendor-B68RYDeC.js";import{F as i,I as a,M as o}from"./index-Dlr2PaZ6.js";var s=e(n(),1),c=r();function l(e){try{let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}catch{return!1}}function u({value:e,className:n}){let[r,u]=(0,s.useState)(`idle`),d=(0,s.useRef)(null);return(0,s.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]),(0,c.jsx)(`button`,{type:`button`,onClick:async()=>{let t=!1;if(navigator.clipboard)try{await navigator.clipboard.writeText(e),t=!0}catch{}t||=l(e),u(t?`copied`:`failed`),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>u(`idle`),1500)},"aria-label":`Copy to clipboard`,title:r===`failed`?`Copy failed`:`Copy to clipboard`,className:t(`inline-flex size-6 shrink-0 items-center justify-center rounded-md text-faint transition-colors hover:bg-surface-2 hover:text-fg`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,n),children:r===`copied`?(0,c.jsx)(o,{className:`size-3.5 text-success`}):r===`failed`?(0,c.jsx)(i,{className:`size-3.5 text-danger`}):(0,c.jsx)(a,{className:`size-3.5`})})}export{u as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{h as t,t as n}from"./react-vendor-B68RYDeC.js";import{A as r,R as i,S as a,T as o,c as s,h as c,k as l,m as u,u as d,x as f,y as p}from"./index-Dlr2PaZ6.js";import{a as m}from"./form-C-zZyKfB.js";import{t as h}from"./Pagination-C-6yLcP3.js";var g=e(t(),1),_=n(),v=25;function y(){let[e,t]=(0,g.useState)(``),[n,y]=(0,g.useState)(0),[b,x]=(0,g.useState)(!1),[S,C]=(0,g.useState)(null),{data:w}=l(()=>r.queues(500),[],{intervalMs:3e4});(0,g.useEffect)(()=>{e||!w?.queues?.length||t((w.queues.find(e=>e.dlq>0)??w.queues[0]).name)},[w,e]);let{data:T,error:E,loading:D,refetch:O}=l((0,g.useCallback)(async()=>{if(!e)return{entries:[],total:0};let t=await r.dlq(e,v,n*v);return{entries:t.entries??[],total:t.total??t.entries?.length??0}},[e,n]),[e,n]),k=async(t,n)=>{if(window.confirm(`${t} the dead letter queue for "${e}"?`)){x(!0),C(null);try{await n(),C(`${t} done`),O()}catch(e){C(e.message)}finally{x(!1)}}},A=T?.entries??[];return(0,_.jsxs)(`div`,{children:[E&&(0,_.jsx)(a,{onRetry:O}),(0,_.jsx)(c,{title:`Dead Letter Queue`,description:`Jobs that exhausted their retries.`,live:!0,actions:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o,{size:`sm`,disabled:!e||b,onClick:()=>k(`Retry`,()=>r.retryDlq(e)),children:`Retry all`}),(0,_.jsx)(o,{variant:`danger`,size:`sm`,disabled:!e||b,onClick:()=>k(`Purge`,()=>r.purgeDlq(e)),children:`Purge`})]})}),(0,_.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(`div`,{className:`w-56`,children:(0,_.jsx)(m,{value:e,onChange:e=>{t(e.target.value),y(0)},children:(w?.queues??[]).map(e=>(0,_.jsxs)(`option`,{value:e.name,children:[e.name,` `,e.dlq?`(${e.dlq})`:``]},e.name))})}),(0,_.jsx)(`div`,{className:`w-40`,children:(0,_.jsx)(u,{label:`DLQ Entries`,value:s(T?.total),tone:T?.total?`red`:`default`,compact:!0})}),S&&(0,_.jsx)(`span`,{className:`text-xs text-muted`,children:S})]}),D&&!T&&!E?(0,_.jsx)(f,{label:`Loading DLQ…`}):A.length===0?(0,_.jsx)(p,{icon:(0,_.jsx)(i,{}),title:`Dead letter queue is empty`,hint:`Jobs land here after exhausting their retry attempts.`}):(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Reason`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Attempts`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`})]})}),(0,_.jsx)(`tbody`,{children:A.map((e,t)=>(0,_.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,_.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.jobId??e.id}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-fg`,children:e.name||`unknown`}),(0,_.jsx)(`td`,{className:`max-w-md px-5 py-3 text-xs text-red-400/90`,children:String(e.reason||e.error||`—`)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:Array.isArray(e.attempts)?e.attempts.length:e.attempts??`—`}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:d(e.failedAt??e.enteredAt)})]},e.jobId??e.id??t))})]})}),T&&(0,_.jsx)(h,{page:n,pageSize:v,total:T.total,onPageChange:y,label:`entries`})]})}export{y as Dlq};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,r,t as i}from"./react-vendor-B68RYDeC.js";import{B as a,E as o,J as s,K as c,P as l,R as u,S as d,T as f,a as p,c as m,h,k as g,m as _,nt as v,o as y,rt as b,u as x,x as S,y as C,z as w}from"./index-Dlr2PaZ6.js";import{a as T}from"./form-C-zZyKfB.js";import{t as E}from"./Pagination-C-6yLcP3.js";import{t as D}from"./CopyButton-B2gM7BeT.js";import{t as O}from"./exportFile-tdUeW5m5.js";var k=e(n(),1),A=i(),j=25,M=e=>`${e.job.id}-${e.enteredAt}`;function N(){let[e,t]=(0,k.useState)(``),[n,r]=(0,k.useState)(0),[i,a]=(0,k.useState)(`all`),[o,l]=(0,k.useState)(``),[p,y]=(0,k.useState)(new Set),[D,N]=(0,k.useState)(!1),[F,I]=(0,k.useState)(null),{data:L}=g(()=>v.queues(),[],{intervalMs:3e4});(0,k.useEffect)(()=>{e||!L?.queues?.length||t((L.queues.find(e=>e.dlq>0)??L.queues[0]).name)},[L,e]);let{data:R,error:z,loading:B,refetch:V}=g((0,k.useCallback)(async()=>{if(!e)return{queue:e,page:n,entries:[],total:0,stats:null};let[t,r]=await Promise.all([v.dlq(e,j,n*j),v.dlqStats(e).catch(()=>null)]);return{queue:e,page:n,entries:t.entries??[],total:t.total??0,stats:r?.stats??null}},[e,n]),[e,n]),H=R&&R.queue===e&&R.page===n?R:null;(0,k.useEffect)(()=>{if(!H)return;let e=Math.max(0,Math.ceil((H.total??0)/j)-1);n>e&&r(e)},[H,n]),(0,k.useEffect)(()=>{y(new Set)},[e,n]);let U=async(t,n,r)=>{if(!(r&&!window.confirm(r))){N(!0),I(null);try{let r=(await n())?.count??0,i=`${t} ${m(r)} ${r===1?`entry`:`entries`}`;I({ok:!0,text:i}),b.success(i,e),V()}catch(e){let n=e.message;I({ok:!1,text:n}),b.error(`${t.replace(/ed$/,``)} failed`,n)}finally{N(!1)}}},W=H?.stats?.byReason??{},G=(0,k.useMemo)(()=>Object.keys(W).filter(e=>W[e]>0),[W]),K=(0,k.useMemo)(()=>[...G].sort((e,t)=>(W[t]??0)-(W[e]??0))[0],[G,W]),q=H?.entries??[],J=(0,k.useMemo)(()=>{let e=q;i!==`all`&&(e=e.filter(e=>e.reason===i));let t=o.trim().toLowerCase();return t&&(e=e.filter(e=>e.job.id.toLowerCase().includes(t))),[...e].sort((e,t)=>t.enteredAt-e.enteredAt)},[q,i,o]),Y=i!==`all`||o.trim()!==``,X=(H?.total??0)>j,Z=e=>y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(h,{title:`DLQ Control`,description:`Inspect, triage, and replay one queue's dead-lettered jobs.`,live:!0,actions:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(f,{size:`sm`,disabled:!e||!J.length,onClick:()=>{if(J.length===0){b.info(`Nothing to export`);return}O(`dlq-${e}`,J.map(e=>({jobId:e.job.id,reason:e.reason,error:e.error??``,attempts:e.job.attempts??e.attempts?.length??``,enteredAt:new Date(e.enteredAt).toISOString()})),[`jobId`,`reason`,`error`,`attempts`,`enteredAt`])},children:[(0,A.jsx)(w,{className:`size-3.5`}),` Export`]}),(0,A.jsxs)(f,{size:`sm`,disabled:!e||D||!H?.total,onClick:()=>U(`Retried`,()=>v.retryDlq(e),`Retry all ${H?.total??0} DLQ entries for "${e}"?`),children:[(0,A.jsx)(c,{className:`size-3.5`}),` Retry all`]}),(0,A.jsx)(f,{variant:`danger`,size:`sm`,disabled:!e||D||!H?.total,onClick:()=>{let t=window.prompt(`Purge all ${H?.total??0} DLQ entries for "${e}"? This cannot be undone.\n\nType the queue name to confirm:`);if(t!=null){if(t.trim()!==e){I({ok:!1,text:`Purge cancelled — queue name did not match.`});return}U(`Purged`,()=>v.purgeDlq(e))}},children:`Purge`})]})}),z&&(0,A.jsx)(d,{onRetry:V}),(0,A.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,A.jsx)(_,{label:`Entries`,value:m(H?.total),tone:H?.total?`red`:`green`,hint:H?.total?K?`top: ${K}`:void 0:`queue is clean`,compact:!0}),(0,A.jsx)(_,{label:`Failure types`,value:H?.stats?m(G.length):`—`,hint:`distinct reasons`,compact:!0}),(0,A.jsx)(_,{label:`Pending retry`,value:H?.stats?m(H.stats.pendingRetry??0):`—`,tone:H?.stats?.pendingRetry?`amber`:`default`,hint:`auto-retry queued`,compact:!0}),(0,A.jsx)(_,{label:`Oldest entry`,value:H?.stats?.oldestEntry?x(H.stats.oldestEntry):`—`,hint:`time in DLQ`,compact:!0})]}),(0,A.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,A.jsx)(`div`,{className:`w-56`,children:(0,A.jsx)(T,{value:e,"aria-label":`Queue`,onChange:e=>{t(e.target.value),r(0),a(`all`),l(``),I(null)},children:(L?.queues??[]).map(e=>(0,A.jsxs)(`option`,{value:e.name,children:[e.name,` `,e.dlq?`(${e.dlq})`:``]},e.name))})}),(0,A.jsx)(`div`,{className:`w-44`,children:(0,A.jsxs)(T,{value:i,"aria-label":`Filter by reason`,onChange:e=>a(e.target.value),children:[(0,A.jsx)(`option`,{value:`all`,children:`All reasons`}),G.map(e=>(0,A.jsxs)(`option`,{value:e,children:[e,` (`,W[e],`)`]},e))]})}),(0,A.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,A.jsx)(s,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,A.jsx)(`input`,{value:o,onChange:e=>l(e.target.value),placeholder:X?`Filter this page by job ID…`:`Filter by job ID…`,"aria-label":`Filter by job ID`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),F&&(0,A.jsx)(`span`,{role:`status`,className:F.ok?`text-sm text-success`:`text-sm text-danger`,children:F.text})]}),B&&!H&&!z?(0,A.jsx)(S,{label:`Loading DLQ…`}):J.length===0?(0,A.jsx)(C,{icon:(0,A.jsx)(u,{}),title:Y?`No matches`:`Dead letter queue is empty`,hint:Y?X?`No entries on this page match your filter — filters are page-scoped. Try another page or clear them.`:`No entries match your filter. Clear it to see all entries.`:`Failed jobs that exhaust their retries land here.`}):(0,A.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,A.jsx)(`th`,{className:`w-8 py-3 pl-4`}),(0,A.jsx)(`th`,{className:`px-3 py-3 font-medium`,children:`Job ID`}),(0,A.jsx)(`th`,{className:`px-3 py-3 font-medium`,children:`Reason`}),(0,A.jsx)(`th`,{className:`px-3 py-3 font-medium`,children:`Error`}),(0,A.jsx)(`th`,{className:`px-3 py-3 text-right font-medium`,children:`Attempts`}),(0,A.jsx)(`th`,{className:`px-3 py-3 text-right font-medium`,children:`Entered`}),(0,A.jsx)(`th`,{className:`w-20 px-4 py-3`})]})}),(0,A.jsx)(`tbody`,{children:J.map(t=>{let n=M(t);return(0,A.jsx)(P,{entry:t,isOpen:p.has(n),busy:D,onToggle:()=>Z(n),onRetry:()=>U(`Retried`,()=>v.retryDlq(e,t.job.id),`Retry job ${t.job.id.slice(0,8)}… from "${e}"?`),attempts:t.attempts??[]},n)})})]})}),H&&(0,A.jsx)(E,{page:n,pageSize:j,total:H.total,onPageChange:r,label:`entries`})]})}function P({entry:e,isOpen:n,busy:i,onToggle:s,onRetry:u,attempts:d}){let f=e;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`tr`,{className:`border-b border-line align-top last:border-0 hover:bg-surface-2/40`,children:[(0,A.jsx)(`td`,{className:`py-3 pl-4`,children:(0,A.jsx)(o,{"aria-label":n?`Collapse details`:`Expand details`,"aria-expanded":n,onClick:s,children:(0,A.jsx)(l,{className:t(`size-3.5 transition-transform`,n&&`rotate-90`)})})}),(0,A.jsx)(`td`,{className:`px-3 py-3`,children:(0,A.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,A.jsx)(r,{to:`/job?id=${encodeURIComponent(f.job.id)}`,className:`max-w-[14rem] truncate font-mono text-xs text-accent hover:underline`,title:f.job.id,children:f.job.id}),(0,A.jsx)(D,{value:f.job.id})]})}),(0,A.jsx)(`td`,{className:`px-3 py-3`,children:(0,A.jsx)(`span`,{className:`inline-block rounded-md bg-red-500/10 px-2 py-0.5 text-xs text-danger`,children:f.reason})}),(0,A.jsx)(`td`,{className:`px-3 py-3`,children:(0,A.jsx)(`span`,{className:`block max-w-md truncate text-xs text-danger/80`,title:f.error??``,children:f.error||`—`})}),(0,A.jsx)(`td`,{className:`px-3 py-3 text-right tnum text-muted`,children:f.job.attempts??d.length}),(0,A.jsx)(`td`,{className:`px-3 py-3 text-right text-faint`,title:p(f.enteredAt),children:x(f.enteredAt)}),(0,A.jsx)(`td`,{className:`px-4 py-3`,children:(0,A.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,A.jsx)(r,{to:`/job?id=${encodeURIComponent(f.job.id)}`,children:(0,A.jsx)(o,{"aria-label":`Inspect job`,children:(0,A.jsx)(a,{className:`size-3.5`})})}),(0,A.jsx)(o,{"aria-label":`Retry job`,disabled:i,onClick:u,children:(0,A.jsx)(c,{className:`size-3.5`})})]})})]}),n&&(0,A.jsxs)(`tr`,{className:`border-b border-line bg-surface-2/30 last:border-0`,children:[(0,A.jsx)(`td`,{}),(0,A.jsxs)(`td`,{colSpan:6,className:`px-3 pb-4 pt-1`,children:[f.error&&(0,A.jsxs)(`div`,{className:`mb-3`,children:[(0,A.jsx)(`div`,{className:`mb-1 text-[11px] font-medium uppercase tracking-wider text-faint`,children:`Error`}),(0,A.jsx)(`pre`,{className:`max-h-40 overflow-auto whitespace-pre-wrap rounded-lg bg-surface p-3 font-mono text-xs text-danger/90`,children:f.error})]}),(0,A.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-[11px] font-medium uppercase tracking-wider text-faint`,children:[`Failure history`,typeof f.retryCount==`number`&&f.retryCount>0&&(0,A.jsxs)(`span`,{className:`rounded-full bg-surface px-2 py-0.5 text-[10px] normal-case text-muted`,children:[`retried `,f.retryCount,`×`]})]}),d.length===0?(0,A.jsx)(`p`,{className:`text-xs text-faint`,children:`No per-attempt history recorded.`}):(0,A.jsx)(`ol`,{className:`space-y-1.5`,children:d.map(e=>(0,A.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-0.5 rounded-lg border border-line bg-surface px-3 py-2 text-xs`,children:[(0,A.jsxs)(`span`,{className:`font-medium text-fg`,children:[`Attempt `,e.attempt]}),(0,A.jsx)(`span`,{className:`text-faint`,title:p(e.failedAt),children:x(e.failedAt)}),e.duration!=null&&(0,A.jsx)(`span`,{className:`tnum text-muted`,children:y(e.duration)}),e.reason&&(0,A.jsx)(`span`,{className:`rounded bg-red-500/10 px-1.5 text-danger`,children:e.reason}),e.error&&(0,A.jsx)(`span`,{className:`w-full truncate text-danger/70`,children:e.error})]},`${e.attempt}-${e.failedAt}`))})]})]})]})}export{N as DlqControl};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{f as t,h as n,r,t as i}from"./react-vendor-B68RYDeC.js";import{C as a,E as o,J as s,T as c,a as l,et as u,g as d,h as f,nt as p,o as m,w as h,x as g,y as _,z as v}from"./index-Dlr2PaZ6.js";import{a as y,n as b}from"./form-C-zZyKfB.js";import{t as x}from"./CopyButton-B2gM7BeT.js";import{n as S}from"./exportFile-tdUeW5m5.js";import{t as C}from"./jobActions-CuOdMglt.js";var w=e(n(),1);function T(e){let t={};return typeof e.priority==`number`&&(t.priority=e.priority),typeof e.maxAttempts==`number`&&(t.maxAttempts=e.maxAttempts),typeof e.backoff==`number`&&(t.backoff=e.backoff),typeof e.timeout==`number`&&(t.timeout=e.timeout),typeof e.removeOnComplete==`boolean`&&(t.removeOnComplete=e.removeOnComplete),typeof e.removeOnFail==`boolean`&&(t.removeOnFail=e.removeOnFail),{clone:{queue:e.queue??``,dataText:JSON.stringify(e.data??{},null,2),options:t}}}var E=i();function ee({job:e,busy:t,act:n}){let r=C(e.state),i=r.cancel||r.discard||r.promote||r.retryActive||r.retryDlq||r.requeueCompleted||r.setPriority||r.setDelay||r.fail||r.moveToDelayed;return(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Actions`}),(0,E.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.promote&&(0,E.jsx)(c,{size:`sm`,disabled:t,onClick:()=>n(`Promote`,()=>p.promoteJob(e.id)),children:`Promote (run now)`}),r.retryActive&&(0,E.jsx)(c,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>p.retryJob(e.id)),children:`Retry (move to waiting)`}),r.retryDlq&&(0,E.jsx)(c,{size:`sm`,disabled:t,onClick:()=>n(`Retry`,()=>p.retryDlq(e.queue??``,e.id)),children:`Retry from DLQ`}),r.requeueCompleted&&(0,E.jsx)(c,{size:`sm`,disabled:t,onClick:()=>n(`Requeue`,()=>p.retryCompleted(e.queue??``,e.id)),children:`Requeue`}),r.moveToDelayed&&(0,E.jsx)(D,{label:`Move to delayed (ms)`,cta:`To delayed`,disabled:t,onSubmit:t=>n(`Move to delayed`,()=>p.moveToDelayed(e.id,t))}),r.discard&&(0,E.jsx)(c,{size:`sm`,disabled:t,onClick:()=>n(`Discard`,()=>p.discardJob(e.id)),children:`Discard (to DLQ)`}),r.setPriority&&(0,E.jsx)(D,{label:`Set priority`,cta:`Set`,disabled:t,onSubmit:t=>n(`Priority`,()=>p.changePriority(e.id,t))}),r.setDelay&&(0,E.jsx)(D,{label:`Set delay (ms)`,cta:`Delay`,disabled:t,onSubmit:t=>n(`Delay`,()=>p.changeDelay(e.id,t))}),r.fail&&(0,E.jsx)(O,{label:`Fail reason (optional)`,cta:`Fail`,variant:`warning`,disabled:t,onSubmit:t=>n(`Fail`,()=>p.failJob(e.id,t||void 0),`Force-fail this active job?`)}),r.cancel&&(0,E.jsx)(c,{variant:`danger`,size:`sm`,disabled:t,onClick:()=>n(`Cancel`,()=>p.cancelJob(e.id),`Cancel and remove job ${e.id}?`),children:`Cancel (delete)`}),!i&&(0,E.jsxs)(`p`,{className:`text-xs text-faint`,children:[`No actions available for a job in state "`,e.state??`unknown`,`".`]})]})]})}function D({label:e,cta:t,disabled:n,onSubmit:r}){let[i,a]=(0,w.useState)(``);return(0,E.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),!n&&i.trim()!==``&&r(Number(i))},children:[(0,E.jsx)(b,{type:`number`,value:i,onChange:e=>a(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(c,{type:`submit`,size:`sm`,disabled:n||i.trim()===``,children:t})]})}function O({label:e,cta:t,disabled:n,variant:r=`default`,onSubmit:i}){let[a,o]=(0,w.useState)(``);return(0,E.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),!n&&(i(a),o(``))},children:[(0,E.jsx)(b,{value:a,onChange:e=>o(e.target.value),placeholder:e,"aria-label":e,className:`h-8 text-xs`}),(0,E.jsx)(c,{type:`submit`,size:`sm`,variant:r,disabled:n,children:t})]})}var k=36e5,A=10;function j(e){let t=e.maxAttempts??0,n=e.attempts??0,r=e.backoffConfig,i=r?.maxDelay??k,a=r?.delay??e.backoff??1e3,o=[];for(let e=n;e<t&&o.length<A;e++){let t=r?.type===`fixed`?a:a*2**e;o.push({attempt:e+1,delayMs:Math.min(t,i)})}return o}function M({job:e}){let t=e.maxAttempts??0,n=e.attempts??0;if(t<=1)return(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Backoff`}),(0,E.jsxs)(`p`,{className:`text-xs text-faint`,children:[`No retries configured (max attempts = `,t||1,`).`]})]});if(n>=t)return(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Backoff schedule`}),(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`Max attempts reached — no further retries will be scheduled.`})]});let r=e.backoffConfig,i=r?r.type:`exponential (default)`,o=t-n,s=j(e);return(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Backoff schedule`,action:(0,E.jsxs)(`span`,{className:`text-xs capitalize text-faint`,children:[i,r?.maxDelay?` · cap ${m(r.maxDelay)}`:``]})}),(0,E.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:s.map(e=>(0,E.jsxs)(`li`,{className:`flex items-center justify-between text-sm`,children:[(0,E.jsxs)(`span`,{className:`text-muted`,children:[`Attempt `,e.attempt,` / `,t]}),(0,E.jsxs)(`span`,{className:`font-mono text-xs text-fg`,children:[`~`,m(e.delayMs)]})]},e.attempt))}),o>A&&(0,E.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Showing next `,A,` of `,o,` remaining attempts.`]}),(0,E.jsxs)(`p`,{className:`mt-2 text-[11px] text-faint`,children:[`Approximate — the server applies ±`,r?.type===`fixed`?`20`:`50`,`% jitter at retry time, capped at `,m(r?.maxDelay??k),`.`]})]})}function N({jobId:e}){let[t,n]=(0,w.useState)(!1),[r,i]=(0,w.useState)(!1),[o,s]=(0,w.useState)(!1),[l,u]=(0,w.useState)(void 0),[d,f]=(0,w.useState)(null),m=async()=>{s(!0),f(null);try{u((await p.jobChildren(e)).data?.values),i(!0)}catch(e){f(e.message)}finally{s(!1)}},g=()=>{let e=!t;n(e),e&&!r&&!o&&m()},_=l&&typeof l==`object`?Array.isArray(l)?l.length:Object.keys(l).length:0;return(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Child values`,action:(0,E.jsx)(c,{size:`sm`,variant:`ghost`,onClick:g,children:t?`Hide`:`Show`})}),t?o?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`Loading child values…`}):d?(0,E.jsx)(`p`,{className:`text-xs text-danger`,children:d}):_===0?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No child values available.`}):(0,E.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:JSON.stringify(l,null,2)}):(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`Resolved return values from this flow job's children.`})]})}function P({data:e,busy:t,onSave:n}){let[r,i]=(0,w.useState)(()=>JSON.stringify(e??null,null,2)),[o,s]=(0,w.useState)(null),l=(0,w.useRef)(r);return(0,w.useEffect)(()=>{let t=JSON.stringify(e??null,null,2);t!==l.current&&(l.current=t,i(t),s(null))},[e]),(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Data`,action:(0,E.jsx)(c,{size:`sm`,disabled:t,onClick:()=>{let e;try{e=JSON.parse(r)}catch(e){s(`Invalid JSON: ${e.message}`);return}s(null),n(e)},children:`Save data`})}),(0,E.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),spellCheck:!1,rows:8,className:`w-full resize-y rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`}),o&&(0,E.jsx)(`p`,{className:`mt-2 text-xs text-danger`,children:o})]})}function F({jobId:e}){let[t,n]=(0,w.useState)([]),[r,i]=(0,w.useState)(0),[o,s]=(0,w.useState)(!1),[l,u]=(0,w.useState)(null),[d,f]=(0,w.useState)(``),[m,g]=(0,w.useState)(`info`),[_,v]=(0,w.useState)(!1),x=(0,w.useCallback)(async()=>{s(!0),u(null);try{let t=await p.jobLogs(e);n(t.data?.logs??[]),i(t.data?.count??0)}catch(e){u(e.message)}finally{s(!1)}},[e]);(0,w.useEffect)(()=>{x()},[x]);let S=async()=>{if(_)return;let t=d.trim();if(t){v(!0),u(null);try{await p.addJobLog(e,t,m),f(``),await x()}catch(e){u(e.message)}finally{v(!1)}}};return(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Logs`,action:(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`span`,{className:`font-mono text-xs text-faint`,children:r}),(0,E.jsx)(c,{size:`sm`,variant:`ghost`,disabled:o||_,onClick:x,children:`Refresh`}),(0,E.jsx)(c,{size:`sm`,variant:`danger`,disabled:_||t.length===0,onClick:async()=>{if(window.confirm(`Clear all logs for this job?`)){v(!0),u(null);try{await p.clearJobLogs(e),await x()}catch(e){u(e.message)}finally{v(!1)}}},children:`Clear logs`})]})}),l&&(0,E.jsx)(`p`,{className:`mb-2 text-xs text-danger`,children:l}),t.length===0?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No log lines recorded for this job.`}):(0,E.jsx)(`ol`,{className:`flex max-h-64 flex-col gap-1 overflow-auto rounded-lg bg-surface-2 p-3`,children:t.map((e,t)=>(0,E.jsx)(`li`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-muted`,children:typeof e==`string`?e:JSON.stringify(e)},t))}),(0,E.jsxs)(`div`,{className:`mt-3 flex gap-2`,children:[(0,E.jsx)(b,{value:d,onChange:e=>f(e.target.value),onKeyDown:e=>e.key===`Enter`&&S(),placeholder:`Add a log line…`,className:`h-8 flex-1 text-xs`}),(0,E.jsxs)(y,{value:m,onChange:e=>g(e.target.value),className:`h-8 w-24 text-xs`,children:[(0,E.jsx)(`option`,{value:`info`,children:`info`}),(0,E.jsx)(`option`,{value:`warn`,children:`warn`}),(0,E.jsx)(`option`,{value:`error`,children:`error`})]}),(0,E.jsx)(c,{size:`sm`,disabled:_||d.trim()===``,onClick:S,children:`Add`})]})]})}function I({timeline:e}){let t=e??[];return(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Timeline`}),t.length===0?(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No state transitions recorded yet.`}):(0,E.jsx)(`ol`,{className:`flex flex-col gap-0`,children:t.map((e,t)=>(0,E.jsxs)(`li`,{className:`border-b border-line/60 py-2 last:border-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(d,{status:e.state}),e.attempt!=null&&(0,E.jsxs)(`span`,{className:`font-mono text-[11px] text-faint`,children:[`attempt `,e.attempt]})]}),(0,E.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:l(e.timestamp)})]}),(e.worker||e.error)&&(0,E.jsxs)(`div`,{className:`mt-1 pl-0.5`,children:[e.worker&&(0,E.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.worker}),e.error&&(0,E.jsx)(`div`,{className:`mt-0.5 text-xs text-danger/90`,children:e.error})]})]},t))})]})}function te(e){let t=e.timeline??[];for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.state===`failed`&&n.error)return{message:n.error,attempt:n.attempt,timestamp:n.timestamp}}return null}function L(){let[e,n]=t(),[i,o]=(0,w.useState)(e.get(`id`)??``),[b,C]=(0,w.useState)(`id`),[D,O]=(0,w.useState)(null),[k,A]=(0,w.useState)({fetched:!1,value:void 0}),[j,L]=(0,w.useState)(!1),[ie,z]=(0,w.useState)(!1),[B,V]=(0,w.useState)(null),[H,U]=(0,w.useState)(!1),W=(0,w.useRef)(0),G=async(e,t=b,r=!1)=>{let i=e.trim();if(!i)return;let a=++W.current;L(!0),z(!1),r||V(null);try{let e=(await(t===`custom`?p.jobByCustomId(i):p.job(i))).job;if(!e){if(a!==W.current)return;O(null),A({fetched:!1,value:void 0}),z(!0),n({},{replace:!0});return}let r=e.state===`completed`?await p.jobResult(e.id).catch(()=>null):null;if(a!==W.current)return;O(e),o(t===`custom`?e.id:i),n({id:e.id},{replace:!0}),A(r?{fetched:!0,value:r.result}:{fetched:!1,value:void 0})}catch(e){if(a!==W.current)return;e instanceof u&&(e.status===404||/not found/i.test(e.message))?(O(null),A({fetched:!1,value:void 0}),z(!0),n({},{replace:!0})):V({ok:!1,text:e.message})}finally{a===W.current&&L(!1)}},K=e.get(`id`);(0,w.useEffect)(()=>{K&&K!==D?.id&&G(K,`id`)},[K,D?.id]);let q=async(e,t,r)=>{if(!(r&&!window.confirm(r))&&D){U(!0),V(null);try{await t(),V({ok:!0,text:`${e} ✓`}),e===`Cancel`?(O(null),A({fetched:!1,value:void 0}),n({},{replace:!0})):await G(D.id,`id`,!0)}catch(e){V({ok:!1,text:e.message})}finally{U(!1)}}},J=D?.state,Y=D?te(D):null,X=(D?.stacktrace?.length??0)>0,Z=(D?.childrenIds?.length??0)>0,Q=J===`failed`,$=D&&(Y||X)?(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Error`}),Y&&(0,E.jsxs)(`div`,{className:`mb-3`,children:[(0,E.jsx)(`p`,{className:`text-sm text-danger`,children:Y.message}),(0,E.jsxs)(`p`,{className:`mt-1 text-[11px] text-faint`,children:[Y.attempt==null?``:`Attempt ${Y.attempt} · `,l(Y.timestamp)]})]}),X&&(0,E.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap rounded-lg bg-surface-2 p-3 font-mono text-xs text-danger/90`,children:D.stacktrace?.join(`
|
|
2
|
-
`)})]}):null;return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(f,{title:`Job Inspector`,description:`Look up any job by ID and drive its full lifecycle.`,actions:D?(0,E.jsxs)(E.Fragment,{children:[(Z||D.parentId)&&(0,E.jsx)(r,{to:`/flows?root=${encodeURIComponent(D.id)}`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`View flow`}),(0,E.jsx)(r,{to:`/add-job`,state:T(D),title:`Enqueue a new job pre-filled from this one`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Clone`}),(0,E.jsxs)(c,{size:`sm`,onClick:()=>S(`job-${D.id}`,k.fetched?{...D,result:k.value}:D),children:[(0,E.jsx)(v,{className:`size-3.5`}),` Download JSON`]})]}):void 0}),(0,E.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-2`,children:[(0,E.jsxs)(y,{value:b,"aria-label":`Lookup mode`,onChange:e=>C(e.target.value),className:`w-40`,children:[(0,E.jsx)(`option`,{value:`id`,children:`By job ID`}),(0,E.jsx)(`option`,{value:`custom`,children:`By custom ID`})]}),(0,E.jsxs)(`div`,{className:`relative min-w-56 flex-1`,children:[(0,E.jsx)(s,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,E.jsx)(`input`,{value:i,"aria-label":b===`custom`?`Custom job ID`:`Job ID`,onChange:e=>o(e.target.value),onKeyDown:e=>e.key===`Enter`&&G(i),placeholder:b===`custom`?`custom / idempotency id — Enter to look up`:`job id (UUID) — Enter to look up`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 font-mono text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,E.jsx)(c,{variant:`accent`,disabled:j,onClick:()=>G(i),children:`Look up`})]}),B&&(0,E.jsx)(`div`,{role:`status`,className:B.ok?`mb-4 text-sm text-success`:`mb-4 text-sm text-danger`,children:B.text}),j&&!D?(0,E.jsx)(g,{label:`Loading job…`}):ie?(0,E.jsx)(_,{title:`Job not found`,hint:`Check the ID, or the job may have been removed.`}):D?(0,E.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-3`,children:[(0,E.jsxs)(`div`,{className:`flex flex-col gap-6 lg:col-span-2`,children:[(0,E.jsxs)(a,{children:[(0,E.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(`div`,{className:`truncate font-mono text-sm text-fg`,children:D.id}),(0,E.jsx)(x,{value:D.id})]}),(0,E.jsx)(`div`,{className:`mt-1 font-mono text-xs text-faint`,children:D.queue})]}),(0,E.jsx)(d,{status:J??`waiting`})]}),(0,E.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-6 gap-y-2 text-sm sm:grid-cols-3`,children:[(0,E.jsx)(R,{k:`Priority`,v:String(D.priority??0)}),(0,E.jsx)(R,{k:`Attempts`,v:`${D.attempts??0} / ${D.maxAttempts??`?`}`}),(0,E.jsx)(R,{k:`Progress`,v:`${D.progress??0}%`}),(0,E.jsx)(R,{k:`Created`,v:l(D.createdAt)}),(0,E.jsx)(R,{k:`Started`,v:l(D.startedAt??void 0)}),(0,E.jsx)(R,{k:`Completed`,v:l(D.completedAt??void 0)}),(0,E.jsx)(R,{k:`Duration`,v:m(D.startedAt&&D.completedAt?D.completedAt-D.startedAt:void 0)}),(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`dt`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`Custom ID`}),(0,E.jsxs)(`dd`,{className:`flex items-center gap-1 text-fg`,children:[(0,E.jsx)(`span`,{className:`truncate font-mono`,children:D.customId??`—`}),D.customId&&(0,E.jsx)(x,{value:D.customId})]})]})]})]}),Q&&$,(0,E.jsx)(P,{data:D.data,busy:H,onSave:e=>q(`Data`,()=>p.updateJobData(D.id,e))}),J===`completed`&&(0,E.jsxs)(a,{children:[(0,E.jsx)(h,{title:`Result`,action:k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(re,{value:k.value,filename:`job-${D.id}-result`}):void 0}),k.fetched&&k.value!==void 0&&k.value!==null?(0,E.jsx)(ne,{value:k.value}):(0,E.jsx)(`p`,{className:`text-xs text-faint`,children:`No result stored for this job.`})]}),!Q&&$,(0,E.jsx)(F,{jobId:D.id},`logs-${D.id}`),Z&&(0,E.jsx)(N,{jobId:D.id},`children-${D.id}`),(0,E.jsx)(I,{timeline:D.timeline}),(0,E.jsx)(M,{job:D})]}),(0,E.jsx)(`div`,{className:`order-first lg:order-none`,children:(0,E.jsx)(ee,{job:D,busy:H,act:q})})]}):(0,E.jsx)(_,{title:`No job loaded`,hint:`Enter a job ID above to inspect it.`})]})}function R({k:e,v:t}){return(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`dt`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:e}),(0,E.jsx)(`dd`,{className:`text-fg`,children:t})]})}function ne({value:e}){return(0,E.jsx)(`pre`,{className:`max-h-64 overflow-auto rounded-lg bg-surface-2 p-3 font-mono text-xs text-muted`,children:JSON.stringify(e??null,null,2)})}function re({value:e,filename:t}){return(0,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,E.jsx)(x,{value:JSON.stringify(e??null,null,2)}),(0,E.jsx)(o,{"aria-label":`Download JSON`,title:`Download JSON`,onClick:()=>S(t,e??null),children:(0,E.jsx)(v,{className:`size-3.5`})})]})}export{L as JobInspector};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{f as n,h as r,r as i,t as a}from"./react-vendor-B68RYDeC.js";import{B as o,E as s,F as ee,J as c,K as l,S as u,T as d,W as te,Y as ne,a as re,c as ie,g as ae,h as oe,k as f,l as se,m as p,n as ce,nt as m,o as le,rt as h,x as ue,z as g}from"./index-Dlr2PaZ6.js";import{a as de,i as fe}from"./form-C-zZyKfB.js";import{t as pe}from"./Pagination-C-6yLcP3.js";import{t as _}from"./exportFile-tdUeW5m5.js";import{t as v}from"./jobActions-CuOdMglt.js";var y=e(r(),1),b=a(),x=[`all`,`waiting`,`active`,`completed`,`failed`],S=25;function me(e=0){return e>=10?{t:`HIGH`,c:`text-warning`}:e>=1?{t:`MEDIUM`,c:`text-blue-400`}:{t:`LOW`,c:`text-faint`}}function C(e){let t=v(e.state);return t.retryActive?m.retryJob(e.id):t.retryDlq?m.retryDlq(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not retryable`))}function w(){let[e,r]=n(),[a,w]=(0,y.useState)(e.get(`queue`)??``),[T,he]=(0,y.useState)(()=>{let t=e.get(`status`);return t&&x.includes(t)?t:`all`}),[E,ge]=(0,y.useState)(``),[D,O]=(0,y.useState)(0),[k,A]=(0,y.useState)(new Set),[_e,j]=(0,y.useState)(new Set),[M,N]=(0,y.useState)(!1),[P,F]=(0,y.useState)(null),{data:I}=f(()=>m.queuesSummary(),[],{intervalMs:3e4}),{data:ve}=f(()=>m.overview(),[],{intervalMs:1e4});(0,y.useEffect)(()=>{!a&&I?.length&&w(I[0].name)},[I,a]);let L=`${a}|${T}|${D}`,{data:R,error:z,loading:ye,refetch:B}=f((0,y.useCallback)(async()=>{if(!a)return{view:L,jobs:[]};let e=T===`all`?void 0:[T];return{view:L,jobs:((await m.jobsList(a,e,S,D*S)).jobs??[]).map(e=>({...e,queue:e.queue??a}))}},[a,T,D,L]),[a,T,D]),V=R&&R.view===L?R.jobs:null,be=(V?.length??0)===S,H=(0,y.useMemo)(()=>{let e=E.trim().toLowerCase();return e?(V??[]).filter(t=>t.id.toLowerCase().includes(e)):V??[]},[V,E]),U=ve?.stats,W=(0,y.useMemo)(()=>(I??[]).reduce((e,t)=>e+(t.counts?.failed??0),0),[I]),G=U?ce(U.completed,W):null,K=e=>U?ie(e):`—`,q=()=>O(0),J=(e,t)=>{let n={};e&&(n.queue=e),t!==`all`&&(n.status=t),r(n,{replace:!0})};(0,y.useEffect)(()=>{A(new Set)},[a,T,D]);let xe=e=>A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),Y=H.length>0&&H.every(e=>k.has(e.id)),Se=()=>A(()=>Y?new Set:new Set(H.map(e=>e.id))),X=async(e,t,n,r)=>{if(!(r&&!window.confirm(r))){j(t=>new Set(t).add(e.id)),F(null);try{await n(),F({ok:!0,text:`${t} ✓`}),h.success(`${t} ✓`,e.id)}catch(e){F({ok:!1,text:`${t} failed: ${e.message}`}),h.error(`${t} failed`,e.message)}finally{j(t=>{let n=new Set(t);return n.delete(e.id),n}),B()}}},Z=async(e,t,n)=>{let r=H.filter(e=>k.has(e.id));if(r.length===0||n&&!window.confirm(n(r.length)))return;N(!0),F(null);let i=await Promise.allSettled(r.map(t)),a=i.filter(e=>e.status===`fulfilled`).length,o=i.length-a,s=`${e}: ${a} succeeded${o?`, ${o} not eligible / failed`:``}`;F({ok:o===0,text:s}),o===0?h.success(s):h.error(s),A(new Set),N(!1),B()},Q=H.filter(e=>k.has(e.id)),$={retry:Q.some(e=>{let t=v(e.state);return t.retryActive||t.retryDlq}),promote:Q.some(e=>v(e.state).promote),requeue:Q.some(e=>v(e.state).requeueCompleted),fail:Q.some(e=>v(e.state).fail),cancel:Q.some(e=>v(e.state).cancel)};return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(oe,{title:`Jobs Explorer`,description:`Browse, inspect, and manage individual jobs.`,live:!0,actions:(0,b.jsxs)(d,{size:`sm`,disabled:!V||H.length===0,onClick:()=>{if(H.length===0){h.info(`No jobs to export on this page`);return}let e=H.map(e=>({id:e.id,queue:e.queue??a,state:e.state??``,priority:e.priority??0,attempts:e.attempts??0,maxAttempts:e.maxAttempts??``,createdAt:e.createdAt?new Date(e.createdAt).toISOString():``,durationMs:e.startedAt&&e.completedAt?e.completedAt-e.startedAt:``}));_(`jobs-${a}-${T}`,e,[`id`,`queue`,`state`,`priority`,`attempts`,`maxAttempts`,`createdAt`,`durationMs`])},children:[(0,b.jsx)(g,{className:`size-3.5`}),` Export CSV`]})}),(0,b.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,b.jsx)(p,{label:`Total`,value:K((U?.completed??0)+W+(U?.waiting??0)+(U?.active??0)+(U?.delayed??0)),hint:`all queues`,compact:!0}),(0,b.jsx)(p,{label:`Waiting`,value:K(U?.waiting),tone:`amber`,compact:!0}),(0,b.jsx)(p,{label:`Active`,value:K(U?.active),tone:`blue`,compact:!0}),(0,b.jsx)(p,{label:`Completed`,value:K(U?.completed),tone:`green`,compact:!0}),(0,b.jsx)(p,{label:`Failed`,value:K(W),tone:W?`red`:`default`,compact:!0}),(0,b.jsx)(p,{label:`Error Rate`,value:G==null?`—`:se(G),tone:G==null?`default`:G>.05?`red`:`green`,compact:!0})]}),(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,b.jsx)(`div`,{className:`w-48`,children:(0,b.jsx)(de,{value:a,"aria-label":`Queue`,onChange:e=>{w(e.target.value),q(),J(e.target.value,T)},children:(I??[]).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.name},e.name))})}),(0,b.jsx)(fe,{options:x,value:T,onChange:e=>{he(e),q(),J(a,e)}}),(0,b.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,b.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,b.jsx)(`input`,{value:E,onChange:e=>ge(e.target.value),placeholder:`Filter this page by ID…`,"aria-label":`Filter by job ID`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),k.size>0&&(0,b.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 rounded-lg border border-line bg-surface-2 px-4 py-2 text-sm`,children:[(0,b.jsxs)(`span`,{className:`mr-1 text-muted`,children:[k.size,` selected`]}),$.retry&&(0,b.jsx)(d,{size:`sm`,disabled:M,onClick:()=>Z(`Retry`,C),children:`Retry selected`}),$.promote&&(0,b.jsx)(d,{size:`sm`,disabled:M,onClick:()=>Z(`Promote`,e=>v(e.state).promote?m.promoteJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not delayed`))),children:`Promote selected`}),$.requeue&&(0,b.jsx)(d,{size:`sm`,disabled:M,onClick:()=>Z(`Requeue`,e=>v(e.state).requeueCompleted?m.retryCompleted(e.queue??``,e.id):Promise.reject(Error(`"${e.state??`unknown`}" is not completed`))),children:`Requeue selected`}),$.fail&&(0,b.jsx)(d,{variant:`warning`,size:`sm`,disabled:M,onClick:()=>Z(`Fail`,e=>v(e.state).fail?m.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)(d,{variant:`danger`,size:`sm`,disabled:M,onClick:()=>Z(`Cancel`,e=>v(e.state).cancel?m.cancelJob(e.id):Promise.reject(Error(`"${e.state??`unknown`}" cannot be cancelled`)),e=>`Cancel ${e} job(s)? This cannot be undone.`),children:`Cancel selected`}),!$.retry&&!$.promote&&!$.requeue&&!$.fail&&!$.cancel&&(0,b.jsx)(`span`,{className:`text-xs text-faint`,children:`No actions apply to the selected job states.`})]}),P&&(0,b.jsx)(`div`,{role:`status`,className:t(`mb-3 text-sm`,P.ok?`text-success`:`text-danger`),children:P.text}),z&&(0,b.jsx)(u,{onRetry:B}),ye&&!V&&!z?(0,b.jsx)(ue,{label:`Loading jobs…`}):(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm`,children:[(0,b.jsx)(`span`,{className:`text-faint`,children:`Jobs in queue`}),(0,b.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-0.5 font-mono text-xs text-fg`,children:a})]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,b.jsx)(`th`,{scope:`col`,className:`w-10 px-5 py-3`,children:(0,b.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:Se,"aria-label":`Select all jobs on page`,className:`accent-accent`})}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Job ID`}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Status`}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Priority`}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Created`}),(0,b.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Duration`}),(0,b.jsx)(`th`,{scope:`col`,className:`w-28 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,b.jsx)(`tbody`,{children:H.length===0?(0,b.jsx)(`tr`,{children:(0,b.jsx)(`td`,{colSpan:7,className:`px-5 py-12 text-center text-sm text-faint`,children:E.trim()?`No jobs on this page match your ID filter.`:a?`No jobs found.`:`Select a queue.`})}):H.map(e=>{let n=me(e.priority),r=v(e.state),a=_e.has(e.id);return(0,b.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(`input`,{type:`checkbox`,checked:k.has(e.id),onChange:()=>xe(e.id),"aria-label":`Select job ${e.id}`,className:`accent-accent`})}),(0,b.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent/90`,children:(0,b.jsx)(`span`,{className:`block max-w-[16rem] truncate`,title:e.id,children:e.id})}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(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:re(e.createdAt)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:le(e.startedAt&&e.completedAt?e.completedAt-e.startedAt:void 0)}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,b.jsx)(i,{to:`/job?id=${encodeURIComponent(e.id)}`,children:(0,b.jsx)(s,{"aria-label":`Inspect job`,children:(0,b.jsx)(o,{className:`size-3.5`})})}),r.promote&&(0,b.jsx)(s,{"aria-label":`Promote job`,disabled:a,onClick:()=>X(e,`Promote`,()=>m.promoteJob(e.id)),children:(0,b.jsx)(te,{className:`size-3.5`})}),(r.retryActive||r.retryDlq)&&(0,b.jsx)(s,{"aria-label":`Retry job`,disabled:a,onClick:()=>X(e,`Retry`,()=>C(e)),children:(0,b.jsx)(l,{className:`size-3.5`})}),r.requeueCompleted&&(0,b.jsx)(s,{"aria-label":`Requeue job`,disabled:a,onClick:()=>X(e,`Requeue`,()=>m.retryCompleted(e.queue??``,e.id)),children:(0,b.jsx)(l,{className:`size-3.5`})}),r.fail&&(0,b.jsx)(s,{"aria-label":`Fail job`,disabled:a,onClick:()=>X(e,`Fail`,()=>m.failJob(e.id),`Force-fail this active job?`),children:(0,b.jsx)(ee,{className:`size-3.5`})}),r.cancel&&(0,b.jsx)(s,{"aria-label":`Cancel job`,disabled:a,onClick:()=>X(e,`Cancel`,()=>m.cancelJob(e.id),`Cancel this job?`),children:(0,b.jsx)(ne,{className:`size-3.5`})})]})})]},e.id)})})]})}),(0,b.jsx)(pe,{page:D,pageSize:S,hasNext:be,onPageChange:O,label:`jobs`})]})]})}export{w as JobsPro};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./cn-CMFYpumL.js";import{h as t,r as n,t as r}from"./react-vendor-B68RYDeC.js";import{J as i,S as a,T as o,c as s,g as c,h as l,k as u,m as d,nt as f,t as p,u as m}from"./index-Dlr2PaZ6.js";import{a as h,i as g}from"./form-C-zZyKfB.js";import{t as _}from"./Pagination-C-6yLcP3.js";import{t as v}from"./CopyButton-B2gM7BeT.js";var y=e(t(),1),b=r(),x=`__all__`,S=[`all`,`waiting`,`active`,`completed`,`failed`],C=10,w=250;function T(){let[e,t]=(0,y.useState)(x),[r,T]=(0,y.useState)(`all`),[E,D]=(0,y.useState)(``),[O,k]=(0,y.useState)(0),[A,j]=(0,y.useState)(null),M=A!==null,{data:N,error:P,refetch:F}=u(()=>f.queues(),[],{intervalMs:3e4}),{events:I,counters:L,throughput:R,connected:z}=p(e===x?void 0:e),B=(0,y.useMemo)(()=>{let e=A??I,t=E.trim().toLowerCase();return e.filter(e=>r!==`all`&&e.status!==r?!1:t?(e.jobId??``).toLowerCase().includes(t)||(e.queue??``).toLowerCase().includes(t):!0)},[I,A,r,E]),V=M?Math.max(0,(I[0]?.seq??0)-(A[0]?.seq??0)):0;(0,y.useEffect)(()=>k(0),[e,r,E]),(0,y.useEffect)(()=>j(null),[e]);let H=O*C,U=B.slice(H,H+C);return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(l,{title:`Activity Logs`,description:`Real-time job activity across all queues.`,live:z&&!M}),P&&(0,b.jsx)(a,{onRetry:F}),(0,b.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,b.jsx)(d,{label:`Total Events`,value:s(L.total),compact:!0}),(0,b.jsx)(d,{label:`Completed`,value:s(L.completed),tone:`green`,compact:!0}),(0,b.jsx)(d,{label:`Failed`,value:s(L.failed),tone:L.failed?`red`:`default`,compact:!0}),(0,b.jsx)(d,{label:`Waiting`,value:s(L.waiting),tone:`amber`,compact:!0}),(0,b.jsx)(d,{label:`Active`,value:s(L.active),tone:`blue`,compact:!0}),(0,b.jsx)(d,{label:`Throughput`,value:`${R.toFixed(1)}/s`,tone:`accent`,compact:!0})]}),(0,b.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-3`,children:[(0,b.jsx)(`div`,{className:`w-48`,children:(0,b.jsxs)(h,{"aria-label":`Filter by queue`,value:e,onChange:e=>t(e.target.value),children:[(0,b.jsx)(`option`,{value:x,children:`All Queues`}),(N?.queues??[]).map(e=>(0,b.jsx)(`option`,{value:e.name,children:e.name},e.name))]})}),(0,b.jsx)(g,{options:S,value:r,onChange:T}),(0,b.jsx)(o,{size:`sm`,variant:M?`warning`:`default`,onClick:()=>j(M?null:I),title:M?`Resume applying live events to the list`:`Freeze the visible list while the stream keeps buffering`,children:M?`Resume${V?` — ${s(V)} new`:``}`:`Following · Pause`}),(0,b.jsxs)(`div`,{className:`relative ml-auto min-w-56 flex-1 md:max-w-xs`,children:[(0,b.jsx)(i,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,b.jsx)(`input`,{"aria-label":`Search by job ID or queue`,value:E,onChange:e=>D(e.target.value),placeholder:`Search by job ID or queue…`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]})]}),(0,b.jsxs)(`p`,{className:`-mt-2 mb-4 text-xs text-faint`,children:[`Search and filters cover the last `,w,` streamed events held in this browser.`]}),(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Event`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Timestamp`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`ID`})]})}),(0,b.jsx)(`tbody`,{children:U.length===0?(0,b.jsx)(`tr`,{children:(0,b.jsx)(`td`,{colSpan:5,className:`px-5 py-12 text-center text-sm text-faint`,children:z?I.length>0?`No events match the current filters.`:`Waiting for activity…`:`Connecting to the event stream…`})}):U.map(e=>(0,b.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(c,{status:e.status})}),(0,b.jsxs)(`td`,{className:`px-5 py-3 font-mono text-xs text-fg`,children:[e.event,e.status===`failed`&&e.error&&(0,b.jsx)(`div`,{className:`mt-0.5 max-w-64 truncate text-[11px] text-danger`,title:e.error,children:e.error})]}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(`span`,{className:`rounded-md bg-surface-2 px-2 py-0.5 font-mono text-xs text-muted`,children:e.queue||`—`})}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,title:new Date(e.timestamp).toISOString(),children:m(e.timestamp)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right font-mono text-xs text-faint`,children:e.jobId?(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,b.jsx)(n,{to:`/job?id=${encodeURIComponent(e.jobId)}`,className:`text-accent hover:underline`,children:e.jobId}),(0,b.jsx)(v,{value:e.jobId})]}):`—`})]},e.seq))})]})}),(0,b.jsx)(_,{page:O,pageSize:C,total:B.length,onPageChange:k,label:`events`})]})}export{T as LogsPro};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r}from"./react-vendor-B68RYDeC.js";import{C as i,S as a,c as o,d as s,h as c,i as l,k as u,l as d,m as f,n as p,nt as m,w as h,x as g}from"./index-Dlr2PaZ6.js";import{t as _}from"./Pagination-C-6yLcP3.js";import{t as v}from"./AreaChart-Dl_9G6GH.js";import{n as y,t as b}from"./useThroughputSeries-lWDIzQ4F.js";var x=e(n(),1),S=r(),C=[`-60s`,`-45s`,`-30s`,`-15s`,`now`],w=15,T=[`push`,`pull`,`ack`],E=100,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=y(60),[n,r]=(0,x.useState)(0),{data:O,error:M,loading:N,refetch:P}=u(async()=>({details:await m.queuesSummary()}),[]),F=O?.details??[],I=Math.max(1,Math.ceil(F.length/w)),L=Math.min(n,I-1),R=(0,x.useMemo)(()=>F.slice(L*w,L*w+w),[F,L]),z=(0,x.useMemo)(()=>F.reduce((e,t)=>e+(t.counts?.failed??0),0),[F]);if(N&&!O&&!M)return(0,S.jsx)(g,{label:`Loading metrics…`});let{stats:B,throughput:V,latency:H}=e.latest??D,U=p(B.completed,z),W=b(e.depth),G=e.depth.length?e.depth[e.depth.length-1]:0;return(0,S.jsxs)(`div`,{children:[(0,S.jsx)(c,{title:`Metrics`,description:`Real-time performance telemetry for your queues.`,live:!M}),M&&(0,S.jsx)(a,{onRetry:P}),(0,S.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,S.jsx)(f,{label:`Total Completed`,value:l(B.completed),tone:`green`,hint:`recorded jobs`}),(0,S.jsx)(f,{label:`Total Failed`,value:o(z),tone:z?`red`:`default`,hint:`recorded jobs`}),(0,S.jsx)(f,{label:`Push/sec`,value:V.pushPerSec.toFixed(1),tone:`accent`,hint:`jobs/sec`}),(0,S.jsx)(f,{label:`Pull/sec`,value:V.pullPerSec.toFixed(1),tone:`accent`,hint:`jobs/sec`})]}),(0,S.jsxs)(i,{className:`mb-6`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Live Throughput`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Real-time jobs per second (rolling 60s window)`})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 font-mono text-[11px] text-faint`,children:[(0,S.jsx)(A,{color:`#ec4899`,label:`Pushed`,value:V.pushPerSec}),(0,S.jsx)(A,{color:`#34d399`,label:`Completed`,value:V.completePerSec}),(0,S.jsx)(A,{color:`#f87171`,label:`Failed`,value:V.failPerSec})]})]}),(0,S.jsx)(v,{xLabels:C,series:[{label:`Pushed`,color:`#ec4899`,points:e.push,area:!0},{label:`Completed`,color:`#34d399`,points:e.complete},{label:`Failed`,color:`#f87171`,points:e.fail}]})]}),(0,S.jsxs)(i,{className:`mb-6`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Queue Depth`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Backlog over time (waiting + active + delayed). The trend says whether you're draining or falling behind — more useful than any single gauge.`})]}),(0,S.jsxs)(`div`,{className:`text-right`,children:[(0,S.jsx)(`div`,{className:`tnum text-2xl font-bold text-fg`,children:o(G)}),(0,S.jsx)(`div`,{className:t(`text-xs font-medium`,W.label===`draining`?`text-success`:W.label===`accumulating`?`text-danger`:`text-faint`),children:W.label===`steady`?`steady`:`${W.slope>0?`+`:``}${W.slope.toFixed(1)}/s · ${W.label}`})]})]}),(0,S.jsx)(v,{xLabels:C,ariaLabel:`queue depth chart`,series:[{label:`Depth`,color:W.draining?`#34d399`:`#f59e0b`,points:e.depth,area:!0}]})]}),(0,S.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,S.jsxs)(i,{children:[(0,S.jsx)(h,{title:`Error Rate`}),(0,S.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Failed as percentage of total processed`}),(0,S.jsxs)(`div`,{className:`flex items-center justify-around`,children:[(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`div`,{className:t(`text-3xl font-bold tnum`,U!=null&&U>.05?`text-danger`:`text-fg`),children:U==null?`—`:d(U)}),(0,S.jsx)(`div`,{className:`text-xs text-faint`,children:`error rate`})]}),(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`div`,{className:t(`text-3xl font-bold tnum`,U==null?`text-fg`:`text-success`),children:U==null?`—`:d(1-U)}),(0,S.jsx)(`div`,{className:`text-xs text-faint`,children:`success rate`})]})]}),U==null?(0,S.jsx)(`div`,{className:`mt-4 h-2 overflow-hidden rounded-full bg-surface-2`}):(0,S.jsx)(`div`,{className:`mt-4 h-2 overflow-hidden rounded-full bg-red-500/40`,children:(0,S.jsx)(`div`,{className:`h-full rounded-full bg-emerald-500`,style:{width:`${(1-U)*100}%`}})})]}),(0,S.jsxs)(i,{children:[(0,S.jsx)(h,{title:`Server Overview`}),(0,S.jsx)(`p`,{className:`-mt-3 mb-4 text-xs text-faint`,children:`Current server-wide statistics`}),(0,S.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,S.jsx)(j,{color:`bg-blue-400`,label:`Queued`,value:o(B.waiting)}),(0,S.jsx)(j,{color:`bg-accent`,label:`Processing`,value:o(B.active)}),(0,S.jsx)(j,{color:`bg-amber-400`,label:`Delayed`,value:o(B.delayed)}),(0,S.jsx)(j,{color:`bg-red-400`,label:`Dead Letter`,value:o(B.dlq)}),(0,S.jsx)(j,{color:`bg-zinc-500`,label:`Pushed (since restart)`,value:l(B.totalPushed)}),(0,S.jsx)(j,{color:`bg-zinc-500`,label:`Pulled (since restart)`,value:l(B.totalPulled)}),(0,S.jsx)(j,{color:`bg-emerald-400`,label:`Uptime`,value:s(B.uptime/1e3)})]})]})]}),(0,S.jsxs)(i,{className:`mb-6`,padded:!1,children:[(0,S.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Operation Latency`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`TCP round-trip per operation (p50 / p95 / p99, milliseconds)`})]}),(0,S.jsx)(`div`,{className:`overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Operation`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Avg`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p50`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p95`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`p99`})]})}),(0,S.jsx)(`tbody`,{children:T.map(e=>{let n=H?.percentiles?.[e],r=H?.averages?.[`${e}Ms`];return(0,S.jsxs)(`tr`,{className:`border-b border-line last:border-0`,children:[(0,S.jsx)(`td`,{className:`px-5 py-3 font-medium capitalize text-fg`,children:e}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:k(r)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:k(n?.p50)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:k(n?.p95)}),(0,S.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,(n?.p99??0)>E?`text-warning`:`text-muted`),children:k(n?.p99)})]},e)})})]})})]}),(0,S.jsxs)(i,{padded:!1,children:[(0,S.jsxs)(`div`,{className:`border-b border-line px-5 py-4`,children:[(0,S.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Per-Queue Metrics`}),(0,S.jsx)(`p`,{className:`text-xs text-faint`,children:`Job counts breakdown by queue`})]}),(0,S.jsx)(`div`,{className:`overflow-x-auto`,children:(0,S.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,S.jsx)(`thead`,{children:(0,S.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,S.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Waiting`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Completed`}),(0,S.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`})]})}),(0,S.jsx)(`tbody`,{children:R.length===0?(0,S.jsx)(`tr`,{children:(0,S.jsx)(`td`,{colSpan:6,className:`px-5 py-12 text-center text-sm text-faint`,children:`No queues yet.`})}):R.map(e=>(0,S.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,S.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-accent`,children:e.name}),(0,S.jsx)(`td`,{className:`px-5 py-3`,children:(0,S.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-success`),children:e.paused?`paused`:`active`})}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:o(e.counts.waiting)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:o(e.counts.active)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-success`,children:o(e.counts.completed)}),(0,S.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-danger`,children:o(e.counts.failed)})]},e.name))})]})}),(0,S.jsx)(`div`,{className:`px-5 pb-4`,children:(0,S.jsx)(_,{page:L,pageSize:w,total:F.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,S.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,S.jsx)(`span`,{className:`size-2 rounded-full`,style:{background:e}}),t,` `,(0,S.jsxs)(`span`,{className:`text-fg`,children:[n.toFixed(1),`/s`]})]})}function j({color:e,label:n,value:r}){return(0,S.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,S.jsxs)(`dt`,{className:`flex items-center gap-2 text-muted`,children:[(0,S.jsx)(`span`,{className:t(`size-2 rounded-full`,e)}),n]}),(0,S.jsx)(`dd`,{className:`font-semibold tnum text-fg`,children:r})]})}export{O as MetricsPro};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{d as n,h as r,r as i,t as a,u as o}from"./react-vendor-B68RYDeC.js";import{C as s,E as c,N as l,S as u,T as d,_ as f,c as p,h as m,j as h,k as g,l as _,m as v,n as y,nt as b,o as x,rt as S,w as C,x as w,y as T}from"./index-Dlr2PaZ6.js";import{t as E}from"./AreaChart-Dl_9G6GH.js";import{t as D}from"./useThroughputSeries-lWDIzQ4F.js";import{i as O,n as k,r as ee,t as A}from"./QueueActions-Dhy0KXjr.js";var j=e(r(),1),M=a(),N=[`waiting`,`active`,`completed`,`failed`,`delayed`,`paused`],P=[`active`,`waiting`,`completed`,`failed`,`delayed`],F=2e3;function I(){let{name:e=``}=n(),r=o(),[a,I]=(0,j.useState)(!1),[R,z]=(0,j.useState)(null),{data:B,error:V,loading:H,refetch:U}=g((0,j.useCallback)(async()=>{if(!e)return null;let[t,n,r,i]=await Promise.all([b.queueDetail(e,!1),b.getStallConfig(e).catch(()=>null),b.getDlqConfig(e).catch(()=>null),b.jobsList(e,P,12).catch(()=>({ok:!1,jobs:[]}))]);return{queue:e,detail:t,stall:n?.config??null,dlq:r?.config??null,jobs:i.jobs??[]}},[e]),[e]),W=B&&B.queue===e?B:null,[G,K]=(0,j.useState)([]),q=(0,j.useRef)(null);(0,j.useEffect)(()=>{let e=W?.detail?.counts;e&&(q.current=(e.waiting??0)+(e.active??0)+(e.delayed??0))},[W]),(0,j.useEffect)(()=>{q.current=null,K([]);let e=setInterval(()=>{let e=q.current;e!=null&&K(t=>[...t,e].slice(-40))},F);return()=>clearInterval(e)},[e]);let J=(t,n,r)=>{r&&!window.confirm(r)||(I(!0),z(null),n().then(n=>{let r=n?.count,i=`${t}${r==null?` ✓`:`: ${r}`}`;z({ok:!0,text:i}),S.success(i,e),U()}).catch(e=>{let n=e.message;z({ok:!1,text:n}),S.error(`${t} failed`,n)}).finally(()=>I(!1)))},Y=()=>{window.confirm(`Obliterate "${e}"? This removes the queue and all its jobs.`)&&(I(!0),b.obliterate(e).then(()=>{S.success(`Queue obliterated`,e),r(`/queues`)}).catch(e=>{let t=e.message;z({ok:!1,text:t}),S.error(`Obliterate failed`,t),I(!1)}))},X=W?.detail,Z=X?.counts,Q=Z?y(Z.completed??0,Z.failed??0)??0:0,$=D(G);return(0,M.jsxs)(`div`,{children:[(0,M.jsx)(m,{title:(0,M.jsx)(`span`,{className:`font-mono`,children:e}),description:`Full per-queue operations and live backlog.`,live:!0,back:(0,M.jsx)(c,{"aria-label":`Back to queues`,onClick:()=>r(`/queues`),children:(0,M.jsx)(l,{className:`size-4`})}),actions:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(i,{to:`/jobs?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:[`Jobs `,(0,M.jsx)(h,{className:`size-3.5`})]}),(0,M.jsxs)(i,{to:`/dlq?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:[`DLQ `,(0,M.jsx)(h,{className:`size-3.5`})]}),(0,M.jsx)(d,{variant:`danger`,size:`sm`,disabled:a,onClick:Y,children:`Obliterate`})]})}),V&&(0,M.jsx)(u,{onRetry:U}),H&&!W&&!V?(0,M.jsx)(w,{label:`Loading ${e}…`}):!X||!Z?!V&&(0,M.jsx)(T,{title:`Queue not found`,hint:`No queue named "${e}" exists — it may have been obliterated, or the link is stale.`,action:(0,M.jsx)(i,{to:`/queues`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Back to queues`})}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[(0,M.jsx)(f,{label:X.paused?`Paused`:`Active`,tone:X.paused?`amber`:`green`}),R&&(0,M.jsx)(`span`,{role:`status`,className:R.ok?`text-xs text-success`:`text-xs text-danger`,children:R.text})]}),(0,M.jsx)(`div`,{className:`mb-6 grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6`,children:N.map(e=>(0,M.jsx)(v,{label:e,value:p(Z[e]),tone:e===`failed`&&Z.failed?`red`:`default`,compact:!0},e))}),(0,M.jsxs)(s,{className:`mb-6`,children:[(0,M.jsx)(C,{title:`Backlog depth`,action:(0,M.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,$.draining?`bg-emerald-500/10 text-success`:$.label===`accumulating`?`bg-red-500/10 text-danger`:`bg-surface-2 text-muted`),children:$.label})}),G.length<2?(0,M.jsx)(`p`,{className:`py-6 text-center text-xs text-faint`,children:`Sampling… the backlog trend appears after a few polls.`}):(0,M.jsx)(E,{height:140,ariaLabel:`${e} backlog depth`,series:[{label:`depth`,color:`var(--accent)`,points:G,area:!0}]}),(0,M.jsxs)(`div`,{className:`mt-1 flex items-center justify-between text-xs text-faint`,children:[(0,M.jsx)(`span`,{children:`waiting + active + delayed`}),(0,M.jsxs)(`span`,{className:`tnum`,children:[`Error rate `,_(Q)]})]})]}),(0,M.jsx)(A,{queue:e,paused:X.paused,busy:a,run:J}),(0,M.jsx)(k,{queue:e,busy:a,run:J}),(0,M.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[W.stall?(0,M.jsx)(O,{queue:e,config:W.stall,onSaved:()=>{z({ok:!0,text:`Stall config saved ✓`}),S.success(`Stall config saved`,e)}},e):(0,M.jsx)(L,{title:`Stall detection`,onRetry:U}),W.dlq?(0,M.jsx)(ee,{queue:e,config:W.dlq,onSaved:()=>{z({ok:!0,text:`DLQ config saved ✓`}),S.success(`DLQ config saved`,e)}},e):(0,M.jsx)(L,{title:`DLQ policy`,onRetry:U})]}),(0,M.jsxs)(s,{padded:!1,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3`,children:[(0,M.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:`Recent jobs`}),(0,M.jsxs)(i,{to:`/jobs?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 text-sm text-muted hover:text-fg`,children:[`View all `,(0,M.jsx)(h,{className:`size-3.5`})]})]}),(0,M.jsx)(`div`,{className:`overflow-x-auto border-t border-line`,children:(0,M.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,M.jsx)(`thead`,{children:(0,M.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,M.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`ID`}),(0,M.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`State`}),(0,M.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Attempts`}),(0,M.jsx)(`th`,{scope:`col`,className:`px-5 py-3 text-right font-medium`,children:`Duration`})]})}),(0,M.jsx)(`tbody`,{children:W.jobs.length===0?(0,M.jsx)(`tr`,{children:(0,M.jsx)(`td`,{colSpan:4,className:`px-5 py-10 text-center text-sm text-faint`,children:`No recent jobs.`})}):W.jobs.map(e=>(0,M.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,M.jsx)(`td`,{className:`px-5 py-3`,children:(0,M.jsx)(i,{to:`/job?id=${encodeURIComponent(e.id)}`,className:`font-mono text-xs text-accent hover:underline`,children:e.id})}),(0,M.jsx)(`td`,{className:`px-5 py-3 text-muted`,children:e.state??`—`}),(0,M.jsxs)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:[e.attempts??0,` / `,e.maxAttempts??`?`]}),(0,M.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:x(e.startedAt&&e.completedAt?e.completedAt-e.startedAt:void 0)})]},e.id))})]})})]})]})]})}function L({title:e,onRetry:t}){return(0,M.jsxs)(s,{children:[(0,M.jsx)(C,{title:e}),(0,M.jsx)(`p`,{className:`mb-3 text-sm text-muted`,children:`Couldn't load this queue's config.`}),(0,M.jsx)(d,{size:`sm`,onClick:t,children:`Retry`})]})}export{I as QueueDetailPro};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,r,t as i,u as a}from"./react-vendor-B68RYDeC.js";import{E as o,G as s,J as c,S as l,T as u,U as d,W as f,c as p,h as m,j as h,k as g,m as _,nt as v,rt as y,x as b}from"./index-Dlr2PaZ6.js";import{t as x}from"./Pagination-C-6yLcP3.js";import{t as S}from"./promisePool-Daxkc1OB.js";var C=e(n(),1),w=i(),T=6,E=15,D=[[`waiting`,`Waiting`],[`active`,`Active`],[`completed`,`Completed`],[`failed`,`Failed`],[`delayed`,`Delayed`]];function O(){let e=a(),[n,i]=(0,C.useState)(``),[O,k]=(0,C.useState)(0),[A,j]=(0,C.useState)(new Set),[M,N]=(0,C.useState)(!1),[P,F]=(0,C.useState)(null),[I,L]=(0,C.useState)(null),[R,z]=(0,C.useState)(`desc`),{data:B,error:V,loading:H,refetch:U}=g(()=>v.queuesSummary(),[]),W=B??[],G=e=>{I===e?R===`desc`?z(`asc`):L(null):(L(e),z(`desc`)),k(0)},K=(0,C.useMemo)(()=>{let e=n.trim().toLowerCase(),t=[...e?W.filter(t=>t.name.toLowerCase().includes(e)):W].sort((e,t)=>e.name.localeCompare(t.name));if(I){let e=R===`desc`?-1:1;t.sort((t,n)=>e*(t.counts[I]-n.counts[I]))}return t},[W,n,I,R]),q=(0,C.useMemo)(()=>W.reduce((e,t)=>(e.waiting+=t.counts.waiting,e.active+=t.counts.active,e.failed+=t.counts.failed,e.paused+=+!!t.paused,e),{waiting:0,active:0,failed:0,paused:0}),[W]),J=Math.max(1,Math.ceil(K.length/E)),Y=Math.min(O,J-1),X=K.slice(Y*E,Y*E+E),Z=async e=>{j(t=>new Set(t).add(e.name)),F(null);try{await(e.paused?v.resume(e.name):v.pause(e.name)),F({ok:!0,text:`${e.name} ${e.paused?`resumed`:`paused`} ✓`})}catch(t){F({ok:!1,text:t.message}),y.error(`Failed to ${e.paused?`resume`:`pause`} ${e.name}`,t.message)}finally{j(t=>{let n=new Set(t);return n.delete(e.name),n}),U()}},Q=async e=>{let t=W.filter(t=>e===`pause`?!t.paused:t.paused);if(t.length===0){y.info(`No queues to ${e}`);return}if(!window.confirm(`${e===`pause`?`Pause`:`Resume`} ${t.length} queue(s)?`))return;N(!0),F(null);let n=(await S(t,T,t=>e===`pause`?v.pause(t.name):v.resume(t.name))).filter(e=>e.status===`rejected`).length,r=`${e===`pause`?`Paused`:`Resumed`} ${t.length-n}/${t.length} queues${n?`, ${n} failed`:``}`;F({ok:n===0,text:r}),n===0?y.success(r):y.error(r),N(!1),U()};return H&&!B&&!V?(0,w.jsx)(b,{label:`Loading queues…`}):(0,w.jsxs)(`div`,{children:[(0,w.jsx)(m,{title:`Queues`,description:`${W.length} queues`,live:!0,actions:W.length>0?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(u,{variant:`warning`,size:`sm`,disabled:M||q.paused>=W.length,onClick:()=>Q(`pause`),children:[(0,w.jsx)(d,{className:`size-3.5`}),` Pause all`]}),(0,w.jsxs)(u,{variant:`success`,size:`sm`,disabled:M||q.paused===0,onClick:()=>Q(`resume`),children:[(0,w.jsx)(f,{className:`size-3.5`}),` Resume all`]})]}):void 0}),V&&(0,w.jsx)(l,{onRetry:U}),(0,w.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,w.jsx)(_,{label:`Waiting`,value:p(q.waiting),tone:`amber`,compact:!0}),(0,w.jsx)(_,{label:`Active`,value:p(q.active),tone:`blue`,compact:!0}),(0,w.jsx)(_,{label:`Failed`,value:p(q.failed),tone:q.failed?`red`:`default`,compact:!0}),(0,w.jsx)(_,{label:`Paused`,value:p(q.paused),tone:q.paused?`amber`:`default`,compact:!0})]}),(0,w.jsxs)(`div`,{className:`relative mb-4 max-w-sm`,children:[(0,w.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,w.jsx)(`input`,{value:n,onChange:e=>{i(e.target.value),k(0)},placeholder:`Search queues…`,"aria-label":`Filter queues`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),P&&(0,w.jsx)(`div`,{role:`status`,className:t(`mb-3 text-sm`,P.ok?`text-success`:`text-danger`),children:P.text}),(0,w.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,w.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,w.jsx)(`thead`,{children:(0,w.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,w.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Queue`}),D.map(([e,t])=>(0,w.jsx)(`th`,{scope:`col`,"aria-sort":I===e?R===`desc`?`descending`:`ascending`:void 0,className:`px-5 py-3 text-right font-medium`,children:(0,w.jsxs)(`button`,{type:`button`,onClick:()=>G(e),className:`inline-flex items-center gap-1 rounded uppercase tracking-wider hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[t,I===e&&(0,w.jsx)(`span`,{"aria-hidden":`true`,children:R===`desc`?`↓`:`↑`})]})},e)),(0,w.jsx)(`th`,{scope:`col`,className:`px-5 py-3 font-medium`,children:`Status`}),(0,w.jsx)(`th`,{scope:`col`,className:`w-24 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,w.jsx)(`tbody`,{children:X.length===0?(0,w.jsx)(`tr`,{children:(0,w.jsx)(`td`,{colSpan:8,className:`px-5 py-12 text-center text-sm text-faint`,children:n?`No queues match your search.`:`No queues yet.`})}):X.map(n=>{let i=A.has(n.name);return(0,w.jsxs)(`tr`,{onClick:()=>e(`/queues/${encodeURIComponent(n.name)}`),className:`group cursor-pointer border-b border-line last:border-0 transition-colors hover:bg-surface-2/50`,children:[(0,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.jsxs)(r,{to:`/queues/${encodeURIComponent(n.name)}`,onClick:e=>e.stopPropagation(),className:`flex items-center gap-2 rounded font-medium text-fg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[(0,w.jsx)(s,{className:`size-4 text-faint`}),n.name]})}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:p(n.counts.waiting)}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:p(n.counts.active)}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-success`,children:p(n.counts.completed)}),(0,w.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,n.counts.failed?`text-danger`:`text-muted`),children:p(n.counts.failed)}),(0,w.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:p(n.counts.delayed)}),(0,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.jsxs)(`span`,{className:t(`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium`,n.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-success`),children:[(0,w.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),n.paused?`Paused`:`Active`]})}),(0,w.jsx)(`td`,{className:`px-5 py-3`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,w.jsx)(o,{"aria-label":n.paused?`Resume queue`:`Pause queue`,disabled:i,onClick:e=>{e.stopPropagation(),Z(n)},children:n.paused?(0,w.jsx)(f,{className:`size-3.5 text-success`}):(0,w.jsx)(d,{className:`size-3.5 text-warning`})}),(0,w.jsx)(h,{className:`size-4 text-faint opacity-0 transition-opacity group-hover:opacity-100`})]})})]},n.name)})})]})}),(0,w.jsx)(x,{page:Y,pageSize:E,total:K.length,onPageChange:k,label:`queues`})]})}export{O as QueuesOverview};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r}from"./react-vendor-B68RYDeC.js";import{C as i,J as a,K as o,S as s,T as c,U as l,W as u,a as d,d as f,h as p,k as m,nt as h,p as g,r as _,u as v,w as y}from"./index-Dlr2PaZ6.js";import{i as b,n as x,t as S}from"./form-C-zZyKfB.js";import{t as C}from"./CopyButton-B2gM7BeT.js";var w=e(n(),1),T=r();function E({children:e}){return(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1.5 py-0.5 text-xs text-fg`,children:e})}function D({agentBase:e}){return(0,T.jsx)(i,{children:(0,T.jsxs)(`details`,{className:`group`,children:[(0,T.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2`,children:[(0,T.jsx)(`span`,{className:`text-base font-semibold text-fg`,children:`How server control works`}),(0,T.jsx)(`span`,{className:`text-xs text-muted transition-transform group-open:rotate-90`,children:`▶`})]}),(0,T.jsxs)(`div`,{className:`mt-4 space-y-4 text-sm leading-relaxed text-muted`,children:[(0,T.jsxs)(`p`,{children:[`A browser can't start or stop an OS process, so the dashboard talks to a small local`,` `,(0,T.jsx)(`span`,{className:`font-medium text-fg`,children:`control agent`}),` (`,(0,T.jsx)(E,{children:e}),`) that supervises the bunqueue server process — start, stop and restart — and streams its logs back here.`]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Launch & environment`}),(0,T.jsxs)(`p`,{children:[`The agent runs your `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Command`}),` and injects`,` `,(0,T.jsx)(E,{children:`HTTP_PORT`}),`, `,(0,T.jsx)(E,{children:`TCP_PORT`}),` and `,(0,T.jsx)(E,{children:`BUNQUEUE_DATA_PATH`}),` — plus any `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Environment variables`}),` you add — into its environment. The default `,(0,T.jsx)(E,{children:`bunqueue start`}),` needs a globally-installed binary; pointing the command at a local entry (e.g.`,` `,(0,T.jsx)(E,{children:`bun run /path/to/bunqueue/src/main.ts`}),`) works without one.`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`When changes apply`}),(0,T.jsxs)(`p`,{children:[`Config is editable any time, but `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Command`}),`, ports and data path only take effect on the `,(0,T.jsx)(`span`,{className:`text-fg`,children:`next start/restart`}),` `,`— the running process keeps the config it launched with until then.`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Data path`}),(0,T.jsxs)(`p`,{children:[`Relative paths resolve against the `,(0,T.jsx)(`span`,{className:`text-fg`,children:`agent's`}),` working directory. SQLite creates the database `,(0,T.jsx)(`span`,{className:`text-fg`,children:`file`}),` but not its parent `,(0,T.jsx)(`span`,{className:`text-fg`,children:`folder`}),` — if start fails with`,` `,(0,T.jsx)(E,{children:`SQLITE_CANTOPEN`}),`, create the directory first or use a path whose folder already exists.`]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Security`}),(0,T.jsxs)(`p`,{children:[`The agent can spawn processes, so it binds `,(0,T.jsx)(E,{children:`127.0.0.1`}),` only, locks CORS to an allowlist (never `,(0,T.jsx)(E,{children:`*`}),`), rejects any disallowed `,(0,T.jsx)(E,{children:`Origin`}),` or`,` `,(0,T.jsx)(E,{children:`Host`}),` with a `,(0,T.jsx)(E,{children:`403`}),` (the latter blocks DNS-rebinding reads), and honours an optional `,(0,T.jsx)(E,{children:`AGENT_TOKEN`}),` on state-changing requests. Keep its port on loopback.`]}),(0,T.jsxs)(`p`,{children:[`If you started the agent with `,(0,T.jsx)(E,{children:`AGENT_TOKEN`}),`, enter that token under`,` `,(0,T.jsx)(`span`,{className:`text-fg`,children:`Settings → Agent token`}),` (or when the lock screen prompts) so start / stop / restart and config changes are authorized.`]})]})]})]})})}var O=0,k=e=>Object.entries(e).map(([e,t])=>({id:O++,key:e,value:t})),A=e=>{let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return t},j=[`AUTH_TOKENS`,`LOG_LEVEL`,`S3_BACKUP_ENABLED`,`S3_BUCKET`,`METRICS_ENABLED`];function M({value:e,onChange:t,disabled:n}){let[r,i]=(0,w.useState)(()=>k(e)),a=e=>{i(e),t(A(e))},o=(e,t)=>a(r.map(n=>n.id===e?{...n,...t}:n)),s=(e=``)=>a([...r,{id:O++,key:e,value:``}]),l=e=>a(r.filter(t=>t.id!==e)),u=new Set(r.map(e=>e.key.trim()).filter(Boolean)),d=r.map(e=>e.key.trim()).filter((e,t,n)=>e&&n.indexOf(e)!==t),f=[...new Set(r.map(e=>e.key.trim()).filter(e=>e&&(/[\s=]/.test(e)||/[a-z]/.test(e))))];return(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.length===0&&(0,T.jsxs)(`p`,{className:`text-xs leading-relaxed text-faint`,children:[`No custom variables. The agent already injects`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`HTTP_PORT`}),`,`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`TCP_PORT`}),` and`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`BUNQUEUE_DATA_PATH`}),`.`]}),r.map(e=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`div`,{className:`w-2/5 shrink-0`,children:(0,T.jsx)(x,{className:`font-mono`,placeholder:`KEY`,value:e.key,disabled:n,onChange:t=>o(e.id,{key:t.target.value})})}),(0,T.jsx)(`span`,{className:`text-faint`,children:`=`}),(0,T.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,T.jsx)(x,{className:`font-mono`,placeholder:`value`,value:e.value,disabled:n,onChange:t=>o(e.id,{value:t.target.value})})}),(0,T.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.key||`variable`}`,disabled:n,onClick:()=>l(e.id),className:`shrink-0 rounded-md px-2 py-1 text-xs text-faint transition-colors hover:text-danger disabled:opacity-40`,children:`✕`})]},e.id)),d.length>0&&(0,T.jsxs)(`p`,{className:`text-xs text-warning`,children:[`Duplicate key`,d.length>1?`s`:``,` — the last value wins: `,d.join(`, `)]}),f.length>0&&(0,T.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Unusual key`,f.length>1?`s`:``,` — env names are usually UPPER_SNAKE_CASE with no spaces or "=": `,f.join(`, `),`. Saved as-is.`]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,T.jsx)(c,{size:`sm`,variant:`ghost`,disabled:n,onClick:()=>s(),children:`+ Add variable`}),j.filter(e=>!u.has(e)).map(e=>(0,T.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>s(e),className:`rounded-md border border-line bg-surface-2 px-2 py-1 font-mono text-[11px] text-muted transition-colors hover:border-line-strong hover:text-fg disabled:opacity-40`,children:[`+ `,e]},e))]})]})}var N=[`all`,`stdout`,`stderr`,`sys`],P=e=>`${new Date(e).toLocaleTimeString([],{hour12:!1})}.${String(e%1e3).padStart(3,`0`)}`,F=e=>e===`stderr`?`text-danger/90`:e===`sys`?`text-accent/80`:`text-muted`;function I(){let{data:e}=R(),n=(0,w.useMemo)(()=>e?.lines??[],[e]),[r,o]=(0,w.useState)(`all`),[s,c]=(0,w.useState)(``),[l,u]=(0,w.useState)(!0),[d,f]=(0,w.useState)(!1),p=(0,w.useRef)(null),m=(0,w.useMemo)(()=>{let e=s.trim().toLowerCase();return n.map(e=>e.line.includes(`\x1B`)?{...e,line:g(e.line)}:e).filter(t=>(r===`all`||t.stream===r)&&(!e||t.line.toLowerCase().includes(e)))},[n,r,s]);(0,w.useEffect)(()=>{if(!l)return;let e=p.current;e&&(e.scrollTop=e.scrollHeight)},[m.length,l]);let h=(0,w.useMemo)(()=>m.map(e=>d?`${P(e.ts)} [${e.stream}] ${e.line}`:e.line).join(`
|
|
2
|
-
`),[m,d]);return(0,T.jsxs)(i,{padded:!1,className:`overflow-hidden`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line px-4 py-3`,children:[(0,T.jsx)(`h3`,{className:`mr-1 text-base font-semibold text-fg`,children:`Process logs`}),(0,T.jsx)(b,{options:N,value:r,onChange:o}),(0,T.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,T.jsx)(a,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),(0,T.jsx)(`input`,{value:s,onChange:e=>c(e.target.value),"aria-label":`Filter log lines`,placeholder:`Filter…`,className:`h-8 w-full rounded-lg border border-line bg-surface-2 pl-8 pr-2 text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,T.jsx)(L,{on:l,onClick:()=>u(e=>!e),label:`Follow`}),(0,T.jsx)(L,{on:d,onClick:()=>f(e=>!e),label:`Times`}),(0,T.jsx)(C,{value:h}),(0,T.jsx)(`button`,{type:`button`,onClick:()=>{let e=new Blob([h],{type:`text/plain`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`bunqueue-logs-${Date.now()}.log`,n.click(),URL.revokeObjectURL(t)},disabled:m.length===0,className:`rounded-md border border-line bg-surface-2 px-2 py-1 text-xs text-muted transition-colors hover:text-fg disabled:opacity-40`,children:`Download`})]}),(0,T.jsx)(`div`,{ref:p,className:`max-h-80 min-h-40 overflow-y-auto p-4 font-mono text-xs leading-relaxed`,children:m.length===0?(0,T.jsx)(`p`,{className:`text-faint`,children:n.length===0?`No output yet.`:`No lines match the current filter.`}):m.map(e=>(0,T.jsxs)(`div`,{className:t(`whitespace-pre-wrap`,F(e.stream)),children:[d&&(0,T.jsx)(`span`,{className:`mr-2 text-faint`,children:P(e.ts)}),e.line]},e.seq))}),(0,T.jsxs)(`div`,{className:`flex items-center justify-between border-t border-line px-4 py-2 text-[11px] text-faint`,children:[(0,T.jsx)(`span`,{children:m.length===n.length?`${n.length} lines`:`${m.length} of ${n.length} lines`}),(0,T.jsx)(`span`,{children:l?`following tail`:`paused`})]})]})}function L({on:e,onClick:n,label:r}){return(0,T.jsx)(`button`,{type:`button`,onClick:n,"aria-pressed":e,className:t(`rounded-md border px-2 py-1 text-xs transition-colors`,e?`border-accent/40 bg-accent/10 text-accent`:`border-line bg-surface-2 text-muted hover:text-fg`),children:r})}function R(){return m(()=>h.control.logs(),[])}var z={running:{label:`Running`,tone:`text-success`,dot:`bg-emerald-400`},starting:{label:`Starting`,tone:`text-warning`,dot:`bg-amber-400`},stopping:{label:`Stopping`,tone:`text-warning`,dot:`bg-amber-400`},stopped:{label:`Stopped`,tone:`text-danger`,dot:`bg-red-400`}};function B({startedAt:e}){let[,t]=(0,w.useState)(0);return(0,w.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,T.jsx)(T.Fragment,{children:f((Date.now()-e)/1e3)})}function V({label:e,children:t,title:n}){return(0,T.jsxs)(`div`,{className:`min-w-0`,title:n,children:[(0,T.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-faint`,children:e}),(0,T.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-sm text-fg`,children:t})]})}function H({status:e,agentBase:n,transitioning:r,stale:i=!1,vitals:a=null,busy:s,onStart:f,onStop:p,onRestart:m}){let h=e?.status??`stopped`,g=h===`running`,_=z[h]??z.stopped,v=!!e?.healthy&&!i,y=!g&&e?.exitCode!=null&&e.exitCode!==0,b=e?.runningConfig??e?.config??null,x=`http://localhost:${b?.httpPort??6790}`;return(0,T.jsxs)(`section`,{className:`mb-6 overflow-hidden rounded-xl border border-line bg-surface`,children:[(0,T.jsx)(`div`,{className:t(`h-0.5 bg-gradient-to-r to-transparent`,g&&v?`from-emerald-400/80 via-emerald-400/25`:g||r?`from-amber-400/80 via-amber-400/25`:`from-red-400/70 via-red-400/20`)}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-5 p-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,T.jsxs)(`span`,{className:`relative flex size-3.5 shrink-0`,children:[g&&v&&(0,T.jsx)(`span`,{className:`absolute inline-flex size-full rounded-full bg-emerald-400 opacity-50 motion-safe:animate-ping`}),(0,T.jsx)(`span`,{className:t(`relative inline-flex size-3.5 rounded-full`,_.dot)})]}),(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,T.jsx)(`span`,{className:t(`text-2xl font-bold tracking-tight`,_.tone),children:r&&s?`${s}…`:_.label}),e?.version&&(0,T.jsxs)(`span`,{className:`font-mono text-xs text-muted`,children:[`bunqueue v`,e.version]}),y&&(0,T.jsxs)(`span`,{className:`rounded-full bg-red-500/15 px-2 py-0.5 font-mono text-[11px] font-medium text-danger`,children:[`crashed · exit `,e?.exitCode]})]}),(0,T.jsx)(`div`,{className:`mt-1 font-mono text-xs text-muted`,children:i?(0,T.jsxs)(`span`,{className:`text-warning`,children:[`last known: pid `,e?.pid??`—`,` — agent unreachable, state may have changed`]}):g?(0,T.jsxs)(T.Fragment,{children:[v?`healthy`:`waiting for health…`,` · pid `,e?.pid??`—`,` · up`,` `,e?.startedAt?(0,T.jsx)(B,{startedAt:e.startedAt}):`—`]}):`process not running — start it below or point the dashboard at an external server`})]})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,T.jsxs)(c,{variant:`success`,disabled:g||r||i,onClick:f,children:[(0,T.jsx)(u,{className:`size-4`}),` Start`]}),(0,T.jsxs)(c,{variant:`warning`,disabled:!g||r||i,onClick:p,children:[(0,T.jsx)(l,{className:`size-4`}),` Stop`]}),(0,T.jsxs)(c,{disabled:r||i,onClick:m,children:[(0,T.jsx)(o,{className:`size-4`}),` Restart`]})]})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 border-t border-line bg-surface-2/30 px-5 py-4 md:grid-cols-3 xl:grid-cols-7`,children:[(0,T.jsx)(V,{label:`Memory`,children:a?.memory?.rss==null?(0,T.jsx)(`span`,{className:`text-faint`,children:`—`}):(0,T.jsxs)(`span`,{title:`heap ${a.memory.heapUsed??`?`} / ${a.memory.heapTotal??`?`} MB`,children:[a.memory.rss,` MB rss`]})}),(0,T.jsx)(V,{label:`Connections`,children:a?.connections?`${a.connections.tcp??0} tcp · ${a.connections.ws??0} ws · ${a.connections.sse??0} sse`:(0,T.jsx)(`span`,{className:`text-faint`,children:`—`})}),(0,T.jsx)(V,{label:`API endpoint`,title:x,children:g?(0,T.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,T.jsx)(`a`,{href:`${x}/health`,target:`_blank`,rel:`noreferrer`,className:`truncate text-accent hover:underline`,children:x}),(0,T.jsx)(C,{value:x})]}):(0,T.jsx)(`span`,{className:`text-faint`,children:x})}),(0,T.jsx)(V,{label:`Ports`,children:b?`${b.httpPort} http · ${b.tcpPort} tcp`:`—`}),(0,T.jsx)(V,{label:`Started`,children:g&&e?.startedAt?d(e.startedAt):`—`}),(0,T.jsx)(V,{label:`Control agent`,title:n,children:n.replace(/^https?:\/\//,``)}),(0,T.jsx)(V,{label:`Launch command`,title:b?.command,children:b?.command??`—`})]})]})}var U=[{key:`size`,label:`Database`,color:`bg-accent`},{key:`walSize`,label:`WAL`,color:`bg-amber-400`},{key:`shmSize`,label:`SHM`,color:`bg-zinc-500`}];function W({db:e}){let n=e.totalSize||0;return(0,T.jsxs)(i,{children:[(0,T.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,T.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Storage`}),(0,T.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:e.exists?`${_(n)} on disk`:`not created yet`})]}),(0,T.jsxs)(`p`,{className:`mb-4 flex items-center gap-1.5 truncate font-mono text-xs text-faint`,title:e.path,children:[(0,T.jsx)(`span`,{className:`truncate`,children:e.path}),(0,T.jsx)(C,{value:e.path})]}),e.exists&&n>0?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(`div`,{className:`flex h-2.5 overflow-hidden rounded-full bg-surface-2`,children:U.map(r=>{let i=e[r.key];return i?(0,T.jsx)(`div`,{className:t(`h-full`,r.color),style:{width:`${i/n*100}%`},title:`${r.label}: ${_(i)}`},r.key):null})}),(0,T.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-5 gap-y-1.5 font-mono text-[11px] text-faint`,children:[U.map(n=>(0,T.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,T.jsx)(`span`,{className:t(`size-2 rounded-full`,n.color)}),n.label,` `,(0,T.jsx)(`span`,{className:`text-fg`,children:_(e[n.key])})]},n.key)),e.mtimeMs?(0,T.jsxs)(`span`,{className:`ml-auto`,children:[`written `,v(e.mtimeMs)]}):null]})]}):(0,T.jsx)(`p`,{className:`rounded-lg border border-dashed border-line px-4 py-6 text-center text-sm text-faint`,children:`The database appears here after the first start — SQLite creates the file at the configured data path.`})]})}function G(){let{data:e,error:t,refetch:n}=m(()=>h.control.status(),[]),[r,a]=(0,w.useState)(null),[o,c]=(0,w.useState)(null),l=e?.status===`running`,{data:u}=m(()=>l?h.health():Promise.resolve(null),[l]),d=l?u??null:null,f=d?.connections?` This drops ${d.connections.tcp??0} TCP / ${d.connections.ws??0} WS connections; in-flight jobs are interrupted.`:` In-flight jobs are interrupted.`,g=async(e,t,r)=>{if(!(r&&!window.confirm(r))){a(e),c(null);try{await t(),await n()}catch(e){c(e.message)}finally{a(null)}}};if(t&&!e)return(0,T.jsxs)(`div`,{children:[(0,T.jsx)(p,{title:`Server`,description:`Start, stop and restart the bunqueue server.`}),(0,T.jsx)(s,{message:`Control agent unreachable — server lifecycle controls are unavailable.`,onRetry:n}),(0,T.jsxs)(i,{children:[(0,T.jsx)(y,{title:`Control agent not running`}),(0,T.jsxs)(`p`,{className:`text-sm text-muted`,children:[`The local control agent is unreachable at`,` `,(0,T.jsx)(`code`,{className:`rounded bg-surface-2 px-1.5 py-0.5 text-xs`,children:h.agentBase}),`. It manages the bunqueue server process (start / stop / restart). Start it with:`]}),(0,T.jsxs)(`pre`,{className:`mt-3 overflow-x-auto rounded-lg border border-line bg-surface-2 px-3 py-2 text-xs`,children:[`bun start`,` `,`# agent + dashboard together (recommended)`,`
|
|
3
|
-
`,`bun run agent`,` `,`# agent only, if the dashboard is already running`]}),(0,T.jsx)(`p`,{className:`mt-3 text-xs text-faint`,children:`This page reconnects automatically once the agent is up — no reload needed.`})]})]});let _=e?.status??`stopped`,v=_===`running`,b=_===`starting`||_===`stopping`||r!=null,x=t!=null&&e!=null;return(0,T.jsxs)(`div`,{children:[(0,T.jsx)(p,{title:`Server`,description:`Supervise the bunqueue server process — lifecycle, configuration, storage and logs.`}),o&&(0,T.jsx)(`div`,{role:`status`,className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-danger`,children:o}),x&&(0,T.jsx)(`div`,{className:`mb-4 rounded-lg border border-amber-500/20 bg-amber-500/5 px-4 py-2 text-sm text-warning`,children:`Control agent unreachable — showing last known state. Lifecycle actions are disabled until it responds again.`}),(0,T.jsx)(H,{status:e,agentBase:h.agentBase,stale:x,vitals:d,transitioning:b,busy:r,onStart:()=>g(`starting`,()=>h.control.start()),onStop:()=>g(`stopping`,()=>h.control.stop(),`Stop the bunqueue server?${f}`),onRestart:()=>g(`restarting`,()=>h.control.restart(),`Restart the bunqueue server?${f}`)}),(0,T.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,T.jsx)(K,{status:e,onSaved:n,running:v,transitioning:b}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e?.db&&(0,T.jsx)(W,{db:e.db}),(0,T.jsx)(I,{})]})]}),(0,T.jsx)(`div`,{className:`mt-6`,children:(0,T.jsx)(D,{agentBase:h.agentBase})})]})}function K({status:e,onSaved:t,running:n,transitioning:r}){let[a,s]=(0,w.useState)(null),[l,u]=(0,w.useState)(!1),[d,f]=(0,w.useState)(!1),[p,m]=(0,w.useState)(null);(0,w.useEffect)(()=>{e?.config&&!a&&s(e.config)},[e,a]);let g=a??e?.config??null;if(!g)return(0,T.jsx)(i,{children:`Loading…`});let _=e=>s({...g,...e}),v=e?.runningConfig??null,b=(e={})=>JSON.stringify(Object.keys(e).sort().map(t=>[t,e[t]])),C=[];v!=null&&(v.command!==g.command&&C.push(`command`),v.httpPort!==g.httpPort&&C.push(`HTTP port`),v.tcpPort!==g.tcpPort&&C.push(`TCP port`),v.dataPath!==g.dataPath&&C.push(`data path`),b(v.extraEnv)!==b(g.extraEnv)&&C.push(`environment variables`));let E=n&&C.length>0,D=r||d,O=()=>{u(!0),setTimeout(()=>u(!1),2e3)},k=()=>{let e=e=>Number.isInteger(e)&&e>=1&&e<=65535;return e(g.httpPort)?e(g.tcpPort)?g.httpPort===g.tcpPort?`HTTP and TCP ports must differ`:null:`TCP port must be an integer between 1 and 65535`:`HTTP port must be an integer between 1 and 65535`},A=async()=>{let e=k();if(e){m(e);return}m(null);try{await h.control.setConfig(g),O(),t()}catch(e){m(e.message)}};return(0,T.jsxs)(i,{children:[(0,T.jsx)(y,{title:`Configuration`}),(0,T.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:n?`Ports and data path apply on the next restart — edit freely, then restart.`:`Edit and save; the config is used the next time the server starts.`}),(0,T.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,T.jsx)(S,{label:`Command`,hint:`The exact command the agent runs to launch bunqueue. It receives HTTP_PORT, TCP_PORT and BUNQUEUE_DATA_PATH in its environment. The default needs a global 'bunqueue' binary — or point it at a local entry, e.g. bun run /path/to/bunqueue/src/main.ts.`,children:(0,T.jsx)(x,{value:g.command,disabled:D,onChange:e=>_({command:e.target.value}),placeholder:`bunqueue start`})}),(0,T.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,T.jsx)(S,{label:`HTTP port`,hint:`Dashboard API + SSE.`,children:(0,T.jsx)(x,{type:`number`,min:1,max:65535,value:g.httpPort,disabled:D,onChange:e=>_({httpPort:Number(e.target.value)})})}),(0,T.jsx)(S,{label:`TCP port`,hint:`Binary protocol. Must differ from HTTP.`,children:(0,T.jsx)(x,{type:`number`,min:1,max:65535,value:g.tcpPort,disabled:D,onChange:e=>_({tcpPort:Number(e.target.value)})})})]}),(0,T.jsx)(S,{label:`Data path`,hint:`SQLite database file, relative to the agent's working directory. The parent folder must already exist — SQLite creates the file, not the directory.`,children:(0,T.jsx)(x,{value:g.dataPath,disabled:D,onChange:e=>_({dataPath:e.target.value})})}),(0,T.jsx)(S,{label:`Environment variables`,hint:`Injected into the server process on start, on top of the ports + data path. Applies on the next restart.`,children:(0,T.jsx)(M,{value:g.extraEnv??{},onChange:e=>_({extraEnv:e}),disabled:D})}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(c,{type:`submit`,variant:`accent`,size:`sm`,disabled:D,children:`Save config`}),n&&(0,T.jsxs)(c,{variant:`warning`,size:`sm`,disabled:D,onClick:async()=>{let e=k();if(e){m(e);return}let n=C.length>0?` Changed: ${C.join(`, `)}.`:``;if(window.confirm(`Save configuration and restart the server to apply it?${n}`)){m(null),f(!0);try{await h.control.setConfig(g),await h.control.restart(),O(),t()}catch(e){m(e.message)}finally{f(!1)}}},children:[(0,T.jsx)(o,{className:`size-3.5`}),` Save & restart`]}),E&&!l&&(0,T.jsx)(`span`,{className:`text-xs text-warning`,children:`Restart to apply changes`}),l&&(0,T.jsx)(`span`,{role:`status`,className:`text-xs text-success`,children:`Saved`}),p&&(0,T.jsx)(`span`,{role:`status`,className:`text-xs text-danger`,children:p})]})]})]})}export{G as ServerControl};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-vendor-B68RYDeC.js";import{C as t,S as n,c as r,d as i,h as a,k as o,l as s,m as c,n as l,nt as u,r as d,u as f,w as p,x as m}from"./index-Dlr2PaZ6.js";var h=e(),g={overview:{stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},memory:{heapUsed:0,heapTotal:0,rss:0},crons:{total:0}},storage:{},failedTotal:0};function _(){let{data:e,error:_,loading:y,refetch:b}=o(async()=>{let[e,t,n]=await Promise.all([u.overview(),u.storage(),u.queuesSummary()]),r=n.reduce((e,t)=>e+(t.counts?.failed??0),0);return{overview:e,storage:t.data??{},failedTotal:r}},[]);if(y&&!e&&!_)return(0,h.jsx)(m,{label:`Loading usage…`});let x=e??g,{stats:S,memory:C,crons:w}=x.overview,{storage:T,failedTotal:E}=x,D=l(S.completed,E),O=S.uptime?i(S.uptime/1e3):`—`;return(0,h.jsxs)(`div`,{children:[(0,h.jsx)(a,{title:`Usage`,description:`Cumulative resource usage on the connected server.`,live:!0}),_&&(0,h.jsx)(n,{onRetry:b}),(0,h.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,h.jsx)(c,{label:`Completed`,value:r(S.completed),tone:`green`}),(0,h.jsx)(c,{label:`Failed`,value:r(E),tone:E?`red`:`default`}),(0,h.jsx)(c,{label:`Waiting`,value:r(S.waiting),tone:`amber`}),(0,h.jsx)(c,{label:`Active`,value:r(S.active),tone:`blue`}),(0,h.jsx)(c,{label:`Error Rate`,value:D==null?`—`:s(D),tone:D==null?`default`:D>.05?`red`:`green`}),(0,h.jsx)(c,{label:`Uptime`,value:O})]}),(0,h.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,h.jsxs)(t,{children:[(0,h.jsx)(p,{title:`Runtime`}),(0,h.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,h.jsx)(v,{label:`Jobs pushed (since restart)`,value:r(S.totalPushed)}),(0,h.jsx)(v,{label:`Jobs pulled (since restart)`,value:r(S.totalPulled)}),(0,h.jsx)(v,{label:`Heap used`,value:d(C.heapUsed*1024*1024)}),(0,h.jsx)(v,{label:`RSS`,value:d(C.rss*1024*1024)}),(0,h.jsx)(v,{label:`Cron jobs`,value:String(w.total)})]})]}),(0,h.jsxs)(t,{children:[(0,h.jsx)(p,{title:`Storage`}),T.diskFull?(0,h.jsxs)(`div`,{className:`rounded-lg border border-red-500/25 bg-red-500/[0.06] px-4 py-3`,children:[(0,h.jsx)(`div`,{className:`font-semibold text-danger`,children:`Disk full — writes suspended`}),T.error&&(0,h.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:T.error}),T.since!=null&&(0,h.jsxs)(`div`,{className:`mt-1 text-xs text-faint`,children:[`since `,f(T.since)]})]}):(0,h.jsxs)(`div`,{className:`rounded-lg border border-emerald-500/25 bg-emerald-500/[0.06] px-4 py-3`,children:[(0,h.jsx)(`div`,{className:`font-semibold text-success`,children:`Healthy`}),(0,h.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`Disk writes are being accepted.`})]})]})]})]})}function v({label:e,value:t}){return(0,h.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,h.jsx)(`dt`,{className:`text-muted`,children:e}),(0,h.jsx)(`dd`,{className:`font-medium text-fg`,children:t})]})}export{_ as UsagePro};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./cn-CMFYpumL.js";import{h as n,t as r}from"./react-vendor-B68RYDeC.js";import{E as i,S as a,X as o,Y as s,c,h as l,k as u,m as d,nt as f,u as p,x as m,y as h}from"./index-Dlr2PaZ6.js";var g=e(n(),1),_=r(),v=100,y=`No heartbeat recently — derived from lastSeen`;function b(){let{data:e,error:n,loading:r,refetch:b}=u(async()=>(await f.workers()).data?.workers??[],[]),[S,C]=(0,g.useState)(new Set),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)(null);if(r&&!e&&!n)return(0,_.jsx)(m,{label:`Loading workers…`});let O=e??[],k=(E?[...O].sort((e,t)=>{let n=E.key===`failed`?e.failedJobs??0:e.lastSeen??0,r=E.key===`failed`?t.failedJobs??0:t.lastSeen??0;return E.dir===`asc`?n-r:r-n}):O).slice(0,v),A=e=>D(t=>t?.key===e?{key:e,dir:t.dir===`desc`?`asc`:`desc`}:{key:e,dir:`desc`}),j=O.filter(e=>e.status===`active`).length,M=O.length-j,N=O.reduce((e,t)=>e+(t.activeJobs??0),0),P=async e=>{if(window.confirm(`Unregister worker "${e.id}"? It can re-register on its next heartbeat.`)){C(t=>new Set(t).add(e.id)),T(null);try{await f.unregisterWorker(e.id),T({ok:!0,text:`Unregistered ${e.id} ✓`})}catch(e){T({ok:!1,text:`Unregister failed: ${e.message}`})}finally{C(t=>{let n=new Set(t);return n.delete(e.id),n}),b()}}};return(0,_.jsxs)(`div`,{children:[(0,_.jsx)(l,{title:`Workers`,description:`Registered workers and their throughput.`,live:!n}),n&&(0,_.jsx)(a,{onRetry:b}),(0,_.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,_.jsx)(d,{label:`Total`,value:c(O.length),compact:!0}),(0,_.jsx)(d,{label:`Active`,value:c(j),tone:`green`,compact:!0}),(0,_.jsx)(`div`,{title:y,children:(0,_.jsx)(d,{label:`Stale`,value:c(M),tone:M?`amber`:`default`,compact:!0})}),(0,_.jsx)(d,{label:`Active Jobs`,value:c(N),tone:`blue`,compact:!0})]}),w&&(0,_.jsx)(`div`,{className:t(`mb-3 text-sm`,w.ok?`text-success`:`text-danger`),children:w.text}),O.length===0?(0,_.jsx)(h,{icon:(0,_.jsx)(o,{}),title:`No workers registered`,hint:`Workers appear here once they connect and register with the server.`}):(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,_.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Worker`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queues`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Processed`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:(0,_.jsx)(x,{label:`Failed`,active:E?.key===`failed`?E.dir:null,onClick:()=>A(`failed`)})}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:(0,_.jsx)(x,{label:`Last Seen`,active:E?.key===`lastSeen`?E.dir:null,onClick:()=>A(`lastSeen`)})}),(0,_.jsx)(`th`,{className:`w-16 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,_.jsx)(`tbody`,{children:k.map(e=>(0,_.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,_.jsxs)(`td`,{className:`px-5 py-3`,children:[(0,_.jsx)(`div`,{className:`font-medium text-fg`,children:e.name||`worker`}),(0,_.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.id})]}),(0,_.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queues.join(`, `)||`—`}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(`span`,{title:e.status===`active`?void 0:y,className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.status===`active`?`bg-emerald-500/10 text-success`:`bg-amber-500/10 text-warning`),children:e.status})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:c(e.activeJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:c(e.processedJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:c(e.failedJobs)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:p(e.lastSeen)}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsx)(`div`,{className:`flex justify-end`,children:(0,_.jsx)(i,{"aria-label":`Unregister worker ${e.id}`,disabled:S.has(e.id),onClick:()=>P(e),children:(0,_.jsx)(s,{className:`size-3.5`})})})})]},e.id))})]})}),O.length>v&&(0,_.jsxs)(`p`,{className:`mt-3 text-xs text-warning`,children:[`Showing first `,c(v),` of `,c(O.length),` workers.`]})]})}function x({label:e,active:n,onClick:r}){return(0,_.jsxs)(`button`,{type:`button`,onClick:r,title:`Sort by ${e}`,className:t(`inline-flex items-center gap-1 uppercase tracking-wider transition-colors hover:text-fg`,n?`text-fg`:`text-faint`),children:[e,(0,_.jsx)(`span`,{"aria-hidden":`true`,children:n===`desc`?`↓`:n===`asc`?`↑`:``})]})}export{b as WorkersPro};
|