@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
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ResolvedSetting } from "@leitwerk-dev/domain";
|
|
3
|
+
import type {
|
|
4
|
+
SettingChoice,
|
|
5
|
+
SettingFieldView,
|
|
6
|
+
SettingsPreview,
|
|
7
|
+
} from "@leitwerk-dev/protocol/http-contracts";
|
|
8
|
+
import { type NamedSelection, settingSelectionValues } from "@leitwerk-dev/protocol/http-contracts";
|
|
9
|
+
import { tick, untrack } from "svelte";
|
|
10
|
+
import {
|
|
11
|
+
changeSettings,
|
|
12
|
+
fetchSettingsChoices,
|
|
13
|
+
fetchSettingsPreview,
|
|
14
|
+
type SettingsChange,
|
|
15
|
+
SettingsRequestError,
|
|
16
|
+
} from "../lib/settings.js";
|
|
17
|
+
import NamedSelectionList from "./NamedSelectionList.svelte";
|
|
18
|
+
|
|
19
|
+
let {
|
|
20
|
+
field,
|
|
21
|
+
subjectId,
|
|
22
|
+
onSaved,
|
|
23
|
+
}: { field: SettingFieldView; subjectId: string; onSaved: (preview: SettingsPreview) => void } =
|
|
24
|
+
$props();
|
|
25
|
+
let editing = $state(false);
|
|
26
|
+
let search = $state("");
|
|
27
|
+
let value = $state<unknown>(null);
|
|
28
|
+
let revision = $state(0);
|
|
29
|
+
let busy = $state(false);
|
|
30
|
+
let error = $state("");
|
|
31
|
+
let notice = $state("");
|
|
32
|
+
let conflict = $state(false);
|
|
33
|
+
let combined = $state<ResolvedSetting | null>(null);
|
|
34
|
+
let previewError = $state("");
|
|
35
|
+
let remoteChoices = $state<SettingChoice[]>([]);
|
|
36
|
+
let choicesLoading = $state(false);
|
|
37
|
+
let choicesError = $state("");
|
|
38
|
+
let choicesLoaded = $state(false);
|
|
39
|
+
let choicesRefresh = $state(0);
|
|
40
|
+
const mergeChoices = (...lists: SettingChoice[][]) => [
|
|
41
|
+
...new Map(lists.flat().map((choice) => [choice.value, choice])).values(),
|
|
42
|
+
];
|
|
43
|
+
const choices = $derived(
|
|
44
|
+
field.choicesDeferred ? mergeChoices(field.choices, remoteChoices) : field.choices,
|
|
45
|
+
);
|
|
46
|
+
const searchMinimum = $derived(field.form.search?.minimumLength ?? 0);
|
|
47
|
+
const needsSearch = $derived(searchMinimum > 0 && search.trim().length < searchMinimum);
|
|
48
|
+
const inputId = $derived(`setting-${subjectId}-${field.key}`);
|
|
49
|
+
const activeOverride = $derived(field.override && !field.override.reset ? field.override : null);
|
|
50
|
+
const selected = $derived(settingSelectionValues(value));
|
|
51
|
+
const retainedChoices = (saved: unknown) =>
|
|
52
|
+
remoteChoices.filter(
|
|
53
|
+
(choice) =>
|
|
54
|
+
selected.includes(choice.value) || settingSelectionValues(saved).includes(choice.value),
|
|
55
|
+
);
|
|
56
|
+
const selectionChoices = $derived([
|
|
57
|
+
...selected
|
|
58
|
+
.filter((value) => !choices.some((choice) => choice.value === value))
|
|
59
|
+
.map((value) => ({ value, label: `${value} (unavailable)`, disabledReason: undefined })),
|
|
60
|
+
...choices,
|
|
61
|
+
]);
|
|
62
|
+
const visibleChoices = $derived(
|
|
63
|
+
selectionChoices.filter(
|
|
64
|
+
(choice) =>
|
|
65
|
+
selected.includes(choice.value) ||
|
|
66
|
+
(searchMinimum > 0
|
|
67
|
+
? !needsSearch || field.choices.some((saved) => saved.value === choice.value)
|
|
68
|
+
: choice.label.toLowerCase().includes(search.trim().toLowerCase())),
|
|
69
|
+
),
|
|
70
|
+
);
|
|
71
|
+
function toggleChoice(choice: string, checked: boolean) {
|
|
72
|
+
value = checked
|
|
73
|
+
? [...new Set([...selected, choice])]
|
|
74
|
+
: selected.filter((entry) => entry !== choice);
|
|
75
|
+
}
|
|
76
|
+
function formatSelection(raw: unknown) {
|
|
77
|
+
if (
|
|
78
|
+
Array.isArray(raw) &&
|
|
79
|
+
raw.length &&
|
|
80
|
+
field.choicesDeferred &&
|
|
81
|
+
!choicesLoaded &&
|
|
82
|
+
raw.some((value) => !choices.some((choice) => choice.value === value))
|
|
83
|
+
)
|
|
84
|
+
return `${raw.length} selected`;
|
|
85
|
+
return Array.isArray(raw)
|
|
86
|
+
? raw
|
|
87
|
+
.map(
|
|
88
|
+
(value) =>
|
|
89
|
+
choices.find((choice) => choice.value === value)?.label ?? `${value} (unavailable)`,
|
|
90
|
+
)
|
|
91
|
+
.join("; ") || "None selected"
|
|
92
|
+
: format(raw);
|
|
93
|
+
}
|
|
94
|
+
const format = (raw: unknown): string =>
|
|
95
|
+
field.form.control === "named-selection-list" && Array.isArray(raw)
|
|
96
|
+
? raw.map((row: NamedSelection) => `${row.name}: ${formatSelection(row.values)}`).join("\n") ||
|
|
97
|
+
"No groups"
|
|
98
|
+
: raw === null
|
|
99
|
+
? "Runtime default (YAML or model catalog)"
|
|
100
|
+
: raw === ""
|
|
101
|
+
? "Empty"
|
|
102
|
+
: typeof raw === "string"
|
|
103
|
+
? raw
|
|
104
|
+
: JSON.stringify(raw);
|
|
105
|
+
const sources = (resolved: ResolvedSetting | null) =>
|
|
106
|
+
resolved?.sources.map((source) => source.label).join(" → ") ?? "Unavailable";
|
|
107
|
+
|
|
108
|
+
async function begin() {
|
|
109
|
+
search = "";
|
|
110
|
+
value = activeOverride ? activeOverride.value : (field.effective?.value ?? null);
|
|
111
|
+
revision = field.override?.revision ?? 0;
|
|
112
|
+
error = "";
|
|
113
|
+
notice = "";
|
|
114
|
+
conflict = false;
|
|
115
|
+
editing = true;
|
|
116
|
+
combined = null;
|
|
117
|
+
previewError = "";
|
|
118
|
+
await tick();
|
|
119
|
+
document.getElementById(inputId)?.focus();
|
|
120
|
+
}
|
|
121
|
+
async function cancel() {
|
|
122
|
+
editing = false;
|
|
123
|
+
error = "";
|
|
124
|
+
await tick();
|
|
125
|
+
document.getElementById(`${inputId}-edit`)?.focus();
|
|
126
|
+
}
|
|
127
|
+
function change(reset = false): SettingsChange {
|
|
128
|
+
return { subjectId, key: field.key, value, mode: "replace", reset, expectedRevision: revision };
|
|
129
|
+
}
|
|
130
|
+
$effect(() => {
|
|
131
|
+
if (!field.choicesDeferred) return;
|
|
132
|
+
const saved = field.effective?.value;
|
|
133
|
+
if (!editing && (!Array.isArray(saved) || !saved.length)) return;
|
|
134
|
+
const id = subjectId;
|
|
135
|
+
const key = field.key;
|
|
136
|
+
const query = editing ? search.trim() : "";
|
|
137
|
+
void choicesRefresh;
|
|
138
|
+
if (searchMinimum > 0) {
|
|
139
|
+
remoteChoices = untrack(() => retainedChoices(saved));
|
|
140
|
+
if (!editing || query.length < searchMinimum) {
|
|
141
|
+
choicesLoading = false;
|
|
142
|
+
choicesError = "";
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const controller = new AbortController();
|
|
147
|
+
choicesLoading = true;
|
|
148
|
+
choicesError = "";
|
|
149
|
+
const timer = setTimeout(() => {
|
|
150
|
+
void fetchSettingsChoices(id, key, query, controller.signal)
|
|
151
|
+
.then((result) => {
|
|
152
|
+
if (controller.signal.aborted) return;
|
|
153
|
+
remoteChoices = mergeChoices(retainedChoices(saved), result.choices);
|
|
154
|
+
choicesLoaded = true;
|
|
155
|
+
})
|
|
156
|
+
.catch((caught: unknown) => {
|
|
157
|
+
if (!controller.signal.aborted)
|
|
158
|
+
choicesError =
|
|
159
|
+
caught instanceof Error ? caught.message : "Could not load options. Try again.";
|
|
160
|
+
})
|
|
161
|
+
.finally(() => {
|
|
162
|
+
if (!controller.signal.aborted) choicesLoading = false;
|
|
163
|
+
});
|
|
164
|
+
}, 200);
|
|
165
|
+
return () => {
|
|
166
|
+
controller.abort();
|
|
167
|
+
clearTimeout(timer);
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
$effect(() => {
|
|
171
|
+
if (!editing || field.form.control !== "named-selection-list") return;
|
|
172
|
+
const draft = change();
|
|
173
|
+
let current = true;
|
|
174
|
+
const timer = setTimeout(() => {
|
|
175
|
+
void changeSettings(draft, true)
|
|
176
|
+
.then((result) => {
|
|
177
|
+
if (!current) return;
|
|
178
|
+
const updated = result.fields.find((candidate) => candidate.key === field.key);
|
|
179
|
+
combined = updated?.effective ?? null;
|
|
180
|
+
previewError = updated?.error ?? "";
|
|
181
|
+
})
|
|
182
|
+
.catch((caught: unknown) => {
|
|
183
|
+
if (current)
|
|
184
|
+
previewError = caught instanceof Error ? caught.message : "Could not preview setting";
|
|
185
|
+
});
|
|
186
|
+
}, 250);
|
|
187
|
+
return () => {
|
|
188
|
+
current = false;
|
|
189
|
+
clearTimeout(timer);
|
|
190
|
+
};
|
|
191
|
+
});
|
|
192
|
+
async function save(reset = false) {
|
|
193
|
+
if (busy) return;
|
|
194
|
+
if (!editing) revision = field.override?.revision ?? 0;
|
|
195
|
+
const draft = change(reset);
|
|
196
|
+
const notifySaved = onSaved;
|
|
197
|
+
busy = true;
|
|
198
|
+
error = "";
|
|
199
|
+
notice = "";
|
|
200
|
+
try {
|
|
201
|
+
const result = await changeSettings(draft);
|
|
202
|
+
notifySaved(result);
|
|
203
|
+
editing = false;
|
|
204
|
+
conflict = false;
|
|
205
|
+
notice = reset ? "Inherited value restored." : "Saved. Future steps will use this setting.";
|
|
206
|
+
window.dispatchEvent(new Event("leitwerk:settings-changed"));
|
|
207
|
+
busy = false;
|
|
208
|
+
await tick();
|
|
209
|
+
document.getElementById(`${inputId}-edit`)?.focus();
|
|
210
|
+
} catch (caught) {
|
|
211
|
+
error =
|
|
212
|
+
caught instanceof Error ? caught.message : "Could not save setting. Your draft is preserved.";
|
|
213
|
+
conflict = caught instanceof SettingsRequestError && caught.status === 409;
|
|
214
|
+
if (conflict) {
|
|
215
|
+
try {
|
|
216
|
+
notifySaved(await fetchSettingsPreview(draft.subjectId));
|
|
217
|
+
} catch {
|
|
218
|
+
/* Keep the draft and original error. */
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
} finally {
|
|
222
|
+
busy = false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
async function useLatestRevision() {
|
|
226
|
+
revision = field.override?.revision ?? 0;
|
|
227
|
+
conflict = false;
|
|
228
|
+
error = "";
|
|
229
|
+
await tick();
|
|
230
|
+
document.getElementById(inputId)?.focus();
|
|
231
|
+
}
|
|
232
|
+
</script>
|
|
233
|
+
|
|
234
|
+
<section class="setting-field" aria-labelledby={`${inputId}-heading`}>
|
|
235
|
+
<div class="field-heading">
|
|
236
|
+
<div><h3 id={`${inputId}-heading`}>{field.form.label}</h3>{#if field.form.description}<p class="description">{field.form.description}</p>{/if}</div>
|
|
237
|
+
{#if !editing}<button id={`${inputId}-edit`} type="button" onclick={begin} disabled={busy}>{activeOverride ? "Edit override" : "Override"}</button>{/if}
|
|
238
|
+
</div>
|
|
239
|
+
<div class="effective"><span class="source">Effective value · {sources(field.effective)}</span><p class:multiline-value={field.form.control === "textarea" || field.form.control === "named-selection-list"}>{field.effective ? (field.form.control === "multiselect" ? formatSelection(field.effective.value) : format(field.effective.value)) : "Unavailable"}</p></div>
|
|
240
|
+
{#if field.error}<p class="error" role="alert">{field.error}</p>{/if}
|
|
241
|
+
{#if editing}
|
|
242
|
+
<form onsubmit={(event) => { event.preventDefault(); void save(); }}>
|
|
243
|
+
<label for={inputId}>{field.form.label} override</label>
|
|
244
|
+
{#if choicesLoading}<p class="source" role="status">{searchMinimum > 0 ? "Searching…" : "Loading options…"}</p>{/if}
|
|
245
|
+
{#if choicesError}<p class="error" role="alert">{choicesError}</p><button type="button" onclick={() => choicesRefresh++}>{searchMinimum > 0 ? "Retry search" : "Retry options"}</button>{/if}
|
|
246
|
+
{#if field.form.control === "named-selection-list"}
|
|
247
|
+
<input id={inputId} type="search" placeholder={field.form.search?.placeholder ?? "Search options"} bind:value={search} disabled={busy} onkeydown={(event) => { if (event.key === "Enter") event.preventDefault(); }} />
|
|
248
|
+
{#if needsSearch}<p class="description">Type at least {searchMinimum} characters to search.</p>{/if}
|
|
249
|
+
{#if choicesLoaded && !needsSearch && !choicesLoading && !choicesError && !remoteChoices.some((choice) => !selected.includes(choice.value))}<p class="description" role="status">No additional matches. Try a different search.</p>{/if}
|
|
250
|
+
<NamedSelectionList rows={Array.isArray(value) ? value as NamedSelection[] : []} choices={visibleChoices} {busy} id={inputId} onChange={(rows) => value = rows} />
|
|
251
|
+
{:else if field.form.control === "multiselect"}
|
|
252
|
+
<input id={inputId} type="search" placeholder={field.form.search?.placeholder ?? "Search options"} bind:value={search} disabled={busy} onkeydown={(event) => { if (event.key === "Enter") event.preventDefault(); }} aria-describedby={`${inputId}-count${searchMinimum > 0 ? ` ${inputId}-search-help` : ""}`} />
|
|
253
|
+
<p id={`${inputId}-count`} class="source" aria-live="polite">{selected.length} selected</p>
|
|
254
|
+
{#if searchMinimum > 0}<p id={`${inputId}-search-help`} class="description">{needsSearch ? `Type at least ${searchMinimum} characters to search.` : "Select options from the matches below."}</p>{/if}
|
|
255
|
+
<div class="choices" role="group" aria-label={field.form.label}>
|
|
256
|
+
{#each visibleChoices as choice (choice.value)}
|
|
257
|
+
<label class="choice"><input type="checkbox" checked={selected.includes(choice.value)} disabled={busy || (Boolean(choice.disabledReason) && !selected.includes(choice.value))} onchange={(event) => toggleChoice(choice.value, event.currentTarget.checked)} /><span>{choice.label}{choice.disabledReason ? ` — ${choice.disabledReason}` : ""}</span></label>
|
|
258
|
+
{:else}{#if !choicesLoading && !choicesError && !needsSearch}<p class="description">No matching options. Try a different search.</p>{/if}{/each}
|
|
259
|
+
</div>
|
|
260
|
+
{:else if field.form.control === "model" || field.form.control === "select"}
|
|
261
|
+
<select id={inputId} value={String(value ?? "")} onchange={(event) => { value = event.currentTarget.value || (field.form.control === "model" ? null : ""); }} disabled={busy}>
|
|
262
|
+
{#if field.form.control === "model"}<option value="">Use YAML / catalog default</option>{/if}
|
|
263
|
+
{#if typeof value === "string" && !choices.some((choice) => choice.value === value)}<option value={value}>{value} (unavailable)</option>{/if}
|
|
264
|
+
{#each choices as choice (choice.value)}<option value={choice.value} disabled={Boolean(choice.disabledReason)}>{choice.label}{choice.disabledReason ? ` — ${choice.disabledReason}` : ""}</option>{/each}
|
|
265
|
+
</select>
|
|
266
|
+
{:else if field.form.control === "textarea"}
|
|
267
|
+
<textarea id={inputId} rows="6" value={String(value ?? "")} oninput={(event) => { value = event.currentTarget.value; }} disabled={busy}></textarea>
|
|
268
|
+
{:else if field.form.control === "checkbox"}
|
|
269
|
+
<input id={inputId} type="checkbox" checked={Boolean(value)} onchange={(event) => { value = event.currentTarget.checked; }} disabled={busy} />
|
|
270
|
+
{:else if field.form.control === "number"}
|
|
271
|
+
<input id={inputId} type="number" value={Number(value)} oninput={(event) => { value = event.currentTarget.valueAsNumber; }} disabled={busy} />
|
|
272
|
+
{:else}
|
|
273
|
+
<input id={inputId} type="text" value={String(value ?? "")} oninput={(event) => { value = event.currentTarget.value; }} disabled={busy} />
|
|
274
|
+
{/if}
|
|
275
|
+
{#if field.form.control === "named-selection-list" && combined}<div class="combined"><span class="source">Group preview</span><p class="multiline-value">{format(combined.value)}</p></div>{/if}
|
|
276
|
+
{#if previewError}<p class="error">{previewError}</p>{/if}
|
|
277
|
+
<div class="actions"><button class="save" type="submit" disabled={busy || conflict}>{busy ? "Saving…" : "Save override"}</button><button type="button" onclick={cancel} disabled={busy}>Cancel</button></div>
|
|
278
|
+
</form>
|
|
279
|
+
{/if}
|
|
280
|
+
{#if activeOverride}<button class="inherit" type="button" onclick={() => save(true)} disabled={busy || conflict}>Use inherited value</button>{/if}
|
|
281
|
+
{#if error}<p class="error" role="alert">{error}</p>{/if}
|
|
282
|
+
{#if conflict}<p>Current saved value: {format(field.override?.value)}. Compare it with your draft above.</p><button type="button" onclick={useLatestRevision} disabled={busy}>Keep draft and use latest revision</button>{/if}
|
|
283
|
+
{#if notice}<p class="notice" role="status">{notice}</p>{/if}
|
|
284
|
+
</section>
|
|
285
|
+
|
|
286
|
+
<style>
|
|
287
|
+
.setting-field { padding: 1.4rem 0; border-top: 1px solid var(--chronicle-border); }
|
|
288
|
+
.field-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
|
|
289
|
+
h3 { margin: 0; font-size: var(--type-body-lg); }
|
|
290
|
+
p { margin: .5rem 0; line-height: 1.5; overflow-wrap: anywhere; }
|
|
291
|
+
.description { color: var(--chronicle-text-muted); max-width: 65ch; font-size: var(--type-body-sm); }
|
|
292
|
+
.source { color: var(--chronicle-text-muted); font-size: var(--type-caption); }
|
|
293
|
+
.effective { margin-top: .75rem; }
|
|
294
|
+
.effective p { margin-top: .25rem; }
|
|
295
|
+
.multiline-value { white-space: pre-wrap; }
|
|
296
|
+
form { margin: 1rem 0; display: grid; gap: .65rem; }
|
|
297
|
+
label { font-weight: 600; }
|
|
298
|
+
input:not([type="checkbox"]), select, textarea { width: 100%; min-width: 0; border: 1px solid var(--chronicle-border-strong); border-radius: var(--radius-sm); padding: .7rem; background: var(--chronicle-panel-surface); color: var(--chronicle-text); font: inherit; }
|
|
299
|
+
textarea { resize: vertical; }
|
|
300
|
+
.combined { padding: .8rem; background: var(--chronicle-panel-muted); border-radius: var(--radius-sm); }
|
|
301
|
+
button { min-height: 44px; padding: .5rem .85rem; border: 1px solid var(--chronicle-border-strong); border-radius: var(--radius-sm); background: var(--chronicle-panel-surface); color: var(--chronicle-text); font: inherit; cursor: pointer; }
|
|
302
|
+
button:hover:not(:disabled) { background: var(--chronicle-panel-muted); }
|
|
303
|
+
button:disabled { opacity: .6; cursor: default; }
|
|
304
|
+
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 3px; }
|
|
305
|
+
.save { background: var(--chronicle-accent); color: var(--chronicle-text-on-accent); border-color: var(--chronicle-accent); }
|
|
306
|
+
.save:hover:not(:disabled) { background: color-mix(in srgb, var(--chronicle-accent) 85%, black); }
|
|
307
|
+
.actions { display: flex; gap: .6rem; flex-wrap: wrap; }
|
|
308
|
+
.choices { max-height: 20rem; overflow-y: auto; border-block: 1px solid var(--chronicle-border); }
|
|
309
|
+
.choice { display: flex; align-items: center; gap: .75rem; min-height: 44px; padding: .6rem .2rem; font-weight: 400; cursor: pointer; }
|
|
310
|
+
.choice span { min-width: 0; overflow-wrap: anywhere; }
|
|
311
|
+
.choice input { flex: 0 0 auto; accent-color: var(--chronicle-accent); }
|
|
312
|
+
.choice:hover { background: var(--chronicle-panel-muted); }
|
|
313
|
+
.inherit { margin-top: .5rem; }
|
|
314
|
+
.error { color: var(--chronicle-danger); }
|
|
315
|
+
.notice { color: var(--chronicle-success); }
|
|
316
|
+
@media (max-width: 600px) { .field-heading { flex-direction: column; gap: .5rem; } }
|
|
317
|
+
</style>
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type {
|
|
3
|
+
SettingChoice,
|
|
4
|
+
SettingsOverviewResponse,
|
|
5
|
+
SettingsScopeOverview,
|
|
6
|
+
SettingsScopesResponse,
|
|
7
|
+
} from "@leitwerk-dev/protocol/http-contracts";
|
|
8
|
+
import { onMount, type Snippet, tick } from "svelte";
|
|
9
|
+
import { locationStore, navigate } from "../lib/router.svelte.js";
|
|
10
|
+
import { fetchSettingsOverview, onSettingsChanged } from "../lib/settings.js";
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
scopeType,
|
|
14
|
+
overview,
|
|
15
|
+
label,
|
|
16
|
+
subjects,
|
|
17
|
+
selected,
|
|
18
|
+
panelOpen,
|
|
19
|
+
refreshVersion = 0,
|
|
20
|
+
onSelect,
|
|
21
|
+
onClose,
|
|
22
|
+
children,
|
|
23
|
+
refresh,
|
|
24
|
+
}: {
|
|
25
|
+
scopeType: string;
|
|
26
|
+
overview?: SettingsScopeOverview;
|
|
27
|
+
label: string;
|
|
28
|
+
subjects: SettingsScopesResponse["subjects"];
|
|
29
|
+
selected: string;
|
|
30
|
+
panelOpen: boolean;
|
|
31
|
+
refreshVersion?: number;
|
|
32
|
+
onSelect: (id: string) => void;
|
|
33
|
+
onClose: () => void;
|
|
34
|
+
children?: Snippet;
|
|
35
|
+
refresh?: Snippet;
|
|
36
|
+
} = $props();
|
|
37
|
+
let items = $state<SettingsOverviewResponse["items"]>([]);
|
|
38
|
+
let loading = $state(true);
|
|
39
|
+
let error = $state("");
|
|
40
|
+
let loadId = 0;
|
|
41
|
+
const params = $derived(new URL($locationStore, window.location.origin).searchParams);
|
|
42
|
+
const query = $derived(params.get("q") ?? "");
|
|
43
|
+
const filter = $derived(params.get("filter") ?? "all");
|
|
44
|
+
const project = $derived(params.get("project") ?? "");
|
|
45
|
+
const mapping = $derived(items.some((item) => item.mapping !== undefined));
|
|
46
|
+
const rows = $derived(
|
|
47
|
+
[...subjects]
|
|
48
|
+
.sort((a, b) => a.label.localeCompare(b.label) || a.id.localeCompare(b.id))
|
|
49
|
+
.map((subject) => ({
|
|
50
|
+
...subject,
|
|
51
|
+
summary: items.find((item) => item.subjectId === subject.id),
|
|
52
|
+
project:
|
|
53
|
+
overview?.parentLabel &&
|
|
54
|
+
overview.labelSeparator &&
|
|
55
|
+
subject.label.includes(overview.labelSeparator)
|
|
56
|
+
? subject.label.split(overview.labelSeparator)[0]
|
|
57
|
+
: "",
|
|
58
|
+
name: overview?.labelSeparator
|
|
59
|
+
? subject.label.split(overview.labelSeparator).slice(1).join(overview.labelSeparator) ||
|
|
60
|
+
subject.label
|
|
61
|
+
: subject.label,
|
|
62
|
+
})),
|
|
63
|
+
);
|
|
64
|
+
const projects = $derived([...new Set(rows.map((row) => row.project).filter(Boolean))].sort());
|
|
65
|
+
const projectRows = $derived(rows.filter((row) => !project || row.project === project));
|
|
66
|
+
function status(row: (typeof rows)[number]) {
|
|
67
|
+
if (!row.summary) return loading ? "loading" : "unavailable";
|
|
68
|
+
if (row.summary.errors.length) return "error";
|
|
69
|
+
if (mapping)
|
|
70
|
+
return row.summary.mapping === undefined
|
|
71
|
+
? "unavailable"
|
|
72
|
+
: row.summary.mapping.length
|
|
73
|
+
? "mapped"
|
|
74
|
+
: "unmapped";
|
|
75
|
+
return row.summary.customized.length ? "customized" : "defaults";
|
|
76
|
+
}
|
|
77
|
+
const filters = $derived(
|
|
78
|
+
mapping
|
|
79
|
+
? [
|
|
80
|
+
{ id: "all", label: "All" },
|
|
81
|
+
{ id: "mapped", label: "Mapped" },
|
|
82
|
+
{ id: "unmapped", label: "Unmapped" },
|
|
83
|
+
]
|
|
84
|
+
: [
|
|
85
|
+
{ id: "all", label: "All" },
|
|
86
|
+
{ id: "customized", label: "Customized" },
|
|
87
|
+
{ id: "defaults", label: "Using defaults" },
|
|
88
|
+
],
|
|
89
|
+
);
|
|
90
|
+
const visibleRows = $derived(
|
|
91
|
+
projectRows.filter(
|
|
92
|
+
(row) =>
|
|
93
|
+
(filter === "all" || status(row) === filter) &&
|
|
94
|
+
`${row.label} ${row.summary?.mapping?.map((choice) => choice.label).join(" ") ?? ""} ${row.summary?.customized.join(" ") ?? ""}`
|
|
95
|
+
.toLowerCase()
|
|
96
|
+
.includes(query.trim().toLowerCase()),
|
|
97
|
+
),
|
|
98
|
+
);
|
|
99
|
+
const nextUnmapped = $derived(
|
|
100
|
+
projectRows.find(
|
|
101
|
+
(row) =>
|
|
102
|
+
row.id !== selected &&
|
|
103
|
+
status(row) === "unmapped" &&
|
|
104
|
+
`${row.label} ${row.summary?.mapping?.map((c) => c.label).join(" ") ?? ""}`
|
|
105
|
+
.toLowerCase()
|
|
106
|
+
.includes(query.trim().toLowerCase()),
|
|
107
|
+
),
|
|
108
|
+
);
|
|
109
|
+
function update(key: string, value: string, replace = false) {
|
|
110
|
+
const url = new URL($locationStore, window.location.origin);
|
|
111
|
+
url.pathname = "/settings";
|
|
112
|
+
url.searchParams.set("scope", selected);
|
|
113
|
+
if (value && value !== "all") url.searchParams.set(key, value);
|
|
114
|
+
else url.searchParams.delete(key);
|
|
115
|
+
navigate(`${url.pathname}${url.search}`, { replace });
|
|
116
|
+
}
|
|
117
|
+
async function reload() {
|
|
118
|
+
const id = ++loadId;
|
|
119
|
+
error = "";
|
|
120
|
+
try {
|
|
121
|
+
const result = await fetchSettingsOverview(scopeType);
|
|
122
|
+
if (id === loadId) items = result.items;
|
|
123
|
+
} catch (caught) {
|
|
124
|
+
if (id === loadId)
|
|
125
|
+
error = caught instanceof Error ? caught.message : "Could not load settings overview";
|
|
126
|
+
} finally {
|
|
127
|
+
if (id === loadId) loading = false;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
$effect(() => {
|
|
131
|
+
const type = scopeType;
|
|
132
|
+
void refreshVersion;
|
|
133
|
+
if (!type) return;
|
|
134
|
+
loading = true;
|
|
135
|
+
void reload();
|
|
136
|
+
});
|
|
137
|
+
onMount(() => {
|
|
138
|
+
const unsubscribe = onSettingsChanged(() => {
|
|
139
|
+
void reload();
|
|
140
|
+
});
|
|
141
|
+
return () => {
|
|
142
|
+
loadId++;
|
|
143
|
+
unsubscribe();
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
function repositoryLabel(label: string) {
|
|
147
|
+
return label.split(" · ")[0];
|
|
148
|
+
}
|
|
149
|
+
function repositoryHref(choice: SettingChoice): string | undefined {
|
|
150
|
+
try {
|
|
151
|
+
const value = JSON.parse(choice.value);
|
|
152
|
+
if (typeof value.origin !== "string" || typeof value.projectId !== "number") return;
|
|
153
|
+
const url = new URL(value.origin);
|
|
154
|
+
if (!["https:", "http:"].includes(url.protocol) || url.username || url.password) return;
|
|
155
|
+
url.pathname = `/projects/${value.projectId}`;
|
|
156
|
+
url.search = "";
|
|
157
|
+
url.hash = "";
|
|
158
|
+
return url.toString();
|
|
159
|
+
} catch {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async function close() {
|
|
164
|
+
onClose();
|
|
165
|
+
await tick();
|
|
166
|
+
(
|
|
167
|
+
document.getElementById(`settings-row-${selected}`) ??
|
|
168
|
+
document.getElementById("settings-search")
|
|
169
|
+
)?.focus();
|
|
170
|
+
}
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<div class="settings-overview" class:editing={panelOpen}>
|
|
174
|
+
<div class="overview-header"><div><h2>{label}</h2><p aria-live="polite">{#if loading}Loading overview…{:else if error}Overview unavailable{:else if mapping}{projectRows.filter((row) => status(row) === "mapped").length} of {projectRows.length} {overview?.itemLabelPlural.toLowerCase() ?? "entries"} mapped · {projectRows.filter((row) => status(row) === "unmapped").length} unmapped{:else}{projectRows.length} {label.toLowerCase()} · {projectRows.filter((row) => status(row) === "customized").length} customized{/if}{#if projectRows.some((row) => status(row) === "error")} · {projectRows.filter((row) => status(row) === "error").length} need attention{/if}</p></div>{@render refresh?.()}</div>
|
|
175
|
+
{#if error}<div class="overview-error" role="alert">{error} <button type="button" onclick={reload}>Retry overview</button></div>{/if}
|
|
176
|
+
<div class="toolbar"><div class="search"><label for="settings-search">Search {overview?.itemLabelPlural.toLowerCase() ?? "entries"}</label><input id="settings-search" type="search" placeholder={mapping ? "Search components or repositories…" : "Search repositories or settings…"} value={query} oninput={(event) => update("q", event.currentTarget.value, true)} /></div>{#if projects.length}<div class="project"><label for="settings-project">{overview?.parentLabel ?? "Group"}</label><select id="settings-project" value={project} onchange={(event) => update("project", event.currentTarget.value)}><option value="">All {(overview?.parentLabel ?? "group").toLowerCase()}s</option>{#each projects as name}<option value={name}>{name}</option>{/each}</select></div>{/if}</div>
|
|
177
|
+
<div class="filters" role="group" aria-label="Filter settings">{#each filters as option}<button type="button" aria-pressed={filter === option.id} onclick={() => update("filter", option.id)}>{option.label} <span>{option.id === "all" ? projectRows.length : projectRows.filter((row) => status(row) === option.id).length}</span></button>{/each}</div>
|
|
178
|
+
<div class="overview-layout" class:panel-open={panelOpen}>
|
|
179
|
+
<div class="inventory">
|
|
180
|
+
<table><caption class="sr-only">{label} settings overview</caption><thead><tr><th scope="col">{overview?.itemLabel ?? "Name"}</th><th scope="col">Status</th><th scope="col">{mapping ? "Repositories" : "Settings"}</th></tr></thead><tbody>
|
|
181
|
+
{#each visibleRows as row (row.id)}<tr class:selected={panelOpen && row.id === selected}><th scope="row"><button type="button" id={`settings-row-${row.id}`} aria-expanded={panelOpen && row.id === selected} aria-controls={panelOpen ? "settings-editor" : undefined} onclick={() => onSelect(row.id)}>{row.name}</button>{#if row.project}<small>{row.project}</small>{/if}{#if !row.active}<small>Inactive scope</small>{/if}</th><td><span class="status" class:mapped={status(row) === "mapped"} class:attention={status(row) === "error"}>{status(row) === "loading" ? "Loading…" : status(row) === "error" ? "Needs attention" : status(row) === "mapped" ? "Mapped" : status(row) === "unmapped" ? "Unmapped" : status(row) === "customized" ? "Customized" : status(row) === "unavailable" ? "Unavailable" : "Using defaults"}</span></td><td>{#if row.summary?.mapping?.length}{@const choice = row.summary.mapping[0]}{@const href = repositoryHref(choice)}{#if href}<a class="repository" {href} target="_blank" rel="noopener noreferrer" aria-label={`${repositoryLabel(choice.label)} (opens in a new tab)`} title={row.summary.mapping.map((entry) => entry.label).join("; ")}>{repositoryLabel(choice.label)}</a>{:else}<span class="repository">{repositoryLabel(choice.label)}</span>{/if}{#if row.summary.mapping.length > 1}<span class="more">+{row.summary.mapping.length - 1} more</span>{/if}{:else if row.summary?.errors.length}<span class="muted">Open to review</span>{:else if row.summary?.mapping !== undefined}<span class="muted">No repository selected</span>{:else if row.summary?.customized.length}<span>{row.summary.customized.join(", ")}</span>{:else}<span class="muted">{mapping ? "No repository selected" : "Inherited settings"}</span>{/if}</td></tr>{/each}
|
|
182
|
+
</tbody></table>
|
|
183
|
+
{#if !visibleRows.length && !loading}<div class="empty"><h3>{query || filter !== "all" || project ? "No matching entries" : "No entries yet"}</h3><p>{query || filter !== "all" || project ? "Change your search or filters to see more entries." : "Refresh sources to discover settings scopes."}</p></div>{/if}
|
|
184
|
+
</div>
|
|
185
|
+
{#if panelOpen}<aside id="settings-editor" aria-label="Settings editor"><div class="editor-heading"><div><h3 tabindex="-1" id="settings-editor-heading">{rows.find((row) => row.id === selected)?.name ?? "Settings"}</h3><p>{rows.find((row) => row.id === selected)?.project || label}</p></div><button type="button" onclick={close}>Close</button></div>{#if mapping && nextUnmapped}<button class="next" type="button" onclick={() => onSelect(nextUnmapped.id)}>Next unmapped {overview?.itemLabel.toLowerCase() ?? "entry"}</button>{/if}{@render children?.()}</aside>{/if}
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
</div>
|
|
189
|
+
|
|
190
|
+
<style>
|
|
191
|
+
h2 { margin: 0; font-size: var(--type-title-sm); }
|
|
192
|
+
h3 { margin: 0; font-size: var(--type-body-lg); overflow-wrap: anywhere; }
|
|
193
|
+
p { margin: .5rem 0 0; color: var(--chronicle-text-muted); line-height: 1.5; }
|
|
194
|
+
.overview-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.75rem 0 1.25rem; }
|
|
195
|
+
.toolbar { display: flex; gap: 1rem; align-items: end; }
|
|
196
|
+
.search { flex: 1; }
|
|
197
|
+
.project { min-width: 140px; }
|
|
198
|
+
label { display: block; margin-bottom: .5rem; font-size: var(--type-body-sm); font-weight: 600; }
|
|
199
|
+
input, select, button { min-height: 44px; padding: .65rem .8rem; border: 1px solid var(--chronicle-border-strong); border-radius: var(--radius-sm); background: var(--chronicle-panel-surface); color: var(--chronicle-text); font: inherit; }
|
|
200
|
+
input, select { width: 100%; min-width: 0; }
|
|
201
|
+
button { cursor: pointer; }
|
|
202
|
+
button:hover { background: var(--chronicle-panel-muted); }
|
|
203
|
+
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 3px; }
|
|
204
|
+
.filters { display: flex; flex-wrap: wrap; gap: .35rem; margin: 1rem 0; }
|
|
205
|
+
.filters button { border-color: transparent; background: transparent; font-size: var(--type-body-sm); }
|
|
206
|
+
.filters button[aria-pressed="true"] { background: var(--chronicle-accent-soft); color: var(--chronicle-accent); font-weight: 600; }
|
|
207
|
+
.filters span { margin-left: .5rem; font-variant-numeric: tabular-nums; }
|
|
208
|
+
.overview-layout { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; border-top: 1px solid var(--chronicle-border); }
|
|
209
|
+
.overview-layout.panel-open { grid-template-columns: minmax(0, 1fr) minmax(320px, .85fr); }
|
|
210
|
+
.inventory { min-width: 0; }
|
|
211
|
+
table { width: 100%; border-collapse: collapse; text-align: left; table-layout: fixed; font-size: var(--type-body-sm); }
|
|
212
|
+
th, td { padding: .85rem .75rem; border-bottom: 1px solid var(--chronicle-border); vertical-align: top; overflow-wrap: anywhere; }
|
|
213
|
+
thead th { font-weight: 600; color: var(--chronicle-text-muted); background: var(--chronicle-panel-muted); }
|
|
214
|
+
th:first-child { width: 35%; }
|
|
215
|
+
th:nth-child(2) { width: 24%; }
|
|
216
|
+
tbody th { font-weight: 400; }
|
|
217
|
+
tbody th button { min-height: 44px; margin: -.5rem 0; padding: .5rem 0; border: 0; background: transparent; border-radius: 0; color: var(--chronicle-link); text-align: left; font-weight: 600; overflow-wrap: anywhere; }
|
|
218
|
+
tbody tr:hover { background: var(--chronicle-panel-muted); }
|
|
219
|
+
tr.selected { background: var(--chronicle-accent-soft); }
|
|
220
|
+
small { display: block; margin-top: .25rem; color: var(--chronicle-text-muted); }
|
|
221
|
+
.status { white-space: normal; color: var(--chronicle-text-muted); }
|
|
222
|
+
.status.mapped { color: var(--chronicle-success); }
|
|
223
|
+
.status.attention, .overview-error { color: var(--chronicle-danger); }
|
|
224
|
+
.repository { display: block; }
|
|
225
|
+
a.repository { color: var(--chronicle-link); text-underline-offset: .2em; }
|
|
226
|
+
a.repository:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 3px; }
|
|
227
|
+
.more, .muted { color: var(--chronicle-text-muted); }
|
|
228
|
+
.more { display: inline-block; margin-top: .25rem; }
|
|
229
|
+
aside { position: sticky; top: 1rem; min-width: 0; max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.25rem; border-left: 1px solid var(--chronicle-border); }
|
|
230
|
+
.editor-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; }
|
|
231
|
+
.editor-heading p { font-size: var(--type-caption); }
|
|
232
|
+
.next { margin-top: 1rem; width: 100%; }
|
|
233
|
+
.empty { padding: 2rem 1rem; }
|
|
234
|
+
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
235
|
+
@media (max-width: 1000px) { .panel-open th:first-child { width: 52%; } .panel-open th:nth-child(2) { width: 48%; } .panel-open th:nth-child(3), .panel-open td:nth-child(3) { display: none; } }
|
|
236
|
+
@media (max-width: 700px) { .editing .overview-header, .editing .toolbar, .editing .filters { display: none; } .toolbar { flex-direction: column; align-items: stretch; } .overview-header { align-items: start; } .overview-layout.panel-open { grid-template-columns: minmax(0, 1fr); } .panel-open .inventory { display: none; } aside { position: static; max-height: none; border-left: 0; padding: 1rem 0; } th:first-child { width: 46%; } th:nth-child(2) { width: 26%; } }
|
|
237
|
+
</style>
|
|
@@ -4,17 +4,28 @@ import type { SkillOptionSummary } from "@leitwerk-dev/protocol";
|
|
|
4
4
|
interface Props {
|
|
5
5
|
skills: readonly SkillOptionSummary[];
|
|
6
6
|
selectedIds?: string[];
|
|
7
|
+
id?: string;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
describedBy?: string;
|
|
10
|
+
onSelectionChange?: () => void;
|
|
7
11
|
}
|
|
8
12
|
|
|
9
|
-
let {
|
|
13
|
+
let {
|
|
14
|
+
skills,
|
|
15
|
+
selectedIds = $bindable([]),
|
|
16
|
+
id = undefined,
|
|
17
|
+
invalid = false,
|
|
18
|
+
describedBy = undefined,
|
|
19
|
+
onSelectionChange = undefined,
|
|
20
|
+
}: Props = $props();
|
|
10
21
|
</script>
|
|
11
22
|
|
|
12
|
-
<fieldset class="skill-selector" data-section="launcher-skills">
|
|
23
|
+
<fieldset {id} tabindex="-1" data-invalid={invalid} aria-describedby={describedBy} class="skill-selector" data-section="launcher-skills">
|
|
13
24
|
<legend class="field-label">Skills</legend>
|
|
14
25
|
<p class="field-description">Make selected skills available to every AI step in this run.</p>
|
|
15
26
|
{#each skills as skill (skill.id)}
|
|
16
27
|
<label class="skill-option">
|
|
17
|
-
<input type="checkbox" value={skill.id} bind:group={selectedIds} />
|
|
28
|
+
<input type="checkbox" aria-invalid={invalid} aria-describedby={describedBy} value={skill.id} bind:group={selectedIds} onchange={onSelectionChange} />
|
|
18
29
|
<span>
|
|
19
30
|
<strong>{skill.label}</strong>
|
|
20
31
|
{#if skill.description}<small>{skill.description}</small>{/if}
|
|
@@ -24,6 +35,7 @@ let { skills, selectedIds = $bindable([]) }: Props = $props();
|
|
|
24
35
|
</fieldset>
|
|
25
36
|
|
|
26
37
|
<style>
|
|
38
|
+
.skill-selector[data-invalid="true"] { outline: 1px solid var(--chronicle-danger); outline-offset: 4px; }
|
|
27
39
|
.skill-selector {
|
|
28
40
|
border: 0;
|
|
29
41
|
padding: 0;
|
|
@@ -90,10 +90,11 @@ export function normalizeLauncherValidationErrors(
|
|
|
90
90
|
): LauncherValidationView {
|
|
91
91
|
const nextFieldErrors: Record<string, string[]> = {};
|
|
92
92
|
const nextFormErrors: string[] = [];
|
|
93
|
+
const knownFields = new Set(fields.map((field) => field.id));
|
|
93
94
|
|
|
94
95
|
for (const error of errors) {
|
|
95
96
|
const message = humanizeLauncherValidationMessage(fields, error);
|
|
96
|
-
if (typeof error.fieldId === "string" && error.fieldId.trim()
|
|
97
|
+
if (typeof error.fieldId === "string" && knownFields.has(error.fieldId.trim())) {
|
|
97
98
|
const fieldId = error.fieldId.trim();
|
|
98
99
|
nextFieldErrors[fieldId] = nextFieldErrors[fieldId] ?? [];
|
|
99
100
|
pushUnique(nextFieldErrors[fieldId], message);
|
|
@@ -104,15 +104,11 @@ export function getDefaultModelSelectableProfiles(input: {
|
|
|
104
104
|
availableProfiles: readonly ModelProfileOptionSummary[];
|
|
105
105
|
recommendedProfile: ModelProfileOptionSummary | null | undefined;
|
|
106
106
|
}): readonly ModelProfileOptionSummary[] {
|
|
107
|
-
|
|
108
|
-
if (recommendedProfileId === "") {
|
|
109
|
-
return input.availableProfiles;
|
|
110
|
-
}
|
|
111
|
-
return input.availableProfiles.filter((option) => option.id !== recommendedProfileId);
|
|
107
|
+
return input.availableProfiles;
|
|
112
108
|
}
|
|
113
109
|
|
|
114
110
|
export function getTurnModelBlankOptionLabel(): string {
|
|
115
|
-
return "Use
|
|
111
|
+
return "Use inherited value";
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
function getModelDisplayName(profile: ModelProfileOptionSummary | null | undefined): string | null {
|
|
@@ -132,7 +128,11 @@ function isTurnUsingProcessDefault(source: LauncherModelLineSource): boolean {
|
|
|
132
128
|
}
|
|
133
129
|
|
|
134
130
|
function isRecommendedTurnSource(source: LauncherModelLineSource): boolean {
|
|
135
|
-
return
|
|
131
|
+
return (
|
|
132
|
+
source === "process_config_turn" ||
|
|
133
|
+
source === "catalog_default" ||
|
|
134
|
+
source === "scoped_purpose_default"
|
|
135
|
+
);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
export function formatLauncherModelSummaryStatus(mode: LauncherModelSummaryMode): string {
|
|
@@ -159,6 +159,7 @@ export function formatLauncherModelDisplayValue(line: LauncherModelDisplayLine):
|
|
|
159
159
|
case "instance_default":
|
|
160
160
|
case "process_config_default":
|
|
161
161
|
return "Use process default";
|
|
162
|
+
case "scoped_purpose_default":
|
|
162
163
|
case "process_config_turn":
|
|
163
164
|
case "catalog_default":
|
|
164
165
|
return `Recommended (${line.modelName ?? "unknown model"})`;
|