@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.
Files changed (114) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +2 -2
  3. package/dist/components/business/CalendarWithEvents.d.ts +7 -1
  4. package/dist/components/business/CalendarWithEvents.js +8 -9
  5. package/dist/components/cards/stat-card.js +22 -3
  6. package/dist/components/charts/BarChart.d.ts +12 -1
  7. package/dist/components/charts/BarChart.js +11 -2
  8. package/dist/components/crud/crud-field.js +1 -0
  9. package/dist/components/data/DataTableActions.js +45 -77
  10. package/dist/components/data/action-access.d.ts +22 -0
  11. package/dist/components/data/action-access.js +33 -0
  12. package/dist/components/data/report-table.d.ts +3 -1
  13. package/dist/components/data/report-table.js +2 -1
  14. package/dist/components/dialog/DialogHeaderContent.js +1 -1
  15. package/dist/components/dialog/confirm-action-dialog.d.ts +86 -0
  16. package/dist/components/dialog/confirm-action-dialog.js +194 -0
  17. package/dist/components/dialog/crud-view-dialog.d.ts +7 -3
  18. package/dist/components/dialog/crud-view-dialog.js +3 -2
  19. package/dist/components/dialog/view-dialog.d.ts +9 -1
  20. package/dist/components/dialog/view-dialog.js +8 -3
  21. package/dist/components/forms/AdminForm.js +2 -1
  22. package/dist/components/forms/BaseForm.js +4 -3
  23. package/dist/components/forms/WizardForm.js +3 -2
  24. package/dist/components/forms/ZustandForm.js +5 -4
  25. package/dist/components/forms/admin-form/field-group.js +5 -4
  26. package/dist/components/forms/grid-classes.d.ts +4 -0
  27. package/dist/components/forms/grid-classes.js +40 -0
  28. package/dist/components/forms/validators/config-validator.js +2 -1
  29. package/dist/components/toolbar/TabToolbar.d.ts +6 -1
  30. package/dist/components/toolbar/TabToolbar.js +5 -3
  31. package/dist/data/InfiniteList.js +2 -4
  32. package/dist/data/MobileCard.js +4 -1
  33. package/dist/data/VirtualDataTable.js +4 -1
  34. package/dist/data/datatable/TableDesktopView.js +2 -5
  35. package/dist/data/row-click.d.ts +10 -0
  36. package/dist/data/row-click.js +11 -0
  37. package/dist/exports/data-crud.d.ts +1 -1
  38. package/dist/exports/pages-dialogs.d.ts +3 -1
  39. package/dist/exports/pages-dialogs.js +2 -0
  40. package/dist/exports/types-constants.d.ts +2 -2
  41. package/dist/exports/types-constants.js +1 -1
  42. package/dist/field-system/mask-presets.d.ts +5 -0
  43. package/dist/field-system/mask-presets.js +18 -0
  44. package/dist/field-system/renderers/advanced-renderers.js +2 -4
  45. package/dist/field-system/renderers/textarea-renderers.js +1 -1
  46. package/dist/hooks/useCrudMutations.js +28 -16
  47. package/dist/i18n/messages/en/index.d.ts +1 -0
  48. package/dist/i18n/messages/en/list.d.ts +1 -0
  49. package/dist/i18n/messages/en/list.js +1 -0
  50. package/dist/i18n/messages/en/queue.js +1 -1
  51. package/dist/i18n/messages/es/index.d.ts +1 -0
  52. package/dist/i18n/messages/es/list.d.ts +1 -0
  53. package/dist/i18n/messages/es/list.js +1 -0
  54. package/dist/i18n/messages/pt-BR/index.d.ts +8 -7
  55. package/dist/i18n/messages/pt-BR/list.d.ts +1 -0
  56. package/dist/i18n/messages/pt-BR/list.js +1 -0
  57. package/dist/i18n/messages/pt-BR/queue.d.ts +7 -7
  58. package/dist/i18n/messages/pt-BR/queue.js +7 -7
  59. package/dist/i18n/use-t.d.ts +8 -7
  60. package/dist/pages/ListPage.js +23 -14
  61. package/dist/pages/list-page/ListPageDialogs.d.ts +8 -3
  62. package/dist/pages/list-page/ListPageDialogs.js +36 -7
  63. package/dist/pages/list-page/ListPageTable.d.ts +1 -1
  64. package/dist/pages/list-page/ListPageTable.js +1 -1
  65. package/dist/pages/list-page/ListPageToolbar.js +10 -14
  66. package/dist/pages/list-page/apply-crud-permissions.d.ts +21 -0
  67. package/dist/pages/list-page/apply-crud-permissions.js +34 -0
  68. package/dist/pages/list-page/types.d.ts +21 -2
  69. package/dist/pages/list-page/useDialogUrlSync.d.ts +10 -4
  70. package/dist/pages/list-page/useDialogUrlSync.js +7 -11
  71. package/dist/pages/list-page/useListPageData.d.ts +3 -1
  72. package/dist/pages/list-page/useListPageData.js +2 -1
  73. package/dist/pages/list-page/useListPageDialogs.d.ts +1 -0
  74. package/dist/pages/list-page/useListPageDialogs.js +13 -4
  75. package/dist/pages/list-page/useListPageToolbar.d.ts +8 -5
  76. package/dist/pages/list-page/useListPageToolbar.js +14 -10
  77. package/dist/queue/components/DispatchJobModal.js +5 -2
  78. package/dist/queue/components/FailureGroupsModal.js +4 -3
  79. package/dist/queue/components/JobConfigDialog.js +9 -1
  80. package/dist/queue/components/JobDetailModal.js +3 -2
  81. package/dist/queue/components/JobDetailPage.d.ts +8 -0
  82. package/dist/queue/components/JobDetailPage.js +29 -13
  83. package/dist/queue/components/JobEventModal.js +3 -2
  84. package/dist/queue/components/QueueDashboard.js +3 -1
  85. package/dist/queue/components/QueueTabbedDashboard.d.ts +21 -2
  86. package/dist/queue/components/QueueTabbedDashboard.js +3 -2
  87. package/dist/queue/components/QueuesTable.d.ts +3 -2
  88. package/dist/queue/components/QueuesTable.js +357 -286
  89. package/dist/queue/components/job-shared.d.ts +2 -0
  90. package/dist/queue/components/job-shared.js +2 -0
  91. package/dist/queue/components/jobs-history-modal/fullscreen-modal.js +3 -2
  92. package/dist/queue/components/jobs-history-modal/job-detail-modal.js +3 -2
  93. package/dist/queue/components/jobs-list-modal/job-row.js +3 -2
  94. package/dist/queue/components/labels-context.d.ts +39 -0
  95. package/dist/queue/components/labels-context.js +35 -0
  96. package/dist/queue/components/labels-provider.d.ts +11 -0
  97. package/dist/queue/components/labels-provider.js +35 -0
  98. package/dist/queue/components/module-icon.d.ts +9 -0
  99. package/dist/queue/components/module-icon.js +14 -0
  100. package/dist/queue/components/tabs/ConfiguracaoTab.d.ts +2 -1
  101. package/dist/queue/components/tabs/ConfiguracaoTab.js +16 -12
  102. package/dist/queue/components/tabs/HistoricoTab.js +4 -3
  103. package/dist/queue/components/tabs/TempoRealTab.d.ts +3 -2
  104. package/dist/queue/components/tabs/TempoRealTab.js +5 -4
  105. package/dist/queue/components/tabs/historico/history-job-row.js +1 -1
  106. package/dist/queue/lib/action-message.d.ts +3 -2
  107. package/dist/queue/lib/action-message.js +2 -2
  108. package/dist/queue/types.d.ts +3 -0
  109. package/dist/types/actions.d.ts +51 -14
  110. package/dist/types/crud.d.ts +53 -9
  111. package/dist/types/dialog-header.d.ts +2 -2
  112. package/dist/types/forms/admin-form.d.ts +8 -1
  113. package/dist/utils/with-scope.js +5 -3
  114. package/package.json +2 -2
@@ -32,6 +32,8 @@ type T = ReturnType<typeof useTelamonjsT>;
32
32
  * URLSearchParams and the fullscreen modal's pagination arithmetic can't
33
33
  * drift apart. */
34
34
  export declare const HISTORY_PAGE_SIZE = 50;
35
+ /** Neutral look for disabled/inactive badges (the theme's `secondary` is blue). */
36
+ export declare const INACTIVE_BADGE = "bg-muted text-muted-foreground";
35
37
  /** Status → icon/label/color config. Takes `t` (from `useTelamonjsT()`) since
36
38
  * it's consumed by function components that can call hooks — module-level
37
39
  * plain functions receive `t` explicitly instead. */
@@ -4,6 +4,7 @@
4
4
  import { CheckCircle, XCircle, Clock, Activity, Timer, History } from "lucide-react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  var HISTORY_PAGE_SIZE = 50;
7
+ var INACTIVE_BADGE = "bg-muted text-muted-foreground";
7
8
  function getStatusConfig(t) {
8
9
  return {
9
10
  waiting: {
@@ -107,6 +108,7 @@ function renderValue(value) {
107
108
  }
108
109
  export {
109
110
  HISTORY_PAGE_SIZE,
111
+ INACTIVE_BADGE,
110
112
  formatDuration,
111
113
  getFilterOptions,
112
114
  getHistoricoStatusLabels,
@@ -19,7 +19,7 @@ import {
19
19
  Trash2
20
20
  } from "lucide-react";
21
21
  import { cn } from "../../../utils/cn.js";
22
- import { formatQueueName } from "../../lib/format.js";
22
+ import { useQueueLabels } from "../labels-context.js";
23
23
  import { useLocale } from "next-intl";
24
24
  import { useTelamonjsT } from "../../../i18n/use-t.js";
25
25
  import { useQueueReadOnly } from "../read-only-context.js";
@@ -55,6 +55,7 @@ function FullscreenModal({
55
55
  onOffsetChange
56
56
  }) {
57
57
  const t = useTelamonjsT();
58
+ const { jobLabel } = useQueueLabels();
58
59
  const readOnly = useQueueReadOnly();
59
60
  const format = useFormat();
60
61
  const locale = useLocale();
@@ -258,7 +259,7 @@ function FullscreenModal({
258
259
  }
259
260
  ),
260
261
  /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
261
- /* @__PURE__ */ jsx("p", { className: "font-medium text-sm truncate", children: formatQueueName(job.queueName) }),
262
+ /* @__PURE__ */ jsx("p", { className: "font-medium text-sm truncate", children: jobLabel(job.queueName) }),
262
263
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: /* @__PURE__ */ jsxs("span", { className: "font-mono", children: [
263
264
  "#",
264
265
  truncateId(job.id)
@@ -16,7 +16,7 @@ import {
16
16
  Trash2
17
17
  } from "lucide-react";
18
18
  import { cn } from "../../../utils/cn.js";
19
- import { formatQueueName } from "../../lib/format.js";
19
+ import { useQueueLabels } from "../labels-context.js";
20
20
  import { useLocale } from "next-intl";
21
21
  import { useTelamonjsT } from "../../../i18n/use-t.js";
22
22
  import { useQueueReadOnly } from "../read-only-context.js";
@@ -36,6 +36,7 @@ function JobDetailModal({
36
36
  onCopy
37
37
  }) {
38
38
  const t = useTelamonjsT();
39
+ const { jobLabel } = useQueueLabels();
39
40
  const readOnly = useQueueReadOnly();
40
41
  const format = useFormat();
41
42
  const locale = useLocale();
@@ -64,7 +65,7 @@ function JobDetailModal({
64
65
  ),
65
66
  /* @__PURE__ */ jsxs("div", { children: [
66
67
  /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: statusConfig[job.status]?.label }),
67
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: formatQueueName(job.queueName) })
68
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: jobLabel(job.queueName) })
68
69
  ] })
69
70
  ] }),
70
71
  /* @__PURE__ */ jsx(
@@ -4,7 +4,7 @@
4
4
  import { memo } from "react";
5
5
  import { CheckSquare, Square, Loader2, RefreshCw, AlertCircle } from "lucide-react";
6
6
  import { cn } from "../../../utils/cn.js";
7
- import { formatQueueName } from "../../lib/format.js";
7
+ import { useQueueLabels } from "../labels-context.js";
8
8
  import { useTelamonjsT } from "../../../i18n/use-t.js";
9
9
  import { getStatusConfig, truncateId } from "../job-shared.js";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -18,6 +18,7 @@ var JobRow = memo(function JobRow2({
18
18
  onSelectJob
19
19
  }) {
20
20
  const t = useTelamonjsT();
21
+ const { jobLabel } = useQueueLabels();
21
22
  const config = getStatusConfig(t)[status];
22
23
  return /* @__PURE__ */ jsxs(
23
24
  "div",
@@ -48,7 +49,7 @@ var JobRow = memo(function JobRow2({
48
49
  /* @__PURE__ */ jsx("div", { className: cn("p-1.5 rounded-lg flex-shrink-0", config.bgColor, config.color), children: status === "active" ? /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }) : /* @__PURE__ */ jsx("span", { className: "h-3.5 w-3.5 flex items-center justify-center", children: config.icon }) }),
49
50
  /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
50
51
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
51
- /* @__PURE__ */ jsx("span", { className: "font-medium text-sm truncate", children: formatQueueName(job.queueName) }),
52
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm truncate", title: jobLabel(job.queueName), children: jobLabel(job.queueName) }),
52
53
  /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground font-mono flex-shrink-0", children: [
53
54
  "#",
54
55
  truncateId(job.id)
@@ -0,0 +1,39 @@
1
+ import type { I18nText } from '../../i18n/msg';
2
+ /**
3
+ * Presentation labels set on `QueueTabbedDashboard` (`moduleLabels`,
4
+ * `jobLabel`) plus the job contracts' display names, read from the stats
5
+ * query by the dashboard. Module keys and job names are Redis keys (no
6
+ * accents, no spaces); these let the UI show real names instead.
7
+ * @internal not exported — the public switches are the dashboard props.
8
+ */
9
+ export interface QueueLabels {
10
+ /** Module key → group title. Its key order is also the group order. */
11
+ moduleLabels?: Record<string, I18nText>;
12
+ /** Job name → label; `undefined` falls back to the display name. */
13
+ jobLabel?: (jobName: string) => I18nText | undefined;
14
+ /** Job name → the contract's `displayName`, as served by the stats endpoint. */
15
+ displayNames?: Readonly<Record<string, string>>;
16
+ /** Job name → the contract's `description`, as served by the stats endpoint. */
17
+ descriptions?: Readonly<Record<string, string>>;
18
+ }
19
+ export declare const QueueLabelsContext: import("react").Context<QueueLabels>;
20
+ export interface QueueLabelResolvers {
21
+ /**
22
+ * The one job-name precedence of the dashboard: the app's `jobLabel` →
23
+ * the contract's `displayName` (which the API derives as contract `label`
24
+ * → `description` → raw name) → `formatQueueName`.
25
+ */
26
+ jobLabel: (jobName: string, displayName?: string) => string;
27
+ /** The contract's `description`, or `undefined` when it has none. */
28
+ jobDescription: (jobName: string) => string | undefined;
29
+ /** The `moduleLabels` entry, or `undefined` (render the raw key). */
30
+ moduleLabel: (module: string) => string | undefined;
31
+ /** `moduleLabels` key order first, then alphabetical by label. */
32
+ orderModules: (modules: string[]) => string[];
33
+ }
34
+ /**
35
+ * Label resolvers for the queue dashboard. Outside `QueueTabbedDashboard`
36
+ * (standalone components, tests) every lookup falls back to the raw key /
37
+ * `formatQueueName`.
38
+ */
39
+ export declare function useQueueLabels(): QueueLabelResolvers;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ // src/queue/components/labels-context.ts
4
+ import { createContext, useContext, useMemo } from "react";
5
+ import { useText } from "../../i18n/use-t.js";
6
+ import { formatQueueName } from "../lib/format.js";
7
+ var QueueLabelsContext = createContext({});
8
+ function useQueueLabels() {
9
+ const { moduleLabels, jobLabel, displayNames, descriptions } = useContext(QueueLabelsContext);
10
+ const text = useText();
11
+ return useMemo(() => {
12
+ const moduleLabel = (module) => text(moduleLabels?.[module]);
13
+ const rank = new Map(Object.keys(moduleLabels ?? {}).map((m, i) => [m, i]));
14
+ const sortKey = (m) => moduleLabel(m) ?? m;
15
+ return {
16
+ jobLabel: (jobName, displayName) => {
17
+ const contract = displayName ?? displayNames?.[jobName];
18
+ return text(jobLabel?.(jobName)) ?? // The backend serves the raw name when the contract has none
19
+ (contract && contract !== jobName ? contract : formatQueueName(jobName));
20
+ },
21
+ jobDescription: (jobName) => descriptions?.[jobName] || void 0,
22
+ moduleLabel,
23
+ orderModules: (modules) => [...modules].sort(
24
+ (a, b) => (
25
+ // Infinity - Infinity is NaN (falsy) → both unranked: compare labels
26
+ (rank.get(a) ?? Infinity) - (rank.get(b) ?? Infinity) || sortKey(a).localeCompare(sortKey(b))
27
+ )
28
+ )
29
+ };
30
+ }, [moduleLabels, jobLabel, displayNames, descriptions, text]);
31
+ }
32
+ export {
33
+ QueueLabelsContext,
34
+ useQueueLabels
35
+ };
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type QueueLabels } from './labels-context';
3
+ /**
4
+ * Provides `moduleLabels`/`jobLabel` plus the contracts' display names and
5
+ * descriptions. Same key as `useQueueStats`: it reads the Real-time tab's
6
+ * cache, fetches once when nothing cached it yet, and never polls on its own.
7
+ * Needs a `QueueApiProvider` above it.
8
+ */
9
+ export declare function QueueLabelsProvider({ moduleLabels, jobLabel, children, }: Pick<QueueLabels, 'moduleLabels' | 'jobLabel'> & {
10
+ children: ReactNode;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+
3
+ // src/queue/components/labels-provider.tsx
4
+ import { useMemo } from "react";
5
+ import { useQuery } from "@tanstack/react-query";
6
+ import { LIB_QUERY_META } from "../../utils/query-meta.js";
7
+ import { useQueueApi } from "../api/provider.js";
8
+ import { QueueLabelsContext } from "./labels-context.js";
9
+ import { jsx } from "react/jsx-runtime";
10
+ var toContractTexts = (stats) => ({
11
+ displayNames: Object.fromEntries(stats.queues.map((q) => [q.name, q.displayName])),
12
+ descriptions: Object.fromEntries(stats.queues.map((q) => [q.name, q.description]))
13
+ });
14
+ function QueueLabelsProvider({
15
+ moduleLabels,
16
+ jobLabel,
17
+ children
18
+ }) {
19
+ const api = useQueueApi();
20
+ const { data } = useQuery({
21
+ meta: LIB_QUERY_META,
22
+ queryKey: ["queue", "stats"],
23
+ queryFn: () => api.getStats(),
24
+ select: toContractTexts,
25
+ staleTime: Infinity
26
+ });
27
+ const value = useMemo(
28
+ () => ({ moduleLabels, jobLabel, ...data }),
29
+ [moduleLabels, jobLabel, data]
30
+ );
31
+ return /* @__PURE__ */ jsx(QueueLabelsContext.Provider, { value, children });
32
+ }
33
+ export {
34
+ QueueLabelsProvider
35
+ };
@@ -0,0 +1,9 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { IconComponent } from '../../types/menu';
3
+ /** A `moduleIcons` entry: an emoji/text, a rendered node, or an icon component (e.g. Lucide). */
4
+ export type QueueModuleIcon = ReactNode | IconComponent;
5
+ /** Renders a `moduleIcons` entry; components get the group-header icon size. */
6
+ export declare function ModuleIcon({ icon, className }: {
7
+ icon: QueueModuleIcon;
8
+ className?: string;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ // src/queue/components/module-icon.tsx
2
+ import { isValidElement } from "react";
3
+ import { Fragment, jsx } from "react/jsx-runtime";
4
+ function ModuleIcon({ icon, className }) {
5
+ const isComponent = typeof icon === "function" || typeof icon === "object" && icon !== null && "$$typeof" in icon && !isValidElement(icon);
6
+ if (isComponent) {
7
+ const Icon = icon;
8
+ return /* @__PURE__ */ jsx(Icon, { className: className ?? "h-4 w-4", "aria-hidden": "true" });
9
+ }
10
+ return /* @__PURE__ */ jsx(Fragment, { children: icon });
11
+ }
12
+ export {
13
+ ModuleIcon
14
+ };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
+ import { type QueueModuleIcon } from '../module-icon';
2
3
  interface ConfiguracaoTabProps {
3
- moduleIcons?: Record<string, string>;
4
+ moduleIcons?: Record<string, QueueModuleIcon>;
4
5
  }
5
6
  export default function ConfiguracaoTab({ moduleIcons: moduleIconsProp, }: ConfiguracaoTabProps): React.JSX.Element;
6
7
  export {};
@@ -24,9 +24,10 @@ import {
24
24
  useUpdateJobConfig
25
25
  } from "../../hooks/index.js";
26
26
  import JobConfigDialog from "../JobConfigDialog.js";
27
- import { formatQueueName } from "../../lib/format.js";
28
27
  import { useTelamonjsT } from "../../../i18n/use-t.js";
29
28
  import { useQueueReadOnly } from "../read-only-context.js";
29
+ import { useQueueLabels } from "../labels-context.js";
30
+ import { ModuleIcon } from "../module-icon.js";
30
31
  import { jsx, jsxs } from "react/jsx-runtime";
31
32
  var defaultModuleIcons = {
32
33
  alertas: "\u{1F6A8}",
@@ -56,6 +57,7 @@ function ConfiguracaoTab({
56
57
  const t = useTelamonjsT();
57
58
  const readOnly = useQueueReadOnly();
58
59
  const icons = moduleIconsProp ?? defaultModuleIcons;
60
+ const { jobLabel, moduleLabel, orderModules } = useQueueLabels();
59
61
  const { data: allJobs, isLoading } = useAllJobs();
60
62
  const [searchQuery, setSearchQuery] = useState("");
61
63
  const [expandedModules, setExpandedModules] = useState(/* @__PURE__ */ new Set());
@@ -92,8 +94,8 @@ function ConfiguracaoTab({
92
94
  return grouped;
93
95
  }, [filteredJobs]);
94
96
  const sortedModules = useMemo(
95
- () => Object.entries(jobsByModule).sort(([a], [b]) => a.localeCompare(b)),
96
- [jobsByModule]
97
+ () => orderModules(Object.keys(jobsByModule)).map((m) => [m, jobsByModule[m]]),
98
+ [jobsByModule, orderModules]
97
99
  );
98
100
  const toggleModule = (module) => {
99
101
  const newExpanded = new Set(expandedModules);
@@ -120,7 +122,7 @@ function ConfiguracaoTab({
120
122
  enabled: !currentJob.enabled
121
123
  });
122
124
  toast.success(currentJob.enabled ? t("queue.config.jobDeactivated") : t("queue.config.jobActivated"), {
123
- description: jobName
125
+ description: jobLabel(jobName)
124
126
  });
125
127
  } catch (error) {
126
128
  toast.error(t("queue.config.statusChangeError"), {
@@ -156,7 +158,7 @@ function ConfiguracaoTab({
156
158
  const handleUpdateJob = async (jobName, updates) => {
157
159
  try {
158
160
  await updateJobMutation.mutateAsync({ jobName, updates });
159
- toast.success(t("queue.config.settingsUpdated"), { description: jobName });
161
+ toast.success(t("queue.config.settingsUpdated"), { description: jobLabel(jobName) });
160
162
  return true;
161
163
  } catch (error) {
162
164
  toast.error(t("queue.config.updateError"), {
@@ -199,6 +201,7 @@ function ConfiguracaoTab({
199
201
  const isExpanded = expandedModules.has(module);
200
202
  const moduleStats = getModuleStats(moduleJobs);
201
203
  const moduleIcon = icons[module] || "\u{1F4E6}";
204
+ const label = moduleLabel(module);
202
205
  const isTogglingModule = togglingModules.has(module);
203
206
  const allEnabled = moduleJobs.every((j) => j.enabled);
204
207
  const allDisabled = moduleJobs.every((j) => !j.enabled);
@@ -212,8 +215,8 @@ function ConfiguracaoTab({
212
215
  className: "flex flex-1 items-center gap-2",
213
216
  children: [
214
217
  isExpanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "text-muted-foreground h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "text-muted-foreground h-4 w-4" }),
215
- /* @__PURE__ */ jsx("span", { className: "text-base", children: moduleIcon }),
216
- /* @__PURE__ */ jsx("span", { className: "text-sm font-medium capitalize", children: module }),
218
+ /* @__PURE__ */ jsx("span", { className: "text-base", children: /* @__PURE__ */ jsx(ModuleIcon, { icon: moduleIcon }) }),
219
+ /* @__PURE__ */ jsx("span", { className: cn("text-sm font-medium", !label && "capitalize"), children: label ?? module }),
217
220
  /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground text-xs", children: [
218
221
  "\xB7 ",
219
222
  moduleJobs.length
@@ -241,7 +244,7 @@ function ConfiguracaoTab({
241
244
  disabled: isTogglingModule,
242
245
  className: "hover:bg-muted rounded p-1 transition-colors",
243
246
  title: t("queue.config.activateAll"),
244
- "aria-label": t("queue.config.activateAllModule", { module }),
247
+ "aria-label": t("queue.config.activateAllModule", { module: label ?? module }),
245
248
  children: /* @__PURE__ */ jsx(
246
249
  Play,
247
250
  {
@@ -260,7 +263,7 @@ function ConfiguracaoTab({
260
263
  disabled: isTogglingModule,
261
264
  className: "hover:bg-muted rounded p-1 transition-colors",
262
265
  title: t("queue.config.deactivateAll"),
263
- "aria-label": t("queue.config.deactivateAllModule", { module }),
266
+ "aria-label": t("queue.config.deactivateAllModule", { module: label ?? module }),
264
267
  children: /* @__PURE__ */ jsx(
265
268
  Pause,
266
269
  {
@@ -277,6 +280,7 @@ function ConfiguracaoTab({
277
280
  ] }),
278
281
  isExpanded && /* @__PURE__ */ jsx("div", { className: "bg-muted/70 dark:bg-muted/60 border-t", children: moduleJobs.sort((a, b) => a.jobName.localeCompare(b.jobName)).map((job) => {
279
282
  const isToggling = togglingJobs.has(job.jobName);
283
+ const title = jobLabel(job.jobName);
280
284
  return /* @__PURE__ */ jsxs(
281
285
  "div",
282
286
  {
@@ -301,18 +305,18 @@ function ConfiguracaoTab({
301
305
  ),
302
306
  /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
303
307
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
304
- /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium", children: formatQueueName(job.jobName) }),
308
+ /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium", title, children: title }),
305
309
  job.orphan && /* @__PURE__ */ jsx(
306
310
  Badge,
307
311
  {
308
312
  variant: "outline",
309
- className: "border-yellow-300 px-1 py-0 text-[10px] text-yellow-600",
313
+ className: "shrink-0 border-yellow-300 px-1 py-0 text-[10px] text-yellow-600",
310
314
  title: t("queue.config.orphanHint"),
311
315
  children: t("queue.config.orphan")
312
316
  }
313
317
  )
314
318
  ] }),
315
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground truncate text-xs", children: job.description || job.jobName })
319
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground truncate text-xs", children: job.description && job.description !== title ? job.description : job.jobName })
316
320
  ] })
317
321
  ] }),
318
322
  /* @__PURE__ */ jsxs("div", { className: "ml-4 flex shrink-0 items-center gap-3", children: [
@@ -27,7 +27,7 @@ import { subHours } from "date-fns";
27
27
  import { useQueueApi } from "../../api/provider.js";
28
28
  import { useQueueHistoryAll, useCopyToClipboard } from "../../hooks/index.js";
29
29
  import { TabToolbar } from "../../../components/toolbar/TabToolbar.js";
30
- import { formatQueueName } from "../../lib/format.js";
30
+ import { useQueueLabels } from "../labels-context.js";
31
31
  import { useLocale } from "next-intl";
32
32
  import { useTelamonjsT } from "../../../i18n/use-t.js";
33
33
  import { useQueueReadOnly } from "../read-only-context.js";
@@ -44,6 +44,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
44
44
  function HistoricoTab() {
45
45
  "use no memo";
46
46
  const t = useTelamonjsT();
47
+ const { jobLabel } = useQueueLabels();
47
48
  const readOnly = useQueueReadOnly();
48
49
  const format = useFormat();
49
50
  const locale = useLocale();
@@ -290,7 +291,7 @@ function HistoricoTab() {
290
291
  onClick: () => setSelectedJob(job),
291
292
  formatDate,
292
293
  formatDuration: formatJobDuration,
293
- formatQueueName,
294
+ formatQueueName: jobLabel,
294
295
  truncateId
295
296
  }
296
297
  )
@@ -354,7 +355,7 @@ function HistoricoTab() {
354
355
  onRemove: handleRemove,
355
356
  formatDate,
356
357
  formatDuration: formatJobDuration,
357
- formatQueueName,
358
+ formatQueueName: jobLabel,
358
359
  copyToClipboard,
359
360
  copied,
360
361
  renderValue
@@ -1,9 +1,10 @@
1
1
  import React from 'react';
2
+ import type { QueueModuleIcon } from '../module-icon';
2
3
  interface TempoRealTabProps {
3
4
  /** Enable SSE real-time updates (default: true) */
4
5
  enableSSE?: boolean;
5
- /** Module icons for the queues table (module name → emoji) */
6
- moduleIcons?: Record<string, string>;
6
+ /** Module icons for the queues table (module name → emoji, node or icon component) */
7
+ moduleIcons?: Record<string, QueueModuleIcon>;
7
8
  /** This tab is the visible one — visited tabs stay mounted (default: true) */
8
9
  active?: boolean;
9
10
  /** Timeline poll interval in ms while SSE is down (default: 2000) */
@@ -38,7 +38,7 @@ import { Badge } from "../../../ui/badge.js";
38
38
  import JobStatsCards from "../JobStatsCards.js";
39
39
  import QueuesTable from "../QueuesTable.js";
40
40
  import { TabToolbar } from "../../../components/toolbar/TabToolbar.js";
41
- import { formatQueueName } from "../../lib/format.js";
41
+ import { useQueueLabels } from "../labels-context.js";
42
42
  import { useTelamonjsT } from "../../../i18n/use-t.js";
43
43
  import { useFormat, useTickingNow } from "../../../i18n/use-format.js";
44
44
  import { actionDoneMessage } from "../../lib/action-message.js";
@@ -217,7 +217,7 @@ var JobRow = React.memo(({ job, isSelected, onClick }) => {
217
217
  const duration = formatDuration(job.processedOn, job.finishedOn, locale);
218
218
  const relativeTs = job.finishedOn || job.processedOn || job.timestamp;
219
219
  const timeAgo = relativeTs ? format.relative(relativeTs, now) : "\u2014";
220
- const queueDisplay = formatQueueName(job.queueName);
220
+ const queueDisplay = useQueueLabels().jobLabel(job.queueName);
221
221
  const StatusIcon = job.status === "active" ? Clock : job.status === "completed" ? CheckCircle : AlertCircle;
222
222
  return /* @__PURE__ */ jsxs(
223
223
  "div",
@@ -397,6 +397,7 @@ function TempoRealTab({
397
397
  }) {
398
398
  "use no memo";
399
399
  const t = useTelamonjsT();
400
+ const { jobLabel } = useQueueLabels();
400
401
  const maxItems = 50;
401
402
  const [selectedJobId, setSelectedJobId] = useState(null);
402
403
  const [searchTerm, setSearchTerm] = useState("");
@@ -420,7 +421,7 @@ function TempoRealTab({
420
421
  try {
421
422
  const result = await queueActionMutation.mutateAsync(action);
422
423
  if (result.success) {
423
- toast.success(actionDoneMessage(t, action, result));
424
+ toast.success(actionDoneMessage(t, action, result, jobLabel(action.queueName)));
424
425
  } else {
425
426
  toast.error(result.message || t("queue.dashboard.actionFailed"));
426
427
  }
@@ -431,7 +432,7 @@ function TempoRealTab({
431
432
  });
432
433
  }
433
434
  },
434
- [queueActionMutation, t]
435
+ [queueActionMutation, t, jobLabel]
435
436
  );
436
437
  const allJobs = useMemo(() => {
437
438
  if (!timelineData?.jobs) return [];
@@ -38,7 +38,7 @@ var HistoryJobRow = React.memo(function HistoryJobRow2({
38
38
  ),
39
39
  children: [
40
40
  /* @__PURE__ */ jsx("span", { className: cn("shrink-0", config?.color), children: config?.icon }),
41
- /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: formatQueueName(job.queueName) }),
41
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-medium", title: formatQueueName(job.queueName), children: formatQueueName(job.queueName) }),
42
42
  /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground shrink-0 font-mono text-[11px]", children: [
43
43
  "#",
44
44
  truncateId(job.id, 8)
@@ -3,6 +3,7 @@ import type { ActionResponse, QueueActionParams } from '../api/types';
3
3
  /**
4
4
  * Success toast for a queue action, in the active locale. The backend's
5
5
  * `message` is plain English (`"Queue x: 1 waiting jobs removed"`), so it is
6
- * not shown; `removed` (drain/clean) feeds the plural.
6
+ * not shown; `removed` (drain/clean) feeds the plural. `queueLabel` is the
7
+ * name already resolved by `useQueueLabels().jobLabel` — never the raw key.
7
8
  */
8
- export declare function actionDoneMessage(t: ReturnType<typeof useTelamonjsT>, action: QueueActionParams, result: ActionResponse): string;
9
+ export declare function actionDoneMessage(t: ReturnType<typeof useTelamonjsT>, action: QueueActionParams, result: ActionResponse, queueLabel: string): string;
@@ -6,9 +6,9 @@ var DONE_KEY = {
6
6
  drain: "drain",
7
7
  "retry-all": "retryAll"
8
8
  };
9
- function actionDoneMessage(t, action, result) {
9
+ function actionDoneMessage(t, action, result, queueLabel) {
10
10
  return t(`queue.dashboard.actionDone.${DONE_KEY[action.type]}`, {
11
- queue: action.queueName,
11
+ queue: queueLabel,
12
12
  count: result.removed ?? 0
13
13
  });
14
14
  }
@@ -6,6 +6,7 @@
6
6
  export type JobState = 'waiting' | 'active' | 'delayed' | 'completed' | 'failed';
7
7
  export interface QueueStats {
8
8
  name: string;
9
+ /** Served by the API: contract `label` → contract `description` → `name`. */
9
10
  displayName: string;
10
11
  module: string;
11
12
  description: string;
@@ -52,6 +53,7 @@ export type QueueHealthStatus = 'ok' | 'late' | 'failing' | 'paused';
52
53
  /** Per-queue health — mirrors `QueueHealthEntry` from `@telamonjs/queue`. */
53
54
  export interface QueueHealth {
54
55
  name: string;
56
+ /** Served by the API: contract `label` → contract `description` → `name`. */
55
57
  displayName: string;
56
58
  module: string;
57
59
  dispatchable: boolean;
@@ -189,6 +191,7 @@ export interface TimelineData {
189
191
  }
190
192
  export interface DispatchableJob {
191
193
  name: string;
194
+ /** Served by the API: contract `label` → contract `description` → `name`. */
192
195
  displayName: string;
193
196
  module: string;
194
197
  description: string;
@@ -28,15 +28,42 @@ export interface ConfirmDialogConfig<TData = any> {
28
28
  cancelText?: I18nText;
29
29
  /** Dialog variant */
30
30
  variant?: 'default' | 'destructive';
31
- /** Optional input fields in the dialog */
32
- inputs?: Array<{
33
- name: string;
34
- label: string;
35
- type: 'text' | 'textarea' | 'select';
36
- required?: boolean;
37
- options?: string[];
38
- defaultValue?: string;
39
- }>;
31
+ /**
32
+ * Fields asked before confirming (a reason, a note…). Their values reach the
33
+ * action as the second argument of `handler`/`onClick`: `(row, { inputs })`.
34
+ */
35
+ inputs?: ConfirmDialogInput[];
36
+ }
37
+ /**
38
+ * A field of a confirmation dialog (`ConfirmDialogConfig.inputs`,
39
+ * `ConfirmActionDialog`'s `inputs`)
40
+ */
41
+ export interface ConfirmDialogInput {
42
+ /** Key of the value in `inputs` */
43
+ name: string;
44
+ label: I18nText;
45
+ /** `date` is the native date input; its value is `YYYY-MM-DD` (`''` when empty) */
46
+ type: 'text' | 'textarea' | 'select' | 'date';
47
+ /** Confirming is blocked while it is empty */
48
+ required?: boolean;
49
+ /** Choices of a `select` (value = label) */
50
+ options?: string[];
51
+ defaultValue?: string;
52
+ /**
53
+ * Custom rule beyond `required`: return a message to mark the field invalid
54
+ * and block the confirm, `undefined` when valid. Runs (pure, on every
55
+ * render) from the first confirm attempt on, also on empty optional fields,
56
+ * with all the values for cross-field rules. `required` is checked first.
57
+ */
58
+ validate?: (value: string, values: Record<string, string>) => I18nText | undefined;
59
+ }
60
+ /**
61
+ * Second argument of an action's `handler`/`onClick`, passed when its
62
+ * `confirmDialog` declares `inputs`
63
+ */
64
+ export interface ActionContext {
65
+ /** Values of `confirmDialog.inputs`, by `name` */
66
+ inputs: Record<string, string>;
40
67
  }
41
68
  /**
42
69
  * Tooltip configuration for actions
@@ -69,17 +96,20 @@ export interface ActionConfig<TData = any> {
69
96
  tooltip?: I18nText | TooltipConfig | ((row: TData) => string);
70
97
  /** Navigation URL */
71
98
  href?: string | ((row: TData) => string);
72
- /** Direct click handler */
73
- onClick?: (row: TData) => void | Promise<void>;
74
- /** Async handler with result */
75
- handler?: (row: TData) => Promise<unknown>;
99
+ /** Direct click handler (`ctx` only when `confirmDialog.inputs` is set) */
100
+ onClick?: (row: TData, ctx?: ActionContext) => void | Promise<void>;
101
+ /** Async handler with result (`ctx` only when `confirmDialog.inputs` is set) */
102
+ handler?: (row: TData, ctx?: ActionContext) => Promise<unknown>;
76
103
  /** Confirmation dialog configuration */
77
104
  confirmDialog?: boolean | ConfirmDialogConfig<TData>;
78
105
  /** Called on successful action completion */
79
106
  onSuccess?: (row: TData, result?: unknown) => void;
80
107
  /** Called on action error */
81
108
  onError?: (error: Error, row: TData) => void;
82
- /** Required permission(s) to show this action */
109
+ /**
110
+ * Required permission(s) to show this action (any of them). Checked with
111
+ * `DataTableActionsConfig.can` when set, else against `userPermissions`.
112
+ */
83
113
  permission?: string | string[];
84
114
  /** Success message to display (I18nText) */
85
115
  successMessage?: I18nText | ((row: TData) => I18nText);
@@ -136,4 +166,11 @@ export interface DataTableActionsConfig<TData = any> {
136
166
  onAfterAction?: (actionId: string, row: TData, result?: unknown) => void | Promise<void>;
137
167
  /** Current user permissions for permission checking */
138
168
  userPermissions?: string[];
169
+ /**
170
+ * Permission checker. When set it decides every `permission` instead of the
171
+ * exact lookup in `userPermissions`, so bypass roles and wildcards work, e.g.
172
+ * `can: perm => checker.can(user, perm)` with `createPermissionChecker` from
173
+ * `@telamonjs/permissions`.
174
+ */
175
+ can?: (permission: string) => boolean;
139
176
  }