@telamonjs/ui 1.3.1 → 1.4.0
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/CHANGELOG.md +94 -0
- package/README.md +7 -8
- package/dist/components/data/DataTableActions.js +4 -3
- package/dist/data/ExportMenu.js +6 -3
- package/dist/data/InfiniteList.js +6 -2
- package/dist/data/datatable/sort-field.d.ts +14 -0
- package/dist/data/datatable/sort-field.js +24 -0
- package/dist/data/datatable/useDataTableInstance.js +3 -2
- package/dist/data/exportUtils.d.ts +14 -9
- package/dist/data/exportUtils.js +56 -56
- package/dist/data/missing-peer.d.ts +17 -0
- package/dist/data/missing-peer.js +22 -0
- package/dist/data/xlsx-writer.d.ts +24 -0
- package/dist/data/xlsx-writer.js +141 -0
- package/dist/exports/types-constants.d.ts +1 -1
- package/dist/exports/types-constants.js +1 -1
- package/dist/i18n/messages/en/data.d.ts +1 -0
- package/dist/i18n/messages/en/data.js +1 -0
- package/dist/i18n/messages/en/index.d.ts +3 -0
- package/dist/i18n/messages/en/queue.d.ts +2 -0
- package/dist/i18n/messages/en/queue.js +3 -1
- package/dist/i18n/messages/es/data.d.ts +1 -0
- package/dist/i18n/messages/es/data.js +1 -0
- package/dist/i18n/messages/es/index.d.ts +3 -0
- package/dist/i18n/messages/es/queue.d.ts +2 -0
- package/dist/i18n/messages/es/queue.js +3 -1
- package/dist/i18n/messages/pt-BR/data.d.ts +1 -0
- package/dist/i18n/messages/pt-BR/data.js +1 -0
- package/dist/i18n/messages/pt-BR/index.d.ts +3 -0
- package/dist/i18n/messages/pt-BR/queue.d.ts +2 -0
- package/dist/i18n/messages/pt-BR/queue.js +3 -1
- package/dist/i18n/use-t.d.ts +3 -0
- package/dist/pages/ListPage.js +6 -1
- package/dist/queue/components/DispatchJobModal.js +157 -115
- package/dist/queue/components/JobEventTimeline.js +321 -210
- package/dist/queue/hooks/use-queue-events-timeline.d.ts +7 -1
- package/dist/queue/hooks/use-queue-events-timeline.js +14 -43
- package/dist/queue/hooks/use-queue-sse.js +3 -1
- package/dist/queue/types.d.ts +2 -0
- package/dist/server/pagination/factory.js +5 -1
- package/dist/server/pagination/types.d.ts +6 -2
- package/dist/server/pagination/utils.d.ts +6 -3
- package/dist/server/pagination/utils.js +13 -7
- package/dist/server/prisma-helpers.d.ts +27 -19
- package/dist/server/prisma-helpers.js +37 -19
- package/dist/stores/datatable-store.d.ts +0 -4
- package/dist/stores/datatable-store.js +0 -5
- package/dist/stores/form-store.d.ts +5 -0
- package/dist/stores/form-store.js +8 -4
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.js +1 -3
- package/dist/stores/sidebar-store.d.ts +1 -1
- package/dist/types/actions.d.ts +4 -1
- package/dist/types/crud.d.ts +14 -1
- package/dist/types/system-config.d.ts +5 -0
- package/dist/ui/chart.d.ts +22 -27
- package/dist/ui/chart.js +2 -8
- package/dist/ui/form.d.ts +1 -1
- package/package.json +67 -64
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/queue/components/JobEventTimeline.tsx
|
|
4
|
-
import { useState, useEffect, useMemo } from "react";
|
|
4
|
+
import { useState, useEffect, useId, useMemo } from "react";
|
|
5
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { toast } from "sonner";
|
|
5
7
|
import {
|
|
6
8
|
Wifi,
|
|
7
9
|
WifiOff,
|
|
@@ -22,7 +24,16 @@ import {
|
|
|
22
24
|
} from "lucide-react";
|
|
23
25
|
import { useFormatter, useLocale } from "next-intl";
|
|
24
26
|
import { cn } from "../../utils/cn.js";
|
|
25
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
useQueueEventsTimeline,
|
|
29
|
+
useQueueStats,
|
|
30
|
+
useQueueHealth,
|
|
31
|
+
useCopyToClipboard
|
|
32
|
+
} from "../hooks/index.js";
|
|
33
|
+
import { useEscapeToClose } from "../hooks/use-escape-to-close.js";
|
|
34
|
+
import { useQueueApi } from "../api/provider.js";
|
|
35
|
+
import { logger } from "../../utils/logger.js";
|
|
36
|
+
import { useQueueReadOnly } from "./read-only-context.js";
|
|
26
37
|
import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
27
38
|
import { useFormat } from "../../i18n/use-format.js";
|
|
28
39
|
import { formatDuration } from "./job-shared.js";
|
|
@@ -47,7 +58,16 @@ function JobEventTimeline({
|
|
|
47
58
|
const locale = useLocale();
|
|
48
59
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
49
60
|
const [selectedJobId, setSelectedJobId] = useState(null);
|
|
61
|
+
const [confirmRemoveId, setConfirmRemoveId] = useState(null);
|
|
62
|
+
const [pendingId, setPendingId] = useState(null);
|
|
50
63
|
const { copied, copy: copyToClipboard, reset: resetCopied } = useCopyToClipboard();
|
|
64
|
+
const api = useQueueApi();
|
|
65
|
+
const queryClient = useQueryClient();
|
|
66
|
+
const readOnly = useQueueReadOnly();
|
|
67
|
+
const { data: health } = useQueueHealth();
|
|
68
|
+
const detailTitleId = useId();
|
|
69
|
+
useEscapeToClose(selectedJobId !== null, () => setSelectedJobId(null));
|
|
70
|
+
useEscapeToClose(isExpanded, () => setIsExpanded(false));
|
|
51
71
|
const {
|
|
52
72
|
data: timelineData,
|
|
53
73
|
isLoading,
|
|
@@ -80,6 +100,34 @@ function JobEventTimeline({
|
|
|
80
100
|
if (!timelineData?.jobs) return [];
|
|
81
101
|
return timelineData.jobs.slice(0, maxItems);
|
|
82
102
|
}, [timelineData, maxItems]);
|
|
103
|
+
const runJobAction = async (job, action) => {
|
|
104
|
+
setPendingId(job.id);
|
|
105
|
+
try {
|
|
106
|
+
const params = { jobId: job.id, queueName: job.queueName };
|
|
107
|
+
if (action === "retry") await api.retryJob(params);
|
|
108
|
+
else await api.removeJob(params);
|
|
109
|
+
toast.success(
|
|
110
|
+
t(action === "retry" ? "queue.jobsListModal.retrySent" : "queue.jobsListModal.removed")
|
|
111
|
+
);
|
|
112
|
+
if (action === "remove" && selectedJobId === job.id) setSelectedJobId(null);
|
|
113
|
+
await Promise.all(
|
|
114
|
+
[["queue", "events-timeline"], ["queue", "stats"], ["queue", "jobs"], ["queue", "history"]].map(
|
|
115
|
+
(queryKey) => queryClient.invalidateQueries({ queryKey })
|
|
116
|
+
)
|
|
117
|
+
);
|
|
118
|
+
} catch (err) {
|
|
119
|
+
logger.error(action === "retry" ? "Error retrying job" : "Error removing job", {
|
|
120
|
+
error: err instanceof Error ? err : String(err)
|
|
121
|
+
});
|
|
122
|
+
toast.error(
|
|
123
|
+
t(action === "retry" ? "queue.jobsListModal.retryError" : "queue.jobsListModal.removeError")
|
|
124
|
+
);
|
|
125
|
+
} finally {
|
|
126
|
+
setPendingId(null);
|
|
127
|
+
setConfirmRemoveId(null);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const canRetry = (job) => !readOnly && job.status === "failed" && health?.get(job.queueName)?.manualRetry !== false;
|
|
83
131
|
const isConnected = !isError && !isLoading;
|
|
84
132
|
const statusText = isLoading ? t("queue.eventTimeline.connecting") : isError ? t("queue.eventTimeline.disconnected") : isFetching ? t("queue.eventTimeline.updatingShort") : t("queue.eventTimeline.online");
|
|
85
133
|
const getJobStatusColor = (status) => {
|
|
@@ -168,69 +216,123 @@ function JobEventTimeline({
|
|
|
168
216
|
t("queue.eventTimeline.loadingJobs")
|
|
169
217
|
] }) }),
|
|
170
218
|
isError && /* @__PURE__ */ jsx("div", { className: "rounded-lg border border-red-200 dark:border-red-900/50 bg-red-50 dark:bg-red-950/30 p-4", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-red-700 dark:text-red-300", children: t("queue.eventTimeline.connectionError") }) }),
|
|
171
|
-
!isLoading && !isError && jobs.length > 0 && /* @__PURE__ */ jsx("
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/* @__PURE__ */ jsxs(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
219
|
+
!isLoading && !isError && jobs.length > 0 && /* @__PURE__ */ jsx("ul", { className: "space-y-2", children: jobs.map((job) => {
|
|
220
|
+
const confirming = confirmRemoveId === job.id;
|
|
221
|
+
const pending = pendingId === job.id;
|
|
222
|
+
return /* @__PURE__ */ jsxs(
|
|
223
|
+
"li",
|
|
224
|
+
{
|
|
225
|
+
className: cn(
|
|
226
|
+
"flex w-full items-start gap-2 rounded border transition-colors group",
|
|
227
|
+
getJobStatusColor(job.status)
|
|
228
|
+
),
|
|
229
|
+
children: [
|
|
230
|
+
/* @__PURE__ */ jsxs(
|
|
231
|
+
"button",
|
|
232
|
+
{
|
|
233
|
+
type: "button",
|
|
234
|
+
onClick: () => setSelectedJobId(job.id),
|
|
235
|
+
"aria-haspopup": "dialog",
|
|
236
|
+
"data-testid": "job-timeline-row",
|
|
237
|
+
className: "flex flex-1 min-w-0 items-start justify-between gap-3 rounded p-4 text-left cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset",
|
|
238
|
+
children: [
|
|
239
|
+
/* @__PURE__ */ jsxs("span", { className: "flex-1 min-w-0", children: [
|
|
240
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
|
|
241
|
+
getStatusIcon(job.status),
|
|
242
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-foreground truncate", children: job.name }),
|
|
243
|
+
job.repeat && /* @__PURE__ */ jsx(
|
|
244
|
+
"span",
|
|
245
|
+
{
|
|
246
|
+
className: "text-xs font-mono text-muted-foreground bg-muted px-2 py-0.5 rounded",
|
|
247
|
+
title: t("queue.eventTimeline.repeatHint"),
|
|
248
|
+
children: t("queue.eventTimeline.repeat")
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
] }),
|
|
252
|
+
/* @__PURE__ */ jsx("span", { className: "block text-xs text-muted-foreground mt-1 truncate", children: job.queueName })
|
|
253
|
+
] }),
|
|
254
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-right", children: job.status === "active" ? /* @__PURE__ */ jsx("span", { className: "text-blue-600 dark:text-blue-400 font-medium", children: t("queue.eventTimeline.inProgress") }) : /* @__PURE__ */ jsx(
|
|
255
|
+
"span",
|
|
256
|
+
{
|
|
257
|
+
className: cn(
|
|
258
|
+
"font-medium",
|
|
259
|
+
job.status === "failed" ? "text-red-600 dark:text-red-400" : "text-green-700 dark:text-green-400"
|
|
260
|
+
),
|
|
261
|
+
children: formatEventDuration(
|
|
262
|
+
job.processedOn,
|
|
263
|
+
job.finishedOn,
|
|
264
|
+
job.timestamp,
|
|
265
|
+
locale
|
|
266
|
+
)
|
|
267
|
+
}
|
|
268
|
+
) })
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
!readOnly && /* @__PURE__ */ jsx(
|
|
273
|
+
"div",
|
|
274
|
+
{
|
|
275
|
+
className: cn(
|
|
276
|
+
"flex items-center gap-1 self-center pr-3 transition-opacity",
|
|
277
|
+
confirming || pending ? "opacity-100" : "opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"
|
|
278
|
+
),
|
|
279
|
+
children: confirming ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
280
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t("queue.detail.confirmDeleteQuestion") }),
|
|
281
|
+
/* @__PURE__ */ jsx(
|
|
282
|
+
"button",
|
|
283
|
+
{
|
|
284
|
+
type: "button",
|
|
285
|
+
onClick: () => runJobAction(job, "remove"),
|
|
286
|
+
disabled: pending,
|
|
287
|
+
"data-testid": "job-timeline-remove-confirm",
|
|
288
|
+
className: "rounded px-2 py-1 text-xs font-medium text-red-700 hover:bg-red-100 dark:text-red-300 dark:hover:bg-red-900/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
|
|
289
|
+
children: t("queue.actions.yes")
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
/* @__PURE__ */ jsx(
|
|
293
|
+
"button",
|
|
294
|
+
{
|
|
295
|
+
type: "button",
|
|
296
|
+
onClick: () => setConfirmRemoveId(null),
|
|
297
|
+
disabled: pending,
|
|
298
|
+
"data-testid": "job-timeline-remove-cancel",
|
|
299
|
+
className: "rounded px-2 py-1 text-xs font-medium hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
|
|
300
|
+
children: t("queue.actions.no")
|
|
301
|
+
}
|
|
302
|
+
)
|
|
303
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
304
|
+
canRetry(job) && /* @__PURE__ */ jsx(
|
|
305
|
+
"button",
|
|
306
|
+
{
|
|
307
|
+
type: "button",
|
|
308
|
+
onClick: () => runJobAction(job, "retry"),
|
|
309
|
+
disabled: pending,
|
|
310
|
+
className: "p-1 rounded hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
|
|
311
|
+
title: t("queue.eventTimeline.retryJob"),
|
|
312
|
+
"aria-label": t("queue.eventTimeline.retryJob"),
|
|
313
|
+
children: /* @__PURE__ */ jsx(RotateCcw, { className: "h-3.5 w-3.5" })
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
job.status !== "active" && /* @__PURE__ */ jsx(
|
|
317
|
+
"button",
|
|
318
|
+
{
|
|
319
|
+
type: "button",
|
|
320
|
+
onClick: () => setConfirmRemoveId(job.id),
|
|
321
|
+
disabled: pending,
|
|
322
|
+
className: "p-1 rounded hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",
|
|
323
|
+
title: t("queue.eventTimeline.removeJob"),
|
|
324
|
+
"aria-label": t("queue.eventTimeline.removeJob"),
|
|
325
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
] })
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
]
|
|
332
|
+
},
|
|
333
|
+
job.id
|
|
334
|
+
);
|
|
335
|
+
}) }),
|
|
234
336
|
selectedJobId && jobs.find((j) => j.id === selectedJobId) && (() => {
|
|
235
337
|
const job = jobs.find((j) => j.id === selectedJobId);
|
|
236
338
|
const getStatusConfig = (status) => {
|
|
@@ -270,163 +372,172 @@ function JobEventTimeline({
|
|
|
270
372
|
onClick: () => setSelectedJobId(null)
|
|
271
373
|
}
|
|
272
374
|
),
|
|
273
|
-
/* @__PURE__ */ jsxs(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
),
|
|
284
|
-
children: config.icon
|
|
285
|
-
}
|
|
286
|
-
),
|
|
287
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
288
|
-
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: config.label }),
|
|
289
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: job.name })
|
|
290
|
-
] })
|
|
291
|
-
] }),
|
|
292
|
-
/* @__PURE__ */ jsx(
|
|
293
|
-
"button",
|
|
294
|
-
{
|
|
295
|
-
onClick: () => setSelectedJobId(null),
|
|
296
|
-
className: "p-2 rounded-lg hover:bg-muted transition-colors",
|
|
297
|
-
"aria-label": t("queue.detail.close"),
|
|
298
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
|
|
299
|
-
}
|
|
300
|
-
)
|
|
301
|
-
] }),
|
|
302
|
-
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: [
|
|
303
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
304
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
305
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
306
|
-
/* @__PURE__ */ jsx(Hash, { className: "h-4 w-4" }),
|
|
307
|
-
t("queue.detail.jobId")
|
|
308
|
-
] }),
|
|
309
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
310
|
-
/* @__PURE__ */ jsx("code", { className: "flex-1 text-sm bg-muted px-2 py-1 rounded font-mono truncate", children: job.id }),
|
|
375
|
+
/* @__PURE__ */ jsxs(
|
|
376
|
+
"div",
|
|
377
|
+
{
|
|
378
|
+
role: "dialog",
|
|
379
|
+
"aria-modal": "true",
|
|
380
|
+
"aria-labelledby": detailTitleId,
|
|
381
|
+
className: "fixed inset-4 md:inset-auto md:left-1/2 md:top-1/2 md:-translate-x-1/2 md:-translate-y-1/2 md:w-full md:max-w-2xl md:max-h-[85vh] bg-card rounded-xl shadow-2xl z-50 flex flex-col animate-in zoom-in-95 duration-200",
|
|
382
|
+
children: [
|
|
383
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-b", children: [
|
|
384
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
311
385
|
/* @__PURE__ */ jsx(
|
|
312
|
-
"
|
|
386
|
+
"div",
|
|
313
387
|
{
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
388
|
+
className: cn(
|
|
389
|
+
"p-2 rounded-lg",
|
|
390
|
+
config.bgColor,
|
|
391
|
+
config.color
|
|
392
|
+
),
|
|
393
|
+
children: config.icon
|
|
319
394
|
}
|
|
320
|
-
)
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
/* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" }),
|
|
326
|
-
t("queue.detail.queue")
|
|
327
|
-
] }),
|
|
328
|
-
/* @__PURE__ */ jsx("code", { className: "block text-sm bg-muted px-2 py-1 rounded font-mono", children: job.queueName })
|
|
329
|
-
] }),
|
|
330
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
331
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
332
|
-
/* @__PURE__ */ jsx(Clock, { className: "h-4 w-4" }),
|
|
333
|
-
t("queue.detail.start")
|
|
334
|
-
] }),
|
|
335
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
336
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: startTime.date }),
|
|
337
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground ml-2", children: startTime.time })
|
|
338
|
-
] })
|
|
339
|
-
] }),
|
|
340
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
341
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
342
|
-
/* @__PURE__ */ jsx(Clock, { className: "h-4 w-4" }),
|
|
343
|
-
t("queue.detail.end")
|
|
344
|
-
] }),
|
|
345
|
-
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
346
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children: endTime.date }),
|
|
347
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground ml-2", children: endTime.time })
|
|
348
|
-
] })
|
|
349
|
-
] }),
|
|
350
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
351
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
352
|
-
/* @__PURE__ */ jsx(Clock, { className: "h-4 w-4" }),
|
|
353
|
-
t("queue.detail.duration")
|
|
354
|
-
] }),
|
|
355
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: duration })
|
|
356
|
-
] }),
|
|
357
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
358
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
359
|
-
/* @__PURE__ */ jsx(Activity, { className: "h-4 w-4" }),
|
|
360
|
-
t("queue.detail.events")
|
|
361
|
-
] }),
|
|
362
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("queue.detail.eventsCount", { n: job.attemptsMade || 0 }) })
|
|
363
|
-
] })
|
|
364
|
-
] }),
|
|
365
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
366
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
367
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-medium text-green-700 dark:text-green-400", children: [
|
|
368
|
-
/* @__PURE__ */ jsx(CheckCircle, { className: "h-4 w-4" }),
|
|
369
|
-
t("queue.detail.result")
|
|
395
|
+
),
|
|
396
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
397
|
+
/* @__PURE__ */ jsx("h2", { id: detailTitleId, className: "text-lg font-semibold", children: config.label }),
|
|
398
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: job.name })
|
|
399
|
+
] })
|
|
370
400
|
] }),
|
|
371
401
|
/* @__PURE__ */ jsx(
|
|
372
402
|
"button",
|
|
373
403
|
{
|
|
374
|
-
onClick: () =>
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
)
|
|
378
|
-
className: "p-1.5 rounded hover:bg-gray-200 transition-colors",
|
|
379
|
-
title: t("queue.detail.copyResult"),
|
|
380
|
-
"aria-label": t("queue.detail.copyResult"),
|
|
381
|
-
children: copied === "result" ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-500" }) : /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4 text-muted-foreground" })
|
|
404
|
+
onClick: () => setSelectedJobId(null),
|
|
405
|
+
className: "p-2 rounded-lg hover:bg-muted transition-colors",
|
|
406
|
+
"aria-label": t("queue.detail.close"),
|
|
407
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
|
|
382
408
|
}
|
|
383
409
|
)
|
|
384
410
|
] }),
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
411
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto p-6 space-y-6", children: [
|
|
412
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
413
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
414
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
415
|
+
/* @__PURE__ */ jsx(Hash, { className: "h-4 w-4" }),
|
|
416
|
+
t("queue.detail.jobId")
|
|
417
|
+
] }),
|
|
418
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
419
|
+
/* @__PURE__ */ jsx("code", { className: "flex-1 text-sm bg-muted px-2 py-1 rounded font-mono truncate", children: job.id }),
|
|
420
|
+
/* @__PURE__ */ jsx(
|
|
421
|
+
"button",
|
|
422
|
+
{
|
|
423
|
+
onClick: () => copyToClipboard(job.id, "jobId"),
|
|
424
|
+
className: "p-1.5 rounded hover:bg-gray-200 transition-colors",
|
|
425
|
+
title: t("queue.detail.copyId"),
|
|
426
|
+
"aria-label": t("queue.detail.copyId"),
|
|
427
|
+
children: copied === "jobId" ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-500" }) : /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4 text-muted-foreground" })
|
|
428
|
+
}
|
|
429
|
+
)
|
|
430
|
+
] })
|
|
431
|
+
] }),
|
|
432
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
433
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
434
|
+
/* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" }),
|
|
435
|
+
t("queue.detail.queue")
|
|
436
|
+
] }),
|
|
437
|
+
/* @__PURE__ */ jsx("code", { className: "block text-sm bg-muted px-2 py-1 rounded font-mono", children: job.queueName })
|
|
438
|
+
] }),
|
|
439
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
440
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
441
|
+
/* @__PURE__ */ jsx(Clock, { className: "h-4 w-4" }),
|
|
442
|
+
t("queue.detail.start")
|
|
443
|
+
] }),
|
|
444
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
445
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: startTime.date }),
|
|
446
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground ml-2", children: startTime.time })
|
|
447
|
+
] })
|
|
448
|
+
] }),
|
|
449
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
450
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
451
|
+
/* @__PURE__ */ jsx(Clock, { className: "h-4 w-4" }),
|
|
452
|
+
t("queue.detail.end")
|
|
453
|
+
] }),
|
|
454
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm", children: [
|
|
455
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: endTime.date }),
|
|
456
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground ml-2", children: endTime.time })
|
|
457
|
+
] })
|
|
458
|
+
] }),
|
|
459
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
460
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
461
|
+
/* @__PURE__ */ jsx(Clock, { className: "h-4 w-4" }),
|
|
462
|
+
t("queue.detail.duration")
|
|
463
|
+
] }),
|
|
464
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: duration })
|
|
465
|
+
] }),
|
|
466
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
467
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
|
|
468
|
+
/* @__PURE__ */ jsx(Activity, { className: "h-4 w-4" }),
|
|
469
|
+
t("queue.detail.events")
|
|
470
|
+
] }),
|
|
471
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: t("queue.detail.eventsCount", { n: job.attemptsMade || 0 }) })
|
|
472
|
+
] })
|
|
399
473
|
] }),
|
|
400
|
-
/* @__PURE__ */
|
|
401
|
-
"
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
474
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
475
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
476
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-medium text-green-700 dark:text-green-400", children: [
|
|
477
|
+
/* @__PURE__ */ jsx(CheckCircle, { className: "h-4 w-4" }),
|
|
478
|
+
t("queue.detail.result")
|
|
479
|
+
] }),
|
|
480
|
+
/* @__PURE__ */ jsx(
|
|
481
|
+
"button",
|
|
482
|
+
{
|
|
483
|
+
onClick: () => copyToClipboard(
|
|
484
|
+
JSON.stringify(job.returnvalue, null, 2),
|
|
485
|
+
"result"
|
|
486
|
+
),
|
|
487
|
+
className: "p-1.5 rounded hover:bg-gray-200 transition-colors",
|
|
488
|
+
title: t("queue.detail.copyResult"),
|
|
489
|
+
"aria-label": t("queue.detail.copyResult"),
|
|
490
|
+
children: copied === "result" ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-500" }) : /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4 text-muted-foreground" })
|
|
491
|
+
}
|
|
492
|
+
)
|
|
493
|
+
] }),
|
|
494
|
+
/* @__PURE__ */ jsx("div", { className: "bg-green-50 dark:bg-green-950/30 border border-green-200 dark:border-green-900/50 rounded-lg p-4 overflow-x-auto", children: /* @__PURE__ */ jsx("pre", { className: "text-sm text-green-700 dark:text-green-300 font-mono whitespace-pre-wrap", children: JSON.stringify(job.returnvalue || {}, null, 2) }) })
|
|
495
|
+
] }),
|
|
496
|
+
job.failedReason && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
497
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-medium text-red-600 dark:text-red-400", children: [
|
|
498
|
+
/* @__PURE__ */ jsx(AlertCircle, { className: "h-4 w-4" }),
|
|
499
|
+
t("queue.detail.error")
|
|
500
|
+
] }),
|
|
501
|
+
/* @__PURE__ */ jsx("div", { className: "bg-red-50 dark:bg-red-950/30 border border-red-200 dark:border-red-900/50 rounded-lg p-4", children: /* @__PURE__ */ jsx("pre", { className: "text-sm text-red-700 dark:text-red-300 whitespace-pre-wrap font-mono", children: job.failedReason }) })
|
|
502
|
+
] }),
|
|
503
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
504
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
505
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-medium", children: [
|
|
506
|
+
/* @__PURE__ */ jsx(FileText, { className: "h-4 w-4" }),
|
|
507
|
+
t("queue.detail.jobData")
|
|
508
|
+
] }),
|
|
509
|
+
/* @__PURE__ */ jsx(
|
|
510
|
+
"button",
|
|
511
|
+
{
|
|
512
|
+
onClick: () => copyToClipboard(
|
|
513
|
+
JSON.stringify(job, null, 2),
|
|
514
|
+
"data"
|
|
515
|
+
),
|
|
516
|
+
className: "p-1.5 rounded hover:bg-gray-200 transition-colors",
|
|
517
|
+
title: t("queue.detail.copyData"),
|
|
518
|
+
"aria-label": t("queue.detail.copyData"),
|
|
519
|
+
children: copied === "data" ? /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 text-green-500" }) : /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4 text-muted-foreground" })
|
|
520
|
+
}
|
|
521
|
+
)
|
|
522
|
+
] }),
|
|
523
|
+
/* @__PURE__ */ jsxs("details", { className: "group", children: [
|
|
524
|
+
/* @__PURE__ */ jsx("summary", { className: "cursor-pointer text-sm text-muted-foreground hover:text-foreground transition-colors", children: t("queue.detail.expandToView") }),
|
|
525
|
+
/* @__PURE__ */ jsx("div", { className: "mt-2 bg-muted rounded-lg p-4 overflow-x-auto", children: /* @__PURE__ */ jsx("pre", { className: "text-xs font-mono whitespace-pre-wrap", children: JSON.stringify(job, null, 2) }) })
|
|
526
|
+
] })
|
|
527
|
+
] })
|
|
413
528
|
] }),
|
|
414
|
-
/* @__PURE__ */
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
children: t("queue.detail.close")
|
|
427
|
-
}
|
|
428
|
-
) })
|
|
429
|
-
] })
|
|
529
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-end gap-2 px-6 py-4 border-t bg-muted/50", children: /* @__PURE__ */ jsx(
|
|
530
|
+
"button",
|
|
531
|
+
{
|
|
532
|
+
onClick: () => setSelectedJobId(null),
|
|
533
|
+
"data-testid": "job-timeline-modal-close",
|
|
534
|
+
className: "px-4 py-2 text-sm font-medium rounded-lg hover:bg-gray-200 transition-colors",
|
|
535
|
+
children: t("queue.detail.close")
|
|
536
|
+
}
|
|
537
|
+
) })
|
|
538
|
+
]
|
|
539
|
+
}
|
|
540
|
+
)
|
|
430
541
|
] });
|
|
431
542
|
})(),
|
|
432
543
|
!isLoading && !isError && jobs.length === 0 && /* @__PURE__ */ jsxs("div", { className: "py-8 text-center", children: [
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Combines active and recently completed jobs for the events timeline.
|
|
5
5
|
* Optimized: 2 parallel aggregated calls instead of multiple individual calls.
|
|
6
6
|
*/
|
|
7
|
-
import type { TimelineJob } from '../types';
|
|
7
|
+
import type { JobInfo, TimelineJob } from '../types';
|
|
8
8
|
export interface TimelineData {
|
|
9
9
|
jobs: TimelineJob[];
|
|
10
10
|
}
|
|
@@ -16,6 +16,12 @@ export interface QueueEventsTimelineOptions {
|
|
|
16
16
|
/** Poll interval in ms while SSE is down (default: 2000) */
|
|
17
17
|
pollInterval?: number;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* A job scheduler / repeatable iteration: BullMQ sets `opts.repeatJobKey`
|
|
21
|
+
* (job schedulers) or `opts.repeat` (legacy repeatables) and ids them
|
|
22
|
+
* `repeat:<key>:<millis>`.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isRepeatJob(job: Pick<JobInfo, 'id' | 'opts'>): boolean;
|
|
19
25
|
/**
|
|
20
26
|
* Poll interval for the timeline: none while hidden or on another tab, a
|
|
21
27
|
* 30s safety net while SSE is live, otherwise `pollInterval` (2s default).
|