@open-mercato/scheduler 0.6.4-develop.4305.1.efaf0ebab1 → 0.6.4-develop.4310.1.0be8773280

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.
@@ -10,7 +10,7 @@ import { Switch } from "@open-mercato/ui/primitives/switch";
10
10
  import { Label } from "@open-mercato/ui/primitives/label";
11
11
  import { DataTable } from "@open-mercato/ui/backend/DataTable";
12
12
  import { apiCallOrThrow } from "@open-mercato/ui/backend/utils/apiCall";
13
- import { LoadingMessage, ErrorMessage } from "@open-mercato/ui/backend/detail";
13
+ import { LoadingMessage, ErrorMessage, RecordNotFoundState } from "@open-mercato/ui/backend/detail";
14
14
  import { JobLogsModal } from "../../../../components/JobLogsModal.js";
15
15
  import { ExecutionDetailsDialog } from "../../../../components/ExecutionDetailsDialog.js";
16
16
  import { flash } from "@open-mercato/ui/backend/FlashMessages";
@@ -27,6 +27,7 @@ function ScheduleDetailPage() {
27
27
  const [runs, setRuns] = React.useState([]);
28
28
  const [loading, setLoading] = React.useState(true);
29
29
  const [error, setError] = React.useState(null);
30
+ const [isNotFound, setIsNotFound] = React.useState(false);
30
31
  const [logsModalOpen, setLogsModalOpen] = React.useState(false);
31
32
  const [detailsModalOpen, setDetailsModalOpen] = React.useState(false);
32
33
  const [selectedRun, setSelectedRun] = React.useState(null);
@@ -42,7 +43,9 @@ function ScheduleDetailPage() {
42
43
  );
43
44
  const schedules = listData?.items || [];
44
45
  if (schedules.length === 0) {
45
- throw new Error(t("scheduler.error.not_found", "Schedule not found"));
46
+ setIsNotFound(true);
47
+ setLoading(false);
48
+ return;
46
49
  }
47
50
  setSchedule(schedules[0]);
48
51
  if (isAsyncStrategy) {
@@ -173,9 +176,25 @@ function ScheduleDetailPage() {
173
176
  }
174
177
  }
175
178
  ];
176
- if (loading) return /* @__PURE__ */ jsx(LoadingMessage, { label: t("scheduler.loading", "Loading schedule...") });
177
- if (error) return /* @__PURE__ */ jsx(ErrorMessage, { label: t("scheduler.details.error", "Error"), description: error });
178
- if (!schedule) return /* @__PURE__ */ jsx(ErrorMessage, { label: t("scheduler.details.not_found", "Not Found"), description: t("scheduler.error.not_found", "Schedule not found") });
179
+ if (loading) {
180
+ return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(LoadingMessage, { label: t("scheduler.loading", "Loading schedule...") }) }) });
181
+ }
182
+ if (isNotFound) {
183
+ return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(
184
+ RecordNotFoundState,
185
+ {
186
+ label: t("scheduler.error.not_found", "Schedule not found"),
187
+ backHref: "/backend/config/scheduled-jobs",
188
+ backLabel: t("scheduler.nav.backToList", "Back to scheduled jobs")
189
+ }
190
+ ) }) });
191
+ }
192
+ if (error) {
193
+ return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(ErrorMessage, { label: t("scheduler.details.error", "Error"), description: error }) }) });
194
+ }
195
+ if (!schedule) {
196
+ return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsx(PageBody, { children: /* @__PURE__ */ jsx(ErrorMessage, { label: t("scheduler.details.not_found", "Not Found"), description: t("scheduler.error.not_found", "Schedule not found") }) }) });
197
+ }
179
198
  return /* @__PURE__ */ jsxs(Page, { children: [
180
199
  ConfirmDialogElement,
181
200
  /* @__PURE__ */ jsx(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../src/modules/scheduler/backend/config/scheduled-jobs/%5Bid%5D/page.tsx"],
4
- "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useParams, useRouter } from 'next/navigation'\nimport { Page, PageBody, PageHeader } from '@open-mercato/ui/backend/Page'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Card, CardContent, CardHeader, CardTitle } from '@open-mercato/ui/primitives/card'\nimport { Switch } from '@open-mercato/ui/primitives/switch'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport { apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'\nimport { JobLogsModal } from '../../../../components/JobLogsModal'\nimport { ExecutionDetailsDialog } from '../../../../components/ExecutionDetailsDialog'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport { formatDistanceToNow } from 'date-fns'\n\ntype ScheduleDetail = {\n id: string\n name: string\n description?: string\n scopeType: 'system' | 'organization' | 'tenant'\n scheduleType: 'cron' | 'interval'\n scheduleValue: string\n timezone: string\n targetType: 'queue' | 'command'\n targetQueue?: string\n targetCommand?: string\n targetPayload?: Record<string, unknown>\n requireFeature?: string\n isEnabled: boolean\n lastRunAt?: string\n nextRunAt?: string\n sourceType: 'user' | 'module'\n sourceModule?: string\n}\n\ntype ExecutionRun = {\n id: string\n startedAt: string\n finishedAt?: string\n status: 'running' | 'completed' | 'failed' | 'skipped'\n triggerType: 'scheduled' | 'manual'\n queueJobId?: string\n queueName?: string\n errorMessage?: string\n errorStack?: string\n durationMs?: number\n}\n\nexport default function ScheduleDetailPage() {\n const params = useParams()\n const router = useRouter()\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n // Extract schedule ID from either params.id or params.slug\n // When using catch-all routes, the ID is in params.slug[2]\n const scheduleId = params.id \n ? (Array.isArray(params.id) ? params.id[0] : params.id)\n : (Array.isArray(params.slug) && params.slug.length >= 3 ? params.slug[2] : undefined)\n\n const [schedule, setSchedule] = React.useState<ScheduleDetail | null>(null)\n const [runs, setRuns] = React.useState<ExecutionRun[]>([])\n const [loading, setLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [logsModalOpen, setLogsModalOpen] = React.useState(false)\n const [detailsModalOpen, setDetailsModalOpen] = React.useState(false)\n const [selectedRun, setSelectedRun] = React.useState<ExecutionRun | null>(null)\n const [triggering, setTriggering] = React.useState(false)\n const [toggling, setToggling] = React.useState(false)\n\n const queueStrategy = process.env.NEXT_PUBLIC_QUEUE_STRATEGY || 'local'\n const isAsyncStrategy = queueStrategy === 'async'\n\n const fetchScheduleAndRuns = React.useCallback(async () => {\n if (!scheduleId) return\n try {\n // Fetch schedule details via list API with ID filter\n const { result: listData } = await apiCallOrThrow(\n `/api/scheduler/jobs?id=${scheduleId}&page=1&pageSize=1`\n )\n const schedules = (listData as { items?: unknown[] })?.items || []\n if (schedules.length === 0) {\n throw new Error(t('scheduler.error.not_found', 'Schedule not found'))\n }\n setSchedule(schedules[0] as ScheduleDetail)\n\n // Fetch recent runs \u2014 only available with async strategy\n if (isAsyncStrategy) {\n try {\n const { result: runsData } = await apiCallOrThrow(\n `/api/scheduler/jobs/${scheduleId}/executions?pageSize=10`\n )\n setRuns((runsData as { items?: ExecutionRun[] }).items || [])\n } catch {\n setRuns([])\n }\n }\n } catch (err: unknown) {\n setError(err instanceof Error ? err.message : t('scheduler.error.load_failed', 'Failed to load schedule'))\n } finally {\n setLoading(false)\n }\n }, [scheduleId, isAsyncStrategy])\n\n React.useEffect(() => {\n if (scheduleId) {\n fetchScheduleAndRuns()\n }\n }, [scheduleId, fetchScheduleAndRuns])\n\n const handleTriggerNow = async () => {\n if (!scheduleId || !schedule) return\n \n // Confirm before triggering\n const targetTypeLabel =\n schedule.targetType === 'queue'\n ? t('scheduler.target.queue', 'queue job')\n : t('scheduler.target.command', 'command')\n const triggerConfirmText = t(\n 'scheduler.confirm.trigger',\n 'Are you sure you want to trigger \"{name}\" now?\\n\\nThis will execute the {targetType} immediately.',\n { name: schedule.name, targetType: targetTypeLabel }\n )\n const confirmed = await confirm({\n title: t('scheduler.action.trigger', 'Trigger Now'),\n text: triggerConfirmText,\n })\n \n if (!confirmed) return\n \n setTriggering(true)\n try {\n await apiCallOrThrow(`/api/scheduler/trigger`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ id: scheduleId }),\n })\n flash(t('scheduler.success.triggered', 'Schedule triggered successfully'), 'success')\n await fetchScheduleAndRuns()\n } catch (err: unknown) {\n flash(err instanceof Error ? err.message : t('scheduler.error.trigger_failed', 'Failed to trigger schedule'), 'error')\n } finally {\n setTriggering(false)\n }\n }\n\n const handleToggleEnabled = async (enabled: boolean) => {\n if (!schedule || !scheduleId) return\n setToggling(true)\n try {\n await apiCallOrThrow(`/api/scheduler/jobs`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ id: scheduleId, isEnabled: enabled }),\n })\n flash(enabled ? t('scheduler.success.enabled', 'Schedule enabled') : t('scheduler.success.disabled', 'Schedule disabled'), 'success')\n await fetchScheduleAndRuns()\n } catch (err: unknown) {\n flash(err instanceof Error ? err.message : t('scheduler.error.update_failed', 'Failed to update schedule'), 'error')\n } finally {\n setToggling(false)\n }\n }\n\n const handleViewLogs = (run: ExecutionRun) => {\n setSelectedRun(run)\n setLogsModalOpen(true)\n }\n\n const handleViewDetails = (run: ExecutionRun) => {\n setSelectedRun(run)\n setDetailsModalOpen(true)\n }\n\n const runsColumns: ColumnDef<ExecutionRun>[] = [\n {\n accessorKey: 'startedAt',\n header: t('scheduler.execution.started', 'Started'),\n cell: ({ row }) => (\n <div>\n <div className=\"text-sm\">{new Date(row.original.startedAt).toLocaleString()}</div>\n <div className=\"text-xs text-muted-foreground\">\n {formatDistanceToNow(new Date(row.original.startedAt), { addSuffix: true })}\n </div>\n </div>\n ),\n },\n {\n accessorKey: 'status',\n header: t('scheduler.execution.status', 'Status'),\n cell: ({ row }) => (\n <Badge variant={\n row.original.status === 'completed' ? 'default' :\n row.original.status === 'failed' ? 'destructive' :\n row.original.status === 'skipped' ? 'secondary' : 'outline'\n }>\n {t(`scheduler.execution_status.${row.original.status}`, row.original.status)}\n </Badge>\n ),\n },\n {\n accessorKey: 'durationMs',\n header: t('scheduler.execution.duration', 'Duration'),\n cell: ({ row }) => \n row.original.durationMs \n ? `${(row.original.durationMs / 1000).toFixed(2)}s` \n : '\u2014',\n },\n {\n accessorKey: 'triggerType',\n header: t('scheduler.execution.trigger', 'Trigger'),\n cell: ({ row }) => t(`scheduler.trigger_type.${row.original.triggerType}`, row.original.triggerType),\n },\n {\n id: 'actions',\n header: t('scheduler.execution.actions', 'Actions'),\n cell: ({ row }) => {\n const canViewLogs = isAsyncStrategy && \n row.original.queueJobId && \n row.original.queueName\n const hasDetails = row.original.errorMessage || row.original.finishedAt\n\n return (\n <div className=\"flex items-center gap-2\">\n {hasDetails && (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => handleViewDetails(row.original)}\n >\n {t('scheduler.execution.view_details', 'View Details')}\n </Button>\n )}\n {canViewLogs && (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => handleViewLogs(row.original)}\n >\n {t('scheduler.execution.view_logs', 'View Logs')}\n </Button>\n )}\n {!hasDetails && !canViewLogs && (\n <span className=\"text-sm text-muted-foreground\">\u2014</span>\n )}\n </div>\n )\n },\n },\n ]\n\n if (loading) return <LoadingMessage label={t('scheduler.loading', 'Loading schedule...')} />\n if (error) return <ErrorMessage label={t('scheduler.details.error', 'Error')} description={error} />\n if (!schedule) return <ErrorMessage label={t('scheduler.details.not_found', 'Not Found')} description={t('scheduler.error.not_found', 'Schedule not found')} />\n\n return (\n <Page>\n {ConfirmDialogElement}\n <PageHeader\n title={schedule.name}\n description={schedule.description}\n actions={\n <div className=\"flex items-center gap-4\">\n <div className=\"flex items-center gap-2\">\n <Label htmlFor=\"schedule-enabled\" className=\"text-sm font-medium cursor-pointer\">\n {schedule.isEnabled ? t('scheduler.status.enabled', 'Enabled') : t('scheduler.status.disabled', 'Disabled')}\n </Label>\n <Switch\n id=\"schedule-enabled\"\n checked={schedule.isEnabled}\n onCheckedChange={handleToggleEnabled}\n disabled={toggling}\n />\n </div>\n <Button\n variant=\"outline\"\n onClick={handleTriggerNow}\n disabled={triggering || !schedule.isEnabled}\n >\n {triggering ? t('scheduler.details.triggering', 'Triggering...') : t('scheduler.action.trigger', 'Trigger Now')}\n </Button>\n <Button onClick={() => router.push(`/backend/config/scheduled-jobs/${scheduleId}/edit`)}>\n {t('scheduler.action.edit', 'Edit')}\n </Button>\n </div>\n }\n />\n\n <PageBody>\n <div className=\"space-y-6\">\n {/* Configuration Card */}\n <Card>\n <CardHeader>\n <CardTitle>{t('scheduler.details.configuration', 'Configuration')}</CardTitle>\n </CardHeader>\n <CardContent>\n <dl className=\"grid grid-cols-2 gap-4\">\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.status', 'Status')}</dt>\n <dd className=\"mt-1\">\n <Badge variant={schedule.isEnabled ? 'default' : 'secondary'}>\n {schedule.isEnabled ? t('scheduler.status.enabled', 'Enabled') : t('scheduler.status.disabled', 'Disabled')}\n </Badge>\n </dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.schedule', 'Schedule')}</dt>\n <dd className=\"text-sm mt-1\">\n {schedule.scheduleValue} \n <span className=\"text-muted-foreground ml-1\">({schedule.scheduleType})</span>\n </dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.timezone', 'Timezone')}</dt>\n <dd className=\"text-sm mt-1\">{schedule.timezone}</dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.target', 'Target')}</dt>\n <dd className=\"text-sm mt-1\">\n <Badge variant=\"outline\">\n {schedule.targetType === 'queue' ? schedule.targetQueue : schedule.targetCommand}\n </Badge>\n </dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.details.scope', 'Scope')}</dt>\n <dd className=\"text-sm mt-1\">{schedule.scopeType}</dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.source', 'Source')}</dt>\n <dd className=\"text-sm mt-1\">\n {schedule.sourceType === 'module' && schedule.sourceModule \n ? `${schedule.sourceModule} (${t('scheduler.details.source_module', 'module')})` \n : t('scheduler.details.source_user', 'User-created')}\n </dd>\n </div>\n {schedule.nextRunAt && (\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.next_run', 'Next Run')}</dt>\n <dd className=\"text-sm mt-1\">\n {new Date(schedule.nextRunAt).toLocaleString()}\n <div className=\"text-xs text-muted-foreground\">\n {formatDistanceToNow(new Date(schedule.nextRunAt), { addSuffix: true })}\n </div>\n </dd>\n </div>\n )}\n {schedule.lastRunAt && (\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.details.last_run', 'Last Run')}</dt>\n <dd className=\"text-sm mt-1\">\n {new Date(schedule.lastRunAt).toLocaleString()}\n <div className=\"text-xs text-muted-foreground\">\n {formatDistanceToNow(new Date(schedule.lastRunAt), { addSuffix: true })}\n </div>\n </dd>\n </div>\n )}\n {schedule.requireFeature && (\n <div className=\"col-span-2\">\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.details.required_feature', 'Required Feature')}</dt>\n <dd className=\"text-sm mt-1\">\n <Badge variant=\"outline\">{schedule.requireFeature}</Badge>\n </dd>\n </div>\n )}\n {schedule.targetPayload && Object.keys(schedule.targetPayload).length > 0 && (\n <div className=\"col-span-2\">\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.details.payload', 'Payload')}</dt>\n <dd className=\"mt-1\">\n <pre className=\"bg-muted p-2 rounded text-xs overflow-auto max-h-32\">\n {JSON.stringify(schedule.targetPayload, null, 2)}\n </pre>\n </dd>\n </div>\n )}\n </dl>\n </CardContent>\n </Card>\n\n {/* Recent Executions Card */}\n <Card>\n <CardHeader>\n <div className=\"flex items-center justify-between\">\n <CardTitle>{t('scheduler.details.recent_executions', 'Recent Executions')}</CardTitle>\n </div>\n </CardHeader>\n <CardContent>\n {!isAsyncStrategy ? (\n <p className=\"text-sm text-muted-foreground\">\n {t('scheduler.details.executions_async_only', 'Execution history and manual triggers require async queue strategy (QUEUE_STRATEGY=async).')}\n </p>\n ) : runs.length > 0 ? (\n <DataTable\n columns={runsColumns}\n data={runs}\n />\n ) : (\n <p className=\"text-sm text-muted-foreground\">{t('scheduler.details.no_executions', 'No executions yet')}</p>\n )}\n </CardContent>\n </Card>\n </div>\n </PageBody>\n\n <ExecutionDetailsDialog\n open={detailsModalOpen}\n onClose={() => setDetailsModalOpen(false)}\n run={selectedRun}\n scheduleName={schedule.name}\n />\n\n <JobLogsModal\n open={logsModalOpen}\n onClose={() => setLogsModalOpen(false)}\n queueJobId={selectedRun?.queueJobId || null}\n queueName={selectedRun?.queueName || null}\n scheduleName={schedule.name}\n />\n </Page>\n )\n}\n"],
5
- "mappings": ";AAwLQ,SACE,KADF;AAtLR,YAAY,WAAW;AACvB,SAAS,WAAW,iBAAiB;AACrC,SAAS,MAAM,UAAU,kBAAkB;AAC3C,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,MAAM,aAAa,YAAY,iBAAiB;AACzD,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,oBAAoB;AAC7C,SAAS,oBAAoB;AAC7B,SAAS,8BAA8B;AACvC,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,YAAY;AAErB,SAAS,2BAA2B;AAmCrB,SAAR,qBAAsC;AAC3C,QAAM,SAAS,UAAU;AACzB,QAAM,SAAS,UAAU;AACzB,QAAM,IAAI,KAAK;AACf,QAAM,EAAE,SAAS,qBAAqB,IAAI,iBAAiB;AAG3D,QAAM,aAAa,OAAO,KACrB,MAAM,QAAQ,OAAO,EAAE,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,KACj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AAE,mCAAmC,mBAAmB,GAAE,GAE5G;AAAA,SACF;AAAA,OACF,GACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS,MAAM,oBAAoB,KAAK;AAAA,QACxC,KAAK;AAAA,QACL,cAAc,SAAS;AAAA;AAAA,IACzB;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS,MAAM,iBAAiB,KAAK;AAAA,QACrC,YAAY,aAAa,cAAc;AAAA,QACvC,WAAW,aAAa,aAAa;AAAA,QACrC,cAAc,SAAS;AAAA;AAAA,IACzB;AAAA,KACF;AAEJ;",
4
+ "sourcesContent": ["\"use client\"\n\nimport * as React from 'react'\nimport { useParams, useRouter } from 'next/navigation'\nimport { Page, PageBody, PageHeader } from '@open-mercato/ui/backend/Page'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { Badge } from '@open-mercato/ui/primitives/badge'\nimport { Card, CardContent, CardHeader, CardTitle } from '@open-mercato/ui/primitives/card'\nimport { Switch } from '@open-mercato/ui/primitives/switch'\nimport { Label } from '@open-mercato/ui/primitives/label'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport { apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'\nimport { LoadingMessage, ErrorMessage, RecordNotFoundState } from '@open-mercato/ui/backend/detail'\nimport { JobLogsModal } from '../../../../components/JobLogsModal'\nimport { ExecutionDetailsDialog } from '../../../../components/ExecutionDetailsDialog'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport type { ColumnDef } from '@tanstack/react-table'\nimport { formatDistanceToNow } from 'date-fns'\n\ntype ScheduleDetail = {\n id: string\n name: string\n description?: string\n scopeType: 'system' | 'organization' | 'tenant'\n scheduleType: 'cron' | 'interval'\n scheduleValue: string\n timezone: string\n targetType: 'queue' | 'command'\n targetQueue?: string\n targetCommand?: string\n targetPayload?: Record<string, unknown>\n requireFeature?: string\n isEnabled: boolean\n lastRunAt?: string\n nextRunAt?: string\n sourceType: 'user' | 'module'\n sourceModule?: string\n}\n\ntype ExecutionRun = {\n id: string\n startedAt: string\n finishedAt?: string\n status: 'running' | 'completed' | 'failed' | 'skipped'\n triggerType: 'scheduled' | 'manual'\n queueJobId?: string\n queueName?: string\n errorMessage?: string\n errorStack?: string\n durationMs?: number\n}\n\nexport default function ScheduleDetailPage() {\n const params = useParams()\n const router = useRouter()\n const t = useT()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n // Extract schedule ID from either params.id or params.slug\n // When using catch-all routes, the ID is in params.slug[2]\n const scheduleId = params.id \n ? (Array.isArray(params.id) ? params.id[0] : params.id)\n : (Array.isArray(params.slug) && params.slug.length >= 3 ? params.slug[2] : undefined)\n\n const [schedule, setSchedule] = React.useState<ScheduleDetail | null>(null)\n const [runs, setRuns] = React.useState<ExecutionRun[]>([])\n const [loading, setLoading] = React.useState(true)\n const [error, setError] = React.useState<string | null>(null)\n const [isNotFound, setIsNotFound] = React.useState(false)\n const [logsModalOpen, setLogsModalOpen] = React.useState(false)\n const [detailsModalOpen, setDetailsModalOpen] = React.useState(false)\n const [selectedRun, setSelectedRun] = React.useState<ExecutionRun | null>(null)\n const [triggering, setTriggering] = React.useState(false)\n const [toggling, setToggling] = React.useState(false)\n\n const queueStrategy = process.env.NEXT_PUBLIC_QUEUE_STRATEGY || 'local'\n const isAsyncStrategy = queueStrategy === 'async'\n\n const fetchScheduleAndRuns = React.useCallback(async () => {\n if (!scheduleId) return\n try {\n // Fetch schedule details via list API with ID filter\n const { result: listData } = await apiCallOrThrow(\n `/api/scheduler/jobs?id=${scheduleId}&page=1&pageSize=1`\n )\n const schedules = (listData as { items?: unknown[] })?.items || []\n if (schedules.length === 0) {\n setIsNotFound(true)\n setLoading(false)\n return\n }\n setSchedule(schedules[0] as ScheduleDetail)\n\n // Fetch recent runs \u2014 only available with async strategy\n if (isAsyncStrategy) {\n try {\n const { result: runsData } = await apiCallOrThrow(\n `/api/scheduler/jobs/${scheduleId}/executions?pageSize=10`\n )\n setRuns((runsData as { items?: ExecutionRun[] }).items || [])\n } catch {\n setRuns([])\n }\n }\n } catch (err: unknown) {\n setError(err instanceof Error ? err.message : t('scheduler.error.load_failed', 'Failed to load schedule'))\n } finally {\n setLoading(false)\n }\n }, [scheduleId, isAsyncStrategy])\n\n React.useEffect(() => {\n if (scheduleId) {\n fetchScheduleAndRuns()\n }\n }, [scheduleId, fetchScheduleAndRuns])\n\n const handleTriggerNow = async () => {\n if (!scheduleId || !schedule) return\n \n // Confirm before triggering\n const targetTypeLabel =\n schedule.targetType === 'queue'\n ? t('scheduler.target.queue', 'queue job')\n : t('scheduler.target.command', 'command')\n const triggerConfirmText = t(\n 'scheduler.confirm.trigger',\n 'Are you sure you want to trigger \"{name}\" now?\\n\\nThis will execute the {targetType} immediately.',\n { name: schedule.name, targetType: targetTypeLabel }\n )\n const confirmed = await confirm({\n title: t('scheduler.action.trigger', 'Trigger Now'),\n text: triggerConfirmText,\n })\n \n if (!confirmed) return\n \n setTriggering(true)\n try {\n await apiCallOrThrow(`/api/scheduler/trigger`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ id: scheduleId }),\n })\n flash(t('scheduler.success.triggered', 'Schedule triggered successfully'), 'success')\n await fetchScheduleAndRuns()\n } catch (err: unknown) {\n flash(err instanceof Error ? err.message : t('scheduler.error.trigger_failed', 'Failed to trigger schedule'), 'error')\n } finally {\n setTriggering(false)\n }\n }\n\n const handleToggleEnabled = async (enabled: boolean) => {\n if (!schedule || !scheduleId) return\n setToggling(true)\n try {\n await apiCallOrThrow(`/api/scheduler/jobs`, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({ id: scheduleId, isEnabled: enabled }),\n })\n flash(enabled ? t('scheduler.success.enabled', 'Schedule enabled') : t('scheduler.success.disabled', 'Schedule disabled'), 'success')\n await fetchScheduleAndRuns()\n } catch (err: unknown) {\n flash(err instanceof Error ? err.message : t('scheduler.error.update_failed', 'Failed to update schedule'), 'error')\n } finally {\n setToggling(false)\n }\n }\n\n const handleViewLogs = (run: ExecutionRun) => {\n setSelectedRun(run)\n setLogsModalOpen(true)\n }\n\n const handleViewDetails = (run: ExecutionRun) => {\n setSelectedRun(run)\n setDetailsModalOpen(true)\n }\n\n const runsColumns: ColumnDef<ExecutionRun>[] = [\n {\n accessorKey: 'startedAt',\n header: t('scheduler.execution.started', 'Started'),\n cell: ({ row }) => (\n <div>\n <div className=\"text-sm\">{new Date(row.original.startedAt).toLocaleString()}</div>\n <div className=\"text-xs text-muted-foreground\">\n {formatDistanceToNow(new Date(row.original.startedAt), { addSuffix: true })}\n </div>\n </div>\n ),\n },\n {\n accessorKey: 'status',\n header: t('scheduler.execution.status', 'Status'),\n cell: ({ row }) => (\n <Badge variant={\n row.original.status === 'completed' ? 'default' :\n row.original.status === 'failed' ? 'destructive' :\n row.original.status === 'skipped' ? 'secondary' : 'outline'\n }>\n {t(`scheduler.execution_status.${row.original.status}`, row.original.status)}\n </Badge>\n ),\n },\n {\n accessorKey: 'durationMs',\n header: t('scheduler.execution.duration', 'Duration'),\n cell: ({ row }) => \n row.original.durationMs \n ? `${(row.original.durationMs / 1000).toFixed(2)}s` \n : '\u2014',\n },\n {\n accessorKey: 'triggerType',\n header: t('scheduler.execution.trigger', 'Trigger'),\n cell: ({ row }) => t(`scheduler.trigger_type.${row.original.triggerType}`, row.original.triggerType),\n },\n {\n id: 'actions',\n header: t('scheduler.execution.actions', 'Actions'),\n cell: ({ row }) => {\n const canViewLogs = isAsyncStrategy && \n row.original.queueJobId && \n row.original.queueName\n const hasDetails = row.original.errorMessage || row.original.finishedAt\n\n return (\n <div className=\"flex items-center gap-2\">\n {hasDetails && (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => handleViewDetails(row.original)}\n >\n {t('scheduler.execution.view_details', 'View Details')}\n </Button>\n )}\n {canViewLogs && (\n <Button\n size=\"sm\"\n variant=\"ghost\"\n onClick={() => handleViewLogs(row.original)}\n >\n {t('scheduler.execution.view_logs', 'View Logs')}\n </Button>\n )}\n {!hasDetails && !canViewLogs && (\n <span className=\"text-sm text-muted-foreground\">\u2014</span>\n )}\n </div>\n )\n },\n },\n ]\n\n if (loading) {\n return (\n <Page>\n <PageBody>\n <LoadingMessage label={t('scheduler.loading', 'Loading schedule...')} />\n </PageBody>\n </Page>\n )\n }\n if (isNotFound) {\n return (\n <Page>\n <PageBody>\n <RecordNotFoundState\n label={t('scheduler.error.not_found', 'Schedule not found')}\n backHref=\"/backend/config/scheduled-jobs\"\n backLabel={t('scheduler.nav.backToList', 'Back to scheduled jobs')}\n />\n </PageBody>\n </Page>\n )\n }\n if (error) {\n return (\n <Page>\n <PageBody>\n <ErrorMessage label={t('scheduler.details.error', 'Error')} description={error} />\n </PageBody>\n </Page>\n )\n }\n if (!schedule) {\n return (\n <Page>\n <PageBody>\n <ErrorMessage label={t('scheduler.details.not_found', 'Not Found')} description={t('scheduler.error.not_found', 'Schedule not found')} />\n </PageBody>\n </Page>\n )\n }\n\n return (\n <Page>\n {ConfirmDialogElement}\n <PageHeader\n title={schedule.name}\n description={schedule.description}\n actions={\n <div className=\"flex items-center gap-4\">\n <div className=\"flex items-center gap-2\">\n <Label htmlFor=\"schedule-enabled\" className=\"text-sm font-medium cursor-pointer\">\n {schedule.isEnabled ? t('scheduler.status.enabled', 'Enabled') : t('scheduler.status.disabled', 'Disabled')}\n </Label>\n <Switch\n id=\"schedule-enabled\"\n checked={schedule.isEnabled}\n onCheckedChange={handleToggleEnabled}\n disabled={toggling}\n />\n </div>\n <Button\n variant=\"outline\"\n onClick={handleTriggerNow}\n disabled={triggering || !schedule.isEnabled}\n >\n {triggering ? t('scheduler.details.triggering', 'Triggering...') : t('scheduler.action.trigger', 'Trigger Now')}\n </Button>\n <Button onClick={() => router.push(`/backend/config/scheduled-jobs/${scheduleId}/edit`)}>\n {t('scheduler.action.edit', 'Edit')}\n </Button>\n </div>\n }\n />\n\n <PageBody>\n <div className=\"space-y-6\">\n {/* Configuration Card */}\n <Card>\n <CardHeader>\n <CardTitle>{t('scheduler.details.configuration', 'Configuration')}</CardTitle>\n </CardHeader>\n <CardContent>\n <dl className=\"grid grid-cols-2 gap-4\">\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.status', 'Status')}</dt>\n <dd className=\"mt-1\">\n <Badge variant={schedule.isEnabled ? 'default' : 'secondary'}>\n {schedule.isEnabled ? t('scheduler.status.enabled', 'Enabled') : t('scheduler.status.disabled', 'Disabled')}\n </Badge>\n </dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.schedule', 'Schedule')}</dt>\n <dd className=\"text-sm mt-1\">\n {schedule.scheduleValue} \n <span className=\"text-muted-foreground ml-1\">({schedule.scheduleType})</span>\n </dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.timezone', 'Timezone')}</dt>\n <dd className=\"text-sm mt-1\">{schedule.timezone}</dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.target', 'Target')}</dt>\n <dd className=\"text-sm mt-1\">\n <Badge variant=\"outline\">\n {schedule.targetType === 'queue' ? schedule.targetQueue : schedule.targetCommand}\n </Badge>\n </dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.details.scope', 'Scope')}</dt>\n <dd className=\"text-sm mt-1\">{schedule.scopeType}</dd>\n </div>\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.source', 'Source')}</dt>\n <dd className=\"text-sm mt-1\">\n {schedule.sourceType === 'module' && schedule.sourceModule \n ? `${schedule.sourceModule} (${t('scheduler.details.source_module', 'module')})` \n : t('scheduler.details.source_user', 'User-created')}\n </dd>\n </div>\n {schedule.nextRunAt && (\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.field.next_run', 'Next Run')}</dt>\n <dd className=\"text-sm mt-1\">\n {new Date(schedule.nextRunAt).toLocaleString()}\n <div className=\"text-xs text-muted-foreground\">\n {formatDistanceToNow(new Date(schedule.nextRunAt), { addSuffix: true })}\n </div>\n </dd>\n </div>\n )}\n {schedule.lastRunAt && (\n <div>\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.details.last_run', 'Last Run')}</dt>\n <dd className=\"text-sm mt-1\">\n {new Date(schedule.lastRunAt).toLocaleString()}\n <div className=\"text-xs text-muted-foreground\">\n {formatDistanceToNow(new Date(schedule.lastRunAt), { addSuffix: true })}\n </div>\n </dd>\n </div>\n )}\n {schedule.requireFeature && (\n <div className=\"col-span-2\">\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.details.required_feature', 'Required Feature')}</dt>\n <dd className=\"text-sm mt-1\">\n <Badge variant=\"outline\">{schedule.requireFeature}</Badge>\n </dd>\n </div>\n )}\n {schedule.targetPayload && Object.keys(schedule.targetPayload).length > 0 && (\n <div className=\"col-span-2\">\n <dt className=\"text-sm font-medium text-muted-foreground\">{t('scheduler.details.payload', 'Payload')}</dt>\n <dd className=\"mt-1\">\n <pre className=\"bg-muted p-2 rounded text-xs overflow-auto max-h-32\">\n {JSON.stringify(schedule.targetPayload, null, 2)}\n </pre>\n </dd>\n </div>\n )}\n </dl>\n </CardContent>\n </Card>\n\n {/* Recent Executions Card */}\n <Card>\n <CardHeader>\n <div className=\"flex items-center justify-between\">\n <CardTitle>{t('scheduler.details.recent_executions', 'Recent Executions')}</CardTitle>\n </div>\n </CardHeader>\n <CardContent>\n {!isAsyncStrategy ? (\n <p className=\"text-sm text-muted-foreground\">\n {t('scheduler.details.executions_async_only', 'Execution history and manual triggers require async queue strategy (QUEUE_STRATEGY=async).')}\n </p>\n ) : runs.length > 0 ? (\n <DataTable\n columns={runsColumns}\n data={runs}\n />\n ) : (\n <p className=\"text-sm text-muted-foreground\">{t('scheduler.details.no_executions', 'No executions yet')}</p>\n )}\n </CardContent>\n </Card>\n </div>\n </PageBody>\n\n <ExecutionDetailsDialog\n open={detailsModalOpen}\n onClose={() => setDetailsModalOpen(false)}\n run={selectedRun}\n scheduleName={schedule.name}\n />\n\n <JobLogsModal\n open={logsModalOpen}\n onClose={() => setLogsModalOpen(false)}\n queueJobId={selectedRun?.queueJobId || null}\n queueName={selectedRun?.queueName || null}\n scheduleName={schedule.name}\n />\n </Page>\n )\n}\n"],
5
+ "mappings": ";AA2LQ,SACE,KADF;AAzLR,YAAY,WAAW;AACvB,SAAS,WAAW,iBAAiB;AACrC,SAAS,MAAM,UAAU,kBAAkB;AAC3C,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,MAAM,aAAa,YAAY,iBAAiB;AACzD,SAAS,cAAc;AACvB,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,gBAAgB,cAAc,2BAA2B;AAClE,SAAS,oBAAoB;AAC7B,SAAS,8BAA8B;AACvC,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,YAAY;AAErB,SAAS,2BAA2B;AAmCrB,SAAR,qBAAsC;AAC3C,QAAM,SAAS,UAAU;AACzB,QAAM,SAAS,UAAU;AACzB,QAAM,IAAI,KAAK;AACf,QAAM,EAAE,SAAS,qBAAqB,IAAI,iBAAiB;AAG3D,QAAM,aAAa,OAAO,KACrB,MAAM,QAAQ,OAAO,EAAE,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,KACjD,MAAM,QAAQ,OAAO,IAAI,KAAK,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,CAAC,IAAI;AAE9E,QAAM,CAAC,UAAU,WAAW,IAAI,MAAM,SAAgC,IAAI;AAC1E,QAAM,CAAC,MAAM,OAAO,IAAI,MAAM,SAAyB,CAAC,CAAC;AACzD,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,IAA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2CAA2C,4FAA4F,GAC5I,IACE,KAAK,SAAS,IAChB;AAAA,UAAC;AAAA;AAAA,YACC,SAAS;AAAA,YACT,MAAM;AAAA;AAAA,QACR,IAEA,oBAAC,OAAE,WAAU,iCAAiC,YAAE,mCAAmC,mBAAmB,GAAE,GAE5G;AAAA,SACF;AAAA,OACF,GACF;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS,MAAM,oBAAoB,KAAK;AAAA,QACxC,KAAK;AAAA,QACL,cAAc,SAAS;AAAA;AAAA,IACzB;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,MAAM;AAAA,QACN,SAAS,MAAM,iBAAiB,KAAK;AAAA,QACrC,YAAY,aAAa,cAAc;AAAA,QACvC,WAAW,aAAa,aAAa;AAAA,QACrC,cAAc,SAAS;AAAA;AAAA,IACzB;AAAA,KACF;AAEJ;",
6
6
  "names": []
7
7
  }
package/jest.config.cjs CHANGED
@@ -1,5 +1,8 @@
1
1
  /** @type {import('jest').Config} */
2
+ const base = require('../../jest.config.base.cjs')
3
+
2
4
  module.exports = {
5
+ ...base,
3
6
  testEnvironment: 'node',
4
7
  watchman: false,
5
8
  roots: ['<rootDir>/src'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/scheduler",
3
- "version": "0.6.4-develop.4305.1.efaf0ebab1",
3
+ "version": "0.6.4-develop.4310.1.0be8773280",
4
4
  "description": "Database-managed scheduled jobs with admin UI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -58,13 +58,13 @@
58
58
  "./*/*/*/*/*/*.json": "./src/*/*/*/*/*/*.json"
59
59
  },
60
60
  "dependencies": {
61
- "@open-mercato/events": "0.6.4-develop.4305.1.efaf0ebab1",
62
- "@open-mercato/queue": "0.6.4-develop.4305.1.efaf0ebab1",
61
+ "@open-mercato/events": "0.6.4-develop.4310.1.0be8773280",
62
+ "@open-mercato/queue": "0.6.4-develop.4310.1.0be8773280",
63
63
  "cron-parser": "^5.5.0"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@mikro-orm/core": "^7.0.14",
67
- "@open-mercato/shared": "0.6.4-develop.4305.1.efaf0ebab1",
67
+ "@open-mercato/shared": "0.6.4-develop.4310.1.0be8773280",
68
68
  "bullmq": "^5.0.0",
69
69
  "ioredis": "^5.0.0",
70
70
  "zod": ">=3.23.0"
@@ -78,7 +78,7 @@
78
78
  }
79
79
  },
80
80
  "devDependencies": {
81
- "@open-mercato/shared": "0.6.4-develop.4305.1.efaf0ebab1",
81
+ "@open-mercato/shared": "0.6.4-develop.4310.1.0be8773280",
82
82
  "@types/jest": "^30.0.0",
83
83
  "@types/node": "^25.9.1",
84
84
  "jest": "^30.4.2",
@@ -10,7 +10,7 @@ import { Switch } from '@open-mercato/ui/primitives/switch'
10
10
  import { Label } from '@open-mercato/ui/primitives/label'
11
11
  import { DataTable } from '@open-mercato/ui/backend/DataTable'
12
12
  import { apiCallOrThrow } from '@open-mercato/ui/backend/utils/apiCall'
13
- import { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'
13
+ import { LoadingMessage, ErrorMessage, RecordNotFoundState } from '@open-mercato/ui/backend/detail'
14
14
  import { JobLogsModal } from '../../../../components/JobLogsModal'
15
15
  import { ExecutionDetailsDialog } from '../../../../components/ExecutionDetailsDialog'
16
16
  import { flash } from '@open-mercato/ui/backend/FlashMessages'
@@ -67,6 +67,7 @@ export default function ScheduleDetailPage() {
67
67
  const [runs, setRuns] = React.useState<ExecutionRun[]>([])
68
68
  const [loading, setLoading] = React.useState(true)
69
69
  const [error, setError] = React.useState<string | null>(null)
70
+ const [isNotFound, setIsNotFound] = React.useState(false)
70
71
  const [logsModalOpen, setLogsModalOpen] = React.useState(false)
71
72
  const [detailsModalOpen, setDetailsModalOpen] = React.useState(false)
72
73
  const [selectedRun, setSelectedRun] = React.useState<ExecutionRun | null>(null)
@@ -85,7 +86,9 @@ export default function ScheduleDetailPage() {
85
86
  )
86
87
  const schedules = (listData as { items?: unknown[] })?.items || []
87
88
  if (schedules.length === 0) {
88
- throw new Error(t('scheduler.error.not_found', 'Schedule not found'))
89
+ setIsNotFound(true)
90
+ setLoading(false)
91
+ return
89
92
  }
90
93
  setSchedule(schedules[0] as ScheduleDetail)
91
94
 
@@ -254,9 +257,46 @@ export default function ScheduleDetailPage() {
254
257
  },
255
258
  ]
256
259
 
257
- if (loading) return <LoadingMessage label={t('scheduler.loading', 'Loading schedule...')} />
258
- if (error) return <ErrorMessage label={t('scheduler.details.error', 'Error')} description={error} />
259
- if (!schedule) return <ErrorMessage label={t('scheduler.details.not_found', 'Not Found')} description={t('scheduler.error.not_found', 'Schedule not found')} />
260
+ if (loading) {
261
+ return (
262
+ <Page>
263
+ <PageBody>
264
+ <LoadingMessage label={t('scheduler.loading', 'Loading schedule...')} />
265
+ </PageBody>
266
+ </Page>
267
+ )
268
+ }
269
+ if (isNotFound) {
270
+ return (
271
+ <Page>
272
+ <PageBody>
273
+ <RecordNotFoundState
274
+ label={t('scheduler.error.not_found', 'Schedule not found')}
275
+ backHref="/backend/config/scheduled-jobs"
276
+ backLabel={t('scheduler.nav.backToList', 'Back to scheduled jobs')}
277
+ />
278
+ </PageBody>
279
+ </Page>
280
+ )
281
+ }
282
+ if (error) {
283
+ return (
284
+ <Page>
285
+ <PageBody>
286
+ <ErrorMessage label={t('scheduler.details.error', 'Error')} description={error} />
287
+ </PageBody>
288
+ </Page>
289
+ )
290
+ }
291
+ if (!schedule) {
292
+ return (
293
+ <Page>
294
+ <PageBody>
295
+ <ErrorMessage label={t('scheduler.details.not_found', 'Not Found')} description={t('scheduler.error.not_found', 'Schedule not found')} />
296
+ </PageBody>
297
+ </Page>
298
+ )
299
+ }
260
300
 
261
301
  return (
262
302
  <Page>