@telamonjs/ui 1.0.3 → 1.1.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 +53 -0
- 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 +6 -1
- package/dist/components/crud/crud-field.js +1 -0
- package/dist/components/data/DataTableActions.js +89 -85
- 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 +54 -0
- package/dist/components/dialog/confirm-action-dialog.js +182 -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/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/admin-form/visibility.js +2 -0
- 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/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/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/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/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/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.js +10 -2
- package/dist/queue/components/JobEventModal.js +3 -2
- package/dist/queue/components/QueueTabbedDashboard.d.ts +25 -2
- package/dist/queue/components/QueueTabbedDashboard.js +37 -5
- package/dist/queue/components/QueuesTable.d.ts +3 -2
- package/dist/queue/components/QueuesTable.js +31 -27
- 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 +31 -0
- package/dist/queue/components/labels-context.js +34 -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 +13 -9
- package/dist/queue/components/tabs/HistoricoTab.js +4 -3
- package/dist/queue/components/tabs/TempoRealTab.d.ts +8 -3
- package/dist/queue/components/tabs/TempoRealTab.js +13 -7
- package/dist/queue/hooks/use-queue-events-timeline.d.ts +19 -1
- package/dist/queue/hooks/use-queue-events-timeline.js +23 -3
- package/dist/server/pagination/factory.js +8 -1
- package/dist/server/pagination/types.d.ts +6 -0
- package/dist/server/pagination/utils.d.ts +13 -0
- package/dist/server/pagination/utils.js +27 -16
- package/dist/types/actions.d.ts +43 -14
- package/dist/types/crud.d.ts +47 -6
- 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
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
// src/pages/list-page/useListPageToolbar.ts
|
|
4
4
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
function isFilterReset(filter, value) {
|
|
6
|
+
if (!value) return true;
|
|
7
|
+
return filter?.allValue !== void 0 ? value === filter.allValue : value === "todos" || value === "all";
|
|
8
|
+
}
|
|
9
|
+
var hasOwnDefault = (f) => Boolean(f?.defaultValue) && f.defaultValue !== (f.allValue !== void 0 ? f.allValue : f.options[0]?.value);
|
|
10
|
+
function toolbarQueryFilters(filters, configs = []) {
|
|
7
11
|
return Object.fromEntries(
|
|
8
|
-
Object.entries(filters).filter(
|
|
12
|
+
Object.entries(filters).filter(
|
|
13
|
+
([k, v]) => !isFilterReset(configs.find((f) => f.key === k), v)
|
|
14
|
+
)
|
|
9
15
|
);
|
|
10
16
|
}
|
|
11
17
|
function useListPageToolbar({
|
|
@@ -23,7 +29,7 @@ function useListPageToolbar({
|
|
|
23
29
|
const fromUrl = initialFilters?.[f.key];
|
|
24
30
|
if (fromUrl) {
|
|
25
31
|
initial[f.key] = fromUrl;
|
|
26
|
-
} else if (f
|
|
32
|
+
} else if (hasOwnDefault(f)) {
|
|
27
33
|
initial[f.key] = f.defaultValue;
|
|
28
34
|
}
|
|
29
35
|
}
|
|
@@ -58,13 +64,11 @@ function useListPageToolbar({
|
|
|
58
64
|
(key, value) => {
|
|
59
65
|
setToolbarFilters((prev) => {
|
|
60
66
|
const next = { ...prev };
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
);
|
|
64
|
-
if (isResetValue(value) && !hasDefault) {
|
|
67
|
+
const filter = list.toolbar?.filters?.find((f) => f.key === key);
|
|
68
|
+
if (isFilterReset(filter, value) && !hasOwnDefault(filter)) {
|
|
65
69
|
delete next[key];
|
|
66
70
|
} else {
|
|
67
|
-
next[key] = value || "todos";
|
|
71
|
+
next[key] = value || (filter?.allValue ?? "todos");
|
|
68
72
|
}
|
|
69
73
|
return next;
|
|
70
74
|
});
|
|
@@ -80,7 +84,7 @@ function useListPageToolbar({
|
|
|
80
84
|
};
|
|
81
85
|
}
|
|
82
86
|
export {
|
|
83
|
-
|
|
87
|
+
isFilterReset,
|
|
84
88
|
toolbarQueryFilters,
|
|
85
89
|
useListPageToolbar
|
|
86
90
|
};
|
|
@@ -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(
|
|
@@ -46,6 +46,7 @@ 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";
|
|
49
50
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
50
51
|
function WithAutoProvider({
|
|
51
52
|
apiUrl,
|
|
@@ -196,7 +197,7 @@ function JobDetailPageUI({
|
|
|
196
197
|
case "enabled":
|
|
197
198
|
return /* @__PURE__ */ jsx(Badge, { className: "bg-green-700", children: t("queue.jobDetailPage.actionEnabled") });
|
|
198
199
|
case "disabled":
|
|
199
|
-
return /* @__PURE__ */ jsx(Badge, { variant: "
|
|
200
|
+
return /* @__PURE__ */ jsx(Badge, { variant: "outline", className: INACTIVE_BADGE, children: t("queue.jobDetailPage.actionDisabled") });
|
|
200
201
|
case "updated":
|
|
201
202
|
return /* @__PURE__ */ jsx(Badge, { variant: "outline", children: t("queue.jobDetailPage.actionUpdated") });
|
|
202
203
|
case "created":
|
|
@@ -229,7 +230,14 @@ function JobDetailPageUI({
|
|
|
229
230
|
/* @__PURE__ */ jsx("h1", { className: "text-3xl font-bold tracking-tight", children: config.jobName }),
|
|
230
231
|
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex items-center gap-2", children: [
|
|
231
232
|
/* @__PURE__ */ jsx(Badge, { variant: "outline", children: config.module }),
|
|
232
|
-
/* @__PURE__ */ jsx(
|
|
233
|
+
/* @__PURE__ */ jsx(
|
|
234
|
+
Badge,
|
|
235
|
+
{
|
|
236
|
+
variant: enabled ? "default" : "outline",
|
|
237
|
+
className: enabled ? void 0 : INACTIVE_BADGE,
|
|
238
|
+
children: enabled ? t("queue.jobDetailPage.active") : t("queue.jobDetailPage.inactive")
|
|
239
|
+
}
|
|
240
|
+
),
|
|
233
241
|
config.orphan && /* @__PURE__ */ jsx(
|
|
234
242
|
Badge,
|
|
235
243
|
{
|
|
@@ -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(
|
|
@@ -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,10 +13,31 @@ 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`, then to the name formatted by the dashboard.
|
|
31
|
+
* Used in queue rows, timeline and history rows, job details and modal titles.
|
|
32
|
+
*/
|
|
33
|
+
jobLabel?: (jobName: string) => I18nText | undefined;
|
|
16
34
|
/** Enable SSE real-time updates (default: true) */
|
|
17
35
|
enableSSE?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Real-time timeline poll interval in ms while SSE is down (default: 2000).
|
|
38
|
+
* With SSE connected it polls every 30s; off the Real-time tab, not at all.
|
|
39
|
+
*/
|
|
40
|
+
pollInterval?: number;
|
|
18
41
|
/** Callback when tab changes (for URL sync) */
|
|
19
42
|
onTabChange?: (tab: string) => void;
|
|
20
43
|
/** Sync active tab with URL searchParams (default: false) */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/queue/components/QueueTabbedDashboard.tsx
|
|
4
4
|
import { useState, useMemo, lazy, Suspense, useCallback } from "react";
|
|
5
|
+
import { useQuery } from "@tanstack/react-query";
|
|
5
6
|
import { useSearchParams, useRouter, usePathname } from "next/navigation";
|
|
6
7
|
import { getSession } from "next-auth/react";
|
|
7
8
|
import { Radio, Settings, Database, History } from "lucide-react";
|
|
@@ -10,9 +11,11 @@ import { AdminHeader } from "../../layouts/shell/AdminHeader.js";
|
|
|
10
11
|
import { AdminTabs } from "../../layouts/shell/AdminTabs.js";
|
|
11
12
|
import { PageSkeleton } from "../../components/skeletons/index.js";
|
|
12
13
|
import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
13
|
-
import { QueueApiProvider, useQueueApiOptional } from "../api/provider.js";
|
|
14
|
+
import { QueueApiProvider, useQueueApi, useQueueApiOptional } from "../api/provider.js";
|
|
14
15
|
import { createNestJSAdapter } from "../api/adapters/nestjs-adapter.js";
|
|
15
16
|
import { QueueReadOnlyContext } from "./read-only-context.js";
|
|
17
|
+
import { LIB_QUERY_META } from "../../utils/query-meta.js";
|
|
18
|
+
import { QueueLabelsContext } from "./labels-context.js";
|
|
16
19
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
20
|
var TempoRealTab = lazy(() => import("./tabs/TempoRealTab.js"));
|
|
18
21
|
var ConfiguracaoTab = lazy(() => import("./tabs/ConfiguracaoTab.js"));
|
|
@@ -27,6 +30,7 @@ function QueueTabbedDashboardCore({
|
|
|
27
30
|
icon,
|
|
28
31
|
moduleIcons,
|
|
29
32
|
enableSSE = true,
|
|
33
|
+
pollInterval,
|
|
30
34
|
onTabChange
|
|
31
35
|
}) {
|
|
32
36
|
const t = useTelamonjsT();
|
|
@@ -49,7 +53,15 @@ function QueueTabbedDashboardCore({
|
|
|
49
53
|
label: t("queue.tabs.realtime"),
|
|
50
54
|
shortLabel: t("queue.tabs.realtimeShort"),
|
|
51
55
|
icon: Radio,
|
|
52
|
-
content: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(PageSkeleton.TabContent, {}), children: /* @__PURE__ */ jsx(
|
|
56
|
+
content: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(PageSkeleton.TabContent, {}), children: /* @__PURE__ */ jsx(
|
|
57
|
+
TempoRealTab,
|
|
58
|
+
{
|
|
59
|
+
enableSSE,
|
|
60
|
+
moduleIcons,
|
|
61
|
+
active: activeTab === "tempo-real",
|
|
62
|
+
pollInterval
|
|
63
|
+
}
|
|
64
|
+
) })
|
|
53
65
|
},
|
|
54
66
|
{
|
|
55
67
|
value: "configuracao",
|
|
@@ -73,7 +85,7 @@ function QueueTabbedDashboardCore({
|
|
|
73
85
|
content: /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(PageSkeleton.TabContent, {}), children: /* @__PURE__ */ jsx(HistoricoTab, {}) })
|
|
74
86
|
}
|
|
75
87
|
],
|
|
76
|
-
[moduleIcons, enableSSE, t]
|
|
88
|
+
[moduleIcons, enableSSE, pollInterval, activeTab, t]
|
|
77
89
|
);
|
|
78
90
|
const filteredTabs = useMemo(() => {
|
|
79
91
|
if (!visibleTabs) return allTabs;
|
|
@@ -123,6 +135,26 @@ function QueueTabbedDashboardWithUrlSync(props) {
|
|
|
123
135
|
}
|
|
124
136
|
);
|
|
125
137
|
}
|
|
138
|
+
var toDisplayNames = (stats) => Object.fromEntries(stats.queues.map((q) => [q.name, q.displayName]));
|
|
139
|
+
function QueueLabelsProvider({
|
|
140
|
+
moduleLabels,
|
|
141
|
+
jobLabel,
|
|
142
|
+
children
|
|
143
|
+
}) {
|
|
144
|
+
const api = useQueueApi();
|
|
145
|
+
const { data: displayNames } = useQuery({
|
|
146
|
+
meta: LIB_QUERY_META,
|
|
147
|
+
queryKey: ["queue", "stats"],
|
|
148
|
+
queryFn: () => api.getStats(),
|
|
149
|
+
select: toDisplayNames,
|
|
150
|
+
staleTime: Infinity
|
|
151
|
+
});
|
|
152
|
+
const value = useMemo(
|
|
153
|
+
() => ({ moduleLabels, jobLabel, displayNames }),
|
|
154
|
+
[moduleLabels, jobLabel, displayNames]
|
|
155
|
+
);
|
|
156
|
+
return /* @__PURE__ */ jsx(QueueLabelsContext.Provider, { value, children });
|
|
157
|
+
}
|
|
126
158
|
function WithAutoProvider({
|
|
127
159
|
apiUrl,
|
|
128
160
|
children
|
|
@@ -148,9 +180,9 @@ function WithAutoProvider({
|
|
|
148
180
|
return /* @__PURE__ */ jsx(QueueApiProvider, { adapter, children });
|
|
149
181
|
}
|
|
150
182
|
function QueueTabbedDashboard(props) {
|
|
151
|
-
const { syncTabWithUrl, apiUrl, readOnly = false, ...rest } = props;
|
|
183
|
+
const { syncTabWithUrl, apiUrl, readOnly = false, moduleLabels, jobLabel, ...rest } = props;
|
|
152
184
|
const existingAdapter = useQueueApiOptional();
|
|
153
|
-
const dashboard = /* @__PURE__ */ jsx(QueueReadOnlyContext.Provider, { value: readOnly, children: syncTabWithUrl ? /* @__PURE__ */ jsx(QueueTabbedDashboardWithUrlSync, { ...rest }) : /* @__PURE__ */ jsx(QueueTabbedDashboardCore, { ...rest }) });
|
|
185
|
+
const dashboard = /* @__PURE__ */ jsx(QueueReadOnlyContext.Provider, { value: readOnly, children: /* @__PURE__ */ jsx(QueueLabelsProvider, { moduleLabels, jobLabel, children: syncTabWithUrl ? /* @__PURE__ */ jsx(QueueTabbedDashboardWithUrlSync, { ...rest }) : /* @__PURE__ */ jsx(QueueTabbedDashboardCore, { ...rest }) }) });
|
|
154
186
|
if (existingAdapter) return dashboard;
|
|
155
187
|
return /* @__PURE__ */ jsx(WithAutoProvider, { apiUrl, children: dashboard });
|
|
156
188
|
}
|
|
@@ -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';
|
|
@@ -27,7 +27,8 @@ import {
|
|
|
27
27
|
import DispatchJobModal from "./DispatchJobModal.js";
|
|
28
28
|
import JobsListModal from "./JobsListModal.js";
|
|
29
29
|
import FailureGroupsModal from "./FailureGroupsModal.js";
|
|
30
|
-
import {
|
|
30
|
+
import { useQueueLabels } from "./labels-context.js";
|
|
31
|
+
import { ModuleIcon } from "./module-icon.js";
|
|
31
32
|
import { useQueueApi } from "../api/provider.js";
|
|
32
33
|
import { useQueueReadOnly } from "./read-only-context.js";
|
|
33
34
|
import { useTelamonjsT } from "../../i18n/use-t.js";
|
|
@@ -62,8 +63,8 @@ function relative(t, ts, now) {
|
|
|
62
63
|
const value = abs < 60 ? `${abs}s` : abs < 3600 ? `${Math.floor(abs / 60)}min` : abs < 86400 ? `${Math.floor(abs / 3600)}h` : `${Math.floor(abs / 86400)}d`;
|
|
63
64
|
return diff >= 0 ? t("queue.queuesTable.ago", { value }) : t("queue.queuesTable.in", { value });
|
|
64
65
|
}
|
|
65
|
-
function confirmTexts(t, { action, count }) {
|
|
66
|
-
const values = { name:
|
|
66
|
+
function confirmTexts(t, jobLabel, { action, count }) {
|
|
67
|
+
const values = { name: jobLabel(action.queueName), count, limit: ACTION_LIMIT };
|
|
67
68
|
switch (action.type) {
|
|
68
69
|
case "retry-all":
|
|
69
70
|
return {
|
|
@@ -114,6 +115,7 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
114
115
|
const api = useQueueApi();
|
|
115
116
|
const hasFailureGroups = "getFailureGroups" in api;
|
|
116
117
|
const icons = moduleIconsProp ?? defaultModuleIcons;
|
|
118
|
+
const { jobLabel, moduleLabel, orderModules } = useQueueLabels();
|
|
117
119
|
const [expandedModules, setExpandedModules] = useState(/* @__PURE__ */ new Set());
|
|
118
120
|
const [loadingAction, setLoadingAction] = useState(null);
|
|
119
121
|
const [selectedQueue, setSelectedQueue] = useState(null);
|
|
@@ -121,7 +123,7 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
121
123
|
const [confirmAction, setConfirmAction] = useState(null);
|
|
122
124
|
const [failuresQueue, setFailuresQueue] = useState(null);
|
|
123
125
|
const groupedQueues = useMemo(() => {
|
|
124
|
-
|
|
126
|
+
const grouped = (queues || []).reduce(
|
|
125
127
|
(acc, queue) => {
|
|
126
128
|
const queueModule = queue.module || "other";
|
|
127
129
|
if (!acc[queueModule]) acc[queueModule] = [];
|
|
@@ -130,7 +132,8 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
130
132
|
},
|
|
131
133
|
{}
|
|
132
134
|
);
|
|
133
|
-
|
|
135
|
+
return orderModules(Object.keys(grouped)).map((m) => [m, grouped[m]]);
|
|
136
|
+
}, [queues, orderModules]);
|
|
134
137
|
const toggleModule = (module) => {
|
|
135
138
|
const newExpanded = new Set(expandedModules);
|
|
136
139
|
if (newExpanded.has(module)) {
|
|
@@ -177,10 +180,11 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
177
180
|
};
|
|
178
181
|
};
|
|
179
182
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
180
|
-
/* @__PURE__ */ jsx("div", { className: cn("divide-y", className), children:
|
|
183
|
+
/* @__PURE__ */ jsx("div", { className: cn("divide-y", className), children: groupedQueues.map(([module, moduleQueues]) => {
|
|
181
184
|
const isExpanded = expandedModules.has(module);
|
|
182
185
|
const stats = getModuleStats(moduleQueues);
|
|
183
186
|
const moduleIcon = icons[module] || "\u{1F4E6}";
|
|
187
|
+
const label = moduleLabel(module);
|
|
184
188
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
185
189
|
/* @__PURE__ */ jsxs(
|
|
186
190
|
"button",
|
|
@@ -199,8 +203,8 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
199
203
|
title: t(`queue.queuesTable.${statusMeta[stats.worst].labelKey}`)
|
|
200
204
|
}
|
|
201
205
|
),
|
|
202
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children: moduleIcon }),
|
|
203
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm capitalize", children: module }),
|
|
206
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: /* @__PURE__ */ jsx(ModuleIcon, { icon: moduleIcon, className: "h-3.5 w-3.5" }) }),
|
|
207
|
+
/* @__PURE__ */ jsx("span", { className: cn("font-medium text-sm", !label && "capitalize"), children: label ?? module }),
|
|
204
208
|
/* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground", children: [
|
|
205
209
|
"\xB7 ",
|
|
206
210
|
moduleQueues.length
|
|
@@ -228,19 +232,19 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
228
232
|
]
|
|
229
233
|
}
|
|
230
234
|
),
|
|
231
|
-
isExpanded && /* @__PURE__ */ jsx("div", { className: "border-t bg-muted/10", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-sm", children: [
|
|
235
|
+
isExpanded && /* @__PURE__ */ jsx("div", { className: "border-t bg-muted/10 overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: cn("w-full table-fixed text-sm", health ? "min-w-[44rem]" : "min-w-[36rem]"), children: [
|
|
232
236
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b text-muted-foreground text-xs", children: [
|
|
233
237
|
/* @__PURE__ */ jsx("th", { className: "text-left px-4 py-1.5 font-medium", children: t("queue.queuesTable.columnQueue") }),
|
|
234
238
|
health && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
235
|
-
/* @__PURE__ */ jsx("th", { className: "text-left px-2 py-1.5 font-medium whitespace-nowrap", children: t("queue.queuesTable.columnLastSuccess") }),
|
|
239
|
+
/* @__PURE__ */ jsx("th", { className: "text-left px-2 py-1.5 font-medium whitespace-nowrap w-24", children: t("queue.queuesTable.columnLastSuccess") }),
|
|
236
240
|
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-12", children: t("queue.queuesTable.columnLastHour") })
|
|
237
241
|
] }),
|
|
238
|
-
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-
|
|
239
|
-
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-
|
|
240
|
-
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-
|
|
241
|
-
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-
|
|
242
|
-
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-
|
|
243
|
-
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-1.5 font-medium w-
|
|
242
|
+
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-14", children: t("queue.queuesTable.columnWaiting") }),
|
|
243
|
+
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-14", children: t("queue.queuesTable.columnActive") }),
|
|
244
|
+
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-14", children: t("queue.queuesTable.columnCompleted") }),
|
|
245
|
+
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-14", children: t("queue.queuesTable.columnFailed") }),
|
|
246
|
+
/* @__PURE__ */ jsx("th", { className: "text-center px-2 py-1.5 font-medium w-14", children: t("queue.queuesTable.columnDelayed") }),
|
|
247
|
+
/* @__PURE__ */ jsx("th", { className: "text-right px-3 py-1.5 font-medium w-40", children: t("queue.queuesTable.columnActions") })
|
|
244
248
|
] }) }),
|
|
245
249
|
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border/40", children: moduleQueues.map((queue) => {
|
|
246
250
|
const h = health?.get(queue.name);
|
|
@@ -258,8 +262,8 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
258
262
|
{
|
|
259
263
|
onClick: () => setSelectedQueue(queue),
|
|
260
264
|
"data-testid": `queue-detail-${queue.name}`,
|
|
261
|
-
className: "text-left group",
|
|
262
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
265
|
+
className: "text-left group max-w-full",
|
|
266
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 min-w-0", children: [
|
|
263
267
|
h && /* @__PURE__ */ jsx(
|
|
264
268
|
"span",
|
|
265
269
|
{
|
|
@@ -267,7 +271,7 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
267
271
|
className: cn("h-1.5 w-1.5 rounded-full shrink-0", meta.dot)
|
|
268
272
|
}
|
|
269
273
|
),
|
|
270
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-xs group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors", children:
|
|
274
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-xs truncate group-hover:text-blue-600 dark:group-hover:text-blue-400 transition-colors", children: jobLabel(queue.name, queue.displayName) }),
|
|
271
275
|
queue.dispatchable && /* @__PURE__ */ jsx("span", { title: t("queue.queuesTable.executableManually"), children: /* @__PURE__ */ jsx(Zap, { className: "h-3 w-3 text-blue-500" }) }),
|
|
272
276
|
queue.paused && /* @__PURE__ */ jsx("span", { className: "px-1 py-0.5 rounded text-[10px] bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300", children: t("queue.queuesTable.paused") }),
|
|
273
277
|
(h?.status === "late" || h?.status === "failing") && /* @__PURE__ */ jsx("span", { className: cn("px-1 py-0.5 rounded text-[10px]", meta.badge), children: t(`queue.queuesTable.${meta.labelKey}`) })
|
|
@@ -304,7 +308,7 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
304
308
|
onClick: () => queue.waiting > 0 && setJobsFilter({
|
|
305
309
|
status: "waiting",
|
|
306
310
|
queueName: queue.name,
|
|
307
|
-
displayName:
|
|
311
|
+
displayName: jobLabel(queue.name, queue.displayName)
|
|
308
312
|
}),
|
|
309
313
|
disabled: queue.waiting === 0,
|
|
310
314
|
"aria-label": t("queue.queuesTable.viewWaiting", { name: queue.name }),
|
|
@@ -322,7 +326,7 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
322
326
|
onClick: () => queue.active > 0 && setJobsFilter({
|
|
323
327
|
status: "active",
|
|
324
328
|
queueName: queue.name,
|
|
325
|
-
displayName:
|
|
329
|
+
displayName: jobLabel(queue.name, queue.displayName)
|
|
326
330
|
}),
|
|
327
331
|
disabled: queue.active === 0,
|
|
328
332
|
"aria-label": t("queue.queuesTable.viewActive", { name: queue.name }),
|
|
@@ -340,7 +344,7 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
340
344
|
onClick: () => queue.completed > 0 && setJobsFilter({
|
|
341
345
|
status: "completed",
|
|
342
346
|
queueName: queue.name,
|
|
343
|
-
displayName:
|
|
347
|
+
displayName: jobLabel(queue.name, queue.displayName)
|
|
344
348
|
}),
|
|
345
349
|
disabled: queue.completed === 0,
|
|
346
350
|
"aria-label": t("queue.queuesTable.viewCompleted", { name: queue.name }),
|
|
@@ -364,7 +368,7 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
364
368
|
setJobsFilter({
|
|
365
369
|
status: "failed",
|
|
366
370
|
queueName: queue.name,
|
|
367
|
-
displayName:
|
|
371
|
+
displayName: jobLabel(queue.name, queue.displayName)
|
|
368
372
|
});
|
|
369
373
|
},
|
|
370
374
|
disabled: queue.failed === 0,
|
|
@@ -390,7 +394,7 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
390
394
|
onClick: () => queue.delayed > 0 && setJobsFilter({
|
|
391
395
|
status: "delayed",
|
|
392
396
|
queueName: queue.name,
|
|
393
|
-
displayName:
|
|
397
|
+
displayName: jobLabel(queue.name, queue.displayName)
|
|
394
398
|
}),
|
|
395
399
|
disabled: queue.delayed === 0,
|
|
396
400
|
"aria-label": t("queue.queuesTable.viewDelayed", { name: queue.name }),
|
|
@@ -559,8 +563,8 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
559
563
|
onOpenChange: (open) => !open && setConfirmAction(null),
|
|
560
564
|
children: /* @__PURE__ */ jsx(AlertDialogContent, { children: confirmAction && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
561
565
|
/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
|
|
562
|
-
/* @__PURE__ */ jsx(AlertDialogTitle, { children: confirmTexts(t, confirmAction).title }),
|
|
563
|
-
/* @__PURE__ */ jsx(AlertDialogDescription, { children: confirmTexts(t, confirmAction).description })
|
|
566
|
+
/* @__PURE__ */ jsx(AlertDialogTitle, { children: confirmTexts(t, jobLabel, confirmAction).title }),
|
|
567
|
+
/* @__PURE__ */ jsx(AlertDialogDescription, { children: confirmTexts(t, jobLabel, confirmAction).description })
|
|
564
568
|
] }),
|
|
565
569
|
/* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
|
|
566
570
|
/* @__PURE__ */ jsx(AlertDialogCancel, { children: t("common.cancel") }),
|
|
@@ -569,7 +573,7 @@ var QueuesTable_default = React.memo(function QueuesTable({
|
|
|
569
573
|
{
|
|
570
574
|
onClick: handleConfirm,
|
|
571
575
|
className: confirmAction.action.type === "retry-all" ? void 0 : "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
572
|
-
children: confirmTexts(t, confirmAction).confirm
|
|
576
|
+
children: confirmTexts(t, jobLabel, confirmAction).confirm
|
|
573
577
|
}
|
|
574
578
|
)
|
|
575
579
|
] })
|
|
@@ -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 {
|
|
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:
|
|
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 {
|
|
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:
|
|
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 {
|
|
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:
|
|
52
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium text-sm truncate", 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)
|