@leitwerk-dev/ui 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ChronicleMarkdown-CDe1jngc.js → ChronicleMarkdown-BGmlWefT.js} +1 -1
- package/dist/assets/{DashboardPage-LiQ0_72g.js → DashboardPage-C0s3lTos.js} +1 -1
- package/dist/assets/{FutureLaunchDetailPage-DvyW_J5d.js → FutureLaunchDetailPage-BwvhEIm9.js} +1 -1
- package/dist/assets/GenericLauncher-C5YOwOxo.js +4 -0
- package/dist/assets/GenericLauncher-uxSarIhv.css +1 -0
- package/dist/assets/HomePage-D4H9dSAC.js +1 -0
- package/dist/assets/{ProcessActionsMenu-DEQynjFa.js → ProcessActionsMenu-DfXCc619.js} +1 -1
- package/dist/assets/{ProcessDetailPage-DvjQQTDj.js → ProcessDetailPage-BcM7lmz9.js} +9 -9
- package/dist/assets/{ProcessesPage-B4BMXJT7.js → ProcessesPage-CFR53V3j.js} +1 -1
- package/dist/assets/SettingsPage-6nM2G0j7.js +2 -0
- package/dist/assets/SkillsPage-CzIRkj9o.js +2 -0
- package/dist/assets/{WatchersPage-Btq_SIk3.js → WatchersPage-CkJn-VT5.js} +1 -1
- package/dist/assets/{WikiPage-BjncVYf1.js → WikiPage-uX3f9ZRi.js} +1 -1
- package/dist/assets/http-contracts-public-qjuVglz6.js +1 -0
- package/dist/assets/index-Cj97qbkU.css +1 -0
- package/dist/assets/index-DOHfnbVk.js +21 -0
- package/dist/index.html +2 -2
- package/package.json +8 -8
- package/src/App.svelte +1 -1
- package/src/components/GenericLauncher.svelte +102 -42
- package/src/components/LauncherReadinessNotice.svelte +26 -0
- package/src/components/UserInformationDialog.svelte +73 -0
- package/src/lib/api.ts +25 -0
- package/src/pages/ProcessCard.svelte +5 -2
- package/src/shell/AppShell.svelte +9 -2
- package/src/shell/Sidebar.svelte +11 -0
- package/dist/assets/GenericLauncher-D1qQy9hq.js +0 -4
- package/dist/assets/GenericLauncher-DRUMMTd7.css +0 -1
- package/dist/assets/HomePage-Cnmp6osB.js +0 -1
- package/dist/assets/SettingsPage-w1RHZ2l6.js +0 -2
- package/dist/assets/SkillsPage-Ber36rAD.js +0 -2
- package/dist/assets/http-contracts-public-BUgTIHYG.js +0 -1
- package/dist/assets/index-Dz0T5gKc.js +0 -21
- package/dist/assets/index-DzKWCM-z.css +0 -1
package/dist/index.html
CHANGED
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
/>
|
|
18
18
|
<link rel="stylesheet" href="/fonts/fonts.css" />
|
|
19
19
|
<title>Leitwerk</title>
|
|
20
|
-
<script type="module" crossorigin src="/assets/index-
|
|
20
|
+
<script type="module" crossorigin src="/assets/index-DOHfnbVk.js"></script>
|
|
21
21
|
<link rel="modulepreload" crossorigin href="/assets/index-client-BSAA7n1a.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/assets/http-client-Cvi3zOou.js">
|
|
23
23
|
<link rel="modulepreload" crossorigin href="/assets/external-links-CX92-VRP.js">
|
|
24
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
24
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Cj97qbkU.css">
|
|
25
25
|
</head>
|
|
26
26
|
<body>
|
|
27
27
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
@@ -13,20 +13,20 @@
|
|
|
13
13
|
"preview": "vite preview"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@leitwerk-dev/domain": "0.4.
|
|
17
|
-
"@leitwerk-dev/process-sdk": "0.4.
|
|
18
|
-
"@leitwerk-dev/protocol": "0.4.
|
|
19
|
-
"@leitwerk-dev/worker-protocol": "0.4.
|
|
16
|
+
"@leitwerk-dev/domain": "0.4.4",
|
|
17
|
+
"@leitwerk-dev/process-sdk": "0.4.4",
|
|
18
|
+
"@leitwerk-dev/protocol": "0.4.4",
|
|
19
|
+
"@leitwerk-dev/worker-protocol": "0.4.4",
|
|
20
20
|
"beautiful-mermaid": "^1.1.3",
|
|
21
21
|
"dompurify": "^3.4.0",
|
|
22
22
|
"elkjs": "^0.12.0",
|
|
23
23
|
"markdown-it": "^14.1.1",
|
|
24
24
|
"valibot": "^1.3.1",
|
|
25
|
-
"@leitwerk-dev/wiki": "0.4.
|
|
26
|
-
"@leitwerk-dev/workflow-graph": "0.4.
|
|
25
|
+
"@leitwerk-dev/wiki": "0.4.4",
|
|
26
|
+
"@leitwerk-dev/workflow-graph": "0.4.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leitwerk-dev/test-support": "0.4.
|
|
29
|
+
"@leitwerk-dev/test-support": "0.4.4",
|
|
30
30
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
31
31
|
"@types/markdown-it": "^14.1.2",
|
|
32
32
|
"svelte": "^5.55.0",
|
package/src/App.svelte
CHANGED
|
@@ -98,7 +98,7 @@ $effect(() => {
|
|
|
98
98
|
{:else if authState === "error"}
|
|
99
99
|
<div class="auth-gate" role="alert">{authError ?? "Could not load authentication status."}</div>
|
|
100
100
|
{:else if authMe?.actor}
|
|
101
|
-
<AppShell route={$routeStore} authEnabled={authMe.authEnabled} actor={authMe.actor} />
|
|
101
|
+
<AppShell route={$routeStore} authEnabled={authMe.authEnabled} actor={authMe.actor} userInformationAvailable={authMe.userInformationAvailable ?? false} />
|
|
102
102
|
{/if}
|
|
103
103
|
|
|
104
104
|
<style>
|
|
@@ -11,12 +11,14 @@ import type {
|
|
|
11
11
|
import type {
|
|
12
12
|
LauncherFieldDefinition,
|
|
13
13
|
LauncherFieldOptionDefinition,
|
|
14
|
+
LauncherReadiness,
|
|
14
15
|
LauncherValidationError,
|
|
15
16
|
} from "@leitwerk-dev/protocol/launcher-contract";
|
|
16
17
|
import {
|
|
17
18
|
fetchLauncherDefaults,
|
|
18
19
|
fetchLauncherModelConfigPreview,
|
|
19
20
|
fetchLauncherOptions,
|
|
21
|
+
fetchLauncherReadiness,
|
|
20
22
|
fetchLauncherRecentValues,
|
|
21
23
|
launchLauncher,
|
|
22
24
|
previewCronExpression,
|
|
@@ -33,6 +35,7 @@ import {
|
|
|
33
35
|
import { onSettingsChanged } from "../lib/settings.js";
|
|
34
36
|
import FormFieldRenderer from "./FormFieldRenderer.svelte";
|
|
35
37
|
import LaunchChecklist from "./LaunchChecklist.svelte";
|
|
38
|
+
import LauncherReadinessNotice from "./LauncherReadinessNotice.svelte";
|
|
36
39
|
import {
|
|
37
40
|
buildLauncherDefaultsNotice,
|
|
38
41
|
getFirstLauncherFieldIdWithErrors,
|
|
@@ -69,19 +72,26 @@ type LauncherFieldInputValue = boolean | string;
|
|
|
69
72
|
class LatestRequest {
|
|
70
73
|
loading = $state(false);
|
|
71
74
|
error = $state<string | null>(null);
|
|
75
|
+
key = $state<string | null>(null);
|
|
72
76
|
private generation = 0;
|
|
73
77
|
private fallback: string;
|
|
78
|
+
private safeError: boolean;
|
|
74
79
|
|
|
75
|
-
constructor(fallback: string, loading = false) {
|
|
80
|
+
constructor(fallback: string, loading = false, safeError = false) {
|
|
76
81
|
this.fallback = fallback;
|
|
77
82
|
this.loading = loading;
|
|
83
|
+
this.safeError = safeError;
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
invalidate() {
|
|
81
87
|
this.generation++;
|
|
82
88
|
}
|
|
83
89
|
|
|
84
|
-
async run(
|
|
90
|
+
async run(
|
|
91
|
+
work: (isCurrent: () => boolean) => Promise<void>,
|
|
92
|
+
loading = true,
|
|
93
|
+
key: string | null = null,
|
|
94
|
+
) {
|
|
85
95
|
const generation = ++this.generation;
|
|
86
96
|
this.loading = loading;
|
|
87
97
|
this.error = null;
|
|
@@ -89,11 +99,32 @@ class LatestRequest {
|
|
|
89
99
|
await work(() => generation === this.generation);
|
|
90
100
|
} catch (error) {
|
|
91
101
|
if (generation === this.generation)
|
|
92
|
-
this.error = error instanceof Error ? error.message : this.fallback;
|
|
102
|
+
this.error = !this.safeError && error instanceof Error ? error.message : this.fallback;
|
|
93
103
|
} finally {
|
|
94
|
-
if (generation === this.generation)
|
|
104
|
+
if (generation === this.generation) {
|
|
105
|
+
this.loading = false;
|
|
106
|
+
this.key = key;
|
|
107
|
+
}
|
|
95
108
|
}
|
|
96
109
|
}
|
|
110
|
+
|
|
111
|
+
schedule(
|
|
112
|
+
key: string,
|
|
113
|
+
work: (isCurrent: () => boolean, signal: AbortSignal) => Promise<void>,
|
|
114
|
+
delay = 0,
|
|
115
|
+
) {
|
|
116
|
+
const controller = new AbortController();
|
|
117
|
+
this.loading = true;
|
|
118
|
+
this.error = null;
|
|
119
|
+
const run = () => void this.run((isCurrent) => work(isCurrent, controller.signal), true, key);
|
|
120
|
+
const timer = delay > 0 ? setTimeout(run, delay) : null;
|
|
121
|
+
if (timer === null) run();
|
|
122
|
+
return () => {
|
|
123
|
+
if (timer !== null) clearTimeout(timer);
|
|
124
|
+
controller.abort();
|
|
125
|
+
this.invalidate();
|
|
126
|
+
};
|
|
127
|
+
}
|
|
97
128
|
}
|
|
98
129
|
|
|
99
130
|
interface Props {
|
|
@@ -141,6 +172,32 @@ let recommendedDefaultModelPreview = $state<LauncherModelConfigPreview["defaultM
|
|
|
141
172
|
null,
|
|
142
173
|
);
|
|
143
174
|
const modelPreviewRequest = new LatestRequest("We couldn't refresh the model preview");
|
|
175
|
+
let readiness = $state<LauncherReadiness | null>(null);
|
|
176
|
+
const readinessRequest = new LatestRequest("Couldn't check configuration", false, true);
|
|
177
|
+
const readinessError = $derived(readinessRequest.error !== null);
|
|
178
|
+
let readinessRevision = $state(0);
|
|
179
|
+
const readinessKey = $derived(
|
|
180
|
+
JSON.stringify({ launcherId: launcher.id, input: buildLaunchInput() }),
|
|
181
|
+
);
|
|
182
|
+
const readinessPending = $derived(
|
|
183
|
+
Boolean(launcher.readiness) && readinessRequest.key !== readinessKey,
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
$effect(() => {
|
|
187
|
+
if (!launcher.readiness || defaultsRequest.loading) return;
|
|
188
|
+
const key = readinessKey;
|
|
189
|
+
readinessRevision;
|
|
190
|
+
const input = buildLaunchInput();
|
|
191
|
+
return readinessRequest.schedule(
|
|
192
|
+
key,
|
|
193
|
+
async (isCurrent) => {
|
|
194
|
+
const result = await fetchLauncherReadiness(launcher.id, input);
|
|
195
|
+
if (isCurrent()) readiness = result;
|
|
196
|
+
},
|
|
197
|
+
150,
|
|
198
|
+
);
|
|
199
|
+
});
|
|
200
|
+
|
|
144
201
|
let submitBusy = $state(false);
|
|
145
202
|
let activeLaunchRunId = $state<string | null>(null);
|
|
146
203
|
let submitError = $state<string | null>(null);
|
|
@@ -150,9 +207,7 @@ let fieldErrors = $state<Record<string, string[]>>({});
|
|
|
150
207
|
let touchedFields = $state<Record<string, boolean>>({});
|
|
151
208
|
let revealedFields = $state<Record<string, boolean>>({});
|
|
152
209
|
let revealAllErrors = $state(false);
|
|
153
|
-
|
|
154
|
-
let validationLoading = $state(false);
|
|
155
|
-
let validationError = $state<string | null>(null);
|
|
210
|
+
const validationCheck = new LatestRequest("Couldn't validate the launch values. Try again.");
|
|
156
211
|
let validationRevision = $state(0);
|
|
157
212
|
let settingsRevision = $state(0);
|
|
158
213
|
let validationDelay = 0;
|
|
@@ -238,14 +293,17 @@ const validationKey = $derived(
|
|
|
238
293
|
const validationPending = $derived(
|
|
239
294
|
defaultsRequest.loading ||
|
|
240
295
|
optionsRequest.loading ||
|
|
241
|
-
|
|
242
|
-
|
|
296
|
+
validationCheck.loading ||
|
|
297
|
+
validationCheck.key !== validationKey,
|
|
243
298
|
);
|
|
244
299
|
const submitDisabled = $derived(
|
|
245
300
|
submitBusy ||
|
|
301
|
+
readinessPending ||
|
|
302
|
+
readinessError ||
|
|
303
|
+
(Boolean(launcher.readiness) && readiness?.status !== "ready") ||
|
|
246
304
|
activeLaunchRunId !== null ||
|
|
247
305
|
validationPending ||
|
|
248
|
-
|
|
306
|
+
validationCheck.error !== null ||
|
|
249
307
|
fieldErrorCount > 0 ||
|
|
250
308
|
formErrors.length > 0,
|
|
251
309
|
);
|
|
@@ -261,13 +319,13 @@ function touchField(fieldId: string, delay = 0) {
|
|
|
261
319
|
function blurField(fieldId: string) {
|
|
262
320
|
touchField(fieldId);
|
|
263
321
|
flushDeferredDependentRefresh();
|
|
264
|
-
if (
|
|
322
|
+
if (validationCheck.key !== validationKey) validationRevision += 1;
|
|
265
323
|
else revealedFields = { ...revealedFields, [fieldId]: true };
|
|
266
324
|
}
|
|
267
325
|
|
|
268
326
|
function retryValidation() {
|
|
269
327
|
validationDelay = 0;
|
|
270
|
-
|
|
328
|
+
validationCheck.key = null;
|
|
271
329
|
validationRevision += 1;
|
|
272
330
|
}
|
|
273
331
|
|
|
@@ -277,31 +335,14 @@ $effect(() => {
|
|
|
277
335
|
const launcherId = launcher.id;
|
|
278
336
|
validationRevision;
|
|
279
337
|
if (defaultsRequest.loading || defaultsRequest.error || optionsRequest.loading) return;
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
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
|
-
};
|
|
338
|
+
return validationCheck.schedule(
|
|
339
|
+
key,
|
|
340
|
+
async (isCurrent, signal) => {
|
|
341
|
+
const errors = await validateLauncher(launcherId, request, signal);
|
|
342
|
+
if (isCurrent() && key === validationKey) applyValidationErrors(errors);
|
|
343
|
+
},
|
|
344
|
+
validationDelay,
|
|
345
|
+
);
|
|
305
346
|
});
|
|
306
347
|
|
|
307
348
|
const cronExamples = [
|
|
@@ -648,8 +689,8 @@ function scheduleDependentLauncherRefresh(
|
|
|
648
689
|
async function loadDefaults() {
|
|
649
690
|
clearDeferredDependentRefresh();
|
|
650
691
|
optionsRequest.loading = false;
|
|
651
|
-
|
|
652
|
-
|
|
692
|
+
validationCheck.key = null;
|
|
693
|
+
validationCheck.error = null;
|
|
653
694
|
validationDelay = 0;
|
|
654
695
|
touchedFields = {};
|
|
655
696
|
revealedFields = {};
|
|
@@ -1156,6 +1197,22 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1156
1197
|
{/snippet}
|
|
1157
1198
|
|
|
1158
1199
|
<div class="launcher-form" data-launcher-id={launcher.id} aria-busy={submitBusy || defaultsRequest.loading}>
|
|
1200
|
+
{#if launcher.readiness}
|
|
1201
|
+
{#if readinessError}
|
|
1202
|
+
<div role="status">
|
|
1203
|
+
<p>Configuration readiness could not be checked. Your input has been preserved.</p>
|
|
1204
|
+
<button type="button" onclick={() => { readinessRequest.key = null; readinessRevision += 1; }}>Retry configuration check</button>
|
|
1205
|
+
</div>
|
|
1206
|
+
{:else if readinessPending}
|
|
1207
|
+
{#if defaultsRequest.loading}
|
|
1208
|
+
<LauncherReadinessNotice readiness={launcher.readiness} />
|
|
1209
|
+
{:else}
|
|
1210
|
+
<p role="status">Checking launcher configuration…</p>
|
|
1211
|
+
{/if}
|
|
1212
|
+
{:else if readiness}
|
|
1213
|
+
<LauncherReadinessNotice {readiness} />
|
|
1214
|
+
{/if}
|
|
1215
|
+
{/if}
|
|
1159
1216
|
{#if defaultsRequest.loading}
|
|
1160
1217
|
<p class="state-msg">Loading the starter values for this process…</p>
|
|
1161
1218
|
{:else if defaultsRequest.error}
|
|
@@ -1592,9 +1649,12 @@ async function handleSubmit(event: SubmitEvent) {
|
|
|
1592
1649
|
</div>
|
|
1593
1650
|
{:else}
|
|
1594
1651
|
<div class="validation-status" id={`${launcher.launchConfigSchema.id}-validation-status`} role="status" aria-live="polite">
|
|
1595
|
-
{#if
|
|
1596
|
-
{:else if
|
|
1597
|
-
|
|
1652
|
+
{#if readinessPending}Checking launcher configuration…
|
|
1653
|
+
{:else if readinessError}Retry the configuration check above to continue.
|
|
1654
|
+
{:else if launcher.readiness && readiness?.status !== "ready"}Resolve the configuration issues above or change your selection.
|
|
1655
|
+
{:else if validationPending}Checking values…
|
|
1656
|
+
{:else if validationCheck.error}
|
|
1657
|
+
<span class="schedule-error">{validationCheck.error}</span>
|
|
1598
1658
|
<button type="button" class="secondary-button" onclick={retryValidation}>Retry validation</button>
|
|
1599
1659
|
{:else if invalidFieldLabels.length > 0}Check: {invalidFieldLabels.join(", ")}.
|
|
1600
1660
|
{:else if formErrors.length > 0}Resolve the validation errors above to continue.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { LauncherReadiness } from "@leitwerk-dev/protocol/launcher-contract";
|
|
3
|
+
|
|
4
|
+
let { readiness }: { readiness: LauncherReadiness } = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<span class="readiness-notice" data-section="launcher-readiness" role="status" aria-live="polite">
|
|
8
|
+
<strong>{readiness.status === "blocked" ? "Configuration required" : readiness.status === "partial" ? "Some selections need configuration" : "Configuration ready"}</strong>
|
|
9
|
+
{#each readiness.issues as issue}
|
|
10
|
+
<span data-issue-code={issue.code}>{issue.summary} {issue.remediation}</span>
|
|
11
|
+
{/each}
|
|
12
|
+
<span class="connection-note">Connectivity has not been tested.</span>
|
|
13
|
+
</span>
|
|
14
|
+
|
|
15
|
+
<style>
|
|
16
|
+
.readiness-notice {
|
|
17
|
+
display: grid;
|
|
18
|
+
gap: var(--space-xs);
|
|
19
|
+
padding-block: var(--space-sm);
|
|
20
|
+
color: var(--chronicle-text);
|
|
21
|
+
font-size: 0.875rem;
|
|
22
|
+
line-height: 1.5;
|
|
23
|
+
overflow-wrap: anywhere;
|
|
24
|
+
}
|
|
25
|
+
.connection-note { color: var(--chronicle-text-muted); }
|
|
26
|
+
</style>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { UserInformationResponseBody } from "@leitwerk-dev/protocol/http-contracts";
|
|
3
|
+
import { fetchUserInformation } from "../lib/api.js";
|
|
4
|
+
import { formatLocalDateTime } from "../lib/format.js";
|
|
5
|
+
import ModalShell from "./ModalShell.svelte";
|
|
6
|
+
|
|
7
|
+
let { onClose }: { onClose: () => void } = $props();
|
|
8
|
+
let information = $state<UserInformationResponseBody | null>(null);
|
|
9
|
+
let error = $state<string | null>(null);
|
|
10
|
+
let loading = $state(true);
|
|
11
|
+
const claims = $derived({ ...information?.idTokenClaims, ...information?.userInfoClaims });
|
|
12
|
+
function text(value: unknown): string {
|
|
13
|
+
return typeof value === "string" && value.trim() ? value : "Not provided";
|
|
14
|
+
}
|
|
15
|
+
async function load() {
|
|
16
|
+
loading = true;
|
|
17
|
+
error = null;
|
|
18
|
+
try {
|
|
19
|
+
information = await fetchUserInformation();
|
|
20
|
+
} catch {
|
|
21
|
+
error = "Could not load user information. Try again or log in again.";
|
|
22
|
+
} finally {
|
|
23
|
+
loading = false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
$effect(() => {
|
|
27
|
+
void load();
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<ModalShell open={true} titleId="user-information-title" closeLabel="Close user information" {onClose} restoreFocusSelector="[data-action='user-menu']" dataSection="user-information">
|
|
32
|
+
<h2 id="user-information-title">User information</h2>
|
|
33
|
+
<div class="information-body" aria-busy={loading}>
|
|
34
|
+
<p class="note">This information reflects your last login. Log in again to refresh it.</p>
|
|
35
|
+
{#if loading}
|
|
36
|
+
<p role="status">Loading user information…</p>
|
|
37
|
+
{:else if error}
|
|
38
|
+
<p role="alert">{error}</p>
|
|
39
|
+
<button class="ui-button" type="button" onclick={load}>Try again</button>
|
|
40
|
+
{:else if information}
|
|
41
|
+
<dl>
|
|
42
|
+
<dt>Name</dt><dd>{text(claims.name)}</dd>
|
|
43
|
+
<dt>Username</dt><dd>{information.facts.identity}</dd>
|
|
44
|
+
<dt>Email</dt><dd>{information.facts.email ?? "Not provided"} · {information.facts.emailVerified ? "Verified" : "Not verified"}</dd>
|
|
45
|
+
<dt>Provider</dt><dd>{information.providerId}<br />{information.issuer}</dd>
|
|
46
|
+
<dt>Subject</dt><dd>{information.subject}</dd>
|
|
47
|
+
<dt>Groups</dt><dd>{information.facts.groups.length ? information.facts.groups.join(", ") : "Not provided"}</dd>
|
|
48
|
+
<dt>Login time</dt><dd>{formatLocalDateTime(information.loginAt)}</dd>
|
|
49
|
+
</dl>
|
|
50
|
+
<details>
|
|
51
|
+
<summary tabindex="0">Provider claims</summary>
|
|
52
|
+
<h3>ID token claims</h3>
|
|
53
|
+
<pre>{JSON.stringify(information.idTokenClaims, null, 2)}</pre>
|
|
54
|
+
<h3>UserInfo claims</h3>
|
|
55
|
+
{#if information.userInfoClaims}<pre>{JSON.stringify(information.userInfoClaims, null, 2)}</pre>{:else}<p>Not received at last login.</p>{/if}
|
|
56
|
+
</details>
|
|
57
|
+
{/if}
|
|
58
|
+
</div>
|
|
59
|
+
</ModalShell>
|
|
60
|
+
|
|
61
|
+
<style>
|
|
62
|
+
h2 { margin: 0; padding-right: 32px; font-size: 20px; }
|
|
63
|
+
.information-body { overflow: auto; min-height: 0; overflow-wrap: anywhere; }
|
|
64
|
+
.note { color: var(--chronicle-text-muted); margin: 0 0 var(--space-lg); }
|
|
65
|
+
dl { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(0, 3fr); gap: var(--space-sm) var(--space-md); margin: 0 0 var(--space-lg); }
|
|
66
|
+
dt { color: var(--chronicle-text-muted); }
|
|
67
|
+
dd { margin: 0; }
|
|
68
|
+
summary { cursor: pointer; padding: var(--space-sm) 0; }
|
|
69
|
+
summary:focus-visible { outline: 2px solid var(--chronicle-accent); outline-offset: 2px; }
|
|
70
|
+
h3 { font-size: 14px; margin-top: var(--space-md); }
|
|
71
|
+
pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: var(--space-md); background: var(--chronicle-panel-muted); border-radius: var(--radius-sm); font-size: 14px; }
|
|
72
|
+
@media (max-width: 480px) { dl { grid-template-columns: 1fr; gap: 4px; } dd { margin-bottom: var(--space-sm); } }
|
|
73
|
+
</style>
|
package/src/lib/api.ts
CHANGED
|
@@ -157,6 +157,16 @@ export async function resolveToolApproval(input: {
|
|
|
157
157
|
).request;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
export async function fetchUserInformation(): Promise<
|
|
161
|
+
import("@leitwerk-dev/protocol/http-contracts").UserInformationResponseBody
|
|
162
|
+
> {
|
|
163
|
+
const res = await getFetchImpl()(resolveApiUrl("/api/auth/user-information"), {
|
|
164
|
+
cache: "no-store",
|
|
165
|
+
});
|
|
166
|
+
if (!res.ok) throw new Error("Could not load user information. Try again or log in again.");
|
|
167
|
+
return readJsonObject(res, "Malformed user information response");
|
|
168
|
+
}
|
|
169
|
+
|
|
160
170
|
export async function fetchAuthMe(): Promise<AuthMeResponseBody> {
|
|
161
171
|
const res = await getFetchImpl()(resolveApiUrl("/api/auth/me"));
|
|
162
172
|
if (res.status === 401) {
|
|
@@ -414,6 +424,21 @@ export async function fetchLauncherRecentValues(
|
|
|
414
424
|
return body.values;
|
|
415
425
|
}
|
|
416
426
|
|
|
427
|
+
export async function fetchLauncherReadiness(
|
|
428
|
+
launcherId: string,
|
|
429
|
+
launcherInput: Record<string, unknown>,
|
|
430
|
+
): Promise<import("@leitwerk-dev/protocol/launcher-contract").LauncherReadiness> {
|
|
431
|
+
const body = await requestStatusJson<
|
|
432
|
+
import("@leitwerk-dev/protocol/http-contracts").LauncherReadinessResponseBody
|
|
433
|
+
>(
|
|
434
|
+
`/api/launchers/${encodeURIComponent(launcherId)}/readiness`,
|
|
435
|
+
"Couldn't check launcher configuration",
|
|
436
|
+
"Malformed launcher readiness response",
|
|
437
|
+
jsonRequestInit("POST", { launcherInput }),
|
|
438
|
+
);
|
|
439
|
+
return body.readiness;
|
|
440
|
+
}
|
|
441
|
+
|
|
417
442
|
export async function fetchLauncherOptions(
|
|
418
443
|
launcherId: string,
|
|
419
444
|
launcherInput: Record<string, unknown>,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { UiLauncherSummary } from "@leitwerk-dev/protocol/http-contracts";
|
|
3
|
+
import LauncherReadinessNotice from "../components/LauncherReadinessNotice.svelte";
|
|
3
4
|
import ProcessFlowDiagram from "./ProcessFlowDiagram.svelte";
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
@@ -22,15 +23,17 @@ const description = $derived(launcher.card.description ?? launcher.description);
|
|
|
22
23
|
data-launcher-id={launcher.id}
|
|
23
24
|
data-pressable="true"
|
|
24
25
|
tabindex={tabindexValue}
|
|
25
|
-
aria-label={`${title}. ${description}`}
|
|
26
26
|
onclick={() => onSelect(launcher.id)}
|
|
27
27
|
onkeydown={onKeydown}
|
|
28
28
|
>
|
|
29
29
|
<span class="card-main">
|
|
30
30
|
<span class="card-title">{title}</span>
|
|
31
31
|
<span class="card-description">{description}</span>
|
|
32
|
+
{#if launcher.readiness && launcher.readiness.status !== "ready"}
|
|
33
|
+
<LauncherReadinessNotice readiness={launcher.readiness} />
|
|
34
|
+
{/if}
|
|
32
35
|
</span>
|
|
33
|
-
<span class="card-flow">
|
|
36
|
+
<span class="card-flow" aria-hidden="true">
|
|
34
37
|
<ProcessFlowDiagram {launcher} compact={true} />
|
|
35
38
|
</span>
|
|
36
39
|
</button>
|
|
@@ -23,6 +23,7 @@ import Sidebar from "./Sidebar.svelte";
|
|
|
23
23
|
interface Props {
|
|
24
24
|
route: Route;
|
|
25
25
|
authEnabled: boolean;
|
|
26
|
+
userInformationAvailable?: boolean;
|
|
26
27
|
actor: Actor;
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -50,7 +51,7 @@ const processShortcutItems: readonly KeyboardShortcutItem[] = [
|
|
|
50
51
|
{ keys: ["?"], label: "Toggle shortcuts" },
|
|
51
52
|
];
|
|
52
53
|
|
|
53
|
-
let { route, authEnabled, actor }: Props = $props();
|
|
54
|
+
let { route, authEnabled, actor, userInformationAvailable = false }: Props = $props();
|
|
54
55
|
|
|
55
56
|
const mobileSidebarQuery = "(max-width: 960px)";
|
|
56
57
|
const homePath = buildHomePath();
|
|
@@ -104,6 +105,12 @@ $effect(() => {
|
|
|
104
105
|
const previousOverflow = document.body.style.overflow;
|
|
105
106
|
document.body.style.overflow = "hidden";
|
|
106
107
|
const handleKeydown = (event: KeyboardEvent) => {
|
|
108
|
+
// A native modal above the drawer owns Escape and focus navigation.
|
|
109
|
+
if (
|
|
110
|
+
event.defaultPrevented ||
|
|
111
|
+
(event.target instanceof Element && event.target.closest("dialog[open]"))
|
|
112
|
+
)
|
|
113
|
+
return;
|
|
107
114
|
if (event.key === "Escape") {
|
|
108
115
|
event.preventDefault();
|
|
109
116
|
closeMobileSidebar();
|
|
@@ -272,7 +279,7 @@ $effect(() => {
|
|
|
272
279
|
<path d="m6 6 12 12M18 6 6 18" />
|
|
273
280
|
</svg>
|
|
274
281
|
</button>
|
|
275
|
-
<Sidebar currentRoute={route} {authEnabled} {actor} />
|
|
282
|
+
<Sidebar currentRoute={route} {authEnabled} {actor} {userInformationAvailable} />
|
|
276
283
|
</div>
|
|
277
284
|
{#if $browserUiExtensionShellIndicators.length > 0}
|
|
278
285
|
<div class="browser-ui-extension-indicators" data-section="browser-ui-extension-indicators">
|
package/src/shell/Sidebar.svelte
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Actor } from "@leitwerk-dev/domain";
|
|
3
3
|
import type { Snippet } from "svelte";
|
|
4
|
+
import UserInformationDialog from "../components/UserInformationDialog.svelte";
|
|
4
5
|
import { type FutureActionSummary, type FutureExecutionSummary, logout } from "../lib/api.js";
|
|
5
6
|
|
|
6
7
|
import {
|
|
@@ -33,6 +34,7 @@ import { wsStore } from "../lib/ws.svelte";
|
|
|
33
34
|
interface Props {
|
|
34
35
|
currentRoute: Route;
|
|
35
36
|
authEnabled: boolean;
|
|
37
|
+
userInformationAvailable?: boolean;
|
|
36
38
|
actor: Actor;
|
|
37
39
|
onLoggedOut?: () => void;
|
|
38
40
|
}
|
|
@@ -42,6 +44,7 @@ const collapseBreakpointPx = 960;
|
|
|
42
44
|
let {
|
|
43
45
|
currentRoute,
|
|
44
46
|
authEnabled,
|
|
47
|
+
userInformationAvailable = false,
|
|
45
48
|
actor,
|
|
46
49
|
onLoggedOut = () => window.location.assign("/"),
|
|
47
50
|
}: Props = $props();
|
|
@@ -74,6 +77,7 @@ let observedReconnectCount = $state<number | null>(null);
|
|
|
74
77
|
let sidebarCollapsed = $state(false);
|
|
75
78
|
type Popover = "current" | "future" | "user";
|
|
76
79
|
let openPopover = $state<Popover | null>(null);
|
|
80
|
+
let userInformationOpen = $state(false);
|
|
77
81
|
let logoutPending = $state(false);
|
|
78
82
|
let logoutError = $state<string | null>(null);
|
|
79
83
|
let collapseSupported = $state(
|
|
@@ -730,6 +734,9 @@ function openCurrentProcessRow(row: ProcessRowView, event: MouseEvent) {
|
|
|
730
734
|
aria-label={`User options for ${userName}`}
|
|
731
735
|
bind:this={userPopoverRef}
|
|
732
736
|
>
|
|
737
|
+
{#if authEnabled && userInformationAvailable}
|
|
738
|
+
<button type="button" class="user-popover-action" onclick={() => { openPopover = null; userInformationOpen = true; }}>User information</button>
|
|
739
|
+
{/if}
|
|
733
740
|
<a class="user-popover-action" href="/account/api-tokens" onclick={(event) => { openPopover = null; followLink(event, "/account/api-tokens"); }}>API tokens</a>
|
|
734
741
|
<button type="button" class="user-popover-action" onclick={showHelp}>Show help</button>
|
|
735
742
|
{#if authEnabled}
|
|
@@ -748,6 +755,10 @@ function openCurrentProcessRow(row: ProcessRowView, event: MouseEvent) {
|
|
|
748
755
|
</div>
|
|
749
756
|
</aside>
|
|
750
757
|
|
|
758
|
+
{#if userInformationOpen}
|
|
759
|
+
<UserInformationDialog onClose={() => { userInformationOpen = false; }} />
|
|
760
|
+
{/if}
|
|
761
|
+
|
|
751
762
|
<style>
|
|
752
763
|
.sidebar {
|
|
753
764
|
--sidebar-expanded-width: 240px;
|