hermium 0.1.2 → 0.1.4
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/bin/hermium.mjs +184 -145
- package/dist/server/index.mjs +65 -65
- package/dist/web-server/__23tanstack-start-plugin-adapters-Cwee5PKy.mjs +6 -0
- package/dist/web-server/_chunks/ssr-renderer.mjs +22 -0
- package/dist/web-server/_libs/babel__runtime.mjs +237 -0
- package/dist/web-server/_libs/bail.mjs +8 -0
- package/dist/web-server/_libs/base-ui__react.mjs +9554 -0
- package/dist/web-server/_libs/base-ui__utils.mjs +1101 -0
- package/dist/web-server/_libs/ccount.mjs +16 -0
- package/dist/web-server/_libs/character-entities-legacy.mjs +111 -0
- package/dist/web-server/_libs/character-entities.mjs +2130 -0
- package/dist/web-server/_libs/character-reference-invalid.mjs +33 -0
- package/dist/web-server/_libs/class-variance-authority.mjs +44 -0
- package/dist/web-server/_libs/clsx.mjs +16 -0
- package/dist/web-server/_libs/comma-separated-tokens.mjs +31 -0
- package/dist/web-server/_libs/cookie-es.mjs +44 -0
- package/dist/web-server/_libs/croner.mjs +1 -0
- package/dist/web-server/_libs/crossws.mjs +1 -0
- package/dist/web-server/_libs/decode-named-character-reference+[...].mjs +8 -0
- package/dist/web-server/_libs/devlop.mjs +8 -0
- package/dist/web-server/_libs/escape-string-regexp.mjs +9 -0
- package/dist/web-server/_libs/estree-util-is-identifier-name.mjs +11 -0
- package/dist/web-server/_libs/extend.mjs +97 -0
- package/dist/web-server/_libs/fault.mjs +1 -0
- package/dist/web-server/_libs/floating-ui__core.mjs +663 -0
- package/dist/web-server/_libs/floating-ui__dom.mjs +624 -0
- package/dist/web-server/_libs/floating-ui__react-dom.mjs +279 -0
- package/dist/web-server/_libs/floating-ui__utils.mjs +322 -0
- package/dist/web-server/_libs/format.mjs +1 -0
- package/dist/web-server/_libs/h3.mjs +408 -0
- package/dist/web-server/_libs/hast-util-parse-selector.mjs +39 -0
- package/dist/web-server/_libs/hast-util-to-jsx-runtime.mjs +388 -0
- package/dist/web-server/_libs/hast-util-whitespace.mjs +10 -0
- package/dist/web-server/_libs/hastscript.mjs +200 -0
- package/dist/web-server/_libs/highlight.js.mjs +1 -0
- package/dist/web-server/_libs/hookable.mjs +1 -0
- package/dist/web-server/_libs/html-url-attributes.mjs +26 -0
- package/dist/web-server/_libs/inline-style-parser.mjs +142 -0
- package/dist/web-server/_libs/is-alphabetical.mjs +7 -0
- package/dist/web-server/_libs/is-alphanumerical.mjs +8 -0
- package/dist/web-server/_libs/is-decimal.mjs +7 -0
- package/dist/web-server/_libs/is-hexadecimal.mjs +7 -0
- package/dist/web-server/_libs/is-plain-obj.mjs +10 -0
- package/dist/web-server/_libs/isbot.mjs +21 -0
- package/dist/web-server/_libs/longest-streak.mjs +25 -0
- package/dist/web-server/_libs/lowlight.mjs +1 -0
- package/dist/web-server/_libs/markdown-table.mjs +142 -0
- package/dist/web-server/_libs/mdast-util-find-and-replace.mjs +109 -0
- package/dist/web-server/_libs/mdast-util-from-markdown.mjs +717 -0
- package/dist/web-server/_libs/mdast-util-gfm-autolink-literal+[...].mjs +156 -0
- package/dist/web-server/_libs/mdast-util-gfm-footnote.mjs +117 -0
- package/dist/web-server/_libs/mdast-util-gfm-strikethrough.mjs +54 -0
- package/dist/web-server/_libs/mdast-util-gfm-table.mjs +157 -0
- package/dist/web-server/_libs/mdast-util-gfm-task-list-item.mjs +77 -0
- package/dist/web-server/_libs/mdast-util-gfm.mjs +29 -0
- package/dist/web-server/_libs/mdast-util-phrasing.mjs +30 -0
- package/dist/web-server/_libs/mdast-util-to-hast.mjs +710 -0
- package/dist/web-server/_libs/mdast-util-to-markdown.mjs +798 -0
- package/dist/web-server/_libs/mdast-util-to-string.mjs +38 -0
- package/dist/web-server/_libs/micromark-core-commonmark.mjs +2259 -0
- package/dist/web-server/_libs/micromark-extension-gfm-autolink-literal+[...].mjs +344 -0
- package/dist/web-server/_libs/micromark-extension-gfm-footnote+[...].mjs +279 -0
- package/dist/web-server/_libs/micromark-extension-gfm-strikethrough+[...].mjs +98 -0
- package/dist/web-server/_libs/micromark-extension-gfm-table.mjs +491 -0
- package/dist/web-server/_libs/micromark-extension-gfm-tagfilter+[...].mjs +1 -0
- package/dist/web-server/_libs/micromark-extension-gfm-task-list-item+[...].mjs +77 -0
- package/dist/web-server/_libs/micromark-extension-gfm.mjs +18 -0
- package/dist/web-server/_libs/micromark-factory-destination.mjs +94 -0
- package/dist/web-server/_libs/micromark-factory-label.mjs +63 -0
- package/dist/web-server/_libs/micromark-factory-space.mjs +24 -0
- package/dist/web-server/_libs/micromark-factory-title.mjs +65 -0
- package/dist/web-server/_libs/micromark-factory-whitespace.mjs +22 -0
- package/dist/web-server/_libs/micromark-util-character.mjs +44 -0
- package/dist/web-server/_libs/micromark-util-chunked.mjs +36 -0
- package/dist/web-server/_libs/micromark-util-classify-character+[...].mjs +12 -0
- package/dist/web-server/_libs/micromark-util-combine-extensions+[...].mjs +41 -0
- package/dist/web-server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +19 -0
- package/dist/web-server/_libs/micromark-util-decode-string.mjs +21 -0
- package/dist/web-server/_libs/micromark-util-encode.mjs +1 -0
- package/dist/web-server/_libs/micromark-util-html-tag-name.mjs +69 -0
- package/dist/web-server/_libs/micromark-util-normalize-identifier+[...].mjs +6 -0
- package/dist/web-server/_libs/micromark-util-resolve-all.mjs +15 -0
- package/dist/web-server/_libs/micromark-util-sanitize-uri.mjs +41 -0
- package/dist/web-server/_libs/micromark-util-subtokenize.mjs +346 -0
- package/dist/web-server/_libs/micromark.mjs +906 -0
- package/dist/web-server/_libs/ocache.mjs +1 -0
- package/dist/web-server/_libs/ohash.mjs +1 -0
- package/dist/web-server/_libs/parse-entities.mjs +245 -0
- package/dist/web-server/_libs/property-information.mjs +1210 -0
- package/dist/web-server/_libs/react-dom.mjs +10779 -0
- package/dist/web-server/_libs/react-markdown.mjs +147 -0
- package/dist/web-server/_libs/react-syntax-highlighter.mjs +941 -0
- package/dist/web-server/_libs/react.mjs +513 -0
- package/dist/web-server/_libs/refractor.mjs +2425 -0
- package/dist/web-server/_libs/remark-gfm.mjs +20 -0
- package/dist/web-server/_libs/remark-parse.mjs +19 -0
- package/dist/web-server/_libs/remark-rehype.mjs +21 -0
- package/dist/web-server/_libs/reselect.mjs +1 -0
- package/dist/web-server/_libs/rou3.mjs +8 -0
- package/dist/web-server/_libs/seroval-plugins.mjs +58 -0
- package/dist/web-server/_libs/seroval.mjs +1775 -0
- package/dist/web-server/_libs/space-separated-tokens.mjs +11 -0
- package/dist/web-server/_libs/srvx.mjs +781 -0
- package/dist/web-server/_libs/style-to-js.mjs +72 -0
- package/dist/web-server/_libs/style-to-object.mjs +38 -0
- package/dist/web-server/_libs/tabler__icons-react.mjs +224 -0
- package/dist/web-server/_libs/tanstack__history.mjs +204 -0
- package/dist/web-server/_libs/tanstack__query-core.mjs +2552 -0
- package/dist/web-server/_libs/tanstack__react-query.mjs +190 -0
- package/dist/web-server/_libs/tanstack__react-router.mjs +1120 -0
- package/dist/web-server/_libs/tanstack__react-store.mjs +2 -0
- package/dist/web-server/_libs/tanstack__router-core.mjs +4288 -0
- package/dist/web-server/_libs/tanstack__store.mjs +1 -0
- package/dist/web-server/_libs/trim-lines.mjs +41 -0
- package/dist/web-server/_libs/trough.mjs +85 -0
- package/dist/web-server/_libs/ufo.mjs +54 -0
- package/dist/web-server/_libs/unctx.mjs +1 -0
- package/dist/web-server/_libs/ungap__structured-clone.mjs +224 -0
- package/dist/web-server/_libs/unified.mjs +661 -0
- package/dist/web-server/_libs/unist-util-is.mjs +100 -0
- package/dist/web-server/_libs/unist-util-position.mjs +27 -0
- package/dist/web-server/_libs/unist-util-stringify-position.mjs +27 -0
- package/dist/web-server/_libs/unist-util-visit-parents.mjs +83 -0
- package/dist/web-server/_libs/unist-util-visit.mjs +24 -0
- package/dist/web-server/_libs/unstorage.mjs +1 -0
- package/dist/web-server/_libs/use-sync-external-store.mjs +139 -0
- package/dist/web-server/_libs/vfile-message.mjs +138 -0
- package/dist/web-server/_libs/vfile.mjs +467 -0
- package/dist/web-server/_libs/zod.mjs +3915 -0
- package/dist/web-server/_libs/zustand.mjs +343 -0
- package/dist/web-server/_libs/zwitch.mjs +1 -0
- package/dist/web-server/_ssr/index-BLK6uN4p.mjs +612 -0
- package/dist/web-server/_ssr/index-BkkxTg0a.mjs +1855 -0
- package/dist/web-server/_ssr/index-Bp9a_nTf.mjs +66 -0
- package/dist/web-server/_ssr/index-C8t8AZQG.mjs +513 -0
- package/dist/web-server/_ssr/index-DSIu0x-q.mjs +449 -0
- package/dist/web-server/_ssr/index-DqFrn6kj.mjs +278 -0
- package/dist/web-server/_ssr/index-EKE8NFy_.mjs +189 -0
- package/dist/web-server/_ssr/index-JzLhPyir.mjs +213 -0
- package/dist/web-server/_ssr/index-wTy_4MhH.mjs +369 -0
- package/dist/web-server/_ssr/index.mjs +1558 -0
- package/dist/web-server/_ssr/input-BQFduUUo.mjs +20 -0
- package/dist/web-server/_ssr/router-59cN5lqo.mjs +1998 -0
- package/dist/web-server/_ssr/start-HYkvq4Ni.mjs +4 -0
- package/dist/web-server/_ssr/switch-Bim4kX8N.mjs +33 -0
- package/dist/web-server/_ssr/syntax-highlighter-5vezNTce.mjs +62 -0
- package/dist/web-server/_ssr/textarea-CK0ROhfF.mjs +18 -0
- package/dist/web-server/_tanstack-start-manifest_v-DLw6M7p4.mjs +4 -0
- package/dist/web-server/index.mjs +611 -0
- package/package.json +1 -1
|
@@ -0,0 +1,612 @@
|
|
|
1
|
+
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
+
import { u as useQueryClient, b as useMutation, a as useQuery } from "../_libs/tanstack__react-query.mjs";
|
|
3
|
+
import { B as Button, a as cn, e as patch, p as post, f as del, g as get } from "./router-59cN5lqo.mjs";
|
|
4
|
+
import { I as Input } from "./input-BQFduUUo.mjs";
|
|
5
|
+
import { T as Textarea } from "./textarea-CK0ROhfF.mjs";
|
|
6
|
+
import { S as IconPlus, F as IconRefresh, T as IconClock, U as IconPower, v as IconPencil, y as IconTrash, V as IconPlayerPlay, W as IconCalendar, X as IconChevronRight, G as IconLoader2 } from "../_libs/tabler__icons-react.mjs";
|
|
7
|
+
import "../_libs/tanstack__query-core.mjs";
|
|
8
|
+
import "../_libs/tanstack__react-router.mjs";
|
|
9
|
+
import "../_libs/tanstack__router-core.mjs";
|
|
10
|
+
import "../_libs/tanstack__history.mjs";
|
|
11
|
+
import "../_libs/cookie-es.mjs";
|
|
12
|
+
import "../_libs/seroval.mjs";
|
|
13
|
+
import "../_libs/seroval-plugins.mjs";
|
|
14
|
+
import "node:stream/web";
|
|
15
|
+
import "node:stream";
|
|
16
|
+
import "../_libs/react-dom.mjs";
|
|
17
|
+
import "util";
|
|
18
|
+
import "crypto";
|
|
19
|
+
import "async_hooks";
|
|
20
|
+
import "stream";
|
|
21
|
+
import "../_libs/isbot.mjs";
|
|
22
|
+
import "../_libs/clsx.mjs";
|
|
23
|
+
import "../_libs/class-variance-authority.mjs";
|
|
24
|
+
import "../_libs/zustand.mjs";
|
|
25
|
+
import "../_libs/base-ui__react.mjs";
|
|
26
|
+
import "../_libs/base-ui__utils.mjs";
|
|
27
|
+
import "../_libs/use-sync-external-store.mjs";
|
|
28
|
+
import "../_libs/floating-ui__utils.mjs";
|
|
29
|
+
import "../_libs/floating-ui__react-dom.mjs";
|
|
30
|
+
import "../_libs/floating-ui__dom.mjs";
|
|
31
|
+
import "../_libs/floating-ui__core.mjs";
|
|
32
|
+
import "../_libs/zod.mjs";
|
|
33
|
+
const DialogContext = reactExports.createContext(null);
|
|
34
|
+
function useDialog() {
|
|
35
|
+
const ctx = reactExports.useContext(DialogContext);
|
|
36
|
+
if (!ctx) throw new Error("Dialog components must be used within <Dialog>");
|
|
37
|
+
return ctx;
|
|
38
|
+
}
|
|
39
|
+
function Dialog({
|
|
40
|
+
open,
|
|
41
|
+
onOpenChange,
|
|
42
|
+
children
|
|
43
|
+
}) {
|
|
44
|
+
const setOpen = reactExports.useCallback(
|
|
45
|
+
(v) => onOpenChange(v),
|
|
46
|
+
[onOpenChange]
|
|
47
|
+
);
|
|
48
|
+
reactExports.useEffect(() => {
|
|
49
|
+
if (!open) return;
|
|
50
|
+
const handleEsc = (e) => {
|
|
51
|
+
if (e.key === "Escape") setOpen(false);
|
|
52
|
+
};
|
|
53
|
+
document.addEventListener("keydown", handleEsc);
|
|
54
|
+
return () => document.removeEventListener("keydown", handleEsc);
|
|
55
|
+
}, [open, setOpen]);
|
|
56
|
+
if (!open) return null;
|
|
57
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogContext.Provider, { value: { open, setOpen }, children: [
|
|
58
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: "fixed inset-0 z-50 bg-black/40 backdrop-blur-sm",
|
|
62
|
+
onClick: () => setOpen(false)
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
className: "relative w-full max-w-lg rounded-xl border border-border bg-card shadow-xl",
|
|
69
|
+
onClick: (e) => e.stopPropagation(),
|
|
70
|
+
children
|
|
71
|
+
}
|
|
72
|
+
) })
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
75
|
+
function DialogContent({ children, className }) {
|
|
76
|
+
useDialog();
|
|
77
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("p-5", className), children });
|
|
78
|
+
}
|
|
79
|
+
function DialogHeader({ children, className }) {
|
|
80
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("mb-4", className), children });
|
|
81
|
+
}
|
|
82
|
+
function DialogTitle({ children, className }) {
|
|
83
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: cn("text-base font-semibold", className), children });
|
|
84
|
+
}
|
|
85
|
+
function DialogFooter({ children, className }) {
|
|
86
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("flex items-center justify-end gap-2 mt-4", className), children });
|
|
87
|
+
}
|
|
88
|
+
function jobId(job) {
|
|
89
|
+
return job.job_id || job.id || "";
|
|
90
|
+
}
|
|
91
|
+
function jobName(job) {
|
|
92
|
+
return job.name || jobId(job) || "Untitled";
|
|
93
|
+
}
|
|
94
|
+
function describeCron(cron) {
|
|
95
|
+
const parts = cron.trim().split(/\s+/);
|
|
96
|
+
if (parts.length < 2) return cron;
|
|
97
|
+
const minute = parseInt(parts[0], 10);
|
|
98
|
+
const hour = parseInt(parts[1], 10);
|
|
99
|
+
if (isNaN(minute) || isNaN(hour)) return cron;
|
|
100
|
+
if (parts[1] === "*") {
|
|
101
|
+
return `At minute ${minute} past every hour`;
|
|
102
|
+
}
|
|
103
|
+
const timeStr = new Date(0, 0, 0, hour, minute).toLocaleTimeString([], {
|
|
104
|
+
hour: "numeric",
|
|
105
|
+
minute: "2-digit",
|
|
106
|
+
hour12: true
|
|
107
|
+
});
|
|
108
|
+
if (parts.length >= 5) {
|
|
109
|
+
const dayField = parts.slice(2, 5).join(" ");
|
|
110
|
+
if (dayField === "* * 1-5") return `${timeStr} weekdays`;
|
|
111
|
+
if (dayField === "* * 0,6") return `${timeStr} weekends`;
|
|
112
|
+
}
|
|
113
|
+
return `${timeStr} daily`;
|
|
114
|
+
}
|
|
115
|
+
function scheduleText(schedule) {
|
|
116
|
+
if (!schedule) return "—";
|
|
117
|
+
if (typeof schedule === "string") return describeCron(schedule);
|
|
118
|
+
const raw = schedule.display || schedule.expr || JSON.stringify(schedule);
|
|
119
|
+
return describeCron(raw);
|
|
120
|
+
}
|
|
121
|
+
function formatSize(bytes) {
|
|
122
|
+
if (bytes < 1024) return `${bytes}B`;
|
|
123
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)}KB`;
|
|
124
|
+
return `${(bytes / 1024 / 1024).toFixed(1)}MB`;
|
|
125
|
+
}
|
|
126
|
+
function timeAgo(iso) {
|
|
127
|
+
const d = new Date(iso);
|
|
128
|
+
const diff = Date.now() - d.getTime();
|
|
129
|
+
const mins = Math.floor(diff / 6e4);
|
|
130
|
+
if (mins < 1) return "just now";
|
|
131
|
+
if (mins < 60) return `${mins}m ago`;
|
|
132
|
+
const hrs = Math.floor(mins / 60);
|
|
133
|
+
if (hrs < 24) return `${hrs}h ago`;
|
|
134
|
+
return `${Math.floor(hrs / 24)}d ago`;
|
|
135
|
+
}
|
|
136
|
+
function formatTime(iso) {
|
|
137
|
+
return new Date(iso).toLocaleString(void 0, {
|
|
138
|
+
month: "short",
|
|
139
|
+
day: "numeric",
|
|
140
|
+
hour: "2-digit",
|
|
141
|
+
minute: "2-digit"
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function useJobs() {
|
|
145
|
+
return useQuery({
|
|
146
|
+
queryKey: ["cron", "jobs"],
|
|
147
|
+
queryFn: () => get("/api/cron-history/jobs"),
|
|
148
|
+
refetchInterval: 3e4
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function useCronRuns(jobId2) {
|
|
152
|
+
return useQuery({
|
|
153
|
+
queryKey: ["cron", "runs", jobId2],
|
|
154
|
+
queryFn: () => get(
|
|
155
|
+
`/api/cron-history${""}`
|
|
156
|
+
),
|
|
157
|
+
refetchInterval: 15e3
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function toCron(hour, minute, dayMode) {
|
|
161
|
+
if (dayMode === "hourly") return `${minute} * * * *`;
|
|
162
|
+
const base = `${minute} ${hour}`;
|
|
163
|
+
if (dayMode === "weekdays") return `${base} * * 1-5`;
|
|
164
|
+
if (dayMode === "weekends") return `${base} * * 0,6`;
|
|
165
|
+
return `${base} * * *`;
|
|
166
|
+
}
|
|
167
|
+
function describeSchedule(hour, minute, dayMode) {
|
|
168
|
+
if (dayMode === "hourly") return `At minute ${minute} past every hour`;
|
|
169
|
+
const timeStr = new Date(0, 0, 0, hour, minute).toLocaleTimeString([], {
|
|
170
|
+
hour: "numeric",
|
|
171
|
+
minute: "2-digit",
|
|
172
|
+
hour12: true
|
|
173
|
+
});
|
|
174
|
+
const suffix = dayMode === "weekdays" ? "on weekdays" : dayMode === "weekends" ? "on weekends" : "daily";
|
|
175
|
+
return `Runs ${timeStr} ${suffix}`;
|
|
176
|
+
}
|
|
177
|
+
const PRESETS = [
|
|
178
|
+
{ label: "Every hour", dayMode: "hourly", hour: 0, minute: 0 },
|
|
179
|
+
{ label: "Daily 9AM", dayMode: "daily", hour: 9, minute: 0 },
|
|
180
|
+
{ label: "Daily noon", dayMode: "daily", hour: 12, minute: 0 },
|
|
181
|
+
{ label: "Daily 6PM", dayMode: "daily", hour: 18, minute: 0 },
|
|
182
|
+
{ label: "Weekdays 9AM", dayMode: "weekdays", hour: 9, minute: 0 },
|
|
183
|
+
{ label: "Weekdays noon", dayMode: "weekdays", hour: 12, minute: 0 }
|
|
184
|
+
];
|
|
185
|
+
function SchedulePicker({
|
|
186
|
+
value,
|
|
187
|
+
onChange
|
|
188
|
+
}) {
|
|
189
|
+
const [dayMode, setDayMode] = reactExports.useState("daily");
|
|
190
|
+
const [hour, setHour] = reactExports.useState(9);
|
|
191
|
+
const [minute, setMinute] = reactExports.useState(0);
|
|
192
|
+
const [showRaw, setShowRaw] = reactExports.useState(false);
|
|
193
|
+
const [rawCron, setRawCron] = reactExports.useState(value || "");
|
|
194
|
+
const parsed = reactExports.useMemo(() => {
|
|
195
|
+
if (!value) return null;
|
|
196
|
+
const parts = value.trim().split(/\s+/);
|
|
197
|
+
if (parts.length < 2) return null;
|
|
198
|
+
const m = parseInt(parts[0], 10);
|
|
199
|
+
const h = parseInt(parts[1], 10);
|
|
200
|
+
if (isNaN(m) || isNaN(h)) return null;
|
|
201
|
+
return { hour: h, minute: m };
|
|
202
|
+
}, []);
|
|
203
|
+
const initialized = reactExports.useRef(false);
|
|
204
|
+
reactExports.useEffect(() => {
|
|
205
|
+
if (initialized.current || !parsed) return;
|
|
206
|
+
initialized.current = true;
|
|
207
|
+
setHour(parsed.hour);
|
|
208
|
+
setMinute(parsed.minute);
|
|
209
|
+
const parts = value.trim().split(/\s+/);
|
|
210
|
+
if (parts.length >= 5) {
|
|
211
|
+
const dayField = parts.slice(2, 5).join(" ");
|
|
212
|
+
if (dayField === "* * 1-5") setDayMode("weekdays");
|
|
213
|
+
else if (dayField === "* * 0,6") setDayMode("weekends");
|
|
214
|
+
else if (dayField === "* * *" || parts[2] === "*") setDayMode("daily");
|
|
215
|
+
if (parts[1] === "*") setDayMode("hourly");
|
|
216
|
+
}
|
|
217
|
+
setRawCron(value);
|
|
218
|
+
}, [parsed, value]);
|
|
219
|
+
const cronExpr = reactExports.useMemo(() => toCron(hour, minute, dayMode), [hour, minute, dayMode]);
|
|
220
|
+
const description = reactExports.useMemo(() => describeSchedule(hour, minute, dayMode), [hour, minute, dayMode]);
|
|
221
|
+
const handleTimeChange = (e) => {
|
|
222
|
+
const [h, m] = e.target.value.split(":").map(Number);
|
|
223
|
+
if (!isNaN(h)) setHour(h);
|
|
224
|
+
if (!isNaN(m)) setMinute(m);
|
|
225
|
+
if (dayMode === "hourly") setDayMode("daily");
|
|
226
|
+
};
|
|
227
|
+
const handlePreset = (preset) => {
|
|
228
|
+
setHour(preset.hour);
|
|
229
|
+
setMinute(preset.minute);
|
|
230
|
+
setDayMode(preset.dayMode);
|
|
231
|
+
};
|
|
232
|
+
const handleRawChange = (e) => {
|
|
233
|
+
setRawCron(e.target.value);
|
|
234
|
+
};
|
|
235
|
+
const effectiveCron = showRaw ? rawCron : cronExpr;
|
|
236
|
+
reactExports.useEffect(() => {
|
|
237
|
+
onChange(effectiveCron);
|
|
238
|
+
}, [effectiveCron]);
|
|
239
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
|
|
240
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-xs font-medium text-muted-foreground mb-1 block", children: "Schedule" }),
|
|
241
|
+
!showRaw ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
242
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
243
|
+
"input",
|
|
244
|
+
{
|
|
245
|
+
type: "time",
|
|
246
|
+
value: `${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}`,
|
|
247
|
+
onChange: handleTimeChange,
|
|
248
|
+
className: "flex h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-sm shadow-xs focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
|
|
249
|
+
}
|
|
250
|
+
),
|
|
251
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex rounded-lg border border-border overflow-hidden text-xs font-medium", children: [
|
|
252
|
+
{ value: "daily", label: "Every day" },
|
|
253
|
+
{ value: "weekdays", label: "Weekdays" },
|
|
254
|
+
{ value: "weekends", label: "Weekends" }
|
|
255
|
+
].map((d, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
256
|
+
"button",
|
|
257
|
+
{
|
|
258
|
+
type: "button",
|
|
259
|
+
onClick: () => setDayMode(d.value),
|
|
260
|
+
className: cn(
|
|
261
|
+
"flex-1 px-3 py-1.5 transition-colors text-center",
|
|
262
|
+
i > 0 && "border-l border-border",
|
|
263
|
+
dayMode === d.value ? "bg-primary text-primary-foreground font-semibold" : "bg-background text-muted-foreground hover:bg-muted"
|
|
264
|
+
),
|
|
265
|
+
children: d.label
|
|
266
|
+
},
|
|
267
|
+
d.value
|
|
268
|
+
)) }),
|
|
269
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1.5", children: PRESETS.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
270
|
+
"button",
|
|
271
|
+
{
|
|
272
|
+
type: "button",
|
|
273
|
+
onClick: () => handlePreset(p),
|
|
274
|
+
className: cn(
|
|
275
|
+
"px-2.5 py-1 rounded-md text-[11px] font-medium transition-colors",
|
|
276
|
+
hour === p.hour && minute === p.minute && dayMode === p.dayMode ? "bg-emerald-500/10 text-emerald-600 border border-emerald-500/20 shadow-xs" : "bg-muted/50 text-muted-foreground border border-border/50 hover:bg-muted hover:text-foreground"
|
|
277
|
+
),
|
|
278
|
+
children: p.label
|
|
279
|
+
},
|
|
280
|
+
p.label
|
|
281
|
+
)) }),
|
|
282
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs text-muted-foreground flex items-center gap-1.5", children: [
|
|
283
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(IconClock, { className: "h-3.5 w-3.5" }),
|
|
284
|
+
description
|
|
285
|
+
] }),
|
|
286
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
287
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("code", { className: "text-[11px] text-muted-foreground/60 font-mono", children: cronExpr }),
|
|
288
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
289
|
+
"button",
|
|
290
|
+
{
|
|
291
|
+
type: "button",
|
|
292
|
+
onClick: () => {
|
|
293
|
+
setRawCron(cronExpr);
|
|
294
|
+
setShowRaw(true);
|
|
295
|
+
},
|
|
296
|
+
className: "text-[10px] text-muted-foreground/40 hover:text-muted-foreground underline underline-offset-2 transition-colors",
|
|
297
|
+
children: "Raw cron"
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
] })
|
|
301
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-2", children: [
|
|
302
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
303
|
+
Input,
|
|
304
|
+
{
|
|
305
|
+
value: rawCron,
|
|
306
|
+
onChange: handleRawChange,
|
|
307
|
+
placeholder: "0 9 * * *",
|
|
308
|
+
className: "h-9 text-sm font-mono"
|
|
309
|
+
}
|
|
310
|
+
),
|
|
311
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-[10px] text-muted-foreground flex items-center gap-1.5", children: [
|
|
312
|
+
"minute hour day month weekday",
|
|
313
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
314
|
+
"button",
|
|
315
|
+
{
|
|
316
|
+
type: "button",
|
|
317
|
+
onClick: () => setShowRaw(false),
|
|
318
|
+
className: "underline underline-offset-2 hover:text-foreground ml-auto transition-colors",
|
|
319
|
+
children: "Use time picker"
|
|
320
|
+
}
|
|
321
|
+
)
|
|
322
|
+
] })
|
|
323
|
+
] })
|
|
324
|
+
] });
|
|
325
|
+
}
|
|
326
|
+
function StatusDot({ status }) {
|
|
327
|
+
if (!status) return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-2 w-2 rounded-full bg-muted-foreground/30" });
|
|
328
|
+
const ok = status === "ok" || status === "success" || status === "completed";
|
|
329
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("h-2 w-2 rounded-full", ok ? "bg-emerald-500" : "bg-red-500") });
|
|
330
|
+
}
|
|
331
|
+
function JobCard({
|
|
332
|
+
job,
|
|
333
|
+
onEdit,
|
|
334
|
+
onDelete,
|
|
335
|
+
onToggle
|
|
336
|
+
}) {
|
|
337
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cn(
|
|
338
|
+
"rounded-xl border bg-card p-5 transition-colors group relative",
|
|
339
|
+
job.enabled !== false ? "border-border hover:border-emerald-500/30" : "border-border opacity-60"
|
|
340
|
+
), children: [
|
|
341
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute top-3 right-3 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity", children: [
|
|
342
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
343
|
+
Button,
|
|
344
|
+
{
|
|
345
|
+
variant: "ghost",
|
|
346
|
+
size: "icon-sm",
|
|
347
|
+
className: "h-7 w-7",
|
|
348
|
+
onClick: (e) => {
|
|
349
|
+
e.stopPropagation();
|
|
350
|
+
onToggle();
|
|
351
|
+
},
|
|
352
|
+
title: job.enabled !== false ? "Disable" : "Enable",
|
|
353
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconPower, { className: cn("h-3.5 w-3.5", job.enabled !== false ? "text-emerald-500" : "text-muted-foreground") })
|
|
354
|
+
}
|
|
355
|
+
),
|
|
356
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
357
|
+
Button,
|
|
358
|
+
{
|
|
359
|
+
variant: "ghost",
|
|
360
|
+
size: "icon-sm",
|
|
361
|
+
className: "h-7 w-7",
|
|
362
|
+
onClick: (e) => {
|
|
363
|
+
e.stopPropagation();
|
|
364
|
+
onEdit();
|
|
365
|
+
},
|
|
366
|
+
title: "Edit",
|
|
367
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconPencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
371
|
+
Button,
|
|
372
|
+
{
|
|
373
|
+
variant: "ghost",
|
|
374
|
+
size: "icon-sm",
|
|
375
|
+
className: "h-7 w-7 hover:text-red-500",
|
|
376
|
+
onClick: (e) => {
|
|
377
|
+
e.stopPropagation();
|
|
378
|
+
onDelete();
|
|
379
|
+
},
|
|
380
|
+
title: "Delete",
|
|
381
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconTrash, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
382
|
+
}
|
|
383
|
+
)
|
|
384
|
+
] }),
|
|
385
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-3 mb-3", children: [
|
|
386
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2.5 min-w-0", children: [
|
|
387
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn(
|
|
388
|
+
"h-8 w-8 rounded-lg flex items-center justify-center shrink-0",
|
|
389
|
+
job.enabled !== false ? "bg-emerald-500/10 text-emerald-600" : "bg-muted text-muted-foreground"
|
|
390
|
+
), children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconClock, { className: "h-4 w-4" }) }),
|
|
391
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [
|
|
392
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold truncate pr-20", children: jobName(job) }),
|
|
393
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-[11px] text-muted-foreground font-mono", children: scheduleText(job.schedule) })
|
|
394
|
+
] })
|
|
395
|
+
] }),
|
|
396
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(StatusDot, { status: job.last_status })
|
|
397
|
+
] }),
|
|
398
|
+
job.prompt && /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs text-muted-foreground leading-relaxed line-clamp-2 mb-3", children: job.prompt }),
|
|
399
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-4 text-[11px] text-muted-foreground", children: [
|
|
400
|
+
job.run_count != null && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1", children: [
|
|
401
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(IconPlayerPlay, { className: "h-3 w-3" }),
|
|
402
|
+
job.run_count,
|
|
403
|
+
" runs"
|
|
404
|
+
] }),
|
|
405
|
+
job.next_run_at && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1", children: [
|
|
406
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(IconCalendar, { className: "h-3 w-3" }),
|
|
407
|
+
"Next: ",
|
|
408
|
+
formatTime(job.next_run_at)
|
|
409
|
+
] }),
|
|
410
|
+
job.last_run_at && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: timeAgo(job.last_run_at) })
|
|
411
|
+
] })
|
|
412
|
+
] });
|
|
413
|
+
}
|
|
414
|
+
function RunRow({ run }) {
|
|
415
|
+
const [open, setOpen] = reactExports.useState(false);
|
|
416
|
+
const detail = useQuery({
|
|
417
|
+
queryKey: ["cron", "run", run.jobId, run.fileName],
|
|
418
|
+
queryFn: () => get(
|
|
419
|
+
`/api/cron-history/${encodeURIComponent(run.jobId)}/${encodeURIComponent(run.fileName)}`
|
|
420
|
+
),
|
|
421
|
+
enabled: open
|
|
422
|
+
});
|
|
423
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "border-b border-border/50 last:border-b-0", children: [
|
|
424
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
425
|
+
"button",
|
|
426
|
+
{
|
|
427
|
+
onClick: () => setOpen(!open),
|
|
428
|
+
className: "flex w-full items-center gap-3 px-4 py-2.5 text-left hover:bg-muted/30 transition-colors group",
|
|
429
|
+
children: [
|
|
430
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(IconChevronRight, { className: cn("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform", open && "rotate-90") }),
|
|
431
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium text-foreground/80 min-w-[80px]", children: run.jobId }),
|
|
432
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-muted-foreground flex-1", children: run.runTime }),
|
|
433
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[10px] text-muted-foreground/60 font-mono shrink-0", children: formatSize(run.size) })
|
|
434
|
+
]
|
|
435
|
+
}
|
|
436
|
+
),
|
|
437
|
+
open && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4 pb-4 pl-10", children: detail.isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 py-3 text-muted-foreground text-xs", children: [
|
|
438
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
439
|
+
"Loading..."
|
|
440
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "text-[12px] font-mono leading-relaxed whitespace-pre-wrap text-foreground/80 bg-muted/30 rounded-lg p-3 border border-border/50 max-h-[400px] overflow-auto", children: detail.data?.content || "No output" }) })
|
|
441
|
+
] });
|
|
442
|
+
}
|
|
443
|
+
function AutomationsPage() {
|
|
444
|
+
const queryClient = useQueryClient();
|
|
445
|
+
const jobs = useJobs();
|
|
446
|
+
const runs = useCronRuns(null);
|
|
447
|
+
const [showForm, setShowForm] = reactExports.useState(false);
|
|
448
|
+
const [editingJob, setEditingJob] = reactExports.useState(null);
|
|
449
|
+
const [formName, setFormName] = reactExports.useState("");
|
|
450
|
+
const [formSchedule, setFormSchedule] = reactExports.useState("");
|
|
451
|
+
const [formPrompt, setFormPrompt] = reactExports.useState("");
|
|
452
|
+
const refresh = reactExports.useCallback(() => {
|
|
453
|
+
jobs.refetch();
|
|
454
|
+
runs.refetch();
|
|
455
|
+
}, [jobs, runs]);
|
|
456
|
+
const createMut = useMutation({
|
|
457
|
+
mutationFn: (data) => post("/api/cron-history/jobs", data),
|
|
458
|
+
onSuccess: () => {
|
|
459
|
+
queryClient.invalidateQueries({ queryKey: ["cron", "jobs"] });
|
|
460
|
+
setShowForm(false);
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
const updateMut = useMutation({
|
|
464
|
+
mutationFn: ({ id, data }) => patch(`/api/cron-history/jobs/${id}`, data),
|
|
465
|
+
onSuccess: () => {
|
|
466
|
+
queryClient.invalidateQueries({ queryKey: ["cron", "jobs"] });
|
|
467
|
+
setEditingJob(null);
|
|
468
|
+
setShowForm(false);
|
|
469
|
+
}
|
|
470
|
+
});
|
|
471
|
+
const deleteMut = useMutation({
|
|
472
|
+
mutationFn: (id) => del(`/api/cron-history/jobs/${id}`),
|
|
473
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ["cron", "jobs"] })
|
|
474
|
+
});
|
|
475
|
+
const toggleMut = useMutation({
|
|
476
|
+
mutationFn: (id) => post(`/api/cron-history/jobs/${id}/toggle`, {}),
|
|
477
|
+
onSuccess: () => queryClient.invalidateQueries({ queryKey: ["cron", "jobs"] })
|
|
478
|
+
});
|
|
479
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-1 flex-col overflow-hidden", children: [
|
|
480
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 border-b px-6 py-4", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
481
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
482
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-lg font-semibold", children: "Automations" }),
|
|
483
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Scheduled cron jobs managed by the Hermes agent" })
|
|
484
|
+
] }),
|
|
485
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
486
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { size: "sm", variant: "outline", className: "gap-1.5", onClick: () => {
|
|
487
|
+
setEditingJob(null);
|
|
488
|
+
setFormName("");
|
|
489
|
+
setFormSchedule("");
|
|
490
|
+
setFormPrompt("");
|
|
491
|
+
setShowForm(true);
|
|
492
|
+
}, children: [
|
|
493
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(IconPlus, { className: "h-4 w-4" }),
|
|
494
|
+
"New Job"
|
|
495
|
+
] }),
|
|
496
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
497
|
+
"button",
|
|
498
|
+
{
|
|
499
|
+
onClick: refresh,
|
|
500
|
+
className: "flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",
|
|
501
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconRefresh, { className: cn("h-4 w-4", (jobs.isFetching || runs.isFetching) && "animate-spin") })
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
] })
|
|
505
|
+
] }) }),
|
|
506
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto", children: [
|
|
507
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Dialog, { open: showForm, onOpenChange: (v) => {
|
|
508
|
+
if (!v) {
|
|
509
|
+
setShowForm(false);
|
|
510
|
+
setEditingJob(null);
|
|
511
|
+
}
|
|
512
|
+
}, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(DialogContent, { children: [
|
|
513
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(DialogHeader, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogTitle, { children: editingJob ? "Edit Cron Job" : "New Cron Job" }) }),
|
|
514
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-3", children: [
|
|
515
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
516
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-xs font-medium text-muted-foreground mb-1 block", children: "Name" }),
|
|
517
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
518
|
+
Input,
|
|
519
|
+
{
|
|
520
|
+
value: formName,
|
|
521
|
+
onChange: (e) => setFormName(e.target.value),
|
|
522
|
+
placeholder: "e.g. Daily weather report",
|
|
523
|
+
className: "h-9 text-sm"
|
|
524
|
+
}
|
|
525
|
+
)
|
|
526
|
+
] }),
|
|
527
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
528
|
+
SchedulePicker,
|
|
529
|
+
{
|
|
530
|
+
value: formSchedule,
|
|
531
|
+
onChange: setFormSchedule
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
535
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("label", { className: "text-xs font-medium text-muted-foreground mb-1 block", children: "Prompt" }),
|
|
536
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
537
|
+
Textarea,
|
|
538
|
+
{
|
|
539
|
+
value: formPrompt,
|
|
540
|
+
onChange: (e) => setFormPrompt(e.target.value),
|
|
541
|
+
placeholder: "What should the agent do when this job runs?",
|
|
542
|
+
className: "min-h-[80px] text-sm",
|
|
543
|
+
rows: 4
|
|
544
|
+
}
|
|
545
|
+
)
|
|
546
|
+
] })
|
|
547
|
+
] }),
|
|
548
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(DialogFooter, { children: [
|
|
549
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { size: "sm", variant: "ghost", onClick: () => {
|
|
550
|
+
setShowForm(false);
|
|
551
|
+
setEditingJob(null);
|
|
552
|
+
}, children: "Cancel" }),
|
|
553
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
554
|
+
Button,
|
|
555
|
+
{
|
|
556
|
+
size: "sm",
|
|
557
|
+
disabled: !formName.trim() || !formSchedule.trim(),
|
|
558
|
+
onClick: () => {
|
|
559
|
+
const data = { name: formName.trim(), schedule: formSchedule.trim(), prompt: formPrompt.trim() };
|
|
560
|
+
if (editingJob) {
|
|
561
|
+
updateMut.mutate({ id: jobId(editingJob), data });
|
|
562
|
+
} else {
|
|
563
|
+
createMut.mutate(data);
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
children: editingJob ? "Save Changes" : "Create Job"
|
|
567
|
+
}
|
|
568
|
+
)
|
|
569
|
+
] })
|
|
570
|
+
] }) }),
|
|
571
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-6 pt-5 pb-2", children: [
|
|
572
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-3", children: "Jobs" }),
|
|
573
|
+
jobs.isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-xl border border-border bg-card h-36 animate-pulse", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "p-5 space-y-3", children: [
|
|
574
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-4 bg-muted rounded w-1/2" }),
|
|
575
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-3 bg-muted rounded w-3/4" }),
|
|
576
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-3 bg-muted rounded w-full" })
|
|
577
|
+
] }) }, i)) }) : jobs.data?.jobs?.length ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4", children: jobs.data.jobs.map((job) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
578
|
+
JobCard,
|
|
579
|
+
{
|
|
580
|
+
job,
|
|
581
|
+
onEdit: () => {
|
|
582
|
+
setEditingJob(job);
|
|
583
|
+
setFormName(job.name || "");
|
|
584
|
+
setFormSchedule(scheduleText(job.schedule));
|
|
585
|
+
setFormPrompt(job.prompt || "");
|
|
586
|
+
setShowForm(true);
|
|
587
|
+
},
|
|
588
|
+
onDelete: () => deleteMut.mutate(jobId(job)),
|
|
589
|
+
onToggle: () => toggleMut.mutate(jobId(job))
|
|
590
|
+
},
|
|
591
|
+
jobId(job)
|
|
592
|
+
)) }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-xl border border-dashed border-border bg-muted/20 py-12 text-center", children: [
|
|
593
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(IconClock, { className: "h-8 w-8 text-muted-foreground/40 mx-auto mb-3" }),
|
|
594
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm font-medium text-foreground", children: "No cron jobs yet" }),
|
|
595
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs text-muted-foreground mt-1", children: [
|
|
596
|
+
"Click ",
|
|
597
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "New Job" }),
|
|
598
|
+
" to create one"
|
|
599
|
+
] })
|
|
600
|
+
] })
|
|
601
|
+
] }),
|
|
602
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-6 pb-6", children: [
|
|
603
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("h2", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-3 mt-6", children: "Run History" }),
|
|
604
|
+
runs.isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "space-y-1", children: [1, 2, 3, 4, 5].map((i) => /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-10 bg-muted/30 rounded animate-pulse" }, i)) }) : runs.data?.runs?.length ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-xl border border-border bg-card overflow-hidden", children: runs.data.runs.slice(0, 50).map((run) => /* @__PURE__ */ jsxRuntimeExports.jsx(RunRow, { run }, `${run.jobId}/${run.fileName}`)) }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "rounded-xl border border-dashed border-border bg-muted/20 py-10 text-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-muted-foreground", children: "No runs yet" }) })
|
|
605
|
+
] })
|
|
606
|
+
] })
|
|
607
|
+
] });
|
|
608
|
+
}
|
|
609
|
+
const SplitComponent = AutomationsPage;
|
|
610
|
+
export {
|
|
611
|
+
SplitComponent as component
|
|
612
|
+
};
|