@telamonjs/ui 1.0.4 → 1.2.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 +79 -0
- package/README.md +2 -2
- package/dist/components/business/CalendarWithEvents.d.ts +7 -1
- package/dist/components/business/CalendarWithEvents.js +8 -9
- package/dist/components/cards/stat-card.js +22 -3
- package/dist/components/charts/BarChart.d.ts +12 -1
- package/dist/components/charts/BarChart.js +11 -2
- package/dist/components/crud/crud-field.js +1 -0
- package/dist/components/data/DataTableActions.js +45 -77
- package/dist/components/data/action-access.d.ts +22 -0
- package/dist/components/data/action-access.js +33 -0
- package/dist/components/data/report-table.d.ts +3 -1
- package/dist/components/data/report-table.js +2 -1
- package/dist/components/dialog/DialogHeaderContent.js +1 -1
- package/dist/components/dialog/confirm-action-dialog.d.ts +86 -0
- package/dist/components/dialog/confirm-action-dialog.js +194 -0
- package/dist/components/dialog/crud-view-dialog.d.ts +7 -3
- package/dist/components/dialog/crud-view-dialog.js +3 -2
- package/dist/components/dialog/view-dialog.d.ts +9 -1
- package/dist/components/dialog/view-dialog.js +8 -3
- package/dist/components/forms/AdminForm.js +2 -1
- package/dist/components/forms/BaseForm.js +4 -3
- package/dist/components/forms/WizardForm.js +3 -2
- package/dist/components/forms/ZustandForm.js +5 -4
- package/dist/components/forms/admin-form/field-group.js +5 -4
- package/dist/components/forms/grid-classes.d.ts +4 -0
- package/dist/components/forms/grid-classes.js +40 -0
- package/dist/components/forms/validators/config-validator.js +2 -1
- package/dist/components/toolbar/TabToolbar.d.ts +6 -1
- package/dist/components/toolbar/TabToolbar.js +5 -3
- package/dist/data/InfiniteList.js +2 -4
- package/dist/data/MobileCard.js +4 -1
- package/dist/data/VirtualDataTable.js +4 -1
- package/dist/data/datatable/TableDesktopView.js +2 -5
- package/dist/data/row-click.d.ts +10 -0
- package/dist/data/row-click.js +11 -0
- package/dist/exports/data-crud.d.ts +1 -1
- package/dist/exports/pages-dialogs.d.ts +3 -1
- package/dist/exports/pages-dialogs.js +2 -0
- package/dist/exports/types-constants.d.ts +2 -2
- package/dist/exports/types-constants.js +1 -1
- package/dist/field-system/mask-presets.d.ts +5 -0
- package/dist/field-system/mask-presets.js +18 -0
- package/dist/field-system/renderers/advanced-renderers.js +2 -4
- package/dist/field-system/renderers/textarea-renderers.js +1 -1
- package/dist/hooks/useCrudMutations.js +28 -16
- package/dist/i18n/messages/en/index.d.ts +1 -0
- package/dist/i18n/messages/en/list.d.ts +1 -0
- package/dist/i18n/messages/en/list.js +1 -0
- package/dist/i18n/messages/en/queue.js +1 -1
- package/dist/i18n/messages/es/index.d.ts +1 -0
- package/dist/i18n/messages/es/list.d.ts +1 -0
- package/dist/i18n/messages/es/list.js +1 -0
- package/dist/i18n/messages/pt-BR/index.d.ts +8 -7
- package/dist/i18n/messages/pt-BR/list.d.ts +1 -0
- package/dist/i18n/messages/pt-BR/list.js +1 -0
- package/dist/i18n/messages/pt-BR/queue.d.ts +7 -7
- package/dist/i18n/messages/pt-BR/queue.js +7 -7
- package/dist/i18n/use-t.d.ts +8 -7
- package/dist/pages/ListPage.js +23 -14
- package/dist/pages/list-page/ListPageDialogs.d.ts +8 -3
- package/dist/pages/list-page/ListPageDialogs.js +36 -7
- package/dist/pages/list-page/ListPageTable.d.ts +1 -1
- package/dist/pages/list-page/ListPageTable.js +1 -1
- package/dist/pages/list-page/ListPageToolbar.js +10 -14
- package/dist/pages/list-page/apply-crud-permissions.d.ts +21 -0
- package/dist/pages/list-page/apply-crud-permissions.js +34 -0
- package/dist/pages/list-page/types.d.ts +21 -2
- package/dist/pages/list-page/useDialogUrlSync.d.ts +10 -4
- package/dist/pages/list-page/useDialogUrlSync.js +7 -11
- package/dist/pages/list-page/useListPageData.d.ts +3 -1
- package/dist/pages/list-page/useListPageData.js +2 -1
- package/dist/pages/list-page/useListPageDialogs.d.ts +1 -0
- package/dist/pages/list-page/useListPageDialogs.js +13 -4
- package/dist/pages/list-page/useListPageToolbar.d.ts +8 -5
- package/dist/pages/list-page/useListPageToolbar.js +14 -10
- package/dist/queue/components/DispatchJobModal.js +5 -2
- package/dist/queue/components/FailureGroupsModal.js +4 -3
- package/dist/queue/components/JobConfigDialog.js +9 -1
- package/dist/queue/components/JobDetailModal.js +3 -2
- package/dist/queue/components/JobDetailPage.d.ts +8 -0
- package/dist/queue/components/JobDetailPage.js +29 -13
- package/dist/queue/components/JobEventModal.js +3 -2
- package/dist/queue/components/QueueDashboard.js +3 -1
- package/dist/queue/components/QueueTabbedDashboard.d.ts +21 -2
- package/dist/queue/components/QueueTabbedDashboard.js +3 -2
- package/dist/queue/components/QueuesTable.d.ts +3 -2
- package/dist/queue/components/QueuesTable.js +357 -286
- package/dist/queue/components/job-shared.d.ts +2 -0
- package/dist/queue/components/job-shared.js +2 -0
- package/dist/queue/components/jobs-history-modal/fullscreen-modal.js +3 -2
- package/dist/queue/components/jobs-history-modal/job-detail-modal.js +3 -2
- package/dist/queue/components/jobs-list-modal/job-row.js +3 -2
- package/dist/queue/components/labels-context.d.ts +39 -0
- package/dist/queue/components/labels-context.js +35 -0
- package/dist/queue/components/labels-provider.d.ts +11 -0
- package/dist/queue/components/labels-provider.js +35 -0
- package/dist/queue/components/module-icon.d.ts +9 -0
- package/dist/queue/components/module-icon.js +14 -0
- package/dist/queue/components/tabs/ConfiguracaoTab.d.ts +2 -1
- package/dist/queue/components/tabs/ConfiguracaoTab.js +16 -12
- package/dist/queue/components/tabs/HistoricoTab.js +4 -3
- package/dist/queue/components/tabs/TempoRealTab.d.ts +3 -2
- package/dist/queue/components/tabs/TempoRealTab.js +5 -4
- package/dist/queue/components/tabs/historico/history-job-row.js +1 -1
- package/dist/queue/lib/action-message.d.ts +3 -2
- package/dist/queue/lib/action-message.js +2 -2
- package/dist/queue/types.d.ts +3 -0
- package/dist/types/actions.d.ts +51 -14
- package/dist/types/crud.d.ts +53 -9
- package/dist/types/dialog-header.d.ts +2 -2
- package/dist/types/forms/admin-form.d.ts +8 -1
- package/dist/utils/with-scope.js +5 -3
- package/package.json +2 -2
|
@@ -8,6 +8,7 @@ import { logger } from "../../utils/logger.js";
|
|
|
8
8
|
import { toast } from "sonner";
|
|
9
9
|
import { useQueueApi } from "../api/provider.js";
|
|
10
10
|
import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
11
|
+
import { useQueueLabels } from "./labels-context.js";
|
|
11
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
13
|
function getDefaultKnownSchemaFields(t) {
|
|
13
14
|
return {
|
|
@@ -77,6 +78,7 @@ function DispatchJobModal({
|
|
|
77
78
|
const defaultKnownSchemaFields = getDefaultKnownSchemaFields(t);
|
|
78
79
|
const resolvedSchemaFields = knownSchemaFields ?? defaultKnownSchemaFields;
|
|
79
80
|
const api = useQueueApi();
|
|
81
|
+
const { jobLabel } = useQueueLabels();
|
|
80
82
|
const [dispatching, setDispatching] = useState(false);
|
|
81
83
|
const [formData, setFormData] = useState({});
|
|
82
84
|
const [jsonMode, setJsonMode] = useState(false);
|
|
@@ -93,6 +95,7 @@ function DispatchJobModal({
|
|
|
93
95
|
setJsonMode(false);
|
|
94
96
|
}
|
|
95
97
|
if (!job) return null;
|
|
98
|
+
const title = jobLabel(job.name, job.displayName);
|
|
96
99
|
const validateJson = (text) => {
|
|
97
100
|
try {
|
|
98
101
|
JSON.parse(text);
|
|
@@ -126,7 +129,7 @@ function DispatchJobModal({
|
|
|
126
129
|
queueName: job.name,
|
|
127
130
|
data
|
|
128
131
|
});
|
|
129
|
-
toast.success(t("queue.dispatch.dispatched", { name:
|
|
132
|
+
toast.success(t("queue.dispatch.dispatched", { name: title }), {
|
|
130
133
|
description: t("queue.dispatch.dispatchedId", { id: result.jobId })
|
|
131
134
|
});
|
|
132
135
|
onSuccess?.();
|
|
@@ -191,7 +194,7 @@ function DispatchJobModal({
|
|
|
191
194
|
children: job.module.toUpperCase()
|
|
192
195
|
}
|
|
193
196
|
),
|
|
194
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium", children:
|
|
197
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: title })
|
|
195
198
|
] }),
|
|
196
199
|
/* @__PURE__ */ jsxs("div", { className: "bg-muted/50 rounded-lg p-4 space-y-2", children: [
|
|
197
200
|
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
@@ -21,11 +21,12 @@ import {
|
|
|
21
21
|
import { useBulkJobAction } from "../hooks/use-queue-actions.js";
|
|
22
22
|
import { useEscapeToClose } from "../hooks/use-escape-to-close.js";
|
|
23
23
|
import { useFailureGroups } from "../hooks/use-queue-health.js";
|
|
24
|
-
import {
|
|
24
|
+
import { useQueueLabels } from "./labels-context.js";
|
|
25
25
|
import JobsListModal from "./JobsListModal.js";
|
|
26
26
|
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
27
27
|
function FailureGroupsModal({ queueName, onClose }) {
|
|
28
28
|
const t = useTelamonjsT();
|
|
29
|
+
const { jobLabel } = useQueueLabels();
|
|
29
30
|
const readOnly = useQueueReadOnly();
|
|
30
31
|
const intl = useFormatter();
|
|
31
32
|
const { data, isLoading, isError, refetch } = useFailureGroups(queueName);
|
|
@@ -70,7 +71,7 @@ function FailureGroupsModal({ queueName, onClose }) {
|
|
|
70
71
|
t("queue.failureGroupsModal.title"),
|
|
71
72
|
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground font-normal", children: [
|
|
72
73
|
" - ",
|
|
73
|
-
|
|
74
|
+
jobLabel(queueName)
|
|
74
75
|
] })
|
|
75
76
|
] }),
|
|
76
77
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: data ? /* @__PURE__ */ jsxs(Fragment2, { children: [
|
|
@@ -212,7 +213,7 @@ function FailureGroupsModal({ queueName, onClose }) {
|
|
|
212
213
|
{
|
|
213
214
|
status: showJobs ? "failed" : null,
|
|
214
215
|
queueName,
|
|
215
|
-
queueDisplayName:
|
|
216
|
+
queueDisplayName: jobLabel(queueName),
|
|
216
217
|
manualRetry: data?.manualRetry,
|
|
217
218
|
onClose: () => {
|
|
218
219
|
setShowJobs(false);
|
|
@@ -15,6 +15,7 @@ import { Label } from "../../ui/label.js";
|
|
|
15
15
|
import { Textarea } from "../../ui/textarea.js";
|
|
16
16
|
import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
17
17
|
import { useEscapeToClose } from "../hooks/use-escape-to-close.js";
|
|
18
|
+
import { INACTIVE_BADGE } from "./job-shared.js";
|
|
18
19
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
20
|
function JobConfigDialog({
|
|
20
21
|
job,
|
|
@@ -78,7 +79,14 @@ function JobConfigDialog({
|
|
|
78
79
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-4 overflow-y-auto p-6", children: [
|
|
79
80
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
80
81
|
/* @__PURE__ */ jsx(Badge, { variant: "outline", children: job.module }),
|
|
81
|
-
/* @__PURE__ */ jsx(
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
Badge,
|
|
84
|
+
{
|
|
85
|
+
variant: job.enabled ? "default" : "outline",
|
|
86
|
+
className: job.enabled ? void 0 : INACTIVE_BADGE,
|
|
87
|
+
children: job.enabled ? t("queue.jobConfigDialog.active") : t("queue.jobConfigDialog.inactive")
|
|
88
|
+
}
|
|
89
|
+
),
|
|
82
90
|
job.orphan && /* @__PURE__ */ jsx(
|
|
83
91
|
Badge,
|
|
84
92
|
{
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
import { useFormatter, useLocale } from "next-intl";
|
|
23
23
|
import { cn } from "../../utils/cn.js";
|
|
24
24
|
import { useCopyToClipboard } from "../hooks/index.js";
|
|
25
|
-
import {
|
|
25
|
+
import { useQueueLabels } from "./labels-context.js";
|
|
26
26
|
import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
27
27
|
import { useFormat } from "../../i18n/use-format.js";
|
|
28
28
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -34,6 +34,7 @@ function JobDetailModal({
|
|
|
34
34
|
onPromote
|
|
35
35
|
}) {
|
|
36
36
|
const t = useTelamonjsT();
|
|
37
|
+
const { jobLabel } = useQueueLabels();
|
|
37
38
|
const format = useFormat();
|
|
38
39
|
const intlFormat = useFormatter();
|
|
39
40
|
const locale = useLocale();
|
|
@@ -172,7 +173,7 @@ function JobDetailModal({
|
|
|
172
173
|
/* @__PURE__ */ jsx("div", { className: cn("p-2 rounded-lg", config.bgColor, config.color), children: config.icon }),
|
|
173
174
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
174
175
|
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: config.label }),
|
|
175
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children:
|
|
176
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: jobLabel(job.queueName) })
|
|
176
177
|
] })
|
|
177
178
|
] }),
|
|
178
179
|
/* @__PURE__ */ jsx(
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - Auto-fetch: when jobName is passed, fetches config+history via hooks
|
|
11
11
|
*/
|
|
12
12
|
import React from 'react';
|
|
13
|
+
import type { I18nText } from '../../i18n/msg';
|
|
13
14
|
import type { JobConfig, JobHistoryEntry } from '../types';
|
|
14
15
|
export interface JobDetailPageProps {
|
|
15
16
|
/** Job name — auto-fetches config+history via hooks */
|
|
@@ -31,6 +32,13 @@ export interface JobDetailPageProps {
|
|
|
31
32
|
onBack?: () => void;
|
|
32
33
|
/** Callback after successful update (e.g. router.refresh()) */
|
|
33
34
|
onRefresh?: () => void;
|
|
35
|
+
/** Module key → badge label — pass the same value as to `QueueTabbedDashboard`. */
|
|
36
|
+
moduleLabels?: Record<string, I18nText>;
|
|
37
|
+
/**
|
|
38
|
+
* Job label override, as on `QueueTabbedDashboard`: `undefined` falls back
|
|
39
|
+
* to the contract's `displayName`, then to the formatted job name.
|
|
40
|
+
*/
|
|
41
|
+
jobLabel?: (jobName: string) => I18nText | undefined;
|
|
34
42
|
}
|
|
35
43
|
/**
|
|
36
44
|
* Main export — auto-provider + auto-fetch
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/queue/components/JobDetailPage.tsx
|
|
4
|
-
import { useState, useMemo } from "react";
|
|
4
|
+
import { useId, useState, useMemo } from "react";
|
|
5
5
|
import {
|
|
6
6
|
ArrowLeft,
|
|
7
7
|
Calendar,
|
|
@@ -46,6 +46,9 @@ import { formatDistanceToNow } from "date-fns";
|
|
|
46
46
|
import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
47
47
|
import { useFormat } from "../../i18n/use-format.js";
|
|
48
48
|
import { useDateFnsLocale } from "../../i18n/use-date-fns-locale.js";
|
|
49
|
+
import { INACTIVE_BADGE } from "./job-shared.js";
|
|
50
|
+
import { useQueueLabels } from "./labels-context.js";
|
|
51
|
+
import { QueueLabelsProvider } from "./labels-provider.js";
|
|
49
52
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
50
53
|
function WithAutoProvider({
|
|
51
54
|
apiUrl,
|
|
@@ -130,6 +133,10 @@ function JobDetailPageUI({
|
|
|
130
133
|
const t = useTelamonjsT();
|
|
131
134
|
const format = useFormat();
|
|
132
135
|
const dateFnsLocale = useDateFnsLocale();
|
|
136
|
+
const { jobLabel, jobDescription, moduleLabel } = useQueueLabels();
|
|
137
|
+
const title = jobLabel(config.jobName);
|
|
138
|
+
const contractDescription = jobDescription(config.jobName);
|
|
139
|
+
const statusId = useId();
|
|
133
140
|
const toggleJobMutation = useToggleJobEnabled();
|
|
134
141
|
const updateJobMutation = useUpdateJobConfig();
|
|
135
142
|
const [isToggling, setIsToggling] = useState(false);
|
|
@@ -152,7 +159,7 @@ function JobDetailPageUI({
|
|
|
152
159
|
setEnabled(result.enabled);
|
|
153
160
|
toast.success(result.enabled ? t("queue.jobDetailPage.activated") : t("queue.jobDetailPage.deactivated"), {
|
|
154
161
|
description: t("queue.jobDetailPage.statusChangedSuccess", {
|
|
155
|
-
name:
|
|
162
|
+
name: title,
|
|
156
163
|
status: result.enabled ? t("queue.jobDetailPage.statusActivated") : t("queue.jobDetailPage.statusDeactivated")
|
|
157
164
|
})
|
|
158
165
|
});
|
|
@@ -196,7 +203,7 @@ function JobDetailPageUI({
|
|
|
196
203
|
case "enabled":
|
|
197
204
|
return /* @__PURE__ */ jsx(Badge, { className: "bg-green-700", children: t("queue.jobDetailPage.actionEnabled") });
|
|
198
205
|
case "disabled":
|
|
199
|
-
return /* @__PURE__ */ jsx(Badge, { variant: "
|
|
206
|
+
return /* @__PURE__ */ jsx(Badge, { variant: "outline", className: INACTIVE_BADGE, children: t("queue.jobDetailPage.actionDisabled") });
|
|
200
207
|
case "updated":
|
|
201
208
|
return /* @__PURE__ */ jsx(Badge, { variant: "outline", children: t("queue.jobDetailPage.actionUpdated") });
|
|
202
209
|
case "created":
|
|
@@ -226,10 +233,19 @@ function JobDetailPageUI({
|
|
|
226
233
|
}
|
|
227
234
|
),
|
|
228
235
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
229
|
-
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight", children:
|
|
236
|
+
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight", children: title }),
|
|
237
|
+
contractDescription && contractDescription !== title && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-1 text-sm", children: contractDescription }),
|
|
230
238
|
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
231
|
-
/* @__PURE__ */ jsx(
|
|
232
|
-
/* @__PURE__ */ jsx(Badge, { variant:
|
|
239
|
+
/* @__PURE__ */ jsx("code", { className: "bg-muted rounded px-1.5 py-0.5 font-mono text-xs", children: config.jobName }),
|
|
240
|
+
/* @__PURE__ */ jsx(Badge, { variant: "outline", children: moduleLabel(config.module) ?? config.module }),
|
|
241
|
+
/* @__PURE__ */ jsx(
|
|
242
|
+
Badge,
|
|
243
|
+
{
|
|
244
|
+
variant: enabled ? "default" : "outline",
|
|
245
|
+
className: enabled ? void 0 : INACTIVE_BADGE,
|
|
246
|
+
children: enabled ? t("queue.jobDetailPage.active") : t("queue.jobDetailPage.inactive")
|
|
247
|
+
}
|
|
248
|
+
),
|
|
233
249
|
config.orphan && /* @__PURE__ */ jsx(
|
|
234
250
|
Badge,
|
|
235
251
|
{
|
|
@@ -248,10 +264,11 @@ function JobDetailPageUI({
|
|
|
248
264
|
{
|
|
249
265
|
checked: enabled,
|
|
250
266
|
onCheckedChange: handleToggle,
|
|
251
|
-
disabled: isToggling
|
|
267
|
+
disabled: isToggling,
|
|
268
|
+
"aria-labelledby": statusId
|
|
252
269
|
}
|
|
253
270
|
),
|
|
254
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: enabled ? t("queue.jobDetailPage.active") : t("queue.jobDetailPage.inactive") })
|
|
271
|
+
/* @__PURE__ */ jsx("span", { id: statusId, className: "text-sm font-medium", children: enabled ? t("queue.jobDetailPage.active") : t("queue.jobDetailPage.inactive") })
|
|
255
272
|
] })
|
|
256
273
|
] }),
|
|
257
274
|
/* @__PURE__ */ jsxs(Card, { children: [
|
|
@@ -419,12 +436,11 @@ function JobDetailPageUI({
|
|
|
419
436
|
] });
|
|
420
437
|
}
|
|
421
438
|
function JobDetailPage(props) {
|
|
422
|
-
const { apiUrl, ...rest } = props;
|
|
439
|
+
const { apiUrl, moduleLabels, jobLabel, ...rest } = props;
|
|
423
440
|
const existingAdapter = useQueueApiOptional();
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
return /* @__PURE__ */ jsx(WithAutoProvider, { apiUrl, children: /* @__PURE__ */ jsx(JobDetailPageInner, { ...rest }) });
|
|
441
|
+
const page = /* @__PURE__ */ jsx(QueueLabelsProvider, { moduleLabels, jobLabel, children: /* @__PURE__ */ jsx(JobDetailPageInner, { ...rest }) });
|
|
442
|
+
if (existingAdapter) return page;
|
|
443
|
+
return /* @__PURE__ */ jsx(WithAutoProvider, { apiUrl, children: page });
|
|
428
444
|
}
|
|
429
445
|
export {
|
|
430
446
|
JobDetailPage as default
|
|
@@ -19,12 +19,13 @@ import {
|
|
|
19
19
|
import { useFormatter } from "next-intl";
|
|
20
20
|
import { cn } from "../../utils/cn.js";
|
|
21
21
|
import { useCopyToClipboard } from "../hooks/index.js";
|
|
22
|
-
import {
|
|
22
|
+
import { useQueueLabels } from "./labels-context.js";
|
|
23
23
|
import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
24
24
|
import { useFormat } from "../../i18n/use-format.js";
|
|
25
25
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
26
|
function JobEventModal({ event, onClose }) {
|
|
27
27
|
const t = useTelamonjsT();
|
|
28
|
+
const { jobLabel } = useQueueLabels();
|
|
28
29
|
const format = useFormat();
|
|
29
30
|
const intlFormat = useFormatter();
|
|
30
31
|
const { copied, copy: copyToClipboard, reset: resetCopied } = useCopyToClipboard();
|
|
@@ -110,7 +111,7 @@ function JobEventModal({ event, onClose }) {
|
|
|
110
111
|
/* @__PURE__ */ jsx("div", { className: cn("p-2 rounded-lg", config.bgColor, config.color), children: config.icon }),
|
|
111
112
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
112
113
|
/* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: config.label }),
|
|
113
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children:
|
|
114
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: jobLabel(event.jobName) })
|
|
114
115
|
] })
|
|
115
116
|
] }),
|
|
116
117
|
/* @__PURE__ */ jsx(
|
|
@@ -14,6 +14,7 @@ import DashboardHeader from "./DashboardHeader.js";
|
|
|
14
14
|
import RedisMetrics from "./RedisMetrics.js";
|
|
15
15
|
import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
16
16
|
import { actionDoneMessage } from "../lib/action-message.js";
|
|
17
|
+
import { useQueueLabels } from "./labels-context.js";
|
|
17
18
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
18
19
|
function QueueDashboard({
|
|
19
20
|
pollInterval = 1e4,
|
|
@@ -21,6 +22,7 @@ function QueueDashboard({
|
|
|
21
22
|
settingsHref
|
|
22
23
|
}) {
|
|
23
24
|
const t = useTelamonjsT();
|
|
25
|
+
const { jobLabel } = useQueueLabels();
|
|
24
26
|
const [historyModalOpen, setHistoryModalOpen] = useState(false);
|
|
25
27
|
const { data: stats, isLoading, refetch } = useQueueStats(pollInterval);
|
|
26
28
|
const queueActionMutation = useQueueAction();
|
|
@@ -28,7 +30,7 @@ function QueueDashboard({
|
|
|
28
30
|
try {
|
|
29
31
|
const result = await queueActionMutation.mutateAsync(action);
|
|
30
32
|
if (result.success) {
|
|
31
|
-
toast.success(actionDoneMessage(t, action, result));
|
|
33
|
+
toast.success(actionDoneMessage(t, action, result, jobLabel(action.queueName)));
|
|
32
34
|
} else {
|
|
33
35
|
toast.error(result.message || t("queue.dashboard.actionFailed"));
|
|
34
36
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { IconComponent } from '../../types/menu';
|
|
2
|
+
import type { I18nText } from '../../i18n/msg';
|
|
3
|
+
import type { QueueModuleIcon } from './module-icon';
|
|
2
4
|
type TabId = 'tempo-real' | 'configuracao' | 'redis' | 'historico';
|
|
3
5
|
export interface QueueTabbedDashboardProps {
|
|
4
6
|
/** Initial active tab */
|
|
@@ -11,8 +13,25 @@ export interface QueueTabbedDashboardProps {
|
|
|
11
13
|
description?: string;
|
|
12
14
|
/** Header icon component */
|
|
13
15
|
icon?: IconComponent;
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Module icons for the module groups of the Real-time and Configuration tabs:
|
|
18
|
+
* module key → emoji, React node or icon component (e.g. a Lucide icon)
|
|
19
|
+
*/
|
|
20
|
+
moduleIcons?: Record<string, QueueModuleIcon>;
|
|
21
|
+
/**
|
|
22
|
+
* Module group titles: module key (the job-name prefix) → label. The key
|
|
23
|
+
* order is also the group order in both tabs; modules not listed follow,
|
|
24
|
+
* alphabetically by label. Without it, groups show the raw key
|
|
25
|
+
* capitalized, sorted alphabetically.
|
|
26
|
+
*/
|
|
27
|
+
moduleLabels?: Record<string, I18nText>;
|
|
28
|
+
/**
|
|
29
|
+
* Job label override: job name → label, or `undefined` to fall back to the
|
|
30
|
+
* job contract's `displayName` (contract `label`, else its `description`),
|
|
31
|
+
* then to the name formatted by the dashboard.
|
|
32
|
+
* Used in queue rows, timeline and history rows, job details and modal titles.
|
|
33
|
+
*/
|
|
34
|
+
jobLabel?: (jobName: string) => I18nText | undefined;
|
|
16
35
|
/** Enable SSE real-time updates (default: true) */
|
|
17
36
|
enableSSE?: boolean;
|
|
18
37
|
/**
|
|
@@ -13,6 +13,7 @@ import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
|
13
13
|
import { QueueApiProvider, useQueueApiOptional } from "../api/provider.js";
|
|
14
14
|
import { createNestJSAdapter } from "../api/adapters/nestjs-adapter.js";
|
|
15
15
|
import { QueueReadOnlyContext } from "./read-only-context.js";
|
|
16
|
+
import { QueueLabelsProvider } from "./labels-provider.js";
|
|
16
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
18
|
var TempoRealTab = lazy(() => import("./tabs/TempoRealTab.js"));
|
|
18
19
|
var ConfiguracaoTab = lazy(() => import("./tabs/ConfiguracaoTab.js"));
|
|
@@ -157,9 +158,9 @@ function WithAutoProvider({
|
|
|
157
158
|
return /* @__PURE__ */ jsx(QueueApiProvider, { adapter, children });
|
|
158
159
|
}
|
|
159
160
|
function QueueTabbedDashboard(props) {
|
|
160
|
-
const { syncTabWithUrl, apiUrl, readOnly = false, ...rest } = props;
|
|
161
|
+
const { syncTabWithUrl, apiUrl, readOnly = false, moduleLabels, jobLabel, ...rest } = props;
|
|
161
162
|
const existingAdapter = useQueueApiOptional();
|
|
162
|
-
const dashboard = /* @__PURE__ */ jsx(QueueReadOnlyContext.Provider, { value: readOnly, children: syncTabWithUrl ? /* @__PURE__ */ jsx(QueueTabbedDashboardWithUrlSync, { ...rest }) : /* @__PURE__ */ jsx(QueueTabbedDashboardCore, { ...rest }) });
|
|
163
|
+
const dashboard = /* @__PURE__ */ jsx(QueueReadOnlyContext.Provider, { value: readOnly, children: /* @__PURE__ */ jsx(QueueLabelsProvider, { moduleLabels, jobLabel, children: syncTabWithUrl ? /* @__PURE__ */ jsx(QueueTabbedDashboardWithUrlSync, { ...rest }) : /* @__PURE__ */ jsx(QueueTabbedDashboardCore, { ...rest }) }) });
|
|
163
164
|
if (existingAdapter) return dashboard;
|
|
164
165
|
return /* @__PURE__ */ jsx(WithAutoProvider, { apiUrl, children: dashboard });
|
|
165
166
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import type { QueueHealth, QueueStats } from '../types';
|
|
6
|
+
import { type QueueModuleIcon } from './module-icon';
|
|
6
7
|
interface QueuesTableProps {
|
|
7
8
|
queues: QueueStats[];
|
|
8
9
|
/**
|
|
@@ -15,8 +16,8 @@ interface QueuesTableProps {
|
|
|
15
16
|
onAction?: (action: QueueAction) => Promise<void>;
|
|
16
17
|
onRefresh?: () => void;
|
|
17
18
|
className?: string;
|
|
18
|
-
/** Custom module icons for visual differentiation */
|
|
19
|
-
moduleIcons?: Record<string,
|
|
19
|
+
/** Custom module icons (emoji, node or icon component) for visual differentiation */
|
|
20
|
+
moduleIcons?: Record<string, QueueModuleIcon>;
|
|
20
21
|
}
|
|
21
22
|
export type QueueAction = {
|
|
22
23
|
type: 'pause';
|