@leitwerk-dev/ui 0.4.2 → 0.4.3
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-CaBB7XWq.js} +1 -1
- package/dist/assets/{DashboardPage-LiQ0_72g.js → DashboardPage-DVksueRO.js} +1 -1
- package/dist/assets/{FutureLaunchDetailPage-DvyW_J5d.js → FutureLaunchDetailPage-CuSQ2eiS.js} +1 -1
- package/dist/assets/{GenericLauncher-D1qQy9hq.js → GenericLauncher-BrfcRwO2.js} +1 -1
- package/dist/assets/{HomePage-Cnmp6osB.js → HomePage-CDTAS_Lu.js} +1 -1
- package/dist/assets/{ProcessActionsMenu-DEQynjFa.js → ProcessActionsMenu-H6RKUq1c.js} +1 -1
- package/dist/assets/{ProcessDetailPage-DvjQQTDj.js → ProcessDetailPage-BFyR72M8.js} +1 -1
- package/dist/assets/{ProcessesPage-B4BMXJT7.js → ProcessesPage-Bt-CIZ4a.js} +1 -1
- package/dist/assets/{SettingsPage-w1RHZ2l6.js → SettingsPage-Ceh_Qtym.js} +1 -1
- package/dist/assets/{SkillsPage-Ber36rAD.js → SkillsPage-MIXltySD.js} +1 -1
- package/dist/assets/{WatchersPage-Btq_SIk3.js → WatchersPage-BWKQdjdA.js} +1 -1
- package/dist/assets/{WikiPage-BjncVYf1.js → WikiPage-CGyIhz4Q.js} +1 -1
- package/dist/assets/http-contracts-public-CsHLJWso.js +1 -0
- package/dist/assets/index-Cj97qbkU.css +1 -0
- package/dist/assets/index-rSCC-5Ne.js +21 -0
- package/dist/index.html +2 -2
- package/package.json +8 -8
- package/src/App.svelte +1 -1
- package/src/components/UserInformationDialog.svelte +73 -0
- package/src/lib/api.ts +10 -0
- package/src/shell/AppShell.svelte +9 -2
- package/src/shell/Sidebar.svelte +11 -0
- 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-rSCC-5Ne.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.3",
|
|
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.3",
|
|
17
|
+
"@leitwerk-dev/process-sdk": "0.4.3",
|
|
18
|
+
"@leitwerk-dev/protocol": "0.4.3",
|
|
19
|
+
"@leitwerk-dev/worker-protocol": "0.4.3",
|
|
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.3",
|
|
26
|
+
"@leitwerk-dev/workflow-graph": "0.4.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@leitwerk-dev/test-support": "0.4.
|
|
29
|
+
"@leitwerk-dev/test-support": "0.4.3",
|
|
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>
|
|
@@ -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) {
|
|
@@ -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;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./index-Dz0T5gKc.js";
|