@flanksource/clicky-ui 0.3.47 → 0.3.48
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/README.md +49 -0
- package/dist/comments/CommentSidePanel.cjs +10 -4
- package/dist/comments/CommentSidePanel.cjs.map +1 -1
- package/dist/comments/CommentSidePanel.d.ts +2 -0
- package/dist/comments/CommentSidePanel.d.ts.map +1 -1
- package/dist/comments/CommentSidePanel.js +10 -4
- package/dist/comments/CommentSidePanel.js.map +1 -1
- package/dist/comments/CommentThread.cjs +2 -0
- package/dist/comments/CommentThread.cjs.map +1 -1
- package/dist/comments/CommentThread.d.ts +2 -1
- package/dist/comments/CommentThread.d.ts.map +1 -1
- package/dist/comments/CommentThread.js +2 -0
- package/dist/comments/CommentThread.js.map +1 -1
- package/dist/comments/CommentThreadList.cjs +3 -0
- package/dist/comments/CommentThreadList.cjs.map +1 -1
- package/dist/comments/CommentThreadList.d.ts +3 -1
- package/dist/comments/CommentThreadList.d.ts.map +1 -1
- package/dist/comments/CommentThreadList.js +3 -0
- package/dist/comments/CommentThreadList.js.map +1 -1
- package/dist/data/CodeLine.cjs +4 -2
- package/dist/data/CodeLine.cjs.map +1 -1
- package/dist/data/CodeLine.d.ts.map +1 -1
- package/dist/data/CodeLine.js +4 -2
- package/dist/data/CodeLine.js.map +1 -1
- package/dist/data/SymbolBadge.cjs +61 -0
- package/dist/data/SymbolBadge.cjs.map +1 -0
- package/dist/data/SymbolBadge.d.ts +21 -0
- package/dist/data/SymbolBadge.d.ts.map +1 -0
- package/dist/data/SymbolBadge.js +61 -0
- package/dist/data/SymbolBadge.js.map +1 -0
- package/dist/data/test-runner/TestDetailPanel.cjs +26 -12
- package/dist/data/test-runner/TestDetailPanel.cjs.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.d.ts.map +1 -1
- package/dist/data/test-runner/TestDetailPanel.js +27 -13
- package/dist/data/test-runner/TestDetailPanel.js.map +1 -1
- package/dist/data/test-runner/TestRunner.cjs +6 -0
- package/dist/data/test-runner/TestRunner.cjs.map +1 -1
- package/dist/data/test-runner/TestRunner.d.ts +3 -1
- package/dist/data/test-runner/TestRunner.d.ts.map +1 -1
- package/dist/data/test-runner/TestRunner.js +6 -0
- package/dist/data/test-runner/TestRunner.js.map +1 -1
- package/dist/data/test-runner/TestTreeNode.cjs +2 -1
- package/dist/data/test-runner/TestTreeNode.cjs.map +1 -1
- package/dist/data/test-runner/TestTreeNode.d.ts.map +1 -1
- package/dist/data/test-runner/TestTreeNode.js +2 -1
- package/dist/data/test-runner/TestTreeNode.js.map +1 -1
- package/dist/data/test-runner/adapter.cjs +4 -0
- package/dist/data/test-runner/adapter.cjs.map +1 -1
- package/dist/data/test-runner/adapter.d.ts +9 -0
- package/dist/data/test-runner/adapter.d.ts.map +1 -1
- package/dist/data/test-runner/adapter.js +4 -0
- package/dist/data/test-runner/adapter.js.map +1 -1
- package/dist/data/test-runner/context.cjs.map +1 -1
- package/dist/data/test-runner/context.d.ts +2 -0
- package/dist/data/test-runner/context.d.ts.map +1 -1
- package/dist/data/test-runner/context.js.map +1 -1
- package/dist/data/test-runner/index.d.ts +2 -2
- package/dist/data/test-runner/index.d.ts.map +1 -1
- package/dist/data/test-runner/marks.cjs +42 -1
- package/dist/data/test-runner/marks.cjs.map +1 -1
- package/dist/data/test-runner/marks.d.ts +10 -0
- package/dist/data/test-runner/marks.d.ts.map +1 -1
- package/dist/data/test-runner/marks.js +42 -1
- package/dist/data/test-runner/marks.js.map +1 -1
- package/dist/data/traces/TerminalCastPlayer.d.ts +21 -0
- package/dist/data/traces/TerminalCastPlayer.d.ts.map +1 -0
- package/dist/data/traces/TraceHarView.d.ts +13 -0
- package/dist/data/traces/TraceHarView.d.ts.map +1 -0
- package/dist/data/traces/cast.d.ts +9 -0
- package/dist/data/traces/cast.d.ts.map +1 -0
- package/dist/data/traces/fixtures.d.ts +8 -0
- package/dist/data/traces/fixtures.d.ts.map +1 -0
- package/dist/data/traces/har-adapter.d.ts +13 -0
- package/dist/data/traces/har-adapter.d.ts.map +1 -0
- package/dist/data/traces/terminal-screen.d.ts +45 -0
- package/dist/data/traces/terminal-screen.d.ts.map +1 -0
- package/dist/data/traces/terminal-timeline.d.ts +26 -0
- package/dist/data/traces/terminal-timeline.d.ts.map +1 -0
- package/dist/data/traces/types.d.ts +141 -0
- package/dist/data/traces/types.d.ts.map +1 -0
- package/dist/data/verification/VerificationResults.cjs +4 -0
- package/dist/data/verification/VerificationResults.cjs.map +1 -1
- package/dist/data/verification/VerificationResults.d.ts +3 -1
- package/dist/data/verification/VerificationResults.d.ts.map +1 -1
- package/dist/data/verification/VerificationResults.js +4 -0
- package/dist/data/verification/VerificationResults.js.map +1 -1
- package/dist/data/verification/adapterViews.cjs +12 -3
- package/dist/data/verification/adapterViews.cjs.map +1 -1
- package/dist/data/verification/adapterViews.d.ts +4 -1
- package/dist/data/verification/adapterViews.d.ts.map +1 -1
- package/dist/data/verification/adapterViews.js +12 -3
- package/dist/data/verification/adapterViews.js.map +1 -1
- package/dist/data/verification/adapters.cjs +53 -10
- package/dist/data/verification/adapters.cjs.map +1 -1
- package/dist/data/verification/adapters.d.ts +7 -1
- package/dist/data/verification/adapters.d.ts.map +1 -1
- package/dist/data/verification/adapters.js +53 -10
- package/dist/data/verification/adapters.js.map +1 -1
- package/dist/data/verification/index.d.ts +4 -2
- package/dist/data/verification/index.d.ts.map +1 -1
- package/dist/data/verification/stepKind.cjs +217 -0
- package/dist/data/verification/stepKind.cjs.map +1 -0
- package/dist/data/verification/stepKind.d.ts +87 -0
- package/dist/data/verification/stepKind.d.ts.map +1 -0
- package/dist/data/verification/stepKind.js +217 -0
- package/dist/data/verification/stepKind.js.map +1 -0
- package/dist/data/verification/stepKindViews.cjs +111 -0
- package/dist/data/verification/stepKindViews.cjs.map +1 -0
- package/dist/data/verification/stepKindViews.d.ts +18 -0
- package/dist/data/verification/stepKindViews.d.ts.map +1 -0
- package/dist/data/verification/stepKindViews.js +111 -0
- package/dist/data/verification/stepKindViews.js.map +1 -0
- package/dist/data/verification/verifyReportTests.cjs +1 -0
- package/dist/data/verification/verifyReportTests.cjs.map +1 -1
- package/dist/data/verification/verifyReportTests.d.ts +2 -1
- package/dist/data/verification/verifyReportTests.d.ts.map +1 -1
- package/dist/data/verification/verifyReportTests.js +1 -0
- package/dist/data/verification/verifyReportTests.js.map +1 -1
- package/dist/data/version-info.cjs +3 -3
- package/dist/data/version-info.js +3 -3
- package/dist/data.cjs +14 -0
- package/dist/data.cjs.map +1 -1
- package/dist/data.d.ts +1 -0
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +16 -2
- package/dist/data.js.map +1 -1
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/rpc/FilterForm.cjs +9 -0
- package/dist/rpc/FilterForm.cjs.map +1 -1
- package/dist/rpc/FilterForm.d.ts +5 -1
- package/dist/rpc/FilterForm.d.ts.map +1 -1
- package/dist/rpc/FilterForm.js +9 -0
- package/dist/rpc/FilterForm.js.map +1 -1
- package/dist/rpc/OperationArgsForm.cjs +153 -0
- package/dist/rpc/OperationArgsForm.cjs.map +1 -0
- package/dist/rpc/OperationArgsForm.d.ts +16 -0
- package/dist/rpc/OperationArgsForm.d.ts.map +1 -0
- package/dist/rpc/OperationArgsForm.js +153 -0
- package/dist/rpc/OperationArgsForm.js.map +1 -0
- package/dist/rpc/OperationScheduleDialog.cjs +61 -17
- package/dist/rpc/OperationScheduleDialog.cjs.map +1 -1
- package/dist/rpc/OperationScheduleDialog.d.ts +3 -0
- package/dist/rpc/OperationScheduleDialog.d.ts.map +1 -1
- package/dist/rpc/OperationScheduleDialog.js +62 -18
- package/dist/rpc/OperationScheduleDialog.js.map +1 -1
- package/dist/rpc/OperationSchedules.cjs +6 -1
- package/dist/rpc/OperationSchedules.cjs.map +1 -1
- package/dist/rpc/OperationSchedules.d.ts.map +1 -1
- package/dist/rpc/OperationSchedules.js +6 -1
- package/dist/rpc/OperationSchedules.js.map +1 -1
- package/dist/rpc/operation-schedule-model.cjs +0 -7
- package/dist/rpc/operation-schedule-model.cjs.map +1 -1
- package/dist/rpc/operation-schedule-model.d.ts +0 -2
- package/dist/rpc/operation-schedule-model.d.ts.map +1 -1
- package/dist/rpc/operation-schedule-model.js +0 -7
- package/dist/rpc/operation-schedule-model.js.map +1 -1
- package/dist/rpc/operation-schedule-types.d.ts +6 -1
- package/dist/rpc/operation-schedule-types.d.ts.map +1 -1
- package/dist/rpc.cjs +2 -0
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.ts +1 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +2 -0
- package/dist/rpc.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -5,16 +5,17 @@ import { Combobox } from "../components/Combobox.js";
|
|
|
5
5
|
import { CopyButton } from "../components/CopyButton.js";
|
|
6
6
|
import { Field } from "../components/Field.js";
|
|
7
7
|
import { InputField } from "../components/InputField.js";
|
|
8
|
-
import { JsonSchemaForm } from "../components/JsonSchemaForm.js";
|
|
9
8
|
import { ScheduleEditor } from "../components/ScheduleEditor.js";
|
|
10
9
|
import { Modal } from "../overlay/Modal.js";
|
|
11
|
-
import { newOperationScheduleInput, scheduleToInput, operationByID,
|
|
10
|
+
import { newOperationScheduleInput, scheduleToInput, operationByID, operationLabel } from "./operation-schedule-model.js";
|
|
12
11
|
import { operationCLICommand } from "./operation-cli-command.js";
|
|
13
12
|
import { InlineError } from "./InlineError.js";
|
|
13
|
+
import { OperationArgsForm } from "./OperationArgsForm.js";
|
|
14
14
|
import { OperationPicker } from "./OperationPicker.js";
|
|
15
15
|
function OperationScheduleDialog(_props) {
|
|
16
16
|
var _a, _b, _c, _d;
|
|
17
17
|
const {
|
|
18
|
+
client,
|
|
18
19
|
open,
|
|
19
20
|
operations,
|
|
20
21
|
schedule,
|
|
@@ -32,19 +33,34 @@ function OperationScheduleDialog(_props) {
|
|
|
32
33
|
const [pending, setPending] = useState();
|
|
33
34
|
const [error, setError] = useState();
|
|
34
35
|
const [confirmingRun, setConfirmingRun] = useState(false);
|
|
36
|
+
const [concurrencyText, setConcurrencyText] = useState("1");
|
|
37
|
+
const [argsValid, setArgsValid] = useState(true);
|
|
38
|
+
const [argsSession, setArgsSession] = useState(0);
|
|
35
39
|
useEffect(() => {
|
|
36
40
|
if (!open) return;
|
|
41
|
+
setArgsSession((session) => session + 1);
|
|
37
42
|
setInput(
|
|
38
43
|
schedule ? scheduleToInput(schedule) : {
|
|
39
44
|
...newOperationScheduleInput(),
|
|
40
45
|
targets: [...defaultTargets ?? []]
|
|
41
46
|
}
|
|
42
47
|
);
|
|
48
|
+
setConcurrencyText(String((schedule == null ? void 0 : schedule.concurrency) ?? 1));
|
|
43
49
|
setError(void 0);
|
|
44
50
|
setConfirmingRun(false);
|
|
45
51
|
}, [open, schedule, defaultTargets]);
|
|
52
|
+
const multiTarget = input.targets.length > 1;
|
|
53
|
+
const concurrency = Number(concurrencyText);
|
|
54
|
+
const concurrencyValid = !multiTarget || concurrencyText.trim() !== "" && Number.isInteger(concurrency) && concurrency >= 1 && concurrency <= input.targets.length;
|
|
55
|
+
const concurrencyPayload = multiTarget ? { concurrency } : {};
|
|
56
|
+
const changeTargets = (targets) => {
|
|
57
|
+
setInput({ ...input, targets });
|
|
58
|
+
const limit = Math.max(1, targets.length);
|
|
59
|
+
setConcurrencyText(
|
|
60
|
+
(current) => Number(current) > limit ? String(limit) : current
|
|
61
|
+
);
|
|
62
|
+
};
|
|
46
63
|
const operation = operationByID(operations, input.operationId);
|
|
47
|
-
const schema = operationInputSchema(operation);
|
|
48
64
|
const suggestions = ((_b = (_a = operation == null ? void 0 : operation.operation["x-clicky"]) == null ? void 0 : _a.schedule) == null ? void 0 : _b.suggestions) ?? [];
|
|
49
65
|
const destructive = ((_d = (_c = operation == null ? void 0 : operation.operation["x-clicky"]) == null ? void 0 : _c.toolHints) == null ? void 0 : _d.destructiveHint) === true;
|
|
50
66
|
const cliCommand = (cli == null ? void 0 : cli.targetFlag) ? input.targets.map(
|
|
@@ -70,7 +86,7 @@ function OperationScheduleDialog(_props) {
|
|
|
70
86
|
setPending("save");
|
|
71
87
|
setError(void 0);
|
|
72
88
|
try {
|
|
73
|
-
await onSave(input);
|
|
89
|
+
await onSave({ ...input, ...concurrencyPayload });
|
|
74
90
|
onClose();
|
|
75
91
|
} catch (nextError) {
|
|
76
92
|
setError(nextError);
|
|
@@ -85,7 +101,8 @@ function OperationScheduleDialog(_props) {
|
|
|
85
101
|
await onRunNow({
|
|
86
102
|
operationId: input.operationId,
|
|
87
103
|
args: input.args,
|
|
88
|
-
targets: input.targets
|
|
104
|
+
targets: input.targets,
|
|
105
|
+
...concurrencyPayload
|
|
89
106
|
});
|
|
90
107
|
setConfirmingRun(false);
|
|
91
108
|
onClose();
|
|
@@ -97,9 +114,11 @@ function OperationScheduleDialog(_props) {
|
|
|
97
114
|
}
|
|
98
115
|
};
|
|
99
116
|
const canSave = Boolean(
|
|
100
|
-
input.name.trim() && input.operationId && input.cron.trim() && input.targets.length
|
|
117
|
+
input.name.trim() && input.operationId && input.cron.trim() && input.targets.length && concurrencyValid && argsValid
|
|
118
|
+
);
|
|
119
|
+
const canRun = Boolean(
|
|
120
|
+
input.operationId && input.targets.length && concurrencyValid && argsValid
|
|
101
121
|
);
|
|
102
|
-
const canRun = Boolean(input.operationId && input.targets.length);
|
|
103
122
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
104
123
|
/* @__PURE__ */ jsx(
|
|
105
124
|
Modal,
|
|
@@ -150,11 +169,34 @@ function OperationScheduleDialog(_props) {
|
|
|
150
169
|
allowCustomValue: false,
|
|
151
170
|
options: targetOptions,
|
|
152
171
|
value: input.targets,
|
|
153
|
-
onChange:
|
|
172
|
+
onChange: changeTargets
|
|
154
173
|
}
|
|
155
174
|
)
|
|
156
175
|
}
|
|
157
176
|
),
|
|
177
|
+
multiTarget ? /* @__PURE__ */ jsx(
|
|
178
|
+
Field,
|
|
179
|
+
{
|
|
180
|
+
label: `${targetLabel} at once`,
|
|
181
|
+
htmlFor: "operation-schedule-concurrency",
|
|
182
|
+
error: concurrencyValid ? void 0 : `Enter a whole number from 1 to ${input.targets.length}.`,
|
|
183
|
+
helper: `How many of the ${input.targets.length} selected run at the same time; the rest wait their turn.`,
|
|
184
|
+
children: /* @__PURE__ */ jsx(
|
|
185
|
+
InputField,
|
|
186
|
+
{
|
|
187
|
+
id: "operation-schedule-concurrency",
|
|
188
|
+
type: "number",
|
|
189
|
+
inputMode: "numeric",
|
|
190
|
+
min: 1,
|
|
191
|
+
max: input.targets.length,
|
|
192
|
+
step: 1,
|
|
193
|
+
invalid: !concurrencyValid,
|
|
194
|
+
value: concurrencyText,
|
|
195
|
+
onChange: setConcurrencyText
|
|
196
|
+
}
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
) : null,
|
|
158
200
|
/* @__PURE__ */ jsx(
|
|
159
201
|
Field,
|
|
160
202
|
{
|
|
@@ -180,19 +222,20 @@ function OperationScheduleDialog(_props) {
|
|
|
180
222
|
onChange: selectOperation
|
|
181
223
|
}
|
|
182
224
|
),
|
|
183
|
-
operation ?
|
|
225
|
+
operation ? /* @__PURE__ */ jsxs("section", { className: "space-y-2", children: [
|
|
184
226
|
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Arguments" }),
|
|
185
227
|
/* @__PURE__ */ jsx(
|
|
186
|
-
|
|
228
|
+
OperationArgsForm,
|
|
187
229
|
{
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
230
|
+
client,
|
|
231
|
+
operation,
|
|
232
|
+
args: input.args,
|
|
233
|
+
onChange: (args) => setInput((current) => ({ ...current, args })),
|
|
234
|
+
onValidityChange: setArgsValid
|
|
235
|
+
},
|
|
236
|
+
`${argsSession}:${input.operationId}`
|
|
194
237
|
)
|
|
195
|
-
] }) :
|
|
238
|
+
] }) : null,
|
|
196
239
|
cliCommand ? /* @__PURE__ */ jsxs("section", { className: "space-y-1", children: [
|
|
197
240
|
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Equivalent CLI command" }),
|
|
198
241
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-md border bg-muted/30 px-3 py-2", children: [
|
|
@@ -247,7 +290,8 @@ function OperationScheduleDialog(_props) {
|
|
|
247
290
|
/* @__PURE__ */ jsxs("p", { className: "mt-2 text-sm", children: [
|
|
248
291
|
targetLabel,
|
|
249
292
|
": ",
|
|
250
|
-
input.targets.join(", ")
|
|
293
|
+
input.targets.join(", "),
|
|
294
|
+
multiTarget ? ` (${concurrency} at once)` : ""
|
|
251
295
|
] })
|
|
252
296
|
]
|
|
253
297
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationScheduleDialog.js","sources":["../../src/rpc/OperationScheduleDialog.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Combobox } from \"../components/Combobox\";\nimport type { ComboboxOption } from \"../components/combobox-types\";\nimport { CopyButton } from \"../components/CopyButton\";\nimport { Field } from \"../components/Field\";\nimport { InputField } from \"../components/InputField\";\nimport { JsonSchemaForm } from \"../components/JsonSchemaForm\";\nimport { ScheduleEditor } from \"../components/ScheduleEditor\";\nimport { Modal } from \"../overlay/Modal\";\nimport {\n newOperationScheduleInput,\n operationByID,\n operationInputSchema,\n operationLabel,\n scheduleToInput,\n} from \"./operation-schedule-model\";\nimport { operationCLICommand } from \"./operation-cli-command\";\nimport type {\n OperationSchedule,\n OperationScheduleCLI,\n OperationScheduleInput,\n OperationScheduleRunInput,\n} from \"./operation-schedule-types\";\nimport type { ResolvedOperation } from \"./types\";\nimport { InlineError } from \"./InlineError\";\nimport { OperationPicker } from \"./OperationPicker\";\n\nexport interface OperationScheduleDialogProps {\n open: boolean;\n operations: readonly ResolvedOperation[];\n targetOptions: ComboboxOption[];\n defaultTargets?: string[];\n targetLabel?: string;\n schedule?: OperationSchedule;\n cli?: OperationScheduleCLI;\n onClose: () => void;\n onSave: (input: OperationScheduleInput) => Promise<unknown>;\n onRunNow: (input: OperationScheduleRunInput) => Promise<unknown>;\n}\n\nexport function OperationScheduleDialog(_props: OperationScheduleDialogProps) {\n const {\n open,\n operations,\n schedule,\n cli,\n targetOptions,\n defaultTargets,\n targetLabel = \"Targets\",\n onClose,\n onSave,\n onRunNow,\n } = _props;\n const [input, setInput] = useState<OperationScheduleInput>(\n newOperationScheduleInput,\n );\n const [pending, setPending] = useState<\"save\" | \"run\">();\n const [error, setError] = useState<unknown>();\n const [confirmingRun, setConfirmingRun] = useState(false);\n\n useEffect(() => {\n if (!open) return;\n setInput(\n schedule\n ? scheduleToInput(schedule)\n : {\n ...newOperationScheduleInput(),\n targets: [...(defaultTargets ?? [])],\n },\n );\n setError(undefined);\n setConfirmingRun(false);\n }, [open, schedule, defaultTargets]);\n\n const operation = operationByID(operations, input.operationId);\n const schema = operationInputSchema(operation);\n const suggestions =\n operation?.operation[\"x-clicky\"]?.schedule?.suggestions ?? [];\n const destructive =\n operation?.operation[\"x-clicky\"]?.toolHints?.destructiveHint === true;\n const cliCommand = cli?.targetFlag\n ? input.targets\n .map((target) =>\n operationCLICommand(operation, input.args, {\n ...cli,\n globalFlags: { ...cli.globalFlags, [cli.targetFlag!]: target },\n }),\n )\n .join(\"\\n\")\n : operationCLICommand(operation, input.args, cli);\n\n const selectOperation = (operationId: string) => {\n const selected = operationByID(operations, operationId);\n setInput((current) => ({\n ...current,\n operationId,\n args: {},\n name: current.name || operationLabel(selected),\n cron:\n selected?.operation[\"x-clicky\"]?.schedule?.suggestions?.[0]?.cron ??\n current.cron,\n }));\n };\n\n const save = async () => {\n setPending(\"save\");\n setError(undefined);\n try {\n await onSave(input);\n onClose();\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n const run = async () => {\n setPending(\"run\");\n setError(undefined);\n try {\n await onRunNow({\n operationId: input.operationId,\n args: input.args,\n targets: input.targets,\n });\n setConfirmingRun(false);\n onClose();\n } catch (nextError) {\n setError(nextError);\n setConfirmingRun(false);\n } finally {\n setPending(undefined);\n }\n };\n\n const canSave = Boolean(\n input.name.trim() &&\n input.operationId &&\n input.cron.trim() &&\n input.targets.length,\n );\n const canRun = Boolean(input.operationId && input.targets.length);\n\n return (\n <>\n <Modal\n open={open}\n onClose={onClose}\n title={schedule ? \"Edit schedule\" : \"Add schedule\"}\n size=\"xl\"\n footer={\n <div className=\"flex w-full flex-wrap justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant={destructive ? \"destructive\" : \"secondary\"}\n disabled={!canRun}\n loading={pending === \"run\"}\n onClick={() => setConfirmingRun(true)}\n >\n Run now\n </Button>\n <Button\n type=\"button\"\n disabled={!canSave}\n loading={pending === \"save\"}\n onClick={save}\n >\n Save schedule\n </Button>\n </div>\n }\n >\n <div className=\"space-y-5\">\n <Field\n label={targetLabel}\n htmlFor=\"operation-schedule-targets\"\n required\n >\n <Combobox\n id=\"operation-schedule-targets\"\n multiple\n variant=\"tags\"\n ariaLabel={targetLabel}\n ariaRequired\n allowCustomValue={false}\n options={targetOptions}\n value={input.targets}\n onChange={(targets) => setInput({ ...input, targets })}\n />\n </Field>\n <Field\n label=\"Schedule name\"\n htmlFor=\"operation-schedule-name\"\n required\n >\n <InputField\n id=\"operation-schedule-name\"\n value={input.name}\n onChange={(name) => setInput({ ...input, name })}\n />\n </Field>\n <OperationPicker\n id=\"operation-schedule-operation\"\n operations={operations}\n value={input.operationId}\n onChange={selectOperation}\n />\n {operation ? (\n schema && Object.keys(schema.properties ?? {}).length > 0 ? (\n <section className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold\">Arguments</h3>\n <JsonSchemaForm\n schema={schema}\n value={input.args}\n onChange={(args) => setInput({ ...input, args })}\n idPrefix=\"operation-schedule-args\"\n showPreferencesMenu={false}\n />\n </section>\n ) : (\n <p className=\"text-sm text-muted-foreground\">\n This operation has no arguments.\n </p>\n )\n ) : null}\n {cliCommand ? (\n <section className=\"space-y-1\">\n <h3 className=\"text-sm font-semibold\">Equivalent CLI command</h3>\n <div className=\"flex items-center gap-2 rounded-md border bg-muted/30 px-3 py-2\">\n <code className=\"min-w-0 flex-1 overflow-x-auto whitespace-pre text-xs\">\n {cliCommand}\n </code>\n <CopyButton value={cliCommand} label=\"Copy CLI command\" />\n </div>\n </section>\n ) : null}\n <ScheduleEditor\n id=\"operation-schedule\"\n value={input}\n onChange={(timing) => setInput({ ...input, ...timing })}\n cronSuggestions={suggestions}\n timezoneSuggestions={[input.timezone, \"UTC\"]}\n />\n {error ? (\n <InlineError title=\"Schedule action failed\" error={error} />\n ) : null}\n </div>\n </Modal>\n <Modal\n open={confirmingRun}\n onClose={() => setConfirmingRun(false)}\n title={`Run ${operationLabel(operation)} now?`}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmingRun(false)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant={destructive ? \"destructive\" : \"default\"}\n loading={pending === \"run\"}\n onClick={run}\n >\n Run now\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n This runs the configured operation once without creating or changing a\n recurring schedule.\n </p>\n <p className=\"mt-2 text-sm\">\n {targetLabel}: {input.targets.join(\", \")}\n </p>\n </Modal>\n </>\n );\n}\n"],"names":["_d","_c","_b","_a"],"mappings":";;;;;;;;;;;;;;AAyCO,SAAS,wBAAwB,QAAsC;;AAC5E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAI;A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,cACL,SAAQ;AAAA,cACR,SAAS,MAAM,iBAAiB,KAAK;AAAA,cACtC,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGD;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAS,cAAc,gBAAgB;AAAA,cACvC,SAAS,YAAY;AAAA,cACrB,SAAS;AAAA,cACV,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED,GACF;AAAA,QAGF,UAAA;AAAA,UAAA,oBAAC,KAAA,EAAE,WAAU,iCAAgC,UAAA,8FAG7C;AAAA,UACA,qBAAC,KAAA,EAAE,WAAU,gBACV,UAAA;AAAA,YAAA;AAAA,YAAY;AAAA,YAAG,MAAM,QAAQ,KAAK,IAAI;AAAA,UAAA,EAAA,CACzC;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"OperationScheduleDialog.js","sources":["../../src/rpc/OperationScheduleDialog.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Combobox } from \"../components/Combobox\";\nimport type { ComboboxOption } from \"../components/combobox-types\";\nimport { CopyButton } from \"../components/CopyButton\";\nimport { Field } from \"../components/Field\";\nimport { InputField } from \"../components/InputField\";\nimport { ScheduleEditor } from \"../components/ScheduleEditor\";\nimport { Modal } from \"../overlay/Modal\";\nimport {\n newOperationScheduleInput,\n operationByID,\n operationLabel,\n scheduleToInput,\n} from \"./operation-schedule-model\";\nimport { operationCLICommand } from \"./operation-cli-command\";\nimport type {\n OperationSchedule,\n OperationScheduleCLI,\n OperationScheduleInput,\n OperationScheduleRunInput,\n} from \"./operation-schedule-types\";\nimport type { ResolvedOperation } from \"./types\";\nimport type { OperationsApiClient } from \"./useOperations\";\nimport { InlineError } from \"./InlineError\";\nimport { OperationArgsForm } from \"./OperationArgsForm\";\nimport { OperationPicker } from \"./OperationPicker\";\n\nexport interface OperationScheduleDialogProps {\n /** Client for the argument form's lookups (the operation's parameter pickers). */\n client: OperationsApiClient;\n open: boolean;\n operations: readonly ResolvedOperation[];\n targetOptions: ComboboxOption[];\n defaultTargets?: string[];\n targetLabel?: string;\n schedule?: OperationSchedule;\n cli?: OperationScheduleCLI;\n onClose: () => void;\n onSave: (input: OperationScheduleInput) => Promise<unknown>;\n onRunNow: (input: OperationScheduleRunInput) => Promise<unknown>;\n}\n\nexport function OperationScheduleDialog(_props: OperationScheduleDialogProps) {\n const {\n client,\n open,\n operations,\n schedule,\n cli,\n targetOptions,\n defaultTargets,\n targetLabel = \"Targets\",\n onClose,\n onSave,\n onRunNow,\n } = _props;\n const [input, setInput] = useState<OperationScheduleInput>(\n newOperationScheduleInput,\n );\n const [pending, setPending] = useState<\"save\" | \"run\">();\n const [error, setError] = useState<unknown>();\n const [confirmingRun, setConfirmingRun] = useState(false);\n const [concurrencyText, setConcurrencyText] = useState(\"1\");\n const [argsValid, setArgsValid] = useState(true);\n // Each opening remounts the argument form so it loads the args set below,\n // not the ones a previous opening left in input.\n const [argsSession, setArgsSession] = useState(0);\n\n useEffect(() => {\n if (!open) return;\n setArgsSession((session) => session + 1);\n setInput(\n schedule\n ? scheduleToInput(schedule)\n : {\n ...newOperationScheduleInput(),\n targets: [...(defaultTargets ?? [])],\n },\n );\n setConcurrencyText(String(schedule?.concurrency ?? 1));\n setError(undefined);\n setConfirmingRun(false);\n }, [open, schedule, defaultTargets]);\n\n const multiTarget = input.targets.length > 1;\n const concurrency = Number(concurrencyText);\n const concurrencyValid =\n !multiTarget ||\n (concurrencyText.trim() !== \"\" &&\n Number.isInteger(concurrency) &&\n concurrency >= 1 &&\n concurrency <= input.targets.length);\n const concurrencyPayload = multiTarget ? { concurrency } : {};\n\n const changeTargets = (targets: string[]) => {\n setInput({ ...input, targets });\n const limit = Math.max(1, targets.length);\n setConcurrencyText((current) =>\n Number(current) > limit ? String(limit) : current,\n );\n };\n\n const operation = operationByID(operations, input.operationId);\n const suggestions =\n operation?.operation[\"x-clicky\"]?.schedule?.suggestions ?? [];\n const destructive =\n operation?.operation[\"x-clicky\"]?.toolHints?.destructiveHint === true;\n const cliCommand = cli?.targetFlag\n ? input.targets\n .map((target) =>\n operationCLICommand(operation, input.args, {\n ...cli,\n globalFlags: { ...cli.globalFlags, [cli.targetFlag!]: target },\n }),\n )\n .join(\"\\n\")\n : operationCLICommand(operation, input.args, cli);\n\n const selectOperation = (operationId: string) => {\n const selected = operationByID(operations, operationId);\n setInput((current) => ({\n ...current,\n operationId,\n args: {},\n name: current.name || operationLabel(selected),\n cron:\n selected?.operation[\"x-clicky\"]?.schedule?.suggestions?.[0]?.cron ??\n current.cron,\n }));\n };\n\n const save = async () => {\n setPending(\"save\");\n setError(undefined);\n try {\n await onSave({ ...input, ...concurrencyPayload });\n onClose();\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n const run = async () => {\n setPending(\"run\");\n setError(undefined);\n try {\n await onRunNow({\n operationId: input.operationId,\n args: input.args,\n targets: input.targets,\n ...concurrencyPayload,\n });\n setConfirmingRun(false);\n onClose();\n } catch (nextError) {\n setError(nextError);\n setConfirmingRun(false);\n } finally {\n setPending(undefined);\n }\n };\n\n const canSave = Boolean(\n input.name.trim() &&\n input.operationId &&\n input.cron.trim() &&\n input.targets.length &&\n concurrencyValid &&\n argsValid,\n );\n const canRun = Boolean(\n input.operationId && input.targets.length && concurrencyValid && argsValid,\n );\n\n return (\n <>\n <Modal\n open={open}\n onClose={onClose}\n title={schedule ? \"Edit schedule\" : \"Add schedule\"}\n size=\"xl\"\n footer={\n <div className=\"flex w-full flex-wrap justify-end gap-2\">\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant={destructive ? \"destructive\" : \"secondary\"}\n disabled={!canRun}\n loading={pending === \"run\"}\n onClick={() => setConfirmingRun(true)}\n >\n Run now\n </Button>\n <Button\n type=\"button\"\n disabled={!canSave}\n loading={pending === \"save\"}\n onClick={save}\n >\n Save schedule\n </Button>\n </div>\n }\n >\n <div className=\"space-y-5\">\n <Field\n label={targetLabel}\n htmlFor=\"operation-schedule-targets\"\n required\n >\n <Combobox\n id=\"operation-schedule-targets\"\n multiple\n variant=\"tags\"\n ariaLabel={targetLabel}\n ariaRequired\n allowCustomValue={false}\n options={targetOptions}\n value={input.targets}\n onChange={changeTargets}\n />\n </Field>\n {multiTarget ? (\n <Field\n label={`${targetLabel} at once`}\n htmlFor=\"operation-schedule-concurrency\"\n error={\n concurrencyValid\n ? undefined\n : `Enter a whole number from 1 to ${input.targets.length}.`\n }\n helper={`How many of the ${input.targets.length} selected run at the same time; the rest wait their turn.`}\n >\n <InputField\n id=\"operation-schedule-concurrency\"\n type=\"number\"\n inputMode=\"numeric\"\n min={1}\n max={input.targets.length}\n step={1}\n invalid={!concurrencyValid}\n value={concurrencyText}\n onChange={setConcurrencyText}\n />\n </Field>\n ) : null}\n <Field\n label=\"Schedule name\"\n htmlFor=\"operation-schedule-name\"\n required\n >\n <InputField\n id=\"operation-schedule-name\"\n value={input.name}\n onChange={(name) => setInput({ ...input, name })}\n />\n </Field>\n <OperationPicker\n id=\"operation-schedule-operation\"\n operations={operations}\n value={input.operationId}\n onChange={selectOperation}\n />\n {operation ? (\n <section className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold\">Arguments</h3>\n <OperationArgsForm\n key={`${argsSession}:${input.operationId}`}\n client={client}\n operation={operation}\n args={input.args}\n onChange={(args) =>\n setInput((current) => ({ ...current, args }))\n }\n onValidityChange={setArgsValid}\n />\n </section>\n ) : null}\n {cliCommand ? (\n <section className=\"space-y-1\">\n <h3 className=\"text-sm font-semibold\">Equivalent CLI command</h3>\n <div className=\"flex items-center gap-2 rounded-md border bg-muted/30 px-3 py-2\">\n <code className=\"min-w-0 flex-1 overflow-x-auto whitespace-pre text-xs\">\n {cliCommand}\n </code>\n <CopyButton value={cliCommand} label=\"Copy CLI command\" />\n </div>\n </section>\n ) : null}\n <ScheduleEditor\n id=\"operation-schedule\"\n value={input}\n onChange={(timing) => setInput({ ...input, ...timing })}\n cronSuggestions={suggestions}\n timezoneSuggestions={[input.timezone, \"UTC\"]}\n />\n {error ? (\n <InlineError title=\"Schedule action failed\" error={error} />\n ) : null}\n </div>\n </Modal>\n <Modal\n open={confirmingRun}\n onClose={() => setConfirmingRun(false)}\n title={`Run ${operationLabel(operation)} now?`}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmingRun(false)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant={destructive ? \"destructive\" : \"default\"}\n loading={pending === \"run\"}\n onClick={run}\n >\n Run now\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n This runs the configured operation once without creating or changing a\n recurring schedule.\n </p>\n <p className=\"mt-2 text-sm\">\n {targetLabel}: {input.targets.join(\", \")}\n {multiTarget ? ` (${concurrency} at once)` : \"\"}\n </p>\n </Modal>\n </>\n );\n}\n"],"names":["_d","_c","_b","_a"],"mappings":";;;;;;;;;;;;;;AA2CO,SAAS,wBAAwB,QAAsC;;AAC5E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,cAAc;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,CAAC,OAAO,QAAQ,IAAI;AAAA,IACxB;AAAA,EAAA;AAEF,QAAM,CAAC,SAAS,UAAU,IAAI,SAAA;AAC9B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAA;AAC1B,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,CAAC,iBAAiB,kBAAkB,IAAI,SAAS,GAAG;AAC1D,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAG/C,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,CAAC;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AAAA,YAAG,MAAM,QAAQ,KAAK,IAAI;AAAA,YACtC,cAAc,KAAK,WAAW,cAAc;AAAA,UAAA,EAAA,CAC/C;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -10,6 +10,7 @@ const OperationScheduleDialog = require("./OperationScheduleDialog.cjs");
|
|
|
10
10
|
const InlineError = require("./InlineError.cjs");
|
|
11
11
|
function OperationSchedules(_props) {
|
|
12
12
|
const {
|
|
13
|
+
client,
|
|
13
14
|
operations,
|
|
14
15
|
schedules,
|
|
15
16
|
disabled,
|
|
@@ -84,7 +85,10 @@ function OperationSchedules(_props) {
|
|
|
84
85
|
children: [
|
|
85
86
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
86
87
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate font-semibold", children: schedule.name }),
|
|
87
|
-
/* @__PURE__ */ jsxRuntime.
|
|
88
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs text-muted-foreground", children: [
|
|
89
|
+
schedule.targets.join(", "),
|
|
90
|
+
schedule.concurrency && schedule.targets.length > 1 ? ` · ${schedule.concurrency} at once` : ""
|
|
91
|
+
] }),
|
|
88
92
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-xs text-muted-foreground", children: operationScheduleModel.operationLabel(operation) })
|
|
89
93
|
] }),
|
|
90
94
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 text-sm", children: [
|
|
@@ -144,6 +148,7 @@ function OperationSchedules(_props) {
|
|
|
144
148
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
145
149
|
OperationScheduleDialog.OperationScheduleDialog,
|
|
146
150
|
{
|
|
151
|
+
client,
|
|
147
152
|
open: dialogOpen,
|
|
148
153
|
operations,
|
|
149
154
|
targetOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationSchedules.cjs","sources":["../../src/rpc/OperationSchedules.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Loading } from \"../components/loading\";\nimport { Modal } from \"../overlay/Modal\";\nimport {\n formatScheduleTimestamp,\n operationByID,\n operationLabel,\n} from \"./operation-schedule-model\";\nimport type { OperationSchedule } from \"./operation-schedule-types\";\nimport type { OperationSchedulesProps } from \"./operation-schedule-types\";\nimport { OperationScheduleDialog } from \"./OperationScheduleDialog\";\nimport { InlineError } from \"./InlineError\";\n\nexport function OperationSchedules(_props: OperationSchedulesProps) {\n const {\n operations,\n schedules,\n disabled,\n loading,\n onCreate,\n onUpdate,\n onDelete,\n onRunSaved,\n onRunDraft,\n cli,\n targetOptions,\n defaultTargets,\n targetLabel,\n } = _props;\n const [dialogOpen, setDialogOpen] = useState(false);\n const [editing, setEditing] = useState<OperationSchedule>();\n const [confirmRun, setConfirmRun] = useState<OperationSchedule>();\n const [confirmDelete, setConfirmDelete] = useState<OperationSchedule>();\n const [pending, setPending] = useState<\"run\" | \"delete\">();\n const [error, setError] = useState<unknown>();\n\n const openAdd = () => {\n setEditing(undefined);\n setDialogOpen(true);\n };\n const openEdit = (schedule: OperationSchedule) => {\n setEditing(schedule);\n setDialogOpen(true);\n };\n\n const runSaved = async () => {\n if (!confirmRun) return;\n setPending(\"run\");\n setError(undefined);\n try {\n await onRunSaved(confirmRun.id);\n setConfirmRun(undefined);\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n const deleteSaved = async () => {\n if (!confirmDelete) return;\n setPending(\"delete\");\n setError(undefined);\n try {\n await onDelete(confirmDelete.id);\n setConfirmDelete(undefined);\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n if (loading) return <Loading variant=\"centered\" label=\"Loading schedules…\" />;\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex justify-end\">\n <Button type=\"button\" disabled={disabled} onClick={openAdd}>\n Add schedule\n </Button>\n </div>\n {error ? (\n <InlineError title=\"Schedule action failed\" error={error} />\n ) : null}\n {schedules.length === 0 ? (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No schedules yet. Add one to run an operation automatically.\n </div>\n ) : (\n <div\n role=\"list\"\n aria-label=\"Schedules\"\n className=\"divide-y rounded-lg border bg-card\"\n >\n {schedules.map((schedule) => {\n const operation = operationByID(operations, schedule.operationId);\n return (\n <div\n key={schedule.id}\n role=\"listitem\"\n className=\"grid gap-3 px-4 py-3 lg:grid-cols-[minmax(12rem,1.1fr)_minmax(12rem,1fr)_minmax(14rem,1fr)_auto] lg:items-center\"\n >\n <div className=\"min-w-0\">\n <div className=\"truncate font-semibold\">{schedule.name}</div>\n <div className=\"text-xs text-muted-foreground\">{schedule.targets.join(\", \")}</div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {operationLabel(operation)}\n </div>\n </div>\n <div className=\"min-w-0 text-sm\">\n <code>{schedule.cron}</code>\n <div className=\"text-xs text-muted-foreground\">\n {schedule.timezone}\n </div>\n </div>\n <div className=\"text-xs text-muted-foreground\">\n <div>\n {schedule.enabled\n ? `Next: ${formatScheduleTimestamp(schedule.nextRun)}`\n : \"Paused\"}\n </div>\n {schedule.lastRun ? (\n <div>Last: {formatScheduleTimestamp(schedule.lastRun)}</div>\n ) : null}\n </div>\n <div className=\"flex flex-wrap justify-end gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={`Run ${schedule.name} now`}\n onClick={() => setConfirmRun(schedule)}\n >\n Run now\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={disabled}\n onClick={() => openEdit(schedule)}\n >\n Edit\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n disabled={disabled}\n onClick={() => setConfirmDelete(schedule)}\n >\n Delete\n </Button>\n </div>\n </div>\n );\n })}\n </div>\n )}\n <OperationScheduleDialog\n open={dialogOpen}\n operations={operations}\n targetOptions={targetOptions}\n {...(defaultTargets ? { defaultTargets } : {})}\n {...(targetLabel ? { targetLabel } : {})}\n {...(editing ? { schedule: editing } : {})}\n onClose={() => setDialogOpen(false)}\n onSave={(input) =>\n editing ? onUpdate(editing.id, input) : onCreate(input)\n }\n onRunNow={onRunDraft}\n {...(cli ? { cli } : {})}\n />\n <Modal\n open={Boolean(confirmRun)}\n onClose={() => setConfirmRun(undefined)}\n title={confirmRun ? `Run ${confirmRun.name} now?` : \"Run schedule now?\"}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmRun(undefined)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n loading={pending === \"run\"}\n onClick={runSaved}\n >\n Run now\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n The recurring schedule is unchanged.\n {confirmRun ? ` Targets: ${confirmRun.targets.join(\", \")}.` : \"\"}\n </p>\n </Modal>\n <Modal\n open={Boolean(confirmDelete)}\n onClose={() => setConfirmDelete(undefined)}\n title={\n confirmDelete ? `Delete ${confirmDelete.name}?` : \"Delete schedule?\"\n }\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmDelete(undefined)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n loading={pending === \"delete\"}\n onClick={deleteSaved}\n >\n Delete schedule\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n This removes the recurring definition. Previous run history is\n retained.\n </p>\n </Modal>\n </div>\n );\n}\n"],"names":["loading","useState","jsx","Loading","jsxs","Button","InlineError","operationByID","operationLabel","formatScheduleTimestamp","OperationScheduleDialog","Modal"],"mappings":";;;;;;;;;;AAcO,SAAS,mBAAmB,QAAiC;AAClE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IAAA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I,WAAU,iCACb,UAAA;AAAA,UAAAF,2BAAAA;AAAAA,YAACG,OAAAA;AAAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,SAAS,MAAM,iBAAiB,MAAS;AAAA,cAC1C,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGDH,2BAAAA;AAAAA,YAACG,OAAAA;AAAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,SAAS,YAAY;AAAA,cACrB,SAAS;AAAA,cACV,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED,GACF;AAAA,QAGF,UAAAH,2BAAAA,IAAC,KAAA,EAAE,WAAU,iCAAgC,UAAA,2EAAA,CAG7C;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;"}
|
|
1
|
+
{"version":3,"file":"OperationSchedules.cjs","sources":["../../src/rpc/OperationSchedules.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Loading } from \"../components/loading\";\nimport { Modal } from \"../overlay/Modal\";\nimport {\n formatScheduleTimestamp,\n operationByID,\n operationLabel,\n} from \"./operation-schedule-model\";\nimport type { OperationSchedule } from \"./operation-schedule-types\";\nimport type { OperationSchedulesProps } from \"./operation-schedule-types\";\nimport { OperationScheduleDialog } from \"./OperationScheduleDialog\";\nimport { InlineError } from \"./InlineError\";\n\nexport function OperationSchedules(_props: OperationSchedulesProps) {\n const {\n client,\n operations,\n schedules,\n disabled,\n loading,\n onCreate,\n onUpdate,\n onDelete,\n onRunSaved,\n onRunDraft,\n cli,\n targetOptions,\n defaultTargets,\n targetLabel,\n } = _props;\n const [dialogOpen, setDialogOpen] = useState(false);\n const [editing, setEditing] = useState<OperationSchedule>();\n const [confirmRun, setConfirmRun] = useState<OperationSchedule>();\n const [confirmDelete, setConfirmDelete] = useState<OperationSchedule>();\n const [pending, setPending] = useState<\"run\" | \"delete\">();\n const [error, setError] = useState<unknown>();\n\n const openAdd = () => {\n setEditing(undefined);\n setDialogOpen(true);\n };\n const openEdit = (schedule: OperationSchedule) => {\n setEditing(schedule);\n setDialogOpen(true);\n };\n\n const runSaved = async () => {\n if (!confirmRun) return;\n setPending(\"run\");\n setError(undefined);\n try {\n await onRunSaved(confirmRun.id);\n setConfirmRun(undefined);\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n const deleteSaved = async () => {\n if (!confirmDelete) return;\n setPending(\"delete\");\n setError(undefined);\n try {\n await onDelete(confirmDelete.id);\n setConfirmDelete(undefined);\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n if (loading) return <Loading variant=\"centered\" label=\"Loading schedules…\" />;\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex justify-end\">\n <Button type=\"button\" disabled={disabled} onClick={openAdd}>\n Add schedule\n </Button>\n </div>\n {error ? (\n <InlineError title=\"Schedule action failed\" error={error} />\n ) : null}\n {schedules.length === 0 ? (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No schedules yet. Add one to run an operation automatically.\n </div>\n ) : (\n <div\n role=\"list\"\n aria-label=\"Schedules\"\n className=\"divide-y rounded-lg border bg-card\"\n >\n {schedules.map((schedule) => {\n const operation = operationByID(operations, schedule.operationId);\n return (\n <div\n key={schedule.id}\n role=\"listitem\"\n className=\"grid gap-3 px-4 py-3 lg:grid-cols-[minmax(12rem,1.1fr)_minmax(12rem,1fr)_minmax(14rem,1fr)_auto] lg:items-center\"\n >\n <div className=\"min-w-0\">\n <div className=\"truncate font-semibold\">{schedule.name}</div>\n <div className=\"text-xs text-muted-foreground\">\n {schedule.targets.join(\", \")}\n {schedule.concurrency && schedule.targets.length > 1\n ? ` · ${schedule.concurrency} at once`\n : \"\"}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {operationLabel(operation)}\n </div>\n </div>\n <div className=\"min-w-0 text-sm\">\n <code>{schedule.cron}</code>\n <div className=\"text-xs text-muted-foreground\">\n {schedule.timezone}\n </div>\n </div>\n <div className=\"text-xs text-muted-foreground\">\n <div>\n {schedule.enabled\n ? `Next: ${formatScheduleTimestamp(schedule.nextRun)}`\n : \"Paused\"}\n </div>\n {schedule.lastRun ? (\n <div>Last: {formatScheduleTimestamp(schedule.lastRun)}</div>\n ) : null}\n </div>\n <div className=\"flex flex-wrap justify-end gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={`Run ${schedule.name} now`}\n onClick={() => setConfirmRun(schedule)}\n >\n Run now\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={disabled}\n onClick={() => openEdit(schedule)}\n >\n Edit\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n disabled={disabled}\n onClick={() => setConfirmDelete(schedule)}\n >\n Delete\n </Button>\n </div>\n </div>\n );\n })}\n </div>\n )}\n <OperationScheduleDialog\n client={client}\n open={dialogOpen}\n operations={operations}\n targetOptions={targetOptions}\n {...(defaultTargets ? { defaultTargets } : {})}\n {...(targetLabel ? { targetLabel } : {})}\n {...(editing ? { schedule: editing } : {})}\n onClose={() => setDialogOpen(false)}\n onSave={(input) =>\n editing ? onUpdate(editing.id, input) : onCreate(input)\n }\n onRunNow={onRunDraft}\n {...(cli ? { cli } : {})}\n />\n <Modal\n open={Boolean(confirmRun)}\n onClose={() => setConfirmRun(undefined)}\n title={confirmRun ? `Run ${confirmRun.name} now?` : \"Run schedule now?\"}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmRun(undefined)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n loading={pending === \"run\"}\n onClick={runSaved}\n >\n Run now\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n The recurring schedule is unchanged.\n {confirmRun ? ` Targets: ${confirmRun.targets.join(\", \")}.` : \"\"}\n </p>\n </Modal>\n <Modal\n open={Boolean(confirmDelete)}\n onClose={() => setConfirmDelete(undefined)}\n title={\n confirmDelete ? `Delete ${confirmDelete.name}?` : \"Delete schedule?\"\n }\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmDelete(undefined)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n loading={pending === \"delete\"}\n onClick={deleteSaved}\n >\n Delete schedule\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n This removes the recurring definition. Previous run history is\n retained.\n </p>\n </Modal>\n </div>\n );\n}\n"],"names":["loading","useState","jsx","Loading","jsxs","Button","InlineError","operationByID","operationLabel","formatScheduleTimestamp","OperationScheduleDialog","Modal"],"mappings":";;;;;;;;;;AAcO,SAAS,mBAAmB,QAAiC;AAClE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAAA,SACAA;AAAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,CAAC,YAAY,aAAa,IAAIC,MAAAA,SAAS,KAAK;AAClD,QAAM,CAAC,SAAS,UAAU,IAAIA,eAAA;AAC9B,QAAM,CAAC,YAAY,aAAa,IAAIA,eAAA;AACpC,QAAM,CAAC,eAAe,gBAAgB,IAAIA,eAAA;AAC1C,QAAM,CAAC,SAAS,UAAU,IAAIA,eAAA;AAC9B,QAAM,CAAC,OAAO,QAAQ,IAAIA,eAAA;AAE1B,QAAM,UAAU,MAAM;AACpB,eAAW,MAAS;AACpB,kBAAc,IAAI;AAAA,EACpB;AACA,QAAM,WAAW,CAAC,aAAgC;AAChD,eAAW,QAAQ;AACnB,kBAAc,IAAI;AAAA,EACpB;AAEA,QAAM,WAAW,YAAY;AAC3B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AAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationSchedules.d.ts","sourceRoot":"","sources":["../../src/rpc/OperationSchedules.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAI1E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,uBAAuB,+
|
|
1
|
+
{"version":3,"file":"OperationSchedules.d.ts","sourceRoot":"","sources":["../../src/rpc/OperationSchedules.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAI1E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,uBAAuB,+BAwOjE"}
|
|
@@ -8,6 +8,7 @@ import { OperationScheduleDialog } from "./OperationScheduleDialog.js";
|
|
|
8
8
|
import { InlineError } from "./InlineError.js";
|
|
9
9
|
function OperationSchedules(_props) {
|
|
10
10
|
const {
|
|
11
|
+
client,
|
|
11
12
|
operations,
|
|
12
13
|
schedules,
|
|
13
14
|
disabled,
|
|
@@ -82,7 +83,10 @@ function OperationSchedules(_props) {
|
|
|
82
83
|
children: [
|
|
83
84
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
84
85
|
/* @__PURE__ */ jsx("div", { className: "truncate font-semibold", children: schedule.name }),
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ jsxs("div", { className: "text-xs text-muted-foreground", children: [
|
|
87
|
+
schedule.targets.join(", "),
|
|
88
|
+
schedule.concurrency && schedule.targets.length > 1 ? ` · ${schedule.concurrency} at once` : ""
|
|
89
|
+
] }),
|
|
86
90
|
/* @__PURE__ */ jsx("div", { className: "truncate text-xs text-muted-foreground", children: operationLabel(operation) })
|
|
87
91
|
] }),
|
|
88
92
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 text-sm", children: [
|
|
@@ -142,6 +146,7 @@ function OperationSchedules(_props) {
|
|
|
142
146
|
/* @__PURE__ */ jsx(
|
|
143
147
|
OperationScheduleDialog,
|
|
144
148
|
{
|
|
149
|
+
client,
|
|
145
150
|
open: dialogOpen,
|
|
146
151
|
operations,
|
|
147
152
|
targetOptions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationSchedules.js","sources":["../../src/rpc/OperationSchedules.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Loading } from \"../components/loading\";\nimport { Modal } from \"../overlay/Modal\";\nimport {\n formatScheduleTimestamp,\n operationByID,\n operationLabel,\n} from \"./operation-schedule-model\";\nimport type { OperationSchedule } from \"./operation-schedule-types\";\nimport type { OperationSchedulesProps } from \"./operation-schedule-types\";\nimport { OperationScheduleDialog } from \"./OperationScheduleDialog\";\nimport { InlineError } from \"./InlineError\";\n\nexport function OperationSchedules(_props: OperationSchedulesProps) {\n const {\n operations,\n schedules,\n disabled,\n loading,\n onCreate,\n onUpdate,\n onDelete,\n onRunSaved,\n onRunDraft,\n cli,\n targetOptions,\n defaultTargets,\n targetLabel,\n } = _props;\n const [dialogOpen, setDialogOpen] = useState(false);\n const [editing, setEditing] = useState<OperationSchedule>();\n const [confirmRun, setConfirmRun] = useState<OperationSchedule>();\n const [confirmDelete, setConfirmDelete] = useState<OperationSchedule>();\n const [pending, setPending] = useState<\"run\" | \"delete\">();\n const [error, setError] = useState<unknown>();\n\n const openAdd = () => {\n setEditing(undefined);\n setDialogOpen(true);\n };\n const openEdit = (schedule: OperationSchedule) => {\n setEditing(schedule);\n setDialogOpen(true);\n };\n\n const runSaved = async () => {\n if (!confirmRun) return;\n setPending(\"run\");\n setError(undefined);\n try {\n await onRunSaved(confirmRun.id);\n setConfirmRun(undefined);\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n const deleteSaved = async () => {\n if (!confirmDelete) return;\n setPending(\"delete\");\n setError(undefined);\n try {\n await onDelete(confirmDelete.id);\n setConfirmDelete(undefined);\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n if (loading) return <Loading variant=\"centered\" label=\"Loading schedules…\" />;\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex justify-end\">\n <Button type=\"button\" disabled={disabled} onClick={openAdd}>\n Add schedule\n </Button>\n </div>\n {error ? (\n <InlineError title=\"Schedule action failed\" error={error} />\n ) : null}\n {schedules.length === 0 ? (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No schedules yet. Add one to run an operation automatically.\n </div>\n ) : (\n <div\n role=\"list\"\n aria-label=\"Schedules\"\n className=\"divide-y rounded-lg border bg-card\"\n >\n {schedules.map((schedule) => {\n const operation = operationByID(operations, schedule.operationId);\n return (\n <div\n key={schedule.id}\n role=\"listitem\"\n className=\"grid gap-3 px-4 py-3 lg:grid-cols-[minmax(12rem,1.1fr)_minmax(12rem,1fr)_minmax(14rem,1fr)_auto] lg:items-center\"\n >\n <div className=\"min-w-0\">\n <div className=\"truncate font-semibold\">{schedule.name}</div>\n <div className=\"text-xs text-muted-foreground\">{schedule.targets.join(\", \")}</div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {operationLabel(operation)}\n </div>\n </div>\n <div className=\"min-w-0 text-sm\">\n <code>{schedule.cron}</code>\n <div className=\"text-xs text-muted-foreground\">\n {schedule.timezone}\n </div>\n </div>\n <div className=\"text-xs text-muted-foreground\">\n <div>\n {schedule.enabled\n ? `Next: ${formatScheduleTimestamp(schedule.nextRun)}`\n : \"Paused\"}\n </div>\n {schedule.lastRun ? (\n <div>Last: {formatScheduleTimestamp(schedule.lastRun)}</div>\n ) : null}\n </div>\n <div className=\"flex flex-wrap justify-end gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={`Run ${schedule.name} now`}\n onClick={() => setConfirmRun(schedule)}\n >\n Run now\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={disabled}\n onClick={() => openEdit(schedule)}\n >\n Edit\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n disabled={disabled}\n onClick={() => setConfirmDelete(schedule)}\n >\n Delete\n </Button>\n </div>\n </div>\n );\n })}\n </div>\n )}\n <OperationScheduleDialog\n open={dialogOpen}\n operations={operations}\n targetOptions={targetOptions}\n {...(defaultTargets ? { defaultTargets } : {})}\n {...(targetLabel ? { targetLabel } : {})}\n {...(editing ? { schedule: editing } : {})}\n onClose={() => setDialogOpen(false)}\n onSave={(input) =>\n editing ? onUpdate(editing.id, input) : onCreate(input)\n }\n onRunNow={onRunDraft}\n {...(cli ? { cli } : {})}\n />\n <Modal\n open={Boolean(confirmRun)}\n onClose={() => setConfirmRun(undefined)}\n title={confirmRun ? `Run ${confirmRun.name} now?` : \"Run schedule now?\"}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmRun(undefined)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n loading={pending === \"run\"}\n onClick={runSaved}\n >\n Run now\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n The recurring schedule is unchanged.\n {confirmRun ? ` Targets: ${confirmRun.targets.join(\", \")}.` : \"\"}\n </p>\n </Modal>\n <Modal\n open={Boolean(confirmDelete)}\n onClose={() => setConfirmDelete(undefined)}\n title={\n confirmDelete ? `Delete ${confirmDelete.name}?` : \"Delete schedule?\"\n }\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmDelete(undefined)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n loading={pending === \"delete\"}\n onClick={deleteSaved}\n >\n Delete schedule\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n This removes the recurring definition. Previous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AAY;AAAA,cACrB,SAAS;AAAA,cACV,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED,GACF;AAAA,QAGF,UAAA,oBAAC,KAAA,EAAE,WAAU,iCAAgC,UAAA,2EAAA,CAG7C;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"OperationSchedules.js","sources":["../../src/rpc/OperationSchedules.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport { Button } from \"../components/button\";\nimport { Loading } from \"../components/loading\";\nimport { Modal } from \"../overlay/Modal\";\nimport {\n formatScheduleTimestamp,\n operationByID,\n operationLabel,\n} from \"./operation-schedule-model\";\nimport type { OperationSchedule } from \"./operation-schedule-types\";\nimport type { OperationSchedulesProps } from \"./operation-schedule-types\";\nimport { OperationScheduleDialog } from \"./OperationScheduleDialog\";\nimport { InlineError } from \"./InlineError\";\n\nexport function OperationSchedules(_props: OperationSchedulesProps) {\n const {\n client,\n operations,\n schedules,\n disabled,\n loading,\n onCreate,\n onUpdate,\n onDelete,\n onRunSaved,\n onRunDraft,\n cli,\n targetOptions,\n defaultTargets,\n targetLabel,\n } = _props;\n const [dialogOpen, setDialogOpen] = useState(false);\n const [editing, setEditing] = useState<OperationSchedule>();\n const [confirmRun, setConfirmRun] = useState<OperationSchedule>();\n const [confirmDelete, setConfirmDelete] = useState<OperationSchedule>();\n const [pending, setPending] = useState<\"run\" | \"delete\">();\n const [error, setError] = useState<unknown>();\n\n const openAdd = () => {\n setEditing(undefined);\n setDialogOpen(true);\n };\n const openEdit = (schedule: OperationSchedule) => {\n setEditing(schedule);\n setDialogOpen(true);\n };\n\n const runSaved = async () => {\n if (!confirmRun) return;\n setPending(\"run\");\n setError(undefined);\n try {\n await onRunSaved(confirmRun.id);\n setConfirmRun(undefined);\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n const deleteSaved = async () => {\n if (!confirmDelete) return;\n setPending(\"delete\");\n setError(undefined);\n try {\n await onDelete(confirmDelete.id);\n setConfirmDelete(undefined);\n } catch (nextError) {\n setError(nextError);\n } finally {\n setPending(undefined);\n }\n };\n\n if (loading) return <Loading variant=\"centered\" label=\"Loading schedules…\" />;\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex justify-end\">\n <Button type=\"button\" disabled={disabled} onClick={openAdd}>\n Add schedule\n </Button>\n </div>\n {error ? (\n <InlineError title=\"Schedule action failed\" error={error} />\n ) : null}\n {schedules.length === 0 ? (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No schedules yet. Add one to run an operation automatically.\n </div>\n ) : (\n <div\n role=\"list\"\n aria-label=\"Schedules\"\n className=\"divide-y rounded-lg border bg-card\"\n >\n {schedules.map((schedule) => {\n const operation = operationByID(operations, schedule.operationId);\n return (\n <div\n key={schedule.id}\n role=\"listitem\"\n className=\"grid gap-3 px-4 py-3 lg:grid-cols-[minmax(12rem,1.1fr)_minmax(12rem,1fr)_minmax(14rem,1fr)_auto] lg:items-center\"\n >\n <div className=\"min-w-0\">\n <div className=\"truncate font-semibold\">{schedule.name}</div>\n <div className=\"text-xs text-muted-foreground\">\n {schedule.targets.join(\", \")}\n {schedule.concurrency && schedule.targets.length > 1\n ? ` · ${schedule.concurrency} at once`\n : \"\"}\n </div>\n <div className=\"truncate text-xs text-muted-foreground\">\n {operationLabel(operation)}\n </div>\n </div>\n <div className=\"min-w-0 text-sm\">\n <code>{schedule.cron}</code>\n <div className=\"text-xs text-muted-foreground\">\n {schedule.timezone}\n </div>\n </div>\n <div className=\"text-xs text-muted-foreground\">\n <div>\n {schedule.enabled\n ? `Next: ${formatScheduleTimestamp(schedule.nextRun)}`\n : \"Paused\"}\n </div>\n {schedule.lastRun ? (\n <div>Last: {formatScheduleTimestamp(schedule.lastRun)}</div>\n ) : null}\n </div>\n <div className=\"flex flex-wrap justify-end gap-2\">\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={disabled}\n aria-label={`Run ${schedule.name} now`}\n onClick={() => setConfirmRun(schedule)}\n >\n Run now\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n disabled={disabled}\n onClick={() => openEdit(schedule)}\n >\n Edit\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n disabled={disabled}\n onClick={() => setConfirmDelete(schedule)}\n >\n Delete\n </Button>\n </div>\n </div>\n );\n })}\n </div>\n )}\n <OperationScheduleDialog\n client={client}\n open={dialogOpen}\n operations={operations}\n targetOptions={targetOptions}\n {...(defaultTargets ? { defaultTargets } : {})}\n {...(targetLabel ? { targetLabel } : {})}\n {...(editing ? { schedule: editing } : {})}\n onClose={() => setDialogOpen(false)}\n onSave={(input) =>\n editing ? onUpdate(editing.id, input) : onCreate(input)\n }\n onRunNow={onRunDraft}\n {...(cli ? { cli } : {})}\n />\n <Modal\n open={Boolean(confirmRun)}\n onClose={() => setConfirmRun(undefined)}\n title={confirmRun ? `Run ${confirmRun.name} now?` : \"Run schedule now?\"}\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmRun(undefined)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n loading={pending === \"run\"}\n onClick={runSaved}\n >\n Run now\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n The recurring schedule is unchanged.\n {confirmRun ? ` Targets: ${confirmRun.targets.join(\", \")}.` : \"\"}\n </p>\n </Modal>\n <Modal\n open={Boolean(confirmDelete)}\n onClose={() => setConfirmDelete(undefined)}\n title={\n confirmDelete ? `Delete ${confirmDelete.name}?` : \"Delete schedule?\"\n }\n size=\"sm\"\n footer={\n <div className=\"flex w-full justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setConfirmDelete(undefined)}\n >\n Cancel\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n loading={pending === \"delete\"}\n onClick={deleteSaved}\n >\n Delete schedule\n </Button>\n </div>\n }\n >\n <p className=\"text-sm text-muted-foreground\">\n This removes the recurring definition. Previous run history is\n retained.\n </p>\n </Modal>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAcO,SAAS,mBAAmB,QAAiC;AAClE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AACJ,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAClD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAA;AAC9B,QAAM,CAAC,YAAY,aAAa,IAAI,SAAA;AACpC,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAA;AAC1C,QAAM,CAAC,SAAS,UAAU,IAAI,SAAA;AAC9B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAA;AAE1B,QAAM,UAAU,MAAM;AACpB,eAAW,MAAS;AACpB,kBAAc,IAAI;AAAA,EACpB;AACA,QAAM,WAAW,CAAC,aAAgC;AAChD,eAAW,QAAQ;AACnB,kBAAc,IAAI;AAAA,EACpB;AAEA,QAAM,WAAW,YAAY;AAC3B,QAAI,CAAC,WAAY;AACjB,eAAW,KAAK;AAChB,aAAS,MAAS;AAClB,QAAI;AACF,YAAM,WAAW,WAAW,EAAE;AAC9B,oBAAc,MAAS;AAAA,IACzB,SAAS,WAAW;AAClB,eAAS,SAAS;AAAA,IACpB,UAAA;AACE,iBAAW,MAAS;AAAA,IACtB;AAAA,EACF;AAEA,QAAM,cAAc,YAAY;AAC9B,QAAI,CAAC,cAAe;AACpB,eAAW,QAAQ;AACnB,aAAS,MAAS;AAClB,QAAI;AACF,YAAM,SAAS,cAAc,EAAE;AAC/B,uBAAiB,MAAS;AAAA,IAC5B,SAAS,WAAW;AAClB,eAAS,SAAS;AAAA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A,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,SAAS,MAAM,iBAAiB,MAAS;AAAA,cAC1C,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGD;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,SAAQ;AAAA,cACR,SAAS,YAAY;AAAA,cACrB,SAAS;AAAA,cACV,UAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAED,GACF;AAAA,QAGF,UAAA,oBAAC,KAAA,EAAE,WAAU,iCAAgC,UAAA,2EAAA,CAG7C;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -15,12 +15,6 @@ function operationLabel(operation) {
|
|
|
15
15
|
function operationByID(operations, operationID) {
|
|
16
16
|
return operations.find(({ operation }) => operation.operationId === operationID);
|
|
17
17
|
}
|
|
18
|
-
function operationInputSchema(operation) {
|
|
19
|
-
var _a, _b, _c;
|
|
20
|
-
const schema = (_c = (_b = (_a = operation == null ? void 0 : operation.operation.requestBody) == null ? void 0 : _a.content) == null ? void 0 : _b["application/json"]) == null ? void 0 : _c.schema;
|
|
21
|
-
if (!schema || schema.type !== "object") return void 0;
|
|
22
|
-
return schema;
|
|
23
|
-
}
|
|
24
18
|
function newOperationScheduleInput() {
|
|
25
19
|
return {
|
|
26
20
|
name: "",
|
|
@@ -51,7 +45,6 @@ function formatScheduleTimestamp(value) {
|
|
|
51
45
|
exports.formatScheduleTimestamp = formatScheduleTimestamp;
|
|
52
46
|
exports.newOperationScheduleInput = newOperationScheduleInput;
|
|
53
47
|
exports.operationByID = operationByID;
|
|
54
|
-
exports.operationInputSchema = operationInputSchema;
|
|
55
48
|
exports.operationLabel = operationLabel;
|
|
56
49
|
exports.schedulableOperations = schedulableOperations;
|
|
57
50
|
exports.scheduleToInput = scheduleToInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-schedule-model.cjs","sources":["../../src/rpc/operation-schedule-model.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"operation-schedule-model.cjs","sources":["../../src/rpc/operation-schedule-model.ts"],"sourcesContent":["import { DEFAULT_CRON } from \"../components/schedule-types\";\nimport type { OperationSchedule, OperationScheduleInput } from \"./operation-schedule-types\";\nimport type { ResolvedOperation } from \"./types\";\n\nexport function schedulableOperations(\n operations: readonly ResolvedOperation[],\n): ResolvedOperation[] {\n return operations.filter(\n ({ operation }) => Boolean(operation.operationId && operation[\"x-clicky\"]?.schedule),\n );\n}\n\nexport function operationLabel(operation: ResolvedOperation | undefined): string {\n return operation?.operation.summary ?? operation?.operation.operationId ?? \"Unknown operation\";\n}\n\nexport function operationByID(\n operations: readonly ResolvedOperation[],\n operationID: string,\n): ResolvedOperation | undefined {\n return operations.find(({ operation }) => operation.operationId === operationID);\n}\n\nexport function newOperationScheduleInput(): OperationScheduleInput {\n return {\n name: \"\",\n operationId: \"\",\n targets: [],\n args: {},\n cron: DEFAULT_CRON,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || \"UTC\",\n enabled: true,\n };\n}\n\nexport function scheduleToInput(schedule: OperationSchedule): OperationScheduleInput {\n return {\n name: schedule.name,\n operationId: schedule.operationId,\n targets: [...schedule.targets],\n args: schedule.args,\n cron: schedule.cron,\n timezone: schedule.timezone,\n enabled: schedule.enabled,\n };\n}\n\nexport function formatScheduleTimestamp(value: string | undefined): string {\n if (!value) return \"Never\";\n const timestamp = new Date(value);\n return Number.isNaN(timestamp.getTime()) ? value : timestamp.toLocaleString();\n}\n"],"names":["DEFAULT_CRON"],"mappings":";;;AAIO,SAAS,sBACd,YACqB;AACrB,SAAO,WAAW;AAAA,IAChB,CAAC,EAAE,UAAA,MAAU;;AAAM,qBAAQ,UAAU,iBAAe,eAAU,UAAU,MAApB,mBAAuB,SAAQ;AAAA;AAAA,EAAA;AAEvF;AAEO,SAAS,eAAe,WAAkD;AAC/E,UAAO,uCAAW,UAAU,aAAW,uCAAW,UAAU,gBAAe;AAC7E;AAEO,SAAS,cACd,YACA,aAC+B;AAC/B,SAAO,WAAW,KAAK,CAAC,EAAE,gBAAgB,UAAU,gBAAgB,WAAW;AACjF;AAEO,SAAS,4BAAoD;AAClE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS,CAAA;AAAA,IACT,MAAM,CAAA;AAAA,IACN,MAAMA,cAAAA;AAAAA,IACN,UAAU,KAAK,eAAA,EAAiB,gBAAA,EAAkB,YAAY;AAAA,IAC9D,SAAS;AAAA,EAAA;AAEb;AAEO,SAAS,gBAAgB,UAAqD;AACnF,SAAO;AAAA,IACL,MAAM,SAAS;AAAA,IACf,aAAa,SAAS;AAAA,IACtB,SAAS,CAAC,GAAG,SAAS,OAAO;AAAA,IAC7B,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,IACf,UAAU,SAAS;AAAA,IACnB,SAAS,SAAS;AAAA,EAAA;AAEtB;AAEO,SAAS,wBAAwB,OAAmC;AACzE,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,YAAY,IAAI,KAAK,KAAK;AAChC,SAAO,OAAO,MAAM,UAAU,QAAA,CAAS,IAAI,QAAQ,UAAU,eAAA;AAC/D;;;;;;;"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { JsonSchemaObject } from '../components/json-schema-form-types.js';
|
|
2
1
|
import { OperationSchedule, OperationScheduleInput } from './operation-schedule-types.js';
|
|
3
2
|
import { ResolvedOperation } from './types.js';
|
|
4
3
|
export declare function schedulableOperations(operations: readonly ResolvedOperation[]): ResolvedOperation[];
|
|
5
4
|
export declare function operationLabel(operation: ResolvedOperation | undefined): string;
|
|
6
5
|
export declare function operationByID(operations: readonly ResolvedOperation[], operationID: string): ResolvedOperation | undefined;
|
|
7
|
-
export declare function operationInputSchema(operation: ResolvedOperation | undefined): JsonSchemaObject | undefined;
|
|
8
6
|
export declare function newOperationScheduleInput(): OperationScheduleInput;
|
|
9
7
|
export declare function scheduleToInput(schedule: OperationSchedule): OperationScheduleInput;
|
|
10
8
|
export declare function formatScheduleTimestamp(value: string | undefined): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-schedule-model.d.ts","sourceRoot":"","sources":["../../src/rpc/operation-schedule-model.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"operation-schedule-model.d.ts","sourceRoot":"","sources":["../../src/rpc/operation-schedule-model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,SAAS,iBAAiB,EAAE,GACvC,iBAAiB,EAAE,CAIrB;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,iBAAiB,GAAG,SAAS,GAAG,MAAM,CAE/E;AAED,wBAAgB,aAAa,CAC3B,UAAU,EAAE,SAAS,iBAAiB,EAAE,EACxC,WAAW,EAAE,MAAM,GAClB,iBAAiB,GAAG,SAAS,CAE/B;AAED,wBAAgB,yBAAyB,IAAI,sBAAsB,CAUlE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,sBAAsB,CAUnF;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAIzE"}
|
|
@@ -13,12 +13,6 @@ function operationLabel(operation) {
|
|
|
13
13
|
function operationByID(operations, operationID) {
|
|
14
14
|
return operations.find(({ operation }) => operation.operationId === operationID);
|
|
15
15
|
}
|
|
16
|
-
function operationInputSchema(operation) {
|
|
17
|
-
var _a, _b, _c;
|
|
18
|
-
const schema = (_c = (_b = (_a = operation == null ? void 0 : operation.operation.requestBody) == null ? void 0 : _a.content) == null ? void 0 : _b["application/json"]) == null ? void 0 : _c.schema;
|
|
19
|
-
if (!schema || schema.type !== "object") return void 0;
|
|
20
|
-
return schema;
|
|
21
|
-
}
|
|
22
16
|
function newOperationScheduleInput() {
|
|
23
17
|
return {
|
|
24
18
|
name: "",
|
|
@@ -50,7 +44,6 @@ export {
|
|
|
50
44
|
formatScheduleTimestamp,
|
|
51
45
|
newOperationScheduleInput,
|
|
52
46
|
operationByID,
|
|
53
|
-
operationInputSchema,
|
|
54
47
|
operationLabel,
|
|
55
48
|
schedulableOperations,
|
|
56
49
|
scheduleToInput
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-schedule-model.js","sources":["../../src/rpc/operation-schedule-model.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"operation-schedule-model.js","sources":["../../src/rpc/operation-schedule-model.ts"],"sourcesContent":["import { DEFAULT_CRON } from \"../components/schedule-types\";\nimport type { OperationSchedule, OperationScheduleInput } from \"./operation-schedule-types\";\nimport type { ResolvedOperation } from \"./types\";\n\nexport function schedulableOperations(\n operations: readonly ResolvedOperation[],\n): ResolvedOperation[] {\n return operations.filter(\n ({ operation }) => Boolean(operation.operationId && operation[\"x-clicky\"]?.schedule),\n );\n}\n\nexport function operationLabel(operation: ResolvedOperation | undefined): string {\n return operation?.operation.summary ?? operation?.operation.operationId ?? \"Unknown operation\";\n}\n\nexport function operationByID(\n operations: readonly ResolvedOperation[],\n operationID: string,\n): ResolvedOperation | undefined {\n return operations.find(({ operation }) => operation.operationId === operationID);\n}\n\nexport function newOperationScheduleInput(): OperationScheduleInput {\n return {\n name: \"\",\n operationId: \"\",\n targets: [],\n args: {},\n cron: DEFAULT_CRON,\n timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || \"UTC\",\n enabled: true,\n };\n}\n\nexport function scheduleToInput(schedule: OperationSchedule): OperationScheduleInput {\n return {\n name: schedule.name,\n operationId: schedule.operationId,\n targets: [...schedule.targets],\n args: schedule.args,\n cron: schedule.cron,\n timezone: schedule.timezone,\n enabled: schedule.enabled,\n };\n}\n\nexport function formatScheduleTimestamp(value: string | undefined): string {\n if (!value) return \"Never\";\n const timestamp = new Date(value);\n return Number.isNaN(timestamp.getTime()) ? value : timestamp.toLocaleString();\n}\n"],"names":[],"mappings":";AAIO,SAAS,sBACd,YACqB;AACrB,SAAO,WAAW;AAAA,IAChB,CAAC,EAAE,UAAA,MAAU;;AAAM,qBAAQ,UAAU,iBAAe,eAAU,UAAU,MAApB,mBAAuB,SAAQ;AAAA;AAAA,EAAA;AAEvF;AAEO,SAAS,eAAe,WAAkD;AAC/E,UAAO,uCAAW,UAAU,aAAW,uCAAW,UAAU,gBAAe;AAC7E;AAEO,SAAS,cACd,YACA,aAC+B;AAC/B,SAAO,WAAW,KAAK,CAAC,EAAE,gBAAgB,UAAU,gBAAgB,WAAW;AACjF;AAEO,SAAS,4BAAoD;AAClE,SAAO;AAAA,IACL,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS,CAAA;AAAA,IACT,MAAM,CAAA;AAAA,IACN,MAAM;AAAA,IACN,UAAU,KAAK,eAAA,EAAiB,gBAAA,EAAkB,YAAY;AAAA,IAC9D,SAAS;AAAA,EAAA;AAEb;AAEO,SAAS,gBAAgB,UAAqD;AACnF,SAAO;AAAA,IACL,MAAM,SAAS;AAAA,IACf,aAAa,SAAS;AAAA,IACtB,SAAS,CAAC,GAAG,SAAS,OAAO;AAAA,IAC7B,MAAM,SAAS;AAAA,IACf,MAAM,SAAS;AAAA,IACf,UAAU,SAAS;AAAA,IACnB,SAAS,SAAS;AAAA,EAAA;AAEtB;AAEO,SAAS,wBAAwB,OAAmC;AACzE,MAAI,CAAC,MAAO,QAAO;AACnB,QAAM,YAAY,IAAI,KAAK,KAAK;AAChC,SAAO,OAAO,MAAM,UAAU,QAAA,CAAS,IAAI,QAAQ,UAAU,eAAA;AAC/D;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ResolvedOperation } from './types.js';
|
|
2
|
+
import { OperationsApiClient } from './useOperations.js';
|
|
2
3
|
import { ComboboxOption } from '../components/combobox-types.js';
|
|
3
4
|
export interface OperationSchedule {
|
|
4
5
|
id: string;
|
|
@@ -9,17 +10,21 @@ export interface OperationSchedule {
|
|
|
9
10
|
cron: string;
|
|
10
11
|
timezone: string;
|
|
11
12
|
enabled: boolean;
|
|
13
|
+
/** Targets executed at once in a multi-target run (1..targets.length); the rest queue. Server default 1. */
|
|
14
|
+
concurrency?: number;
|
|
12
15
|
lastRun?: string;
|
|
13
16
|
nextRun?: string;
|
|
14
17
|
}
|
|
15
18
|
export type OperationScheduleInput = Omit<OperationSchedule, "id" | "lastRun" | "nextRun">;
|
|
16
|
-
export type OperationScheduleRunInput = Pick<OperationScheduleInput, "operationId" | "args" | "targets">;
|
|
19
|
+
export type OperationScheduleRunInput = Pick<OperationScheduleInput, "operationId" | "args" | "targets" | "concurrency">;
|
|
17
20
|
export interface OperationScheduleCLI {
|
|
18
21
|
executable: string;
|
|
19
22
|
globalFlags?: Record<string, unknown>;
|
|
20
23
|
targetFlag?: string;
|
|
21
24
|
}
|
|
22
25
|
export interface OperationSchedulesProps {
|
|
26
|
+
/** Client for the argument form's lookups (the operation's parameter pickers). */
|
|
27
|
+
client: OperationsApiClient;
|
|
23
28
|
operations: readonly ResolvedOperation[];
|
|
24
29
|
schedules: readonly OperationSchedule[];
|
|
25
30
|
targetOptions: ComboboxOption[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operation-schedule-types.d.ts","sourceRoot":"","sources":["../../src/rpc/operation-schedule-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEnE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,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C,sBAAsB,EACtB,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,aAAa,CACnD,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACtC,kFAAkF;IAClF,MAAM,EAAE,mBAAmB,CAAC;IAC5B,UAAU,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACzC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACxC,aAAa,EAAE,cAAc,EAAE,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,oBAAoB,CAAC;IAC3B,QAAQ,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9D,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1E,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,UAAU,EAAE,CAAC,KAAK,EAAE,yBAAyB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACpE"}
|
package/dist/rpc.cjs
CHANGED
|
@@ -18,6 +18,7 @@ const commandFormUtils = require("./rpc/command-form-utils.cjs");
|
|
|
18
18
|
const CommandOutput = require("./rpc/CommandOutput.cjs");
|
|
19
19
|
const FilterForm = require("./rpc/FilterForm.cjs");
|
|
20
20
|
const InlineError = require("./rpc/InlineError.cjs");
|
|
21
|
+
const OperationArgsForm = require("./rpc/OperationArgsForm.cjs");
|
|
21
22
|
const OperationActionDialog = require("./rpc/OperationActionDialog.cjs");
|
|
22
23
|
const OperationPicker = require("./rpc/OperationPicker.cjs");
|
|
23
24
|
const OperationScheduleDialog = require("./rpc/OperationScheduleDialog.cjs");
|
|
@@ -76,6 +77,7 @@ exports.submitValue = commandFormUtils.submitValue;
|
|
|
76
77
|
exports.CommandOutput = CommandOutput.CommandOutput;
|
|
77
78
|
exports.FilterForm = FilterForm.FilterForm;
|
|
78
79
|
exports.InlineError = InlineError.InlineError;
|
|
80
|
+
exports.OperationArgsForm = OperationArgsForm.OperationArgsForm;
|
|
79
81
|
exports.OperationActionDialog = OperationActionDialog.OperationActionDialog;
|
|
80
82
|
exports.OperationPicker = OperationPicker.OperationPicker;
|
|
81
83
|
exports.OperationScheduleDialog = OperationScheduleDialog.OperationScheduleDialog;
|
package/dist/rpc.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|