@coffre/ui 0.3.0 → 0.4.0
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/chunks/audit-sentence-BhHmvQX_.js +660 -0
- package/dist/chunks/audit-sentence-BhHmvQX_.js.map +1 -0
- package/dist/chunks/delete-place-CRX7ntE8.js +206 -0
- package/dist/chunks/delete-place-CRX7ntE8.js.map +1 -0
- package/dist/chunks/{directory-CSjWWUQ1.js → directory-zr3ek7Mc.js} +175 -60
- package/dist/chunks/directory-zr3ek7Mc.js.map +1 -0
- package/dist/chunks/folders-DoBmCwOi.js +207 -0
- package/dist/chunks/folders-DoBmCwOi.js.map +1 -0
- package/dist/chunks/grants-Cw1FyGID.js +669 -0
- package/dist/chunks/grants-Cw1FyGID.js.map +1 -0
- package/dist/chunks/offboarding-CE6d7um1.js +305 -0
- package/dist/chunks/offboarding-CE6d7um1.js.map +1 -0
- package/dist/chunks/one-time-DXEl9hbg.js +35 -0
- package/dist/chunks/one-time-DXEl9hbg.js.map +1 -0
- package/dist/chunks/page-DvsgZ2Hd.js +391 -0
- package/dist/chunks/page-DvsgZ2Hd.js.map +1 -0
- package/dist/chunks/principal-BIN-xwZw.js +42 -0
- package/dist/chunks/principal-BIN-xwZw.js.map +1 -0
- package/dist/chunks/{principal-page-D_91OA0l.js → principal-page-DhjO76GH.js} +245 -251
- package/dist/chunks/principal-page-DhjO76GH.js.map +1 -0
- package/dist/chunks/project-page-SRCtRe2g.js +17 -0
- package/dist/chunks/project-page-SRCtRe2g.js.map +1 -0
- package/dist/chunks/{queries-CQ81o4so.js → queries-DVR_i3rA.js} +132 -30
- package/dist/chunks/queries-DVR_i3rA.js.map +1 -0
- package/dist/chunks/references-B6pLT1uQ.js +343 -0
- package/dist/chunks/references-B6pLT1uQ.js.map +1 -0
- package/dist/chunks/{row-state-0PsrEzOL.js → row-state-DOPUsjQK.js} +3 -3
- package/dist/chunks/{row-state-0PsrEzOL.js.map → row-state-DOPUsjQK.js.map} +1 -1
- package/dist/chunks/signin-errors--ykMFuqN.js +57 -0
- package/dist/chunks/signin-errors--ykMFuqN.js.map +1 -0
- package/dist/chunks/tabs-BmwKfUeK.js +22 -0
- package/dist/chunks/tabs-BmwKfUeK.js.map +1 -0
- package/dist/chunks/{theme-B2vQolVR.js → theme-DJuz-xLM.js} +3 -3
- package/dist/chunks/{theme-B2vQolVR.js.map → theme-DJuz-xLM.js.map} +1 -1
- package/dist/chunks/{ui-DixXLQvQ.js → ui-DJje3gST.js} +6 -3
- package/dist/chunks/ui-DJje3gST.js.map +1 -0
- package/dist/chunks/{use-change-c6CeLRin.js → use-change-DUiGO19U.js} +52 -21
- package/dist/chunks/use-change-DUiGO19U.js.map +1 -0
- package/dist/chunks/{use-shell-jxd7Tzd-.js → use-shell-rNKfGjdj.js} +3 -3
- package/dist/chunks/{use-shell-jxd7Tzd-.js.map → use-shell-rNKfGjdj.js.map} +1 -1
- package/dist/chunks/validation-D312_NLf.js +87 -0
- package/dist/chunks/validation-D312_NLf.js.map +1 -0
- package/dist/index.d.ts +361 -27
- package/dist/index.js +188 -98
- package/dist/index.js.map +1 -1
- package/dist/pages/account.d.ts +2 -2
- package/dist/pages/account.js +297 -135
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/approval.d.ts +9 -0
- package/dist/pages/approval.js +207 -0
- package/dist/pages/approval.js.map +1 -0
- package/dist/pages/audit.js +17 -542
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +2 -3
- package/dist/pages/device-login.js.map +1 -1
- package/dist/pages/environment.js +647 -257
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +18 -7
- package/dist/pages/login.js.map +1 -1
- package/dist/pages/oauth-authorize.d.ts +10 -0
- package/dist/pages/oauth-authorize.js +249 -0
- package/dist/pages/oauth-authorize.js.map +1 -0
- package/dist/pages/project-access.d.ts +6 -0
- package/dist/pages/project-access.js +370 -0
- package/dist/pages/project-access.js.map +1 -0
- package/dist/pages/project-environments.d.ts +4 -0
- package/dist/pages/project-environments.js +593 -0
- package/dist/pages/project-environments.js.map +1 -0
- package/dist/pages/project-settings.d.ts +4 -0
- package/dist/pages/project-settings.js +242 -0
- package/dist/pages/project-settings.js.map +1 -0
- package/dist/pages/project.d.ts +10 -2
- package/dist/pages/project.js +57 -934
- package/dist/pages/project.js.map +1 -1
- package/dist/pages/projects.js +53 -21
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.d.ts +10 -0
- package/dist/pages/{token.js → service-account.js} +112 -54
- package/dist/pages/service-account.js.map +1 -0
- package/dist/pages/service-accounts.d.ts +3 -0
- package/dist/pages/service-accounts.js +38 -0
- package/dist/pages/service-accounts.js.map +1 -0
- package/dist/pages/settings.d.ts +1 -0
- package/dist/pages/settings.js +104 -42
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.js +2 -3
- package/dist/pages/unregistered.js.map +1 -1
- package/dist/pages/user.d.ts +6 -1
- package/dist/pages/user.js +18 -6
- package/dist/pages/user.js.map +1 -1
- package/dist/pages/users.js +6 -10
- package/dist/pages/users.js.map +1 -1
- package/package.json +3 -3
- package/src/components/actions-log.tsx +117 -0
- package/src/components/audit-sentence.tsx +55 -0
- package/src/components/command-palette.tsx +4 -4
- package/src/components/delete-place.tsx +180 -0
- package/src/components/directory.tsx +259 -110
- package/src/components/every-project.tsx +287 -0
- package/src/components/expiry-field.tsx +42 -0
- package/src/components/folders.tsx +219 -0
- package/src/components/grants.tsx +11 -4
- package/src/components/icons.tsx +2 -0
- package/src/components/missing.tsx +110 -0
- package/src/components/offboarding.tsx +61 -33
- package/src/components/page.tsx +4 -1
- package/src/components/principal-page.tsx +136 -106
- package/src/components/principal-picker.tsx +5 -5
- package/src/components/principal.tsx +4 -4
- package/src/components/references.tsx +323 -0
- package/src/components/service-tokens.tsx +112 -93
- package/src/components/shell.tsx +11 -32
- package/src/components/tabs.tsx +18 -0
- package/src/components/trusted-workloads.tsx +97 -79
- package/src/components/ui.tsx +8 -1
- package/src/index.ts +13 -2
- package/src/layout.tsx +2 -2
- package/src/lib/access-plan.ts +2 -2
- package/src/lib/audit-sentences.ts +161 -77
- package/src/lib/changes.ts +56 -5
- package/src/lib/coffre.ts +3 -2
- package/src/lib/one-time.ts +32 -0
- package/src/lib/project-access.ts +11 -23
- package/src/lib/project-page.ts +14 -0
- package/src/lib/queries.ts +126 -32
- package/src/lib/search.ts +25 -0
- package/src/lib/signin-errors.ts +45 -1
- package/src/lib/validation.ts +14 -0
- package/src/options.ts +187 -35
- package/src/pages/account.tsx +274 -129
- package/src/pages/approval.tsx +197 -0
- package/src/pages/audit.tsx +9 -61
- package/src/pages/environment.tsx +585 -286
- package/src/pages/login.tsx +8 -2
- package/src/pages/oauth-authorize.tsx +233 -0
- package/src/pages/project-access.tsx +219 -0
- package/src/pages/project-environments.tsx +582 -0
- package/src/pages/project-settings.tsx +259 -0
- package/src/pages/project.tsx +52 -879
- package/src/pages/projects.tsx +55 -18
- package/src/pages/service-account.tsx +50 -0
- package/src/pages/{tokens.tsx → service-accounts.tsx} +9 -6
- package/src/pages/settings.tsx +62 -8
- package/src/pages/user.tsx +16 -4
- package/src/pages/users.tsx +2 -2
- package/src/parity.ts +160 -0
- package/src/register.ts +58 -9
- package/src/router.tsx +4 -0
- package/src/shared/models.ts +6 -2
- package/src/styles/globals.css +536 -31
- package/dist/chunks/directory-CSjWWUQ1.js.map +0 -1
- package/dist/chunks/grants-saMQagmG.js +0 -160
- package/dist/chunks/grants-saMQagmG.js.map +0 -1
- package/dist/chunks/icons-D-PfAfnH.js +0 -203
- package/dist/chunks/icons-D-PfAfnH.js.map +0 -1
- package/dist/chunks/offboarding-C6l30DZR.js +0 -263
- package/dist/chunks/offboarding-C6l30DZR.js.map +0 -1
- package/dist/chunks/page-C5HcNqf2.js +0 -190
- package/dist/chunks/page-C5HcNqf2.js.map +0 -1
- package/dist/chunks/principal-page-D_91OA0l.js.map +0 -1
- package/dist/chunks/queries-CQ81o4so.js.map +0 -1
- package/dist/chunks/signin-errors-BEFlVDbQ.js +0 -30
- package/dist/chunks/signin-errors-BEFlVDbQ.js.map +0 -1
- package/dist/chunks/ui-DixXLQvQ.js.map +0 -1
- package/dist/chunks/use-action-CWsg_YWU.js +0 -49
- package/dist/chunks/use-action-CWsg_YWU.js.map +0 -1
- package/dist/chunks/use-change-c6CeLRin.js.map +0 -1
- package/dist/chunks/validation-BQtqPe2V.js +0 -29
- package/dist/chunks/validation-BQtqPe2V.js.map +0 -1
- package/dist/pages/token.d.ts +0 -3
- package/dist/pages/token.js.map +0 -1
- package/dist/pages/tokens.d.ts +0 -3
- package/dist/pages/tokens.js +0 -39
- package/dist/pages/tokens.js.map +0 -1
- package/dist/project-BqIy8gYR.d.ts +0 -5
- package/src/lib/instance.ts +0 -13
- package/src/pages/token.tsx +0 -34
package/src/pages/projects.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
+
import { byFolder } from '@coffre/client';
|
|
2
3
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
3
4
|
import { Link } from '@tanstack/react-router';
|
|
4
5
|
import { createProject, projectsList } from '../lib/changes';
|
|
@@ -11,7 +12,11 @@ import type { ProjectSummary } from '../shared/models';
|
|
|
11
12
|
import { isActiveAccessibleEnvironment } from '../lib/project-environments';
|
|
12
13
|
import { slugProblem } from '../lib/validation';
|
|
13
14
|
import { RowFailure, RowPending, rowClass } from '../components/row-state';
|
|
14
|
-
import { EmptyState, Modal } from '../components/ui';
|
|
15
|
+
import { EmptyState, ErrorLine, Modal } from '../components/ui';
|
|
16
|
+
import { FolderMenu, FolderRow } from '../components/folders';
|
|
17
|
+
import { toast } from 'sonner';
|
|
18
|
+
import { affects } from '../lib/queries';
|
|
19
|
+
import { useAction } from '../lib/use-action';
|
|
15
20
|
import { ClosedDoor, PageHeader } from '../components/page';
|
|
16
21
|
import { Tile } from '../components/tile';
|
|
17
22
|
import { AlertTriangle, Folder, Hash, Layers, Plus } from '../components/icons';
|
|
@@ -19,6 +24,7 @@ import {
|
|
|
19
24
|
ProjectEmptyStateCopy,
|
|
20
25
|
RootAdminOnly,
|
|
21
26
|
} from '../components/affordances';
|
|
27
|
+
import { ReachedBy, reaching, useEveryProject } from '../components/every-project';
|
|
22
28
|
|
|
23
29
|
export function ProjectsPage() {
|
|
24
30
|
const { data: result, refetch } = useSuspenseQuery(queries.projects(useCoffre()));
|
|
@@ -54,14 +60,7 @@ export function ProjectsPage() {
|
|
|
54
60
|
|
|
55
61
|
return (
|
|
56
62
|
<>
|
|
57
|
-
<PageHeader
|
|
58
|
-
title="Projects"
|
|
59
|
-
actions={
|
|
60
|
-
<RootAdminOnly capabilities={capabilities}>
|
|
61
|
-
<NewProject />
|
|
62
|
-
</RootAdminOnly>
|
|
63
|
-
}
|
|
64
|
-
/>
|
|
63
|
+
<PageHeader title="Projects" />
|
|
65
64
|
|
|
66
65
|
{active.length === 0 && refusedProjects.length === 0 ? (
|
|
67
66
|
<div className="card">
|
|
@@ -78,6 +77,12 @@ export function ProjectsPage() {
|
|
|
78
77
|
</section>
|
|
79
78
|
)}
|
|
80
79
|
|
|
80
|
+
<RootAdminOnly capabilities={capabilities}>
|
|
81
|
+
<div className="table-actions">
|
|
82
|
+
<NewProject />
|
|
83
|
+
</div>
|
|
84
|
+
</RootAdminOnly>
|
|
85
|
+
|
|
81
86
|
{archived.length > 0 && (
|
|
82
87
|
<section aria-labelledby="archived-projects">
|
|
83
88
|
<h2 className="section-title" id="archived-projects">
|
|
@@ -94,8 +99,34 @@ export function ProjectsPage() {
|
|
|
94
99
|
|
|
95
100
|
function ProjectTable({ projects, refused = false }: { projects: ProjectSummary[]; refused?: boolean }) {
|
|
96
101
|
const { status, failedAdds, dismiss } = useChangeStatus(projectsList.queryKey);
|
|
102
|
+
// Numbered as listed: those in no folder first, then each folder by name.
|
|
103
|
+
const numbers = new Map(byFolder(projects).flatMap(([, inFolder]) => inFolder).map((project, index) => [project.slug, index]));
|
|
104
|
+
const coffre = useCoffre();
|
|
105
|
+
// Renaming or removing a folder of projects: all of it, by who manages each project in it.
|
|
106
|
+
const refile = useAction();
|
|
107
|
+
const folders = byFolder(projects).flatMap(([folder]) => (folder === null ? [] : [folder]));
|
|
108
|
+
const folderMenu = (folder: string, inFolder: ProjectSummary[]) =>
|
|
109
|
+
inFolder.every((project) => project.permissions.includes('project.manage')) && (
|
|
110
|
+
<FolderMenu
|
|
111
|
+
folder={folder}
|
|
112
|
+
count={inFolder.length}
|
|
113
|
+
what="project"
|
|
114
|
+
folders={folders}
|
|
115
|
+
onRename={(name) =>
|
|
116
|
+
void refile.run(() => coffre.folders.rename(folder, name), {
|
|
117
|
+
affects: affects.places(),
|
|
118
|
+
onSuccess: () => toast.success(`${folder} is ${name} now`),
|
|
119
|
+
})}
|
|
120
|
+
onRemove={() =>
|
|
121
|
+
void refile.run(() => coffre.folders.remove(folder), {
|
|
122
|
+
affects: affects.places(),
|
|
123
|
+
onSuccess: () => toast.success(`${folder} removed: its projects are in no folder`),
|
|
124
|
+
})}
|
|
125
|
+
/>
|
|
126
|
+
);
|
|
97
127
|
return (
|
|
98
128
|
<div className="dt-wrap">
|
|
129
|
+
{refile.error !== null && <ErrorLine error={refile.error} />}
|
|
99
130
|
<table className="dt projects stacks">
|
|
100
131
|
<thead>
|
|
101
132
|
<tr>
|
|
@@ -121,15 +152,18 @@ function ProjectTable({ projects, refused = false }: { projects: ProjectSummary[
|
|
|
121
152
|
</tr>
|
|
122
153
|
</thead>
|
|
123
154
|
<tbody>
|
|
124
|
-
{projects.
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
155
|
+
{byFolder(projects).flatMap(([folder, inFolder]) => [
|
|
156
|
+
...(folder === null ? [] : [<FolderRow key={`folder:${folder}`} folder={folder} count={inFolder.length} columns={4} actions={folderMenu(folder, inFolder)} />]),
|
|
157
|
+
...inFolder.map((project) => (
|
|
158
|
+
<ProjectRow
|
|
159
|
+
key={project.slug}
|
|
160
|
+
number={(numbers.get(project.slug) ?? 0) + 1}
|
|
161
|
+
project={project}
|
|
162
|
+
status={status(project.slug)}
|
|
163
|
+
onDismiss={dismiss}
|
|
164
|
+
/>
|
|
165
|
+
)),
|
|
166
|
+
])}
|
|
133
167
|
{refused &&
|
|
134
168
|
failedAdds<{ slug: string }>(projects.map((project) => project.slug)).map(
|
|
135
169
|
({ mutationId, vars, status: failed }) => (
|
|
@@ -252,6 +286,7 @@ function NewProject() {
|
|
|
252
286
|
const [open, setOpen] = useState(false);
|
|
253
287
|
const create = useChange(createProject(useCoffre()));
|
|
254
288
|
const slugError = slug === '' ? null : slugProblem(slug);
|
|
289
|
+
const reachedBy = reaching(useEveryProject(), null);
|
|
255
290
|
|
|
256
291
|
function close() {
|
|
257
292
|
setOpen(false);
|
|
@@ -309,6 +344,8 @@ function NewProject() {
|
|
|
309
344
|
/>
|
|
310
345
|
</label>
|
|
311
346
|
|
|
347
|
+
<ReachedBy grants={reachedBy} lead="As soon as it exists, it is reached by" />
|
|
348
|
+
|
|
312
349
|
<div className="dialog-actions">
|
|
313
350
|
<button className="btn" type="button" onClick={close}>
|
|
314
351
|
Cancel
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
2
|
+
|
|
3
|
+
import { ActionsLog } from '../components/actions-log';
|
|
4
|
+
import { PrincipalAccess, PrincipalLayout } from '../components/principal-page';
|
|
5
|
+
import { ServiceTokens } from '../components/service-tokens';
|
|
6
|
+
import { TrustedWorkloads } from '../components/trusted-workloads';
|
|
7
|
+
import { Notice } from '../components/ui';
|
|
8
|
+
import { memberRef, useCoffre } from '../lib/coffre';
|
|
9
|
+
import { queries, signInWays } from '../lib/queries';
|
|
10
|
+
import { useShell } from '../lib/use-shell';
|
|
11
|
+
import { pageRoute } from '../lib/page-route';
|
|
12
|
+
import type { serviceAccount } from '../options';
|
|
13
|
+
|
|
14
|
+
const Route = pageRoute<typeof serviceAccount>();
|
|
15
|
+
|
|
16
|
+
/** A service account's page, around its tabs. */
|
|
17
|
+
export function ServiceAccountLayout() {
|
|
18
|
+
return <PrincipalLayout principalType="service" principalId={Route.useParams().account} />;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Its first tab, while it shows one: the ways it signs in, OIDC first, the one with nothing to store. */
|
|
22
|
+
export function ServiceAccountSignInPage() {
|
|
23
|
+
const { account } = Route.useParams();
|
|
24
|
+
const client = useCoffre();
|
|
25
|
+
const shell = useShell();
|
|
26
|
+
const member = memberRef('service', account);
|
|
27
|
+
const { data: report } = useSuspenseQuery(queries.report(client, member, shell.capabilities.canManageGrants));
|
|
28
|
+
// Nothing to issue once it is removed, which its loader sent elsewhere; its layout then shows no such tab.
|
|
29
|
+
const ways = signInWays(shell, report) ?? { tokens: false, workloads: false };
|
|
30
|
+
const { data: credentials } = useSuspenseQuery(queries.credentials(client, member, ways.tokens));
|
|
31
|
+
const { data: bindings } = useSuspenseQuery(queries.bindings(client, member, ways.workloads));
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
{bindings !== null &&
|
|
35
|
+
(bindings.ok ? <TrustedWorkloads serviceId={account} bindings={bindings.bindings} /> : <Notice tone="bad">{bindings.error}</Notice>)}
|
|
36
|
+
{credentials !== null &&
|
|
37
|
+
(credentials.ok ? <ServiceTokens serviceId={account} tokens={credentials.tokens} /> : <Notice tone="bad">{credentials.error}</Notice>)}
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Its access, or once removed, its offboarding. */
|
|
43
|
+
export function ServiceAccountAccessPage() {
|
|
44
|
+
return <PrincipalAccess principalType="service" principalId={Route.useParams().account} />;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Everything it did, from the audit log. */
|
|
48
|
+
export function ServiceAccountActivityPage() {
|
|
49
|
+
return <ActionsLog member={memberRef('service', Route.useParams().account)} />;
|
|
50
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { DirectoryTable } from '../components/directory';
|
|
4
4
|
import { useCoffre } from '../lib/coffre';
|
|
5
5
|
import { queries } from '../lib/queries';
|
|
6
6
|
import { useShell } from '../lib/use-shell';
|
|
@@ -8,26 +8,29 @@ import { ClosedDoor, PageHeader } from '../components/page';
|
|
|
8
8
|
import { RemovedList } from '../components/offboarding';
|
|
9
9
|
import { Key } from '../components/icons';
|
|
10
10
|
|
|
11
|
-
export function
|
|
11
|
+
export function ServiceAccountsPage() {
|
|
12
12
|
const { capabilities } = useShell();
|
|
13
13
|
const { data: result } = useSuspenseQuery(queries.directory(useCoffre(), capabilities.canManageGrants));
|
|
14
14
|
|
|
15
15
|
if (!result.ok) {
|
|
16
16
|
return (
|
|
17
|
-
<ClosedDoor icon={<Key size={18} />} label="
|
|
17
|
+
<ClosedDoor icon={<Key size={18} />} label="Service accounts" title="Service accounts are closed to you">
|
|
18
18
|
{result.error}
|
|
19
19
|
</ClosedDoor>
|
|
20
20
|
);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const accounts = result.principals.filter((principal) => principal.principalType === 'service');
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
26
|
<>
|
|
27
|
-
<PageHeader
|
|
27
|
+
<PageHeader
|
|
28
|
+
title="Service accounts"
|
|
29
|
+
description="Identities for CI and other automation."
|
|
30
|
+
/>
|
|
28
31
|
<DirectoryTable
|
|
29
32
|
principalType="service"
|
|
30
|
-
principals={
|
|
33
|
+
principals={accounts}
|
|
31
34
|
hasRemoved={result.removed.some((principal) => principal.principalType === 'service')}
|
|
32
35
|
/>
|
|
33
36
|
<RemovedList principalType="service" removed={result.removed} />
|
package/src/pages/settings.tsx
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import type { RouteOutput } from '@coffre/client';
|
|
1
2
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
2
3
|
import { Link } from '@tanstack/react-router';
|
|
3
4
|
import { useCoffre } from '../lib/coffre';
|
|
4
5
|
import { queries } from '../lib/queries';
|
|
5
6
|
import { useShell } from '../lib/use-shell';
|
|
6
7
|
import { Card, Fact, PageHeader } from '../components/page';
|
|
8
|
+
import { Toggletip } from '../components/ui';
|
|
9
|
+
import { Info } from '../components/icons';
|
|
7
10
|
|
|
8
11
|
/** The instance's settings. Your own are under Account, at the sidebar's foot. */
|
|
9
12
|
|
|
10
|
-
const listFormat = new Intl.ListFormat('en', { type: 'disjunction' });
|
|
11
|
-
|
|
12
13
|
export function SettingsPage() {
|
|
13
14
|
const { auth, capabilities } = useShell();
|
|
14
|
-
const
|
|
15
|
+
const client = useCoffre();
|
|
16
|
+
const { data: directory } = useSuspenseQuery(queries.directory(client, capabilities.canManageGrants));
|
|
17
|
+
const { data: keys } = useSuspenseQuery(queries.auditKeys(client, capabilities.canManageGrants));
|
|
15
18
|
const providers = auth?.signin?.providers.map((provider) => provider.label) ?? [];
|
|
16
19
|
|
|
17
20
|
const principals = directory?.ok === true ? directory.principals : null;
|
|
@@ -30,9 +33,20 @@ export function SettingsPage() {
|
|
|
30
33
|
>
|
|
31
34
|
<dl className="facts">
|
|
32
35
|
<Fact label="Sign-in">
|
|
33
|
-
|
|
34
|
-
?
|
|
35
|
-
|
|
36
|
+
<span>
|
|
37
|
+
{auth?.signin ? providers.join(', ') : 'Cloudflare Access'}
|
|
38
|
+
<Toggletip
|
|
39
|
+
label={
|
|
40
|
+
auth?.signin
|
|
41
|
+
? 'coffre’s own sign-in. Only invited members get in.'
|
|
42
|
+
: 'coffre has no sign-in of its own: every request carries an Access assertion, verified at the origin.'
|
|
43
|
+
}
|
|
44
|
+
>
|
|
45
|
+
<button type="button" className="fact-tip" aria-label="About sign-in">
|
|
46
|
+
<Info size={14} />
|
|
47
|
+
</button>
|
|
48
|
+
</Toggletip>
|
|
49
|
+
</span>
|
|
36
50
|
</Fact>
|
|
37
51
|
{principals !== null && (
|
|
38
52
|
<>
|
|
@@ -51,8 +65,8 @@ export function SettingsPage() {
|
|
|
51
65
|
{users} user{users === 1 ? '' : 's'}
|
|
52
66
|
</Link>
|
|
53
67
|
{' · '}
|
|
54
|
-
<Link to="/
|
|
55
|
-
{tokens}
|
|
68
|
+
<Link to="/service-accounts">
|
|
69
|
+
{tokens} service account{tokens === 1 ? '' : 's'}
|
|
56
70
|
</Link>
|
|
57
71
|
</span>
|
|
58
72
|
</Fact>
|
|
@@ -60,6 +74,46 @@ export function SettingsPage() {
|
|
|
60
74
|
)}
|
|
61
75
|
</dl>
|
|
62
76
|
</Card>
|
|
77
|
+
|
|
78
|
+
{keys?.ok === true && <Keys keys={keys} />}
|
|
63
79
|
</>
|
|
64
80
|
);
|
|
65
81
|
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* What the keys you keep are checked against: no secret, so shown. The keys
|
|
85
|
+
* themselves are checked by `coffre verify keys`, on your machine: a vault
|
|
86
|
+
* key typed into a web page would be within reach of everything running in it.
|
|
87
|
+
*/
|
|
88
|
+
function Keys({ keys }: { keys: RouteOutput<'GET /audit/keys'> }) {
|
|
89
|
+
const { current, checks } = keys.vault;
|
|
90
|
+
const replaced = new Set(checks.map((check) => check.vaultId).filter((id) => id !== current.vaultId)).size;
|
|
91
|
+
return (
|
|
92
|
+
<Card
|
|
93
|
+
labelledBy="keys"
|
|
94
|
+
title="Keys"
|
|
95
|
+
description={
|
|
96
|
+
<>
|
|
97
|
+
What the vault key and app key you keep are checked against. Check the keys themselves
|
|
98
|
+
with <code>coffre verify keys</code>, which reads them on your machine and sends neither.
|
|
99
|
+
</>
|
|
100
|
+
}
|
|
101
|
+
>
|
|
102
|
+
<dl className="facts">
|
|
103
|
+
<Fact label="Vault ID">
|
|
104
|
+
<span className="mono">{current.vaultId}</span>
|
|
105
|
+
</Fact>
|
|
106
|
+
<Fact label="Vault key">
|
|
107
|
+
<span>
|
|
108
|
+
Held by <span className="mono">{current.provider}</span>
|
|
109
|
+
{replaced > 0 && `; ${replaced} earlier vault key${replaced === 1 ? '' : 's'} still checkable`}
|
|
110
|
+
</span>
|
|
111
|
+
</Fact>
|
|
112
|
+
<Fact label="App key">
|
|
113
|
+
<span className="mono">{keys.app.keyId}</span>
|
|
114
|
+
</Fact>
|
|
115
|
+
</dl>
|
|
116
|
+
</Card>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
package/src/pages/user.tsx
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ActionsLog } from '../components/actions-log';
|
|
2
|
+
import { PrincipalAccess, PrincipalLayout } from '../components/principal-page';
|
|
3
|
+
import { memberRef } from '../lib/coffre';
|
|
2
4
|
import { pageRoute } from '../lib/page-route';
|
|
3
5
|
import type { user } from '../options';
|
|
4
6
|
|
|
5
7
|
const Route = pageRoute<typeof user>();
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return <
|
|
9
|
+
/** A user's page, around its tabs. */
|
|
10
|
+
export function UserLayout() {
|
|
11
|
+
return <PrincipalLayout principalType="user" principalId={Route.useParams().user} />;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Their first tab: their access, or once removed, their offboarding. */
|
|
15
|
+
export function UserAccessPage() {
|
|
16
|
+
return <PrincipalAccess principalType="user" principalId={Route.useParams().user} />;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Everything they did, from the audit log. */
|
|
20
|
+
export function UserActivityPage() {
|
|
21
|
+
return <ActionsLog member={memberRef('user', Route.useParams().user)} />;
|
|
10
22
|
}
|
package/src/pages/users.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { DirectoryTable } from '../components/directory';
|
|
4
4
|
import { useCoffre } from '../lib/coffre';
|
|
5
5
|
import { queries } from '../lib/queries';
|
|
6
6
|
import { useShell } from '../lib/use-shell';
|
|
@@ -24,7 +24,7 @@ export function UsersPage() {
|
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
26
|
<>
|
|
27
|
-
<PageHeader title="Users"
|
|
27
|
+
<PageHeader title="Users" />
|
|
28
28
|
<DirectoryTable
|
|
29
29
|
principalType="user"
|
|
30
30
|
principals={users}
|
package/src/parity.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every route of the API, and where a person does it in coffre's pages: the
|
|
3
|
+
* counterpart of the CLI's PARITY (`packages/cli/src/commands.ts`). The map
|
|
4
|
+
* is typed over the route table, so a route added to the server fails the
|
|
5
|
+
* typecheck here until it names the page that performs it, or says why no
|
|
6
|
+
* page does, or which work in flight brings its page. `test/parity.test.ts`
|
|
7
|
+
* holds each entry to it: the file exists, the pages make the call, and the
|
|
8
|
+
* call sends that route.
|
|
9
|
+
*/
|
|
10
|
+
import type { CoffreClient, RouteKey } from '@coffre/client';
|
|
11
|
+
|
|
12
|
+
/** A client call, as the pages make it: `secrets.reveal`, `me`. */
|
|
13
|
+
export type ClientCall = {
|
|
14
|
+
[N in keyof CoffreClient & string]: CoffreClient[N] extends (...args: never[]) => unknown
|
|
15
|
+
? N
|
|
16
|
+
: `${N}.${keyof CoffreClient[N] & string}`;
|
|
17
|
+
}[keyof CoffreClient & string];
|
|
18
|
+
|
|
19
|
+
/** Where a person does it: the control, in words, its file under `src/`, and the call it makes. */
|
|
20
|
+
export type Affordance = { readonly does: string; readonly in: string; readonly call: ClientCall };
|
|
21
|
+
|
|
22
|
+
export type Reach =
|
|
23
|
+
| { readonly ui: readonly Affordance[] }
|
|
24
|
+
/** No page performs it, and why not. */
|
|
25
|
+
| { readonly not: string }
|
|
26
|
+
/** Its page is being built elsewhere: the pull request or thread that brings it. */
|
|
27
|
+
| { readonly inFlight: string };
|
|
28
|
+
|
|
29
|
+
export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
30
|
+
'GET /me': { ui: [{ does: 'every page: who is signed in, in the sidebar', in: 'components/shell.tsx', call: 'me' }] },
|
|
31
|
+
'GET /projects': { ui: [{ does: 'Projects', in: 'pages/projects.tsx', call: 'projects.list' }] },
|
|
32
|
+
'PUT /projects/:project': { ui: [{ does: 'Projects › New project', in: 'pages/projects.tsx', call: 'projects.create' }] },
|
|
33
|
+
'PATCH /projects/:project': {
|
|
34
|
+
ui: [
|
|
35
|
+
{ does: 'a project › Settings › Save (slug, name)', in: 'pages/project-settings.tsx', call: 'projects.update' },
|
|
36
|
+
{ does: 'a project › Settings › Archive …, Restore …', in: 'pages/project-settings.tsx', call: 'projects.update' },
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
'DELETE /projects/:project': {
|
|
40
|
+
ui: [
|
|
41
|
+
{ does: 'an archived project › Settings › Delete …, its slug typed out', in: 'components/delete-place.tsx', call: 'projects.delete' },
|
|
42
|
+
{ does: 'the same dialog: what deleting would erase and revoke', in: 'lib/queries.ts', call: 'projects.previewDelete' },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
'PUT /projects/:project/:environment': {
|
|
46
|
+
ui: [{ does: 'a project › Environments › Add environment', in: 'pages/project-environments.tsx', call: 'environments.create' }],
|
|
47
|
+
},
|
|
48
|
+
'PATCH /projects/:project/:environment': {
|
|
49
|
+
ui: [{ does: "an environment's card › ⋯ › Rename, Archive…, Restore", in: 'pages/project-environments.tsx', call: 'environments.update' }],
|
|
50
|
+
},
|
|
51
|
+
'DELETE /projects/:project/:environment': {
|
|
52
|
+
ui: [
|
|
53
|
+
{ does: "an archived environment's card › ⋯ › Delete…, its path typed out", in: 'components/delete-place.tsx', call: 'environments.delete' },
|
|
54
|
+
{ does: 'the same dialog: what deleting would erase and revoke', in: 'lib/queries.ts', call: 'environments.previewDelete' },
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
'GET /projects/:project/:environment/missing': {
|
|
58
|
+
ui: [{ does: "an environment: the keys its siblings you read have and it lacks", in: 'lib/queries.ts', call: 'environments.missing' }],
|
|
59
|
+
},
|
|
60
|
+
'PATCH /projects/:project/:environment/dismissals': {
|
|
61
|
+
ui: [{ does: 'an environment › Missing keys › Dismiss, Dismiss all, Restore', in: 'components/missing.tsx', call: 'environments.dismiss' }],
|
|
62
|
+
},
|
|
63
|
+
'GET /secrets/:project/:environment': { ui: [{ does: 'an environment: its secrets', in: 'pages/environment.tsx', call: 'secrets.list' }] },
|
|
64
|
+
'PATCH /secrets/:project/:environment': {
|
|
65
|
+
ui: [
|
|
66
|
+
{ does: 'an environment › New secret, Edit, then Save', in: 'pages/environment.tsx', call: 'secrets.set' },
|
|
67
|
+
{ does: 'an environment › Import .env, after its plan', in: 'pages/environment.tsx', call: 'secrets.set' },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
'PATCH /secrets/:project/:environment/:key': {
|
|
71
|
+
ui: [
|
|
72
|
+
{ does: "a secret › Edit: its name, then Save", in: 'pages/environment.tsx', call: 'secrets.rename' },
|
|
73
|
+
{ does: 'a secret › ⋯ › Archive; an archived one › ⋯ › Restore', in: 'pages/environment.tsx', call: 'secrets.update' },
|
|
74
|
+
],
|
|
75
|
+
},
|
|
76
|
+
'GET /secrets/:project/:environment/:key/versions': {
|
|
77
|
+
ui: [{ does: 'a secret › ⋯ › Version history', in: 'pages/environment.tsx', call: 'secrets.history' }],
|
|
78
|
+
},
|
|
79
|
+
'POST /secrets/:project/:environment/:key/restore': {
|
|
80
|
+
ui: [{ does: 'a secret › Version history › Restore a version', in: 'pages/environment.tsx', call: 'secrets.restore' }],
|
|
81
|
+
},
|
|
82
|
+
'PATCH /folders/:folder': { ui: [{ does: 'Projects › a folder › ⋯ › Rename folder…', in: 'pages/projects.tsx', call: 'folders.rename' }] },
|
|
83
|
+
'DELETE /folders/:folder': { ui: [{ does: 'Projects › a folder › ⋯ › Remove folder…', in: 'pages/projects.tsx', call: 'folders.remove' }] },
|
|
84
|
+
'PATCH /folders/:project/:environment/:folder': { ui: [{ does: "an environment's keys › a folder › ⋯ › Rename folder…", in: 'pages/environment.tsx', call: 'folders.renameKeys' }] },
|
|
85
|
+
'DELETE /folders/:project/:environment/:folder': { ui: [{ does: "an environment's keys › a folder › ⋯ › Remove folder…", in: 'pages/environment.tsx', call: 'folders.removeKeys' }] },
|
|
86
|
+
'DELETE /secrets/:project/:environment/:key/reference': {
|
|
87
|
+
ui: [
|
|
88
|
+
{ does: "a reference's row › ⋯ › Break reference…, or the Read elsewhere list's Break", in: 'pages/environment.tsx', call: 'references.break' },
|
|
89
|
+
{ does: "a project's references › Break", in: 'components/references.tsx', call: 'references.break' },
|
|
90
|
+
{ does: 'Archive a project, an environment or a key, while references read it › Break, in the dialog', in: 'components/references.tsx', call: 'references.break' },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
'GET /references': {
|
|
94
|
+
ui: [
|
|
95
|
+
{ does: "an environment: what reads its secrets from elsewhere; a project's references", in: 'lib/queries.ts', call: 'references.list' },
|
|
96
|
+
{ does: 'a project › Settings › Archive …: the references that would stop reading it', in: 'pages/project-settings.tsx', call: 'references.list' },
|
|
97
|
+
{ does: "an environment's card › ⋯ › Archive…: the references that would stop reading it", in: 'pages/project-environments.tsx', call: 'references.list' },
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
'POST /reveals': { ui: [{ does: 'a secret › Reveal, and Edit, which starts from the value', in: 'pages/environment.tsx', call: 'secrets.reveal' }] },
|
|
101
|
+
'GET /members': {
|
|
102
|
+
ui: [
|
|
103
|
+
{ does: 'Users, Service accounts', in: 'components/directory.tsx', call: 'members.list' },
|
|
104
|
+
{ does: "a project › Users, Service accounts: who holds access there", in: 'pages/project-access.tsx', call: 'members.list' },
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
'GET /members/:member': {
|
|
108
|
+
ui: [
|
|
109
|
+
{ does: "a user's or service account's page: what it holds, and Offboarding", in: 'components/principal-page.tsx', call: 'members.get' },
|
|
110
|
+
{ does: '⋯ › Remove…: what removing would revoke, before it does', in: 'components/directory.tsx', call: 'members.get' },
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
'PUT /members/:member': {
|
|
114
|
+
ui: [
|
|
115
|
+
{ does: 'Users › Add user; Service accounts › Add service account', in: 'components/directory.tsx', call: 'members.add' },
|
|
116
|
+
{ does: 'a user › ⋯ › Change role', in: 'components/directory.tsx', call: 'members.add' },
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
'DELETE /members/:member': { ui: [{ does: 'a user or service account › ⋯ › Remove…', in: 'components/directory.tsx', call: 'members.remove' }] },
|
|
120
|
+
'GET /members/:member/tokens': { ui: [{ does: 'a service account › Sign-in › Bearer tokens', in: 'components/service-tokens.tsx', call: 'tokens.list' }] },
|
|
121
|
+
'POST /members/:member/tokens': { ui: [{ does: 'a service account › Sign-in › Issue token', in: 'components/service-tokens.tsx', call: 'tokens.issue' }] },
|
|
122
|
+
'DELETE /members/:member/tokens/:id': { ui: [{ does: 'a bearer token › Revoke', in: 'components/service-tokens.tsx', call: 'tokens.revoke' }] },
|
|
123
|
+
'GET /members/:member/bindings': { ui: [{ does: 'a service account › Sign-in › Sign in with OIDC', in: 'components/trusted-workloads.tsx', call: 'bindings.list' }] },
|
|
124
|
+
'POST /members/:member/bindings': {
|
|
125
|
+
ui: [
|
|
126
|
+
{ does: 'Trust a workload: the binding reviewed first', in: 'components/trusted-workloads.tsx', call: 'bindings.preview' },
|
|
127
|
+
{ does: 'Trust a workload › Trust', in: 'components/trusted-workloads.tsx', call: 'bindings.create' },
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
'DELETE /members/:member/bindings/:id': { ui: [{ does: 'a trust binding › Remove', in: 'components/trusted-workloads.tsx', call: 'bindings.remove' }] },
|
|
131
|
+
'GET /workloads/lookup': { ui: [{ does: 'Trust a workload: a repository named, its IDs looked up', in: 'components/trusted-workloads.tsx', call: 'bindings.lookup' }] },
|
|
132
|
+
'PATCH /access/:member': {
|
|
133
|
+
ui: [
|
|
134
|
+
{ does: 'a project › Users, Service accounts › Add user, Add service account', in: 'pages/project-access.tsx', call: 'access.set' },
|
|
135
|
+
{ does: 'a grant › Revoke', in: 'components/grants.tsx', call: 'access.set' },
|
|
136
|
+
{ does: "a user's or service account's page › Edit access", in: 'components/principal-page.tsx', call: 'access.set' },
|
|
137
|
+
{ does: "an owner, on a user's or service account's Access tab › Grant on every project, and its Revoke", in: 'components/every-project.tsx', call: 'access.set' },
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
'GET /sessions': { ui: [{ does: 'Account › Sessions', in: 'pages/account.tsx', call: 'sessions.list' }] },
|
|
141
|
+
'DELETE /sessions/:id': { ui: [{ does: 'Account › a session › End', in: 'pages/account.tsx', call: 'sessions.revoke' }] },
|
|
142
|
+
'GET /identities': { ui: [{ does: 'Account › Sign-in accounts', in: 'pages/account.tsx', call: 'identities.list' }] },
|
|
143
|
+
'DELETE /identities/:id': { ui: [{ does: 'Account › a sign-in account › Unlink', in: 'pages/account.tsx', call: 'identities.unlink' }] },
|
|
144
|
+
'GET /device-logins/:code': { ui: [{ does: "the page `coffre login` opens: the login's code", in: 'pages/device-login.tsx', call: 'deviceLogins.get' }] },
|
|
145
|
+
'POST /device-logins/:code': { ui: [{ does: 'that page › Approve, Deny', in: 'pages/device-login.tsx', call: 'deviceLogins.decide' }] },
|
|
146
|
+
'GET /oauth/authorizations': { ui: [{ does: 'the page an MCP client opens to connect: what it asks for', in: 'pages/oauth-authorize.tsx', call: 'oauth.describe' }] },
|
|
147
|
+
'POST /oauth/authorizations': { ui: [{ does: 'that page › Approve, Deny', in: 'pages/oauth-authorize.tsx', call: 'oauth.decide' }] },
|
|
148
|
+
'GET /approvals/:id': { ui: [{ does: 'the page an MCP client sends you to, to decide a change it asked for', in: 'pages/approval.tsx', call: 'approvals.get' }] },
|
|
149
|
+
'POST /approvals/:id': { ui: [{ does: 'that page › Approve, Deny', in: 'pages/approval.tsx', call: 'approvals.decide' }] },
|
|
150
|
+
'GET /apps': { ui: [{ does: 'Account › Connected apps', in: 'pages/account.tsx', call: 'apps.list' }] },
|
|
151
|
+
'DELETE /apps/:id': { ui: [{ does: 'Account › a connected app › Disconnect', in: 'pages/account.tsx', call: 'apps.disconnect' }] },
|
|
152
|
+
'GET /audit': {
|
|
153
|
+
ui: [
|
|
154
|
+
{ does: 'Audit', in: 'pages/audit.tsx', call: 'audit.list' },
|
|
155
|
+
{ does: "a user's or service account's page › Activity", in: 'components/actions-log.tsx', call: 'audit.list' },
|
|
156
|
+
],
|
|
157
|
+
},
|
|
158
|
+
'GET /audit/verification': { ui: [{ does: "Audit: the log's seal, verified on every visit", in: 'pages/audit.tsx', call: 'audit.verify' }] },
|
|
159
|
+
'GET /audit/keys': { ui: [{ does: 'Settings › Keys: what the keys you keep are checked against', in: 'pages/settings.tsx', call: 'audit.keys' }] },
|
|
160
|
+
};
|
package/src/register.ts
CHANGED
|
@@ -6,19 +6,50 @@
|
|
|
6
6
|
import { createRootRouteWithContext, createRoute } from '@tanstack/react-router';
|
|
7
7
|
|
|
8
8
|
import type { createRouter } from './router';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
access,
|
|
11
|
+
account,
|
|
12
|
+
audit,
|
|
13
|
+
deviceLogin,
|
|
14
|
+
environment,
|
|
15
|
+
home,
|
|
16
|
+
login,
|
|
17
|
+
project,
|
|
18
|
+
projectEnvironments,
|
|
19
|
+
projects,
|
|
20
|
+
projectServiceAccounts,
|
|
21
|
+
projectSettings,
|
|
22
|
+
projectUsers,
|
|
23
|
+
serviceAccount,
|
|
24
|
+
serviceAccountAccess,
|
|
25
|
+
serviceAccountActivity,
|
|
26
|
+
serviceAccounts,
|
|
27
|
+
serviceAccountSignIn,
|
|
28
|
+
settings,
|
|
29
|
+
shell,
|
|
30
|
+
solo,
|
|
31
|
+
unregistered,
|
|
32
|
+
user,
|
|
33
|
+
userAccess,
|
|
34
|
+
userActivity,
|
|
35
|
+
users,
|
|
36
|
+
type CoffreContext,
|
|
37
|
+
} from './options';
|
|
10
38
|
import { AccountPage } from './pages/account';
|
|
11
39
|
import { AuditPage } from './pages/audit';
|
|
12
40
|
import { DevicePage } from './pages/device-login';
|
|
13
41
|
import { EnvironmentPage } from './pages/environment';
|
|
14
42
|
import { LoginPage } from './pages/login';
|
|
15
|
-
import {
|
|
43
|
+
import { ProjectLayout } from './pages/project';
|
|
44
|
+
import { ProjectServiceAccountsPage, ProjectUsersPage } from './pages/project-access';
|
|
45
|
+
import { ProjectEnvironmentsPage } from './pages/project-environments';
|
|
46
|
+
import { ProjectSettingsPage } from './pages/project-settings';
|
|
16
47
|
import { ProjectsPage } from './pages/projects';
|
|
48
|
+
import { ServiceAccountAccessPage, ServiceAccountActivityPage, ServiceAccountLayout, ServiceAccountSignInPage } from './pages/service-account';
|
|
49
|
+
import { ServiceAccountsPage } from './pages/service-accounts';
|
|
17
50
|
import { SettingsPage } from './pages/settings';
|
|
18
|
-
import { TokenPage } from './pages/token';
|
|
19
|
-
import { TokensPage } from './pages/tokens';
|
|
20
51
|
import { UnregisteredPage } from './pages/unregistered';
|
|
21
|
-
import {
|
|
52
|
+
import { UserAccessPage, UserActivityPage, UserLayout } from './pages/user';
|
|
22
53
|
import { UsersPage } from './pages/users';
|
|
23
54
|
|
|
24
55
|
const root = createRootRouteWithContext<CoffreContext>()({});
|
|
@@ -26,6 +57,12 @@ const nav = createRoute({ getParentRoute: () => root, id: '_coffre', ...shell })
|
|
|
26
57
|
const frame = createRoute({ getParentRoute: () => root, id: '_solo', ...solo });
|
|
27
58
|
const under = <T extends string>(path: T) => ({ getParentRoute: () => nav, path });
|
|
28
59
|
|
|
60
|
+
// A page with tabs is a layout, each tab a route under it, the first its index.
|
|
61
|
+
const projectPage = createRoute({ ...under('/projects/$project'), ...project, component: ProjectLayout });
|
|
62
|
+
const userPage = createRoute({ ...under('/users/$user'), ...user, component: UserLayout });
|
|
63
|
+
const serviceAccountPage = createRoute({ ...under('/service-accounts/$account'), ...serviceAccount, component: ServiceAccountLayout });
|
|
64
|
+
const tab = <P extends typeof projectPage | typeof userPage | typeof serviceAccountPage, T extends string>(parent: P, path: T) => ({ getParentRoute: () => parent, path });
|
|
65
|
+
|
|
29
66
|
const routeTree = root.addChildren([
|
|
30
67
|
frame.addChildren([
|
|
31
68
|
createRoute({ getParentRoute: () => frame, path: '/login', ...login, component: LoginPage }),
|
|
@@ -35,14 +72,26 @@ const routeTree = root.addChildren([
|
|
|
35
72
|
nav.addChildren([
|
|
36
73
|
createRoute({ ...under('/'), ...home }),
|
|
37
74
|
createRoute({ ...under('/projects'), ...projects, component: ProjectsPage }),
|
|
38
|
-
|
|
75
|
+
projectPage.addChildren([
|
|
76
|
+
createRoute({ ...tab(projectPage, '/'), ...projectEnvironments, component: ProjectEnvironmentsPage }),
|
|
77
|
+
createRoute({ ...tab(projectPage, '/users'), ...projectUsers, component: ProjectUsersPage }),
|
|
78
|
+
createRoute({ ...tab(projectPage, '/service-accounts'), ...projectServiceAccounts, component: ProjectServiceAccountsPage }),
|
|
79
|
+
createRoute({ ...tab(projectPage, '/settings'), ...projectSettings, component: ProjectSettingsPage }),
|
|
80
|
+
]),
|
|
39
81
|
createRoute({ ...under('/projects/$project/$environment'), ...environment, component: EnvironmentPage }),
|
|
40
82
|
createRoute({ ...under('/audit'), ...audit, component: AuditPage }),
|
|
41
83
|
createRoute({ ...under('/access'), ...access }),
|
|
42
84
|
createRoute({ ...under('/users'), ...users, component: UsersPage }),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
85
|
+
userPage.addChildren([
|
|
86
|
+
createRoute({ ...tab(userPage, '/'), ...userAccess, component: UserAccessPage }),
|
|
87
|
+
createRoute({ ...tab(userPage, '/activity'), ...userActivity, component: UserActivityPage }),
|
|
88
|
+
]),
|
|
89
|
+
createRoute({ ...under('/service-accounts'), ...serviceAccounts, component: ServiceAccountsPage }),
|
|
90
|
+
serviceAccountPage.addChildren([
|
|
91
|
+
createRoute({ ...tab(serviceAccountPage, '/'), ...serviceAccountSignIn, component: ServiceAccountSignInPage }),
|
|
92
|
+
createRoute({ ...tab(serviceAccountPage, '/access'), ...serviceAccountAccess, component: ServiceAccountAccessPage }),
|
|
93
|
+
createRoute({ ...tab(serviceAccountPage, '/activity'), ...serviceAccountActivity, component: ServiceAccountActivityPage }),
|
|
94
|
+
]),
|
|
46
95
|
createRoute({ ...under('/settings'), ...settings, component: SettingsPage }),
|
|
47
96
|
createRoute({ ...under('/account'), ...account, component: AccountPage }),
|
|
48
97
|
]),
|