@leitwerk-dev/ui 0.3.1 → 0.4.1
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/dist/assets/ApiTokensPage-DCmYvZdE.js +1 -0
- package/dist/assets/ChronicleMarkdown-CDe1jngc.js +1 -0
- package/dist/assets/DashboardPage-BRxe3uuy.css +1 -0
- package/dist/assets/DashboardPage-LiQ0_72g.js +1 -0
- package/dist/assets/FutureLaunchDetailPage-DvyW_J5d.js +1 -0
- package/dist/assets/GenericLauncher-D1qQy9hq.js +4 -0
- package/dist/assets/GenericLauncher-DRUMMTd7.css +1 -0
- package/dist/assets/HomePage-Cnmp6osB.js +1 -0
- package/dist/assets/ProcessActionsMenu-DEQynjFa.js +1 -0
- package/dist/assets/ProcessDetailPage-DvjQQTDj.js +14 -0
- package/dist/assets/ProcessDetailPage-km76G8wj.css +1 -0
- package/dist/assets/ProcessFlowDiagram-DI5KZ2Qj.js +1 -0
- package/dist/assets/ProcessFlowDiagram-NQ6oEZi7.css +1 -0
- package/dist/assets/ProcessesPage-B4BMXJT7.js +1 -0
- package/dist/assets/ScheduleDateTimePicker-2eJ0jBQ-.css +1 -0
- package/dist/assets/ScheduleDateTimePicker-fg0Vau5Z.js +3 -0
- package/dist/assets/SettingsPage-BHSV4rl7.css +1 -0
- package/dist/assets/SettingsPage-w1RHZ2l6.js +2 -0
- package/dist/assets/SkillsPage-Ber36rAD.js +2 -0
- package/dist/assets/WatchersPage-Btq_SIk3.js +1 -0
- package/dist/assets/WikiPage-BjncVYf1.js +1 -0
- package/dist/assets/WikiPage-Bvnhxl3m.css +1 -0
- package/dist/assets/http-client-Cvi3zOou.js +2 -0
- package/dist/assets/http-contracts-public-BUgTIHYG.js +1 -0
- package/dist/assets/index-Dz0T5gKc.js +21 -0
- package/dist/assets/index-DzKWCM-z.css +1 -0
- package/dist/assets/{index-client-BYQviCtQ.js → index-client-BSAA7n1a.js} +2 -2
- package/dist/assets/mermaid-render.worker-BN0bcvGc.js +6398 -0
- package/dist/assets/retry-config.svelte-HNNF65qc.js +1 -0
- package/dist/assets/settings-Dk5UoSQa.js +1 -0
- package/dist/index.html +4 -7
- package/package.json +10 -9
- package/src/App.svelte +9 -0
- package/src/chronicle/components/ChronicleActionSection.svelte +10 -2
- package/src/chronicle/components/ChronicleEntryHeader.svelte +4 -16
- package/src/chronicle/components/ChronicleFlow.svelte +24 -6
- package/src/chronicle/components/ChronicleLiveTail.svelte +52 -24
- package/src/chronicle/components/ChronicleProcessErrorSection.svelte +14 -0
- package/src/chronicle/components/ChronicleQuestionRequest.svelte +1 -1
- package/src/chronicle/components/ChronicleRecoverySection.svelte +14 -10
- package/src/chronicle/components/ChronicleStartupRecoverySection.svelte +22 -10
- package/src/chronicle/components/ChronicleThinkingSection.svelte +8 -2
- package/src/chronicle/components/ChronicleToolApproval.svelte +120 -17
- package/src/chronicle/components/ChronicleToolCallItem.svelte +32 -6
- package/src/chronicle/components/ChronicleTurnCluster.svelte +6 -6
- package/src/chronicle/components/ChronicleTurnProgress.svelte +10 -4
- package/src/chronicle/components/ChronicleTurnRail.svelte +1 -0
- package/src/chronicle/components/RecoveryModelControl.svelte +14 -13
- package/src/chronicle/lib/chronicle-projection.ts +74 -376
- package/src/chronicle/lib/chronicle-selectable-items.ts +23 -3
- package/src/chronicle/lib/recovery-model.ts +17 -0
- package/src/components/ConversationTreeDiagram.svelte +93 -30
- package/src/components/FormFieldRenderer.svelte +184 -27
- package/src/components/GenericLauncher.svelte +438 -259
- package/src/components/NamedSelectionList.svelte +77 -0
- package/src/components/ProcessActionsMenu.svelte +37 -59
- package/src/components/ProcessSettings.svelte +110 -0
- package/src/components/ScheduleDateTimePicker.svelte +9 -4
- package/src/components/SettingsField.svelte +317 -0
- package/src/components/SettingsOverview.svelte +237 -0
- package/src/components/SkillSelector.svelte +15 -3
- package/src/components/launcher-form-copy.ts +2 -1
- package/src/components/launcher-model-config.ts +8 -7
- package/src/components/launcher-selections.ts +123 -0
- package/src/lib/api.ts +100 -43
- package/src/lib/dashboard-refresh.ts +47 -0
- package/src/lib/http-client.ts +20 -1
- package/src/lib/instance-tree-layout.ts +41 -10
- package/src/lib/primary-path-detail.ts +56 -341
- package/src/lib/primary-path-replay.ts +8 -9
- package/src/lib/process-history.ts +57 -0
- package/src/lib/processes.svelte.ts +71 -79
- package/src/lib/reasoning-history.ts +31 -23
- package/src/lib/router-logic.ts +127 -56
- package/src/lib/router.svelte.ts +10 -6
- package/src/lib/settings.ts +114 -0
- package/src/lib/wiki.ts +34 -0
- package/src/pages/DashboardPage.svelte +194 -0
- package/src/pages/FutureLaunchDetailPage.svelte +2 -2
- package/src/pages/HomePage.svelte +4 -4
- package/src/pages/ProcessDetailPage.svelte +55 -344
- package/src/pages/ProcessFlowDiagram.svelte +39 -684
- package/src/pages/SettingsPage.svelte +265 -0
- package/src/pages/SkillsPage.svelte +26 -12
- package/src/pages/WikiPage.svelte +9 -0
- package/src/pages/process-detail/ProcessDetailChronicle.svelte +57 -13
- package/src/pages/process-detail/ProcessDetailHeader.svelte +9 -3
- package/src/pages/process-detail/TicketCreationComposer.svelte +49 -10
- package/src/pages/process-detail/inspector/ExecutionDetails.svelte +210 -0
- package/src/pages/process-detail/inspector/InspectionEvidence.svelte +48 -0
- package/src/pages/process-detail/inspector/InspectionMessage.svelte +71 -0
- package/src/pages/process-detail/inspector/ProcessInspector.svelte +144 -0
- package/src/pages/process-detail/inspector/ProcessModelEditor.svelte +161 -0
- package/src/pages/process-detail/inspector/ProcessReference.svelte +166 -0
- package/src/pages/process-detail/inspector/inspection-activity.ts +118 -0
- package/src/pages/process-detail/inspector/inspection-data.svelte.ts +107 -0
- package/src/pages/process-detail/inspector/inspection-tool-call.ts +30 -0
- package/src/pages/process-detail/inspector/inspector-navigation.ts +190 -0
- package/src/pages/process-detail/inspector/model-source-label.ts +17 -0
- package/src/pages/process-detail/process-detail-actions.svelte.ts +10 -0
- package/src/pages/process-detail/process-detail-chronicle-scroll.svelte.ts +18 -2
- package/src/pages/process-detail/process-detail-view-model.ts +2 -2
- package/src/shell/AppShell.svelte +55 -56
- package/src/shell/Sidebar.svelte +136 -232
- package/src/test-support/mount.ts +34 -0
- package/src/test-support/wait.ts +19 -0
- package/dist/assets/ApiTokensPage-ClJp9PYr.js +0 -1
- package/dist/assets/ChronicleMarkdown-lqwX9Ywa.js +0 -16
- package/dist/assets/FutureLaunchDetailPage-ygp-IdXC.js +0 -1
- package/dist/assets/GenericLauncher-CExW6wei.css +0 -1
- package/dist/assets/GenericLauncher-DOwsERpB.js +0 -1
- package/dist/assets/HomePage-D1J-Rmsw.js +0 -1
- package/dist/assets/PageHeader-DPuQInDo.css +0 -1
- package/dist/assets/PageHeader-sphJnWL1.js +0 -1
- package/dist/assets/ProcessActionsMenu-DV9zaxNS.js +0 -1
- package/dist/assets/ProcessDetailPage-BW1M2IH8.js +0 -14
- package/dist/assets/ProcessDetailPage-Cth6A0DN.css +0 -1
- package/dist/assets/ProcessFlowDiagram-Cz8wNicU.css +0 -1
- package/dist/assets/ProcessFlowDiagram-Dx2wheGN.js +0 -2
- package/dist/assets/ProcessesPage-CSPH5L7E.js +0 -1
- package/dist/assets/ScheduleDateTimePicker-DmojMRxN.js +0 -1
- package/dist/assets/ScheduleDateTimePicker-uacJAkIq.css +0 -1
- package/dist/assets/SkillsPage-KnLql0n1.js +0 -2
- package/dist/assets/WatchersPage-B4jf3Ywp.js +0 -1
- package/dist/assets/http-client-VpPXJwbR.js +0 -2
- package/dist/assets/index-DPCokDbS.js +0 -6
- package/dist/assets/index-DtEI5gsQ.css +0 -1
- package/dist/assets/mermaid-render.worker-QW2WZpEE.js +0 -6393
- package/dist/assets/process-terminal-display-BQRQwGod.js +0 -1
- package/dist/assets/router.svelte-EEldxHlO.js +0 -1
- package/src/chronicle/components/ChronicleReasoningDetailsOverlay.svelte +0 -855
- package/src/components/ProcessInfoOverlay.svelte +0 -1221
- package/src/lib/flow-layout.ts +0 -319
- package/src/pages/process-detail/OverlayFrame.svelte +0 -58
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
launchLauncher,
|
|
22
22
|
previewCronExpression,
|
|
23
23
|
updateScheduledLaunch,
|
|
24
|
+
validateLauncher,
|
|
24
25
|
} from "../lib/api.js";
|
|
25
26
|
import { getBrowserStorage } from "../lib/browser-storage.js";
|
|
26
27
|
import { formatLocalDateTime24Hour, formatUtcDateTime24Hour } from "../lib/format.js";
|
|
@@ -29,6 +30,7 @@ import {
|
|
|
29
30
|
readLauncherRecentValues,
|
|
30
31
|
writeLauncherRecentValue,
|
|
31
32
|
} from "../lib/launcher-recent-values.js";
|
|
33
|
+
import { onSettingsChanged } from "../lib/settings.js";
|
|
32
34
|
import FormFieldRenderer from "./FormFieldRenderer.svelte";
|
|
33
35
|
import LaunchChecklist from "./LaunchChecklist.svelte";
|
|
34
36
|
import {
|
|
@@ -52,11 +54,48 @@ import {
|
|
|
52
54
|
localScheduleDateTimePartsToIso,
|
|
53
55
|
splitLauncherScheduleTimeString,
|
|
54
56
|
} from "./launcher-schedule.js";
|
|
57
|
+
import {
|
|
58
|
+
changeLauncherSelection,
|
|
59
|
+
initializeLauncherSelections,
|
|
60
|
+
type LauncherSelections,
|
|
61
|
+
reconcileLauncherSelections,
|
|
62
|
+
selectionValues,
|
|
63
|
+
} from "./launcher-selections.js";
|
|
55
64
|
import ScheduleDateTimePicker from "./ScheduleDateTimePicker.svelte";
|
|
56
65
|
import SkillSelector from "./SkillSelector.svelte";
|
|
57
66
|
|
|
58
67
|
type LauncherFieldInputValue = boolean | string;
|
|
59
68
|
|
|
69
|
+
class LatestRequest {
|
|
70
|
+
loading = $state(false);
|
|
71
|
+
error = $state<string | null>(null);
|
|
72
|
+
private generation = 0;
|
|
73
|
+
private fallback: string;
|
|
74
|
+
|
|
75
|
+
constructor(fallback: string, loading = false) {
|
|
76
|
+
this.fallback = fallback;
|
|
77
|
+
this.loading = loading;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
invalidate() {
|
|
81
|
+
this.generation++;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
async run(work: (isCurrent: () => boolean) => Promise<void>, loading = true) {
|
|
85
|
+
const generation = ++this.generation;
|
|
86
|
+
this.loading = loading;
|
|
87
|
+
this.error = null;
|
|
88
|
+
try {
|
|
89
|
+
await work(() => generation === this.generation);
|
|
90
|
+
} catch (error) {
|
|
91
|
+
if (generation === this.generation)
|
|
92
|
+
this.error = error instanceof Error ? error.message : this.fallback;
|
|
93
|
+
} finally {
|
|
94
|
+
if (generation === this.generation) this.loading = false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
60
99
|
interface Props {
|
|
61
100
|
launcher: UiLauncherSummary;
|
|
62
101
|
initialRelaunchDraft?: ProcessRetryConfig | null;
|
|
@@ -87,27 +126,36 @@ let titleInputValue = $state("");
|
|
|
87
126
|
let selectedSkillIds = $state<string[]>([]);
|
|
88
127
|
let fieldInputValues = $state<Record<string, LauncherFieldInputValue>>({});
|
|
89
128
|
let fieldOptionsById = $state<Record<string, readonly LauncherFieldOptionDefinition[]>>({});
|
|
129
|
+
let knownFieldOptionsById = $state<Record<string, readonly LauncherFieldOptionDefinition[]>>({});
|
|
130
|
+
let launcherSelections: LauncherSelections = {};
|
|
90
131
|
let recentFieldValuesById = $state<Record<string, readonly string[]>>({});
|
|
91
132
|
let defaultModelProfileId = $state("");
|
|
92
133
|
let turnModelProfileIds = $state<Record<string, string>>({});
|
|
93
134
|
let advancedModelConfigOpen = $state(false);
|
|
94
135
|
let turnModelProfileIdsBeforeEditing = $state<Record<string, string> | null>(null);
|
|
95
|
-
|
|
96
|
-
let defaultsError = $state<string | null>(null);
|
|
136
|
+
const defaultsRequest = new LatestRequest("We couldn't load the starter values", true);
|
|
97
137
|
let defaultsWarnings = $state<LauncherValidationError[]>([]);
|
|
98
|
-
|
|
138
|
+
const optionsRequest = new LatestRequest("We couldn't refresh the available options");
|
|
99
139
|
let modelConfigPreview = $state<LauncherModelConfigPreview | null>(null);
|
|
100
140
|
let recommendedDefaultModelPreview = $state<LauncherModelConfigPreview["defaultModel"] | null>(
|
|
101
141
|
null,
|
|
102
142
|
);
|
|
103
|
-
|
|
104
|
-
let modelConfigPreviewError = $state<string | null>(null);
|
|
143
|
+
const modelPreviewRequest = new LatestRequest("We couldn't refresh the model preview");
|
|
105
144
|
let submitBusy = $state(false);
|
|
106
145
|
let activeLaunchRunId = $state<string | null>(null);
|
|
107
146
|
let submitError = $state<string | null>(null);
|
|
108
147
|
let submitSuccess = $state<string | null>(null);
|
|
109
148
|
let formErrors = $state<string[]>([]);
|
|
110
149
|
let fieldErrors = $state<Record<string, string[]>>({});
|
|
150
|
+
let touchedFields = $state<Record<string, boolean>>({});
|
|
151
|
+
let revealedFields = $state<Record<string, boolean>>({});
|
|
152
|
+
let revealAllErrors = $state(false);
|
|
153
|
+
let validatedKey = $state<string | null>(null);
|
|
154
|
+
let validationLoading = $state(false);
|
|
155
|
+
let validationError = $state<string | null>(null);
|
|
156
|
+
let validationRevision = $state(0);
|
|
157
|
+
let settingsRevision = $state(0);
|
|
158
|
+
let validationDelay = 0;
|
|
111
159
|
let scheduleMode = $state<ScheduleConfigInput["mode"]>("now");
|
|
112
160
|
let scheduledRunOnDate = $state("");
|
|
113
161
|
let scheduledRunAtHour = $state("");
|
|
@@ -116,13 +164,21 @@ let cronExpression = $state("");
|
|
|
116
164
|
let cronPreviewAt = $state<string | null>(null);
|
|
117
165
|
let cronPreviewError = $state<string | null>(null);
|
|
118
166
|
let cronPreviewBusy = $state(false);
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
167
|
+
$effect(() =>
|
|
168
|
+
onSettingsChanged(() => {
|
|
169
|
+
settingsRevision += 1;
|
|
170
|
+
void loadModelConfigPreview(fieldInputValues, buildLaunchModelConfig());
|
|
171
|
+
}, true),
|
|
172
|
+
);
|
|
122
173
|
let cronPreviewToken = 0;
|
|
123
174
|
let deferredDependentRefreshValues: Record<string, LauncherFieldInputValue> | null = null;
|
|
124
175
|
|
|
125
176
|
const launcherSkills = $derived(launcher.skills ?? []);
|
|
177
|
+
const recentValueFields = $derived(
|
|
178
|
+
launcher.launchConfigSchema.fields.filter(
|
|
179
|
+
(field) => field.kind === "text" && field.rememberRecentValues === true,
|
|
180
|
+
),
|
|
181
|
+
);
|
|
126
182
|
const modelCustomizationState = $derived(
|
|
127
183
|
getLauncherModelCustomizationState({ defaultModelProfileId, turnModelProfileIds }),
|
|
128
184
|
);
|
|
@@ -160,6 +216,94 @@ const defaultsNotice = $derived(
|
|
|
160
216
|
const fieldErrorCount = $derived(
|
|
161
217
|
Object.values(fieldErrors).reduce((total, messages) => total + messages.length, 0),
|
|
162
218
|
);
|
|
219
|
+
const validationFields = $derived([
|
|
220
|
+
...launcher.launchConfigSchema.fields,
|
|
221
|
+
{ id: "process-title", label: "Title", kind: "text" as const },
|
|
222
|
+
{ id: "model-config", label: "Model setup", kind: "text" as const },
|
|
223
|
+
{ id: "skills", label: "Skills", kind: "text" as const },
|
|
224
|
+
{ id: "schedule-date", label: "Start at", kind: "text" as const },
|
|
225
|
+
{ id: "schedule-cron", label: "Cron expression", kind: "text" as const },
|
|
226
|
+
]);
|
|
227
|
+
const validationRequest = $derived({
|
|
228
|
+
...(editingFutureLaunch ? { futureExecutionId: editingFutureLaunch.id } : {}),
|
|
229
|
+
title: buildSubmittedTitle(),
|
|
230
|
+
launcherInput: buildLaunchInput(),
|
|
231
|
+
modelConfig: buildLaunchModelConfig(),
|
|
232
|
+
schedule: buildScheduleConfig(),
|
|
233
|
+
skillIds: [...selectedSkillIds],
|
|
234
|
+
});
|
|
235
|
+
const validationKey = $derived(
|
|
236
|
+
JSON.stringify({ launcherId: launcher.id, request: validationRequest, settingsRevision }),
|
|
237
|
+
);
|
|
238
|
+
const validationPending = $derived(
|
|
239
|
+
defaultsRequest.loading ||
|
|
240
|
+
optionsRequest.loading ||
|
|
241
|
+
validationLoading ||
|
|
242
|
+
validatedKey !== validationKey,
|
|
243
|
+
);
|
|
244
|
+
const submitDisabled = $derived(
|
|
245
|
+
submitBusy ||
|
|
246
|
+
activeLaunchRunId !== null ||
|
|
247
|
+
validationPending ||
|
|
248
|
+
validationError !== null ||
|
|
249
|
+
fieldErrorCount > 0 ||
|
|
250
|
+
formErrors.length > 0,
|
|
251
|
+
);
|
|
252
|
+
const invalidFieldLabels = $derived(
|
|
253
|
+
validationFields.filter((field) => fieldErrors[field.id]?.length).map((field) => field.label),
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
function touchField(fieldId: string, delay = 0) {
|
|
257
|
+
touchedFields = { ...touchedFields, [fieldId]: true };
|
|
258
|
+
validationDelay = delay;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function blurField(fieldId: string) {
|
|
262
|
+
touchField(fieldId);
|
|
263
|
+
flushDeferredDependentRefresh();
|
|
264
|
+
if (validatedKey !== validationKey) validationRevision += 1;
|
|
265
|
+
else revealedFields = { ...revealedFields, [fieldId]: true };
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
function retryValidation() {
|
|
269
|
+
validationDelay = 0;
|
|
270
|
+
validatedKey = null;
|
|
271
|
+
validationRevision += 1;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
$effect(() => {
|
|
275
|
+
const key = validationKey;
|
|
276
|
+
const request = validationRequest;
|
|
277
|
+
const launcherId = launcher.id;
|
|
278
|
+
validationRevision;
|
|
279
|
+
if (defaultsRequest.loading || defaultsRequest.error || optionsRequest.loading) return;
|
|
280
|
+
const controller = new AbortController();
|
|
281
|
+
validationLoading = true;
|
|
282
|
+
validationError = null;
|
|
283
|
+
async function validate() {
|
|
284
|
+
try {
|
|
285
|
+
const errors = await validateLauncher(launcherId, request, controller.signal);
|
|
286
|
+
if (controller.signal.aborted || key !== validationKey) return;
|
|
287
|
+
applyValidationErrors(errors);
|
|
288
|
+
} catch (error) {
|
|
289
|
+
if (controller.signal.aborted || key !== validationKey) return;
|
|
290
|
+
validationError =
|
|
291
|
+
error instanceof Error ? error.message : "Couldn't validate the launch values. Try again.";
|
|
292
|
+
} finally {
|
|
293
|
+
if (!controller.signal.aborted && key === validationKey) {
|
|
294
|
+
validatedKey = key;
|
|
295
|
+
validationLoading = false;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
const timer = validationDelay > 0 ? setTimeout(() => void validate(), validationDelay) : null;
|
|
300
|
+
if (timer === null) void validate();
|
|
301
|
+
return () => {
|
|
302
|
+
if (timer !== null) clearTimeout(timer);
|
|
303
|
+
controller.abort();
|
|
304
|
+
};
|
|
305
|
+
});
|
|
306
|
+
|
|
163
307
|
const cronExamples = [
|
|
164
308
|
{ expression: "0 9 * * 1-5", label: "Weekdays at 09:00 UTC" },
|
|
165
309
|
{ expression: "0 13 * * *", label: "Daily at 13:00 UTC" },
|
|
@@ -167,10 +311,11 @@ const cronExamples = [
|
|
|
167
311
|
{ expression: "30 8 * * 1", label: "Mondays at 08:30 UTC" },
|
|
168
312
|
] as const;
|
|
169
313
|
const MAX_PROCESS_TITLE_LENGTH = 80;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
314
|
+
const scheduleModes = [
|
|
315
|
+
{ mode: "now", label: "Start now" },
|
|
316
|
+
{ mode: "once", label: "Start later" },
|
|
317
|
+
{ mode: "cron", label: "Run on cron" },
|
|
318
|
+
] as const;
|
|
174
319
|
|
|
175
320
|
function buildFieldDomId(fieldId: string): string {
|
|
176
321
|
return `${launcher.launchConfigSchema.id}-${fieldId}`;
|
|
@@ -214,10 +359,7 @@ function clearDeferredDependentRefresh() {
|
|
|
214
359
|
}
|
|
215
360
|
|
|
216
361
|
function flushDeferredDependentRefresh() {
|
|
217
|
-
if (!deferredDependentRefreshValues)
|
|
218
|
-
clearDeferredDependentRefresh();
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
362
|
+
if (!deferredDependentRefreshValues) return;
|
|
221
363
|
const pendingValues = deferredDependentRefreshValues;
|
|
222
364
|
clearDeferredDependentRefresh();
|
|
223
365
|
refreshDependentLauncherState(pendingValues);
|
|
@@ -250,10 +392,7 @@ function loadRecentFieldValuesFromStorage(): Record<string, readonly string[]> {
|
|
|
250
392
|
return {};
|
|
251
393
|
}
|
|
252
394
|
const nextValues: Record<string, readonly string[]> = {};
|
|
253
|
-
for (const field of
|
|
254
|
-
if (field.kind !== "text" || field.rememberRecentValues !== true) {
|
|
255
|
-
continue;
|
|
256
|
-
}
|
|
395
|
+
for (const field of recentValueFields) {
|
|
257
396
|
nextValues[field.id] = readLauncherRecentValues(storage, launcher.id, field.id);
|
|
258
397
|
}
|
|
259
398
|
return nextValues;
|
|
@@ -263,10 +402,7 @@ function mergeRecentFieldValues(
|
|
|
263
402
|
...sources: readonly Record<string, readonly string[]>[]
|
|
264
403
|
): Record<string, readonly string[]> {
|
|
265
404
|
const nextValues: Record<string, readonly string[]> = {};
|
|
266
|
-
for (const field of
|
|
267
|
-
if (field.kind !== "text" || field.rememberRecentValues !== true) {
|
|
268
|
-
continue;
|
|
269
|
-
}
|
|
405
|
+
for (const field of recentValueFields) {
|
|
270
406
|
nextValues[field.id] = normalizeLauncherRecentValues(
|
|
271
407
|
sources.flatMap((source) => source[field.id] ?? []),
|
|
272
408
|
);
|
|
@@ -289,10 +425,7 @@ function rememberSuccessfulLauncherFieldValues(launcherInput: Record<string, unk
|
|
|
289
425
|
return;
|
|
290
426
|
}
|
|
291
427
|
const nextValues = { ...recentFieldValuesById };
|
|
292
|
-
for (const field of
|
|
293
|
-
if (field.kind !== "text" || field.rememberRecentValues !== true) {
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
428
|
+
for (const field of recentValueFields) {
|
|
296
429
|
nextValues[field.id] = writeLauncherRecentValue(
|
|
297
430
|
storage,
|
|
298
431
|
launcher.id,
|
|
@@ -416,8 +549,6 @@ function shouldAutoOpenAdvancedModelConfig(modelConfig: LauncherModelConfigDefau
|
|
|
416
549
|
function clearSubmissionState() {
|
|
417
550
|
submitError = null;
|
|
418
551
|
submitSuccess = null;
|
|
419
|
-
formErrors = [];
|
|
420
|
-
fieldErrors = {};
|
|
421
552
|
}
|
|
422
553
|
|
|
423
554
|
function getTurnModelPreview(turnId: string): LauncherTurnModelConfigPreview["effective"] | null {
|
|
@@ -447,71 +578,59 @@ async function loadModelConfigPreview(
|
|
|
447
578
|
if (!hasModelConfigFields()) {
|
|
448
579
|
modelConfigPreview = null;
|
|
449
580
|
recommendedDefaultModelPreview = null;
|
|
450
|
-
|
|
451
|
-
|
|
581
|
+
modelPreviewRequest.loading = false;
|
|
582
|
+
modelPreviewRequest.error = null;
|
|
452
583
|
return;
|
|
453
584
|
}
|
|
454
585
|
|
|
455
|
-
|
|
456
|
-
modelConfigPreviewLoading = modelConfigPreview === null;
|
|
457
|
-
modelConfigPreviewError = null;
|
|
458
|
-
try {
|
|
586
|
+
return modelPreviewRequest.run(async (isCurrent) => {
|
|
459
587
|
const nextPreview = await fetchLauncherModelConfigPreview(
|
|
460
588
|
launcher.id,
|
|
461
589
|
buildLaunchInputFromValues(values),
|
|
462
590
|
previewModelConfig,
|
|
463
591
|
);
|
|
464
|
-
if (
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
592
|
+
if (!isCurrent()) return;
|
|
467
593
|
modelConfigPreview = nextPreview;
|
|
468
594
|
if ((previewModelConfig.defaultModelProfileId ?? "").trim() === "") {
|
|
469
595
|
recommendedDefaultModelPreview = nextPreview.defaultModel;
|
|
470
596
|
}
|
|
471
|
-
}
|
|
472
|
-
if (token !== modelConfigPreviewLoadToken) {
|
|
473
|
-
return;
|
|
474
|
-
}
|
|
475
|
-
modelConfigPreviewError =
|
|
476
|
-
error instanceof Error ? error.message : "We couldn't refresh the model preview";
|
|
477
|
-
} finally {
|
|
478
|
-
if (token === modelConfigPreviewLoadToken) {
|
|
479
|
-
modelConfigPreviewLoading = false;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
597
|
+
}, modelConfigPreview === null);
|
|
482
598
|
}
|
|
483
599
|
|
|
484
600
|
async function loadOptions(values: Record<string, LauncherFieldInputValue>) {
|
|
485
601
|
if (!hasSelectableFields()) {
|
|
486
602
|
fieldOptionsById = {};
|
|
487
|
-
|
|
603
|
+
optionsRequest.error = null;
|
|
488
604
|
return;
|
|
489
605
|
}
|
|
490
606
|
|
|
491
|
-
|
|
492
|
-
optionsError = null;
|
|
493
|
-
try {
|
|
607
|
+
return optionsRequest.run(async (isCurrent) => {
|
|
494
608
|
const options = await fetchLauncherOptions(launcher.id, buildLaunchInputFromValues(values));
|
|
495
|
-
if (
|
|
496
|
-
return;
|
|
497
|
-
}
|
|
609
|
+
if (!isCurrent()) return;
|
|
498
610
|
fieldOptionsById = options;
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
611
|
+
for (const [id, choices] of Object.entries(options)) {
|
|
612
|
+
const known = new Map(
|
|
613
|
+
(knownFieldOptionsById[id] ?? []).map((option) => [option.value, option]),
|
|
614
|
+
);
|
|
615
|
+
for (const option of choices) known.set(option.value, option);
|
|
616
|
+
knownFieldOptionsById[id] = [...known.values()];
|
|
502
617
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
618
|
+
const reconciled = reconcileLauncherSelections(
|
|
619
|
+
launcher.launchConfigSchema.fields,
|
|
620
|
+
fieldInputValues,
|
|
621
|
+
options,
|
|
622
|
+
launcherSelections,
|
|
623
|
+
);
|
|
624
|
+
const changed = JSON.stringify(reconciled.values) !== JSON.stringify(fieldInputValues);
|
|
625
|
+
fieldInputValues = reconciled.values;
|
|
626
|
+
launcherSelections = reconciled.selections;
|
|
627
|
+
if (changed) void loadModelConfigPreview(fieldInputValues, buildLaunchModelConfig());
|
|
628
|
+
});
|
|
506
629
|
}
|
|
507
630
|
|
|
508
631
|
function refreshDependentLauncherState(values: Record<string, LauncherFieldInputValue>) {
|
|
509
|
-
const nextModelConfig = buildLaunchModelConfigFromValues({
|
|
510
|
-
defaultModelProfileId,
|
|
511
|
-
turnModelProfileIds,
|
|
512
|
-
});
|
|
513
632
|
void loadOptions(values);
|
|
514
|
-
void loadModelConfigPreview(values,
|
|
633
|
+
void loadModelConfigPreview(values, buildLaunchModelConfig());
|
|
515
634
|
}
|
|
516
635
|
|
|
517
636
|
function scheduleDependentLauncherRefresh(
|
|
@@ -527,21 +646,29 @@ function scheduleDependentLauncherRefresh(
|
|
|
527
646
|
}
|
|
528
647
|
|
|
529
648
|
async function loadDefaults() {
|
|
530
|
-
const token = ++defaultsLoadToken;
|
|
531
649
|
clearDeferredDependentRefresh();
|
|
532
|
-
|
|
533
|
-
|
|
650
|
+
optionsRequest.loading = false;
|
|
651
|
+
validatedKey = null;
|
|
652
|
+
validationError = null;
|
|
653
|
+
validationDelay = 0;
|
|
654
|
+
touchedFields = {};
|
|
655
|
+
revealedFields = {};
|
|
656
|
+
revealAllErrors = false;
|
|
657
|
+
formErrors = [];
|
|
658
|
+
fieldErrors = {};
|
|
534
659
|
defaultsWarnings = [];
|
|
535
|
-
|
|
536
|
-
|
|
660
|
+
optionsRequest.error = null;
|
|
661
|
+
modelPreviewRequest.error = null;
|
|
537
662
|
clearSubmissionState();
|
|
538
663
|
titleInputValue = "";
|
|
539
664
|
selectedSkillIds = [];
|
|
540
665
|
fieldInputValues = createFieldInputValues({});
|
|
541
666
|
fieldOptionsById = {};
|
|
667
|
+
knownFieldOptionsById = {};
|
|
668
|
+
launcherSelections = {};
|
|
542
669
|
recentFieldValuesById = loadRecentFieldValuesFromStorage();
|
|
543
670
|
modelConfigPreview = null;
|
|
544
|
-
|
|
671
|
+
modelPreviewRequest.loading = false;
|
|
545
672
|
defaultModelProfileId = "";
|
|
546
673
|
turnModelProfileIds = createTurnModelProfileIds({});
|
|
547
674
|
advancedModelConfigOpen = false;
|
|
@@ -554,11 +681,9 @@ async function loadDefaults() {
|
|
|
554
681
|
cronPreviewAt = null;
|
|
555
682
|
cronPreviewError = null;
|
|
556
683
|
|
|
557
|
-
|
|
684
|
+
return defaultsRequest.run(async (isCurrent) => {
|
|
558
685
|
const { defaults, title, modelConfig, warnings } = await fetchLauncherDefaults(launcher.id);
|
|
559
|
-
if (
|
|
560
|
-
return;
|
|
561
|
-
}
|
|
686
|
+
if (!isCurrent()) return;
|
|
562
687
|
const relaunchDraft = initialRelaunchDraft;
|
|
563
688
|
const draftValues = relaunchDraft?.launcherInput ?? initialValues;
|
|
564
689
|
const mergedDefaults = draftValues ? { ...defaults, ...draftValues } : defaults;
|
|
@@ -567,14 +692,16 @@ async function loadDefaults() {
|
|
|
567
692
|
const mergedModelConfig = relaunchDraft?.modelConfig ?? initialModelConfig ?? modelConfig;
|
|
568
693
|
defaultsWarnings = warnings ?? [];
|
|
569
694
|
const nextValues = createFieldInputValues(mergedDefaults);
|
|
695
|
+
launcherSelections = initializeLauncherSelections(
|
|
696
|
+
launcher.launchConfigSchema.fields,
|
|
697
|
+
draftValues ?? defaults,
|
|
698
|
+
);
|
|
570
699
|
const initialScheduleConfig = createInitialSchedule();
|
|
571
700
|
titleInputValue = mergedTitle;
|
|
572
701
|
selectedSkillIds = [...(relaunchDraft?.skillIds ?? initialSkillIds ?? [])];
|
|
573
702
|
fieldInputValues = nextValues;
|
|
574
703
|
recentFieldValuesById = await loadRecentFieldValues();
|
|
575
|
-
if (
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
704
|
+
if (!isCurrent()) return;
|
|
578
705
|
defaultModelProfileId = createDefaultModelProfileId(mergedModelConfig);
|
|
579
706
|
turnModelProfileIds = createTurnModelProfileIds(mergedModelConfig);
|
|
580
707
|
advancedModelConfigOpen = shouldAutoOpenAdvancedModelConfig(mergedModelConfig);
|
|
@@ -597,18 +724,9 @@ async function loadDefaults() {
|
|
|
597
724
|
typeof initialScheduleConfig.cronExpression === "string"
|
|
598
725
|
? initialScheduleConfig.cronExpression
|
|
599
726
|
: "";
|
|
600
|
-
void loadOptions(nextValues);
|
|
601
727
|
void loadModelConfigPreview(nextValues, mergedModelConfig);
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
return;
|
|
605
|
-
}
|
|
606
|
-
defaultsError = error instanceof Error ? error.message : "We couldn't load the starter values";
|
|
607
|
-
} finally {
|
|
608
|
-
if (token === defaultsLoadToken) {
|
|
609
|
-
loadingDefaults = false;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
728
|
+
await loadOptions(nextValues);
|
|
729
|
+
});
|
|
612
730
|
}
|
|
613
731
|
|
|
614
732
|
$effect(() => {
|
|
@@ -623,9 +741,9 @@ $effect(() => {
|
|
|
623
741
|
void loadDefaults();
|
|
624
742
|
return () => {
|
|
625
743
|
clearDeferredDependentRefresh();
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
744
|
+
defaultsRequest.invalidate();
|
|
745
|
+
optionsRequest.invalidate();
|
|
746
|
+
modelPreviewRequest.invalidate();
|
|
629
747
|
cronPreviewToken += 1;
|
|
630
748
|
};
|
|
631
749
|
});
|
|
@@ -635,22 +753,28 @@ function getStringValue(fieldId: string): string {
|
|
|
635
753
|
return typeof value === "string" ? value : "";
|
|
636
754
|
}
|
|
637
755
|
|
|
638
|
-
function getNumberValue(fieldId: string): string {
|
|
639
|
-
const value = fieldInputValues[fieldId];
|
|
640
|
-
return typeof value === "string" ? value : "";
|
|
641
|
-
}
|
|
642
|
-
|
|
643
756
|
function getBooleanValue(fieldId: string): boolean {
|
|
644
757
|
return fieldInputValues[fieldId] === true;
|
|
645
758
|
}
|
|
646
759
|
|
|
647
760
|
function getFieldErrors(fieldId: string): string[] {
|
|
648
|
-
return fieldErrors[fieldId] ?? [];
|
|
761
|
+
return revealAllErrors || revealedFields[fieldId] ? (fieldErrors[fieldId] ?? []) : [];
|
|
649
762
|
}
|
|
650
763
|
|
|
651
764
|
function getFieldOptions(field: LauncherFieldDefinition): readonly LauncherFieldOptionDefinition[] {
|
|
652
765
|
const baseOptions = fieldOptionsById[field.id] ?? field.options ?? [];
|
|
653
766
|
const currentValue = getStringValue(field.id).trim();
|
|
767
|
+
if (field.kind === "select" && field.multiple)
|
|
768
|
+
return [
|
|
769
|
+
...currentValue
|
|
770
|
+
.split("\n")
|
|
771
|
+
.filter((value) => value && !baseOptions.some((option) => option.value === value))
|
|
772
|
+
.map((value) => ({
|
|
773
|
+
value,
|
|
774
|
+
label: `${knownFieldOptionsById[field.id]?.find((option) => option.value === value)?.label ?? value} (unavailable)`,
|
|
775
|
+
})),
|
|
776
|
+
...baseOptions,
|
|
777
|
+
];
|
|
654
778
|
if (
|
|
655
779
|
field.kind !== "select" ||
|
|
656
780
|
currentValue === "" ||
|
|
@@ -661,6 +785,30 @@ function getFieldOptions(field: LauncherFieldDefinition): readonly LauncherField
|
|
|
661
785
|
return [{ value: currentValue, label: currentValue }, ...baseOptions];
|
|
662
786
|
}
|
|
663
787
|
|
|
788
|
+
function getSelectionDetails(field: LauncherFieldDefinition): Record<string, string> | undefined {
|
|
789
|
+
if (!field.presetsFrom) return undefined;
|
|
790
|
+
const selectedPresets = selectionValues(fieldInputValues[field.presetsFrom]);
|
|
791
|
+
const sourceField = launcher.launchConfigSchema.fields.find(
|
|
792
|
+
(source) => source.id === field.presetsFrom,
|
|
793
|
+
);
|
|
794
|
+
const presets = (knownFieldOptionsById[field.presetsFrom] ?? sourceField?.options ?? []).filter(
|
|
795
|
+
(option) => selectedPresets.includes(option.value),
|
|
796
|
+
);
|
|
797
|
+
const selected = selectionValues(fieldInputValues[field.id]);
|
|
798
|
+
return Object.fromEntries(
|
|
799
|
+
getFieldOptions(field).map((option) => {
|
|
800
|
+
const names = presets
|
|
801
|
+
.filter((preset) => preset.selectionValues?.includes(option.value))
|
|
802
|
+
.map((preset) => preset.label);
|
|
803
|
+
return [
|
|
804
|
+
option.value,
|
|
805
|
+
names.join(", ") ||
|
|
806
|
+
(selected.includes(option.value) ? "Added individually" : "Outside selected groups"),
|
|
807
|
+
];
|
|
808
|
+
}),
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
|
|
664
812
|
function getSelectedFieldOption(
|
|
665
813
|
field: LauncherFieldDefinition,
|
|
666
814
|
): LauncherFieldOptionDefinition | null {
|
|
@@ -674,64 +822,53 @@ function getSelectedFieldOption(
|
|
|
674
822
|
return getFieldOptions(field).find((option) => option.value === currentValue) ?? null;
|
|
675
823
|
}
|
|
676
824
|
|
|
677
|
-
function updateFieldErrorState(fieldId: string) {
|
|
678
|
-
if (!fieldErrors[fieldId]) {
|
|
679
|
-
return;
|
|
680
|
-
}
|
|
681
|
-
const nextFieldErrors = { ...fieldErrors };
|
|
682
|
-
delete nextFieldErrors[fieldId];
|
|
683
|
-
fieldErrors = nextFieldErrors;
|
|
684
|
-
}
|
|
685
|
-
|
|
686
825
|
function setFieldValue(
|
|
687
826
|
field: LauncherFieldDefinition,
|
|
688
827
|
value: LauncherFieldInputValue,
|
|
689
828
|
options: { dependentRefresh?: "immediate" | "deferred" } = {},
|
|
690
829
|
) {
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
830
|
+
const changed = changeLauncherSelection(
|
|
831
|
+
launcher.launchConfigSchema.fields,
|
|
832
|
+
fieldInputValues,
|
|
833
|
+
fieldOptionsById,
|
|
834
|
+
launcherSelections,
|
|
835
|
+
field.id,
|
|
836
|
+
value,
|
|
837
|
+
);
|
|
838
|
+
const nextValues = changed.values;
|
|
839
|
+
launcherSelections = changed.selections;
|
|
840
|
+
for (const id of changed.resetFields) {
|
|
841
|
+
delete fieldOptionsById[id];
|
|
842
|
+
delete knownFieldOptionsById[id];
|
|
843
|
+
touchField(id);
|
|
844
|
+
}
|
|
695
845
|
fieldInputValues = nextValues;
|
|
696
|
-
|
|
846
|
+
touchField(
|
|
847
|
+
field.id,
|
|
848
|
+
field.kind === "text" || field.kind === "textarea" || field.kind === "number" ? 300 : 0,
|
|
849
|
+
);
|
|
697
850
|
submitError = null;
|
|
698
|
-
formErrors = [];
|
|
699
851
|
scheduleDependentLauncherRefresh(
|
|
700
852
|
nextValues,
|
|
701
853
|
options.dependentRefresh ?? getFieldDependentRefreshMode(field),
|
|
702
854
|
);
|
|
703
855
|
}
|
|
704
856
|
|
|
705
|
-
function
|
|
706
|
-
|
|
857
|
+
function refreshEditedModelConfig() {
|
|
858
|
+
touchField("model-config");
|
|
707
859
|
submitError = null;
|
|
708
|
-
formErrors = [];
|
|
709
860
|
clearDeferredDependentRefresh();
|
|
710
|
-
void loadModelConfigPreview(
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
);
|
|
861
|
+
void loadModelConfigPreview(fieldInputValues, buildLaunchModelConfig());
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
function setDefaultModelProfileValue(value: string) {
|
|
865
|
+
defaultModelProfileId = value;
|
|
866
|
+
refreshEditedModelConfig();
|
|
717
867
|
}
|
|
718
868
|
|
|
719
869
|
function setTurnModelProfileValue(turnId: string, value: string) {
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
[turnId]: value,
|
|
723
|
-
};
|
|
724
|
-
turnModelProfileIds = nextTurnModelProfileIds;
|
|
725
|
-
submitError = null;
|
|
726
|
-
formErrors = [];
|
|
727
|
-
clearDeferredDependentRefresh();
|
|
728
|
-
void loadModelConfigPreview(
|
|
729
|
-
fieldInputValues,
|
|
730
|
-
buildLaunchModelConfigFromValues({
|
|
731
|
-
defaultModelProfileId,
|
|
732
|
-
turnModelProfileIds: nextTurnModelProfileIds,
|
|
733
|
-
}),
|
|
734
|
-
);
|
|
870
|
+
turnModelProfileIds = { ...turnModelProfileIds, [turnId]: value };
|
|
871
|
+
refreshEditedModelConfig();
|
|
735
872
|
}
|
|
736
873
|
|
|
737
874
|
function openModelConfigEditor() {
|
|
@@ -745,36 +882,14 @@ function closeModelConfigEditor() {
|
|
|
745
882
|
}
|
|
746
883
|
|
|
747
884
|
function cancelModelConfigEditing() {
|
|
748
|
-
|
|
749
|
-
turnModelProfileIds = nextTurnModelProfileIds;
|
|
750
|
-
submitError = null;
|
|
751
|
-
formErrors = [];
|
|
752
|
-
modelConfigPreviewError = null;
|
|
753
|
-
clearDeferredDependentRefresh();
|
|
885
|
+
turnModelProfileIds = turnModelProfileIdsBeforeEditing ?? { ...turnModelProfileIds };
|
|
754
886
|
closeModelConfigEditor();
|
|
755
|
-
|
|
756
|
-
fieldInputValues,
|
|
757
|
-
buildLaunchModelConfigFromValues({
|
|
758
|
-
defaultModelProfileId,
|
|
759
|
-
turnModelProfileIds: nextTurnModelProfileIds,
|
|
760
|
-
}),
|
|
761
|
-
);
|
|
887
|
+
refreshEditedModelConfig();
|
|
762
888
|
}
|
|
763
889
|
|
|
764
890
|
function resetModelConfigToRecommended() {
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
submitError = null;
|
|
768
|
-
formErrors = [];
|
|
769
|
-
modelConfigPreviewError = null;
|
|
770
|
-
clearDeferredDependentRefresh();
|
|
771
|
-
void loadModelConfigPreview(
|
|
772
|
-
fieldInputValues,
|
|
773
|
-
buildLaunchModelConfigFromValues({
|
|
774
|
-
defaultModelProfileId,
|
|
775
|
-
turnModelProfileIds: nextTurnModelProfileIds,
|
|
776
|
-
}),
|
|
777
|
-
);
|
|
891
|
+
turnModelProfileIds = createTurnModelProfileIds({});
|
|
892
|
+
refreshEditedModelConfig();
|
|
778
893
|
}
|
|
779
894
|
|
|
780
895
|
function resetCronPreviewState(invalidatePending = false) {
|
|
@@ -786,11 +901,6 @@ function resetCronPreviewState(invalidatePending = false) {
|
|
|
786
901
|
cronPreviewBusy = false;
|
|
787
902
|
}
|
|
788
903
|
|
|
789
|
-
function clearScheduleSubmissionState() {
|
|
790
|
-
submitError = null;
|
|
791
|
-
submitSuccess = null;
|
|
792
|
-
}
|
|
793
|
-
|
|
794
904
|
function prefillScheduledRunAtFromNowIfBlank() {
|
|
795
905
|
if (scheduledRunOnDate !== "" || scheduledRunAtHour !== "" || scheduledRunAtMinute !== "") {
|
|
796
906
|
return;
|
|
@@ -804,28 +914,32 @@ function prefillScheduledRunAtFromNowIfBlank() {
|
|
|
804
914
|
|
|
805
915
|
function setScheduleMode(value: ScheduleConfigInput["mode"]) {
|
|
806
916
|
scheduleMode = value;
|
|
917
|
+
touchField(value === "cron" ? "schedule-cron" : "schedule-date");
|
|
807
918
|
if (value === "once") {
|
|
808
919
|
prefillScheduledRunAtFromNowIfBlank();
|
|
809
920
|
}
|
|
810
|
-
|
|
921
|
+
clearSubmissionState();
|
|
811
922
|
if (value !== "cron") {
|
|
812
923
|
resetCronPreviewState(true);
|
|
813
924
|
}
|
|
814
925
|
}
|
|
815
926
|
|
|
816
927
|
function setScheduledRunDate(value: string) {
|
|
928
|
+
touchField("schedule-date");
|
|
817
929
|
scheduledRunOnDate = value;
|
|
818
|
-
|
|
930
|
+
clearSubmissionState();
|
|
819
931
|
}
|
|
820
932
|
|
|
821
933
|
function setScheduledRunHour(value: string) {
|
|
934
|
+
touchField("schedule-date");
|
|
822
935
|
scheduledRunAtHour = value;
|
|
823
|
-
|
|
936
|
+
clearSubmissionState();
|
|
824
937
|
}
|
|
825
938
|
|
|
826
939
|
function setScheduledRunMinute(value: string) {
|
|
940
|
+
touchField("schedule-date");
|
|
827
941
|
scheduledRunAtMinute = value;
|
|
828
|
-
|
|
942
|
+
clearSubmissionState();
|
|
829
943
|
}
|
|
830
944
|
|
|
831
945
|
function getScheduledRunTimeValue(): string {
|
|
@@ -859,6 +973,7 @@ function buildScheduleConfig(): ScheduleConfigInput {
|
|
|
859
973
|
}
|
|
860
974
|
|
|
861
975
|
function applyCronExample(expression: string) {
|
|
976
|
+
touchField("schedule-cron");
|
|
862
977
|
cronExpression = expression;
|
|
863
978
|
submitError = null;
|
|
864
979
|
submitSuccess = null;
|
|
@@ -905,11 +1020,32 @@ $effect(() => {
|
|
|
905
1020
|
}
|
|
906
1021
|
void refreshCronPreview(expression);
|
|
907
1022
|
});
|
|
908
|
-
function applyValidationErrors(errors: readonly LauncherValidationError[]) {
|
|
909
|
-
|
|
1023
|
+
function applyValidationErrors(errors: readonly LauncherValidationError[], focus = false) {
|
|
1024
|
+
// Reveal newly edited fields only when their current values have been checked.
|
|
1025
|
+
// Otherwise an empty field's initial error can flash while the user starts typing.
|
|
1026
|
+
revealedFields = { ...revealedFields, ...touchedFields };
|
|
1027
|
+
const normalized = normalizeLauncherValidationErrors(
|
|
1028
|
+
validationFields,
|
|
1029
|
+
errors.map((error) => ({
|
|
1030
|
+
...error,
|
|
1031
|
+
fieldId:
|
|
1032
|
+
error.fieldId ??
|
|
1033
|
+
(error.code === "invalid_schedule"
|
|
1034
|
+
? scheduleMode === "cron"
|
|
1035
|
+
? "schedule-cron"
|
|
1036
|
+
: "schedule-date"
|
|
1037
|
+
: error.code === "invalid_model_config"
|
|
1038
|
+
? "model-config"
|
|
1039
|
+
: error.code === "invalid_skill_selection"
|
|
1040
|
+
? "skills"
|
|
1041
|
+
: undefined),
|
|
1042
|
+
})),
|
|
1043
|
+
);
|
|
910
1044
|
fieldErrors = normalized.fieldErrors;
|
|
911
1045
|
formErrors = normalized.formErrors;
|
|
912
1046
|
|
|
1047
|
+
if (!focus) return;
|
|
1048
|
+
revealAllErrors = true;
|
|
913
1049
|
const firstInvalidFieldId = getFirstLauncherFieldIdWithErrors(
|
|
914
1050
|
launcher.launchConfigSchema.fields,
|
|
915
1051
|
normalized.fieldErrors,
|
|
@@ -954,42 +1090,29 @@ function submitButtonLabel(): string {
|
|
|
954
1090
|
|
|
955
1091
|
async function handleSubmit(event: SubmitEvent) {
|
|
956
1092
|
event.preventDefault();
|
|
1093
|
+
if (submitDisabled) {
|
|
1094
|
+
if (!validationPending) {
|
|
1095
|
+
revealAllErrors = true;
|
|
1096
|
+
const first = getFirstLauncherFieldIdWithErrors(validationFields, fieldErrors);
|
|
1097
|
+
if (first) focusLauncherField(first);
|
|
1098
|
+
}
|
|
1099
|
+
return;
|
|
1100
|
+
}
|
|
957
1101
|
clearDeferredDependentRefresh();
|
|
958
1102
|
clearSubmissionState();
|
|
959
1103
|
submitBusy = true;
|
|
960
1104
|
|
|
961
1105
|
try {
|
|
962
|
-
const schedule =
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
}
|
|
973
|
-
const title = buildSubmittedTitle();
|
|
974
|
-
const launcherInput = buildLaunchInput();
|
|
975
|
-
const modelConfig = buildLaunchModelConfig();
|
|
976
|
-
const result = editingFutureLaunch
|
|
977
|
-
? await updateScheduledLaunch(
|
|
978
|
-
editingFutureLaunch.id,
|
|
979
|
-
title,
|
|
980
|
-
launcherInput,
|
|
981
|
-
modelConfig,
|
|
982
|
-
schedule,
|
|
983
|
-
selectedSkillIds,
|
|
984
|
-
)
|
|
985
|
-
: await launchLauncher(
|
|
986
|
-
launcher.id,
|
|
987
|
-
title,
|
|
988
|
-
launcherInput,
|
|
989
|
-
modelConfig,
|
|
990
|
-
schedule,
|
|
991
|
-
selectedSkillIds,
|
|
992
|
-
);
|
|
1106
|
+
const { title, launcherInput, modelConfig, schedule, skillIds } = validationRequest;
|
|
1107
|
+
const submit = editingFutureLaunch ? updateScheduledLaunch : launchLauncher;
|
|
1108
|
+
const result = await submit(
|
|
1109
|
+
editingFutureLaunch?.id ?? launcher.id,
|
|
1110
|
+
title,
|
|
1111
|
+
launcherInput,
|
|
1112
|
+
modelConfig,
|
|
1113
|
+
schedule,
|
|
1114
|
+
skillIds,
|
|
1115
|
+
);
|
|
993
1116
|
switch (result.kind) {
|
|
994
1117
|
case "launch_started":
|
|
995
1118
|
activeLaunchRunId = result.launchRunId;
|
|
@@ -1010,7 +1133,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1010
1133
|
: `Scheduled for ${formatLocalDateTime24Hour(result.futureExecution.nextRunAt)}.`;
|
|
1011
1134
|
return;
|
|
1012
1135
|
case "validation_error":
|
|
1013
|
-
applyValidationErrors(result.errors);
|
|
1136
|
+
applyValidationErrors(result.errors, true);
|
|
1014
1137
|
return;
|
|
1015
1138
|
case "failure":
|
|
1016
1139
|
submitError = result.error;
|
|
@@ -1024,14 +1147,22 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1024
1147
|
}
|
|
1025
1148
|
</script>
|
|
1026
1149
|
|
|
1027
|
-
|
|
1028
|
-
{#if
|
|
1150
|
+
{#snippet validationMessages(fieldId: string)}
|
|
1151
|
+
{#if getFieldErrors(fieldId).length > 0}
|
|
1152
|
+
<ul class="inline-validation-errors" id={fieldErrorsDomId(fieldId)} aria-live="polite">
|
|
1153
|
+
{#each getFieldErrors(fieldId) as message (message)}<li>{message}</li>{/each}
|
|
1154
|
+
</ul>
|
|
1155
|
+
{/if}
|
|
1156
|
+
{/snippet}
|
|
1157
|
+
|
|
1158
|
+
<div class="launcher-form" data-launcher-id={launcher.id} aria-busy={submitBusy || defaultsRequest.loading}>
|
|
1159
|
+
{#if defaultsRequest.loading}
|
|
1029
1160
|
<p class="state-msg">Loading the starter values for this process…</p>
|
|
1030
|
-
{:else if
|
|
1161
|
+
{:else if defaultsRequest.error}
|
|
1031
1162
|
<div class="state-block error" role="status">
|
|
1032
1163
|
<div class="state-copy">
|
|
1033
1164
|
<p class="state-title">We couldn't prepare this form yet.</p>
|
|
1034
|
-
<p class="state-msg error">{
|
|
1165
|
+
<p class="state-msg error">{defaultsRequest.error}</p>
|
|
1035
1166
|
</div>
|
|
1036
1167
|
<button
|
|
1037
1168
|
type="button"
|
|
@@ -1043,12 +1174,12 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1043
1174
|
</button>
|
|
1044
1175
|
</div>
|
|
1045
1176
|
{:else}
|
|
1046
|
-
{#if
|
|
1177
|
+
{#if optionsRequest.error}
|
|
1047
1178
|
<p class="state-msg error refresh-error" role="status">
|
|
1048
1179
|
We couldn't refresh the latest options, so we're showing the last set we loaded.
|
|
1049
1180
|
</p>
|
|
1050
1181
|
{/if}
|
|
1051
|
-
{#if
|
|
1182
|
+
{#if modelPreviewRequest.error}
|
|
1052
1183
|
<p class="state-msg error refresh-error" role="status">
|
|
1053
1184
|
We couldn't refresh the current model preview, so we're showing the last preview we loaded.
|
|
1054
1185
|
</p>
|
|
@@ -1075,7 +1206,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1075
1206
|
</div>
|
|
1076
1207
|
{/if}
|
|
1077
1208
|
|
|
1078
|
-
{#if submitError || formErrors.length > 0 || fieldErrorCount > 0}
|
|
1209
|
+
{#if submitError || formErrors.length > 0 || (revealAllErrors && fieldErrorCount > 0)}
|
|
1079
1210
|
<div
|
|
1080
1211
|
class="form-error-banner"
|
|
1081
1212
|
data-section="launcher-form-error-banner"
|
|
@@ -1087,7 +1218,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1087
1218
|
{fieldErrorCount > 0 ? "Check the highlighted fields." : "We couldn't continue yet."}
|
|
1088
1219
|
</p>
|
|
1089
1220
|
{#if fieldErrorCount > 0}
|
|
1090
|
-
<p>
|
|
1221
|
+
<p>Review the highlighted details before continuing.</p>
|
|
1091
1222
|
{/if}
|
|
1092
1223
|
{#if submitError}
|
|
1093
1224
|
<p>{submitError}</p>
|
|
@@ -1113,9 +1244,12 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1113
1244
|
|
|
1114
1245
|
<form class="launcher-fields" novalidate onsubmit={handleSubmit}>
|
|
1115
1246
|
<div class="field-group title-field">
|
|
1116
|
-
<label class="field-label" for={
|
|
1247
|
+
<label class="field-label" for={buildFieldDomId("process-title")}>Title</label>
|
|
1117
1248
|
<input
|
|
1118
|
-
id={
|
|
1249
|
+
id={buildFieldDomId("process-title")}
|
|
1250
|
+
aria-invalid={getFieldErrors("process-title").length > 0}
|
|
1251
|
+
aria-describedby={getFieldErrors("process-title").length ? fieldErrorsDomId("process-title") : undefined}
|
|
1252
|
+
onblur={() => blurField("process-title")}
|
|
1119
1253
|
data-launcher-form-field
|
|
1120
1254
|
type="text"
|
|
1121
1255
|
value={titleInputValue}
|
|
@@ -1123,20 +1257,18 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1123
1257
|
maxlength={MAX_PROCESS_TITLE_LENGTH}
|
|
1124
1258
|
oninput={(event) => {
|
|
1125
1259
|
titleInputValue = (event.currentTarget as HTMLInputElement).value;
|
|
1260
|
+
touchField("process-title", 300);
|
|
1126
1261
|
clearSubmissionState();
|
|
1127
1262
|
}}
|
|
1128
1263
|
/>
|
|
1129
1264
|
<p class="field-description">Leave blank to generate a title later.</p>
|
|
1265
|
+
{@render validationMessages("process-title")}
|
|
1130
1266
|
</div>
|
|
1131
1267
|
{#each launcher.launchConfigSchema.fields as field (field.id)}
|
|
1132
1268
|
<FormFieldRenderer
|
|
1133
1269
|
{field}
|
|
1134
1270
|
id={buildFieldDomId(field.id)}
|
|
1135
|
-
value={field.kind === "boolean"
|
|
1136
|
-
? getBooleanValue(field.id)
|
|
1137
|
-
: field.kind === "number"
|
|
1138
|
-
? getNumberValue(field.id)
|
|
1139
|
-
: getStringValue(field.id)}
|
|
1271
|
+
value={field.kind === "boolean" ? getBooleanValue(field.id) : getStringValue(field.id)}
|
|
1140
1272
|
errors={getFieldErrors(field.id)}
|
|
1141
1273
|
descriptionId={fieldDescriptionDomId(field.id)}
|
|
1142
1274
|
errorId={fieldErrorsDomId(field.id)}
|
|
@@ -1144,23 +1276,36 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1144
1276
|
marker="launcher"
|
|
1145
1277
|
textareaRows={5}
|
|
1146
1278
|
options={getFieldOptions(field)}
|
|
1279
|
+
optionDetails={getSelectionDetails(field)}
|
|
1147
1280
|
selectedOptionDescription={getSelectedFieldOption(field)?.description ?? null}
|
|
1148
1281
|
selectedOptionDescriptionId={fieldOptionDescriptionDomId(field.id)}
|
|
1149
1282
|
recentValues={getRememberedRecentValues(field)}
|
|
1150
1283
|
layout="split"
|
|
1151
1284
|
onValueChange={(changedField, value) => setFieldValue(changedField, value)}
|
|
1152
|
-
onTextBlur={
|
|
1285
|
+
onTextBlur={() => blurField(field.id)}
|
|
1153
1286
|
onRecentValue={(changedField, value) =>
|
|
1154
1287
|
setFieldValue(changedField, value, { dependentRefresh: "immediate" })}
|
|
1155
1288
|
/>
|
|
1156
1289
|
{/each}
|
|
1157
1290
|
|
|
1158
1291
|
{#if launcherSkills.length > 0}
|
|
1159
|
-
<SkillSelector skills={launcherSkills} bind:selectedIds={selectedSkillIds}
|
|
1292
|
+
<SkillSelector skills={launcherSkills} bind:selectedIds={selectedSkillIds}
|
|
1293
|
+
id={buildFieldDomId("skills")}
|
|
1294
|
+
invalid={getFieldErrors("skills").length > 0}
|
|
1295
|
+
describedBy={getFieldErrors("skills").length ? fieldErrorsDomId("skills") : undefined}
|
|
1296
|
+
onSelectionChange={() => touchField("skills")} />
|
|
1297
|
+
{@render validationMessages("skills")}
|
|
1160
1298
|
{/if}
|
|
1161
1299
|
|
|
1162
1300
|
{#if hasModelConfigFields()}
|
|
1163
|
-
<section class="field-group model-config-group" data-section="launcher-model-config"
|
|
1301
|
+
<section class="field-group model-config-group" data-section="launcher-model-config"
|
|
1302
|
+
id={buildFieldDomId("model-config")} tabindex="-1" role="group" aria-label="Model setup"
|
|
1303
|
+
data-invalid={getFieldErrors("model-config").length > 0}
|
|
1304
|
+
aria-describedby={getFieldErrors("model-config").length ? fieldErrorsDomId("model-config") : undefined}>
|
|
1305
|
+
{@render validationMessages("model-config")}
|
|
1306
|
+
<a href={`/settings?scope=${encodeURIComponent(modelConfigPreview?.settingsSubjectId ?? "instance")}`}>Repository and instance defaults</a>
|
|
1307
|
+
{#each modelConfigPreview?.settingsExplanations ?? [] as explanation}<p>{explanation}</p>{/each}
|
|
1308
|
+
{#each modelConfigPreview?.turns ?? [] as turn}{#if turn.effective.error}<p role="alert">{turn.description}: {turn.effective.error}</p>{/if}{/each}
|
|
1164
1309
|
<div class="model-config-intro">
|
|
1165
1310
|
<p class="field-label">Model setup</p>
|
|
1166
1311
|
<p class="field-description">
|
|
@@ -1182,6 +1327,8 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1182
1327
|
<select
|
|
1183
1328
|
id={`${launcher.launchConfigSchema.id}-default-model-profile`}
|
|
1184
1329
|
class="model-config-default-select"
|
|
1330
|
+
aria-invalid={getFieldErrors("model-config").length > 0}
|
|
1331
|
+
aria-describedby={getFieldErrors("model-config").length ? fieldErrorsDomId("model-config") : undefined}
|
|
1185
1332
|
value={defaultModelProfileId}
|
|
1186
1333
|
onchange={(event) =>
|
|
1187
1334
|
setDefaultModelProfileValue((event.currentTarget as HTMLSelectElement).value)}
|
|
@@ -1196,7 +1343,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1196
1343
|
{/each}
|
|
1197
1344
|
</select>
|
|
1198
1345
|
</div>
|
|
1199
|
-
{#if
|
|
1346
|
+
{#if modelPreviewRequest.loading && modelConfigPreview === null}
|
|
1200
1347
|
<p class="field-description model-config-status-note">Refreshing the current recommendation…</p>
|
|
1201
1348
|
{/if}
|
|
1202
1349
|
</div>
|
|
@@ -1208,7 +1355,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1208
1355
|
data-summary-mode={modelSummaryView.mode}
|
|
1209
1356
|
data-customization-mode={modelCustomizationState.mode}
|
|
1210
1357
|
data-customization-count={modelCustomizationState.totalCustomizedChoices}
|
|
1211
|
-
data-preview-loading={
|
|
1358
|
+
data-preview-loading={modelPreviewRequest.loading}
|
|
1212
1359
|
data-editing={advancedModelConfigOpen ? "true" : "false"}
|
|
1213
1360
|
data-override-count={modelCustomizationState.turnOverrideCount}
|
|
1214
1361
|
role="status"
|
|
@@ -1287,6 +1434,8 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1287
1434
|
<select
|
|
1288
1435
|
id={`${launcher.launchConfigSchema.id}-${turn.turnId}-model-profile`}
|
|
1289
1436
|
class="model-config-summary-turn-select"
|
|
1437
|
+
aria-invalid={getFieldErrors("model-config").length > 0}
|
|
1438
|
+
aria-describedby={getFieldErrors("model-config").length ? fieldErrorsDomId("model-config") : undefined}
|
|
1290
1439
|
value={turnModelProfileIds[turn.turnId] ?? ""}
|
|
1291
1440
|
onchange={(event) =>
|
|
1292
1441
|
setTurnModelProfileValue(
|
|
@@ -1337,33 +1486,17 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1337
1486
|
</div>
|
|
1338
1487
|
|
|
1339
1488
|
<div class="schedule-mode-grid" role="radiogroup" aria-label="When to run">
|
|
1340
|
-
|
|
1341
|
-
<
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
type="radio"
|
|
1352
|
-
name={`${launcher.launchConfigSchema.id}-schedule-mode`}
|
|
1353
|
-
checked={scheduleMode === "once"}
|
|
1354
|
-
onchange={() => setScheduleMode("once")}
|
|
1355
|
-
/>
|
|
1356
|
-
<span>Start later</span>
|
|
1357
|
-
</label>
|
|
1358
|
-
<label class="schedule-choice" data-selected={scheduleMode === "cron"}>
|
|
1359
|
-
<input
|
|
1360
|
-
type="radio"
|
|
1361
|
-
name={`${launcher.launchConfigSchema.id}-schedule-mode`}
|
|
1362
|
-
checked={scheduleMode === "cron"}
|
|
1363
|
-
onchange={() => setScheduleMode("cron")}
|
|
1364
|
-
/>
|
|
1365
|
-
<span>Run on cron</span>
|
|
1366
|
-
</label>
|
|
1489
|
+
{#each scheduleModes as option (option.mode)}
|
|
1490
|
+
<label class="schedule-choice" data-selected={scheduleMode === option.mode}>
|
|
1491
|
+
<input
|
|
1492
|
+
type="radio"
|
|
1493
|
+
name={`${launcher.launchConfigSchema.id}-schedule-mode`}
|
|
1494
|
+
checked={scheduleMode === option.mode}
|
|
1495
|
+
onchange={() => setScheduleMode(option.mode)}
|
|
1496
|
+
/>
|
|
1497
|
+
<span>{option.label}</span>
|
|
1498
|
+
</label>
|
|
1499
|
+
{/each}
|
|
1367
1500
|
</div>
|
|
1368
1501
|
|
|
1369
1502
|
{#if scheduleMode === "once"}
|
|
@@ -1380,10 +1513,13 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1380
1513
|
hourValue={scheduledRunAtHour}
|
|
1381
1514
|
minuteValue={scheduledRunAtMinute}
|
|
1382
1515
|
dataSection="launcher-schedule-once-picker"
|
|
1516
|
+
invalid={getFieldErrors("schedule-date").length > 0}
|
|
1517
|
+
describedBy={getFieldErrors("schedule-date").length ? fieldErrorsDomId("schedule-date") : undefined}
|
|
1383
1518
|
onDateChange={setScheduledRunDate}
|
|
1384
1519
|
onHourChange={setScheduledRunHour}
|
|
1385
1520
|
onMinuteChange={setScheduledRunMinute}
|
|
1386
1521
|
/>
|
|
1522
|
+
{@render validationMessages("schedule-date")}
|
|
1387
1523
|
{#if scheduledRunAtIso}
|
|
1388
1524
|
<p class="field-description">
|
|
1389
1525
|
Runs at {formatLocalDateTime24Hour(scheduledRunAtIso)} · {formatUtcDateTime24Hour(scheduledRunAtIso)}
|
|
@@ -1398,15 +1534,20 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1398
1534
|
</label>
|
|
1399
1535
|
<input
|
|
1400
1536
|
id={`${launcher.launchConfigSchema.id}-schedule-cron`}
|
|
1537
|
+
aria-invalid={getFieldErrors("schedule-cron").length > 0}
|
|
1538
|
+
aria-describedby={getFieldErrors("schedule-cron").length ? fieldErrorsDomId("schedule-cron") : undefined}
|
|
1539
|
+
onblur={() => blurField("schedule-cron")}
|
|
1401
1540
|
type="text"
|
|
1402
1541
|
placeholder="0 9 * * 1-5"
|
|
1403
1542
|
value={cronExpression}
|
|
1404
1543
|
oninput={(event) => {
|
|
1405
1544
|
cronExpression = (event.currentTarget as HTMLInputElement).value;
|
|
1545
|
+
touchField("schedule-cron", 300);
|
|
1406
1546
|
submitError = null;
|
|
1407
1547
|
submitSuccess = null;
|
|
1408
1548
|
}}
|
|
1409
1549
|
/>
|
|
1550
|
+
{@render validationMessages("schedule-cron")}
|
|
1410
1551
|
<p class="field-description">Cron uses 5 fields and runs in UTC.</p>
|
|
1411
1552
|
<div class="cron-example-list" data-section="launcher-cron-examples">
|
|
1412
1553
|
{#each cronExamples as example (example.expression)}
|
|
@@ -1427,7 +1568,7 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1427
1568
|
<p class="field-description">
|
|
1428
1569
|
Next run: {formatLocalDateTime24Hour(cronPreviewAt)} · {formatUtcDateTime24Hour(cronPreviewAt)}
|
|
1429
1570
|
</p>
|
|
1430
|
-
{:else if cronPreviewError}
|
|
1571
|
+
{:else if cronPreviewError && getFieldErrors("schedule-cron").length === 0}
|
|
1431
1572
|
<p class="field-description schedule-error">{cronPreviewError}</p>
|
|
1432
1573
|
{/if}
|
|
1433
1574
|
</div>
|
|
@@ -1450,10 +1591,20 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1450
1591
|
/>
|
|
1451
1592
|
</div>
|
|
1452
1593
|
{:else}
|
|
1594
|
+
<div class="validation-status" id={`${launcher.launchConfigSchema.id}-validation-status`} role="status" aria-live="polite">
|
|
1595
|
+
{#if validationPending}Checking values…
|
|
1596
|
+
{:else if validationError}
|
|
1597
|
+
<span class="schedule-error">{validationError}</span>
|
|
1598
|
+
<button type="button" class="secondary-button" onclick={retryValidation}>Retry validation</button>
|
|
1599
|
+
{:else if invalidFieldLabels.length > 0}Check: {invalidFieldLabels.join(", ")}.
|
|
1600
|
+
{:else if formErrors.length > 0}Resolve the validation errors above to continue.
|
|
1601
|
+
{/if}
|
|
1602
|
+
</div>
|
|
1453
1603
|
<button
|
|
1454
1604
|
class="submit-button"
|
|
1455
1605
|
type="submit"
|
|
1456
|
-
disabled={
|
|
1606
|
+
disabled={submitDisabled}
|
|
1607
|
+
aria-describedby={`${launcher.launchConfigSchema.id}-validation-status`}
|
|
1457
1608
|
data-pressable="true"
|
|
1458
1609
|
>
|
|
1459
1610
|
{submitButtonLabel()}
|
|
@@ -1465,6 +1616,34 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1465
1616
|
</div>
|
|
1466
1617
|
|
|
1467
1618
|
<style>
|
|
1619
|
+
.inline-validation-errors {
|
|
1620
|
+
margin: 0;
|
|
1621
|
+
padding: 0;
|
|
1622
|
+
list-style: none;
|
|
1623
|
+
color: var(--chronicle-danger);
|
|
1624
|
+
font-size: 0.875rem;
|
|
1625
|
+
line-height: 1.5;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
.title-field .inline-validation-errors { grid-column: 2; }
|
|
1629
|
+
|
|
1630
|
+
.validation-status {
|
|
1631
|
+
color: var(--chronicle-text-muted);
|
|
1632
|
+
font-size: 0.875rem;
|
|
1633
|
+
line-height: 1.5;
|
|
1634
|
+
flex: 1;
|
|
1635
|
+
min-width: 0;
|
|
1636
|
+
overflow-wrap: anywhere;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
.validation-status:empty { display: none; }
|
|
1640
|
+
|
|
1641
|
+
.launcher-fields input[aria-invalid="true"],
|
|
1642
|
+
.launcher-fields select[aria-invalid="true"],
|
|
1643
|
+
.model-config-group[data-invalid="true"] {
|
|
1644
|
+
border-color: var(--chronicle-danger);
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1468
1647
|
.launcher-form {
|
|
1469
1648
|
container-type: inline-size;
|
|
1470
1649
|
display: flex;
|