@coffre/ui 0.1.17 → 0.2.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/README.md +23 -3
- package/dist/{server/_coffre/assets/affordances-CKANXDTG.js → chunks/affordances-DAvsVz7u.js} +12 -7
- package/dist/chunks/affordances-DAvsVz7u.js.map +1 -0
- package/dist/chunks/directory-CSjWWUQ1.js +370 -0
- package/dist/chunks/directory-CSjWWUQ1.js.map +1 -0
- package/dist/{server/_coffre/assets/grants-DdKT11Ny.js → chunks/grants-saMQagmG.js} +41 -39
- package/dist/chunks/grants-saMQagmG.js.map +1 -0
- package/dist/chunks/icons-D-PfAfnH.js +203 -0
- package/dist/chunks/icons-D-PfAfnH.js.map +1 -0
- package/dist/chunks/mounted-jJmqqV_n.js +17 -0
- package/dist/chunks/mounted-jJmqqV_n.js.map +1 -0
- package/dist/{server/_coffre/assets/offboarding-CRz-K82H.js → chunks/offboarding-C6l30DZR.js} +70 -69
- package/dist/chunks/offboarding-C6l30DZR.js.map +1 -0
- package/dist/chunks/page-C5HcNqf2.js +190 -0
- package/dist/chunks/page-C5HcNqf2.js.map +1 -0
- package/dist/chunks/page-route-Drfw7lmn.js +20 -0
- package/dist/chunks/page-route-Drfw7lmn.js.map +1 -0
- package/dist/{server/_coffre/assets/principal-page-C-EFwJQw.js → chunks/principal-page-D_91OA0l.js} +105 -103
- package/dist/chunks/principal-page-D_91OA0l.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/project-environments-lEzFHUt4.js +2 -0
- package/dist/chunks/project-environments-lEzFHUt4.js.map +1 -0
- package/dist/chunks/queries-CQ81o4so.js +376 -0
- package/dist/chunks/queries-CQ81o4so.js.map +1 -0
- package/dist/{server/_coffre/assets/row-state-C2P57xT1.js → chunks/row-state-0PsrEzOL.js} +22 -21
- package/dist/chunks/row-state-0PsrEzOL.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/signin-errors-BEFlVDbQ.js +2 -0
- package/dist/chunks/signin-errors-BEFlVDbQ.js.map +1 -0
- package/dist/chunks/theme-B2vQolVR.js +86 -0
- package/dist/chunks/theme-B2vQolVR.js.map +1 -0
- package/dist/chunks/ui-DixXLQvQ.js +405 -0
- package/dist/chunks/ui-DixXLQvQ.js.map +1 -0
- package/dist/{server/_coffre/assets/use-action-B-xpvVRO.js → chunks/use-action-CWsg_YWU.js} +8 -6
- package/dist/chunks/use-action-CWsg_YWU.js.map +1 -0
- package/dist/{server/_coffre/assets/use-change-C8BCf3oU.js → chunks/use-change-c6CeLRin.js} +10 -474
- package/dist/chunks/use-change-c6CeLRin.js.map +1 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js +26 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/validation-BQtqPe2V.js +2 -0
- package/dist/chunks/validation-BQtqPe2V.js.map +1 -0
- package/dist/index.d.ts +386 -18
- package/dist/index.js +1147 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/account.d.ts +9 -0
- package/dist/pages/account.js +334 -0
- package/dist/pages/account.js.map +1 -0
- package/dist/pages/audit.d.ts +3 -0
- package/dist/{server/_coffre/assets/audit-qB9G2AQJ.js → pages/audit.js} +102 -100
- package/dist/pages/audit.js.map +1 -0
- package/dist/pages/device-login.d.ts +9 -0
- package/dist/pages/device-login.js +211 -0
- package/dist/pages/device-login.js.map +1 -0
- package/dist/pages/environment.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects._project._environment-C6uybzeU.js → pages/environment.js} +323 -469
- package/dist/pages/environment.js.map +1 -0
- package/dist/pages/login.d.ts +10 -0
- package/dist/pages/login.js +104 -0
- package/dist/pages/login.js.map +1 -0
- package/dist/pages/project.d.ts +2 -0
- package/dist/{server/_coffre/assets/projects._project.index-3CXwkyTh.js → pages/project.js} +223 -225
- package/dist/pages/project.js.map +1 -0
- package/dist/pages/projects.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects.index-iSoBpRFz.js → pages/projects.js} +83 -81
- package/dist/pages/projects.js.map +1 -0
- package/dist/pages/settings.d.ts +3 -0
- package/dist/{server/_coffre/assets/settings-BDQTF5XW.js → pages/settings.js} +20 -18
- package/dist/pages/settings.js.map +1 -0
- package/dist/pages/token.d.ts +3 -0
- package/dist/{server/_coffre/assets/tokens._token-CrBMpcbN.js → pages/token.js} +195 -265
- package/dist/pages/token.js.map +1 -0
- package/dist/pages/tokens.d.ts +3 -0
- package/dist/pages/tokens.js +39 -0
- package/dist/pages/tokens.js.map +1 -0
- package/dist/pages/unregistered.d.ts +8 -0
- package/dist/pages/unregistered.js +54 -0
- package/dist/pages/unregistered.js.map +1 -0
- package/dist/pages/user.d.ts +3 -0
- package/dist/pages/user.js +16 -0
- package/dist/pages/user.js.map +1 -0
- package/dist/pages/users.d.ts +3 -0
- package/dist/pages/users.js +39 -0
- package/dist/pages/users.js.map +1 -0
- package/dist/project-BqIy8gYR.d.ts +5 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.js +52 -0
- package/package.json +36 -21
- package/src/assets/icon.svg +1 -0
- package/src/components/affordances.ts +10 -4
- package/src/components/command-palette.tsx +229 -203
- package/src/components/directory.tsx +34 -38
- package/src/components/principal.tsx +7 -3
- package/src/components/shell.tsx +89 -127
- package/src/components/theme.tsx +14 -81
- package/src/components/ui.tsx +97 -68
- package/src/index.ts +29 -0
- package/src/layout.tsx +113 -0
- package/src/lib/coffre.ts +8 -4
- package/src/lib/mounted.ts +13 -0
- package/src/lib/page-context.ts +31 -0
- package/src/lib/page-route.ts +22 -0
- package/src/lib/preferences.tsx +46 -0
- package/src/options.ts +240 -0
- package/src/{routes → pages}/account.tsx +7 -24
- package/src/{routes → pages}/audit.tsx +5 -16
- package/src/{routes/auth.device.tsx → pages/device-login.tsx} +8 -21
- package/src/{routes/projects.$project.$environment.tsx → pages/environment.tsx} +43 -52
- package/src/{routes → pages}/login.tsx +5 -16
- package/src/{routes/projects.$project.index.tsx → pages/project.tsx} +38 -50
- package/src/{routes/projects.index.tsx → pages/projects.tsx} +2 -7
- package/src/{routes → pages}/settings.tsx +3 -10
- package/src/{routes/tokens.$token.tsx → pages/token.tsx} +6 -7
- package/src/{routes/tokens.index.tsx → pages/tokens.tsx} +3 -8
- package/src/{routes → pages}/unregistered.tsx +1 -6
- package/src/pages/user.tsx +10 -0
- package/src/{routes/users.index.tsx → pages/users.tsx} +3 -8
- package/src/register.ts +55 -0
- package/src/router.tsx +31 -62
- package/src/styles/globals.css +104 -46
- package/src/vite.ts +78 -0
- package/dist/client/.assetsignore +0 -2
- package/dist/client/_coffre/assets/account-BoLGAxbD.js +0 -2
- package/dist/client/_coffre/assets/account-CnnuRTDB.js +0 -1
- package/dist/client/_coffre/assets/affordances-CEafRJcN.js +0 -1
- package/dist/client/_coffre/assets/audit-CHSvKLWX.js +0 -1
- package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +0 -2
- package/dist/client/_coffre/assets/auth.device-Co5vrpaA.js +0 -2
- package/dist/client/_coffre/assets/auth.device-DAlqWacc.js +0 -1
- package/dist/client/_coffre/assets/directory-H8Eh3MnS.js +0 -1
- package/dist/client/_coffre/assets/dist-Braunv_x.js +0 -1
- package/dist/client/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/client/_coffre/assets/grants-DPDxJXU1.js +0 -1
- package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +0 -1
- package/dist/client/_coffre/assets/index-sUCIXRgJ.js +0 -12
- package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/client/_coffre/assets/link-DBINMwm6.js +0 -1
- package/dist/client/_coffre/assets/login-BZFYfL1Y.js +0 -1
- package/dist/client/_coffre/assets/login-CYCKWTOD.js +0 -2
- package/dist/client/_coffre/assets/offboarding-Bwpftp3g.js +0 -1
- package/dist/client/_coffre/assets/page-C_hnzdaR.js +0 -1
- package/dist/client/_coffre/assets/preload-helper-CLkO85Nq.js +0 -1
- package/dist/client/_coffre/assets/principal-page-DLho8TSJ.js +0 -1
- package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +0 -3
- package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-DGl921dP.js +0 -1
- package/dist/client/_coffre/assets/projects.index-BDn7Bhoo.js +0 -1
- package/dist/client/_coffre/assets/row-state-DJ-KLamZ.js +0 -1
- package/dist/client/_coffre/assets/settings-q9G1QvR_.js +0 -1
- package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +0 -1
- package/dist/client/_coffre/assets/suspense-O8sP0mEC.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-CcXSZnAG.js +0 -1
- package/dist/client/_coffre/assets/ui-BXP2IqrW.js +0 -46
- package/dist/client/_coffre/assets/unregistered-D2JXJ90x.js +0 -1
- package/dist/client/_coffre/assets/use-action-BpzKWhgg.js +0 -1
- package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +0 -1
- package/dist/client/_coffre/assets/use-shell-W0SusPkz.js +0 -1
- package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +0 -1
- package/dist/client/_coffre/assets/useSuspenseQuery-BZ-nzHST.js +0 -1
- package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +0 -1
- package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +0 -2
- package/dist/client/_coffre/assets/users.index-BvzP3qwW.js +0 -1
- package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +0 -1
- package/dist/server/.vite/manifest.json +0 -668
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +0 -162
- package/dist/server/_coffre/assets/account-CV-a2IU2.js +0 -329
- package/dist/server/_coffre/assets/account-hk6wcIXU.js +0 -162
- package/dist/server/_coffre/assets/async-local-storage-C10uQtMM.js +0 -3108
- package/dist/server/_coffre/assets/audit-C1_Ej6YB.js +0 -31
- package/dist/server/_coffre/assets/auth.device-6JRrWbSV.js +0 -210
- package/dist/server/_coffre/assets/auth.device-CLoAxC2T.js +0 -29
- package/dist/server/_coffre/assets/directory-B-_rqsPx.js +0 -371
- package/dist/server/_coffre/assets/dist-CnnV3t2g.js +0 -908
- package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +0 -5
- package/dist/server/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/server/_coffre/assets/icons-DOFT-eWB.js +0 -1704
- package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +0 -480
- package/dist/server/_coffre/assets/link-42ZWdjzZ.js +0 -422
- package/dist/server/_coffre/assets/login-DRKUKkaW.js +0 -22
- package/dist/server/_coffre/assets/login-DnwxVl4Y.js +0 -102
- package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +0 -56
- package/dist/server/_coffre/assets/page-D6n45dcK.js +0 -3561
- package/dist/server/_coffre/assets/projects._project._environment-CS8DdSMY.js +0 -48
- package/dist/server/_coffre/assets/projects._project.index-BGfcNpj0.js +0 -23
- package/dist/server/_coffre/assets/react-dom-bBoJXlK2.js +0 -1718
- package/dist/server/_coffre/assets/router-9BTgJhWG.js +0 -2322
- package/dist/server/_coffre/assets/start-DR3rN0St.js +0 -4
- package/dist/server/_coffre/assets/suspense-C-2QfDd2.js +0 -602
- package/dist/server/_coffre/assets/tokens._token-rY86Cjgp.js +0 -10
- package/dist/server/_coffre/assets/tokens.index-Bq5qDW9q.js +0 -37
- package/dist/server/_coffre/assets/ui-Cc0CGMtr.js +0 -14881
- package/dist/server/_coffre/assets/unregistered-D9ZKLOPJ.js +0 -53
- package/dist/server/_coffre/assets/use-shell-DwOzEi87.js +0 -462
- package/dist/server/_coffre/assets/useQuery-CTe86qFq.js +0 -8
- package/dist/server/_coffre/assets/useRouter-CaUSUNsw.js +0 -473
- package/dist/server/_coffre/assets/useSuspenseQuery-CSoHzrMb.js +0 -117
- package/dist/server/_coffre/assets/users._user-BmLKYeo_.js +0 -10
- package/dist/server/_coffre/assets/users._user-BmiHwQx3.js +0 -14
- package/dist/server/_coffre/assets/users.index-BiEax90r.js +0 -37
- package/dist/server/index.js +0 -13911
- package/src/assets/favicon-32.png +0 -0
- package/src/components/agentation.tsx +0 -34
- package/src/entry.ts +0 -19
- package/src/routeTree.gen.ts +0 -367
- package/src/routes/__root.tsx +0 -169
- package/src/routes/access.tsx +0 -11
- package/src/routes/index.tsx +0 -15
- package/src/routes/users.$user.tsx +0 -13
- package/src/types.ts +0 -21
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEffect, useState, type ReactNode } from 'react';
|
|
2
2
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
3
|
-
import {
|
|
3
|
+
import { Link, useRouter } from '@tanstack/react-router';
|
|
4
4
|
import { useShell } from '../lib/use-shell';
|
|
5
|
-
import {
|
|
5
|
+
import { Menu } from '@base-ui/react/menu';
|
|
6
6
|
import { toast } from 'sonner';
|
|
7
7
|
import { useCoffre } from '../lib/coffre';
|
|
8
8
|
import {
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
grantId,
|
|
14
14
|
renameEnvironment,
|
|
15
15
|
} from '../lib/changes';
|
|
16
|
-
import { affects, keys,
|
|
16
|
+
import { affects, keys, projectOf, queries } from '../lib/queries';
|
|
17
17
|
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
18
18
|
import { ItemFailure, RowPending, rowClass } from '../components/row-state';
|
|
19
19
|
import { useAction } from '../lib/use-action';
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
ConfirmDialog,
|
|
28
28
|
EmptyState,
|
|
29
29
|
ErrorLine,
|
|
30
|
+
MenuPopup,
|
|
30
31
|
Modal,
|
|
31
32
|
Notice,
|
|
32
33
|
Spinner,
|
|
@@ -52,21 +53,12 @@ import {
|
|
|
52
53
|
User,
|
|
53
54
|
Users,
|
|
54
55
|
} from '../components/icons';
|
|
56
|
+
import { pageRoute } from '../lib/page-route';
|
|
57
|
+
import type { project } from '../options';
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export
|
|
59
|
-
// The tab lives in the URL so a link can land on a project's access list.
|
|
60
|
-
// Environments is the default and so has no parameter.
|
|
61
|
-
validateSearch: (search: Record<string, unknown>): { tab?: Exclude<ProjectTab, 'environments'> } => ({
|
|
62
|
-
tab:
|
|
63
|
-
search.tab === 'users' || search.tab === 'tokens' || search.tab === 'settings'
|
|
64
|
-
? search.tab
|
|
65
|
-
: undefined,
|
|
66
|
-
}),
|
|
67
|
-
loader: ({ context: { client, queryClient }, params }) => loadProject(queryClient, client, params.project),
|
|
68
|
-
component: ProjectPage,
|
|
69
|
-
});
|
|
59
|
+
const Route = pageRoute<typeof project>();
|
|
60
|
+
|
|
61
|
+
export type ProjectTab = 'environments' | 'users' | 'tokens' | 'settings';
|
|
70
62
|
|
|
71
63
|
const TABS: { key: ProjectTab; label: string; icon: ReactNode }[] = [
|
|
72
64
|
{ key: 'environments', label: 'Environments', icon: <Layers size={15} /> },
|
|
@@ -75,7 +67,7 @@ const TABS: { key: ProjectTab; label: string; icon: ReactNode }[] = [
|
|
|
75
67
|
{ key: 'settings', label: 'Settings', icon: <Settings size={15} /> },
|
|
76
68
|
];
|
|
77
69
|
|
|
78
|
-
function ProjectPage() {
|
|
70
|
+
export function ProjectPage() {
|
|
79
71
|
const { project: projectSlug } = Route.useParams();
|
|
80
72
|
const { data: projects } = useSuspenseQuery(queries.projects(useCoffre()));
|
|
81
73
|
const result = projectOf(projects, projectSlug);
|
|
@@ -362,39 +354,35 @@ function EnvironmentCard({
|
|
|
362
354
|
{pending && <RowPending status={state} />}
|
|
363
355
|
|
|
364
356
|
{manageable && !pending && (
|
|
365
|
-
<
|
|
366
|
-
<
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
357
|
+
<Menu.Root>
|
|
358
|
+
<Menu.Trigger
|
|
359
|
+
className="act act-quiet env-card-menu"
|
|
360
|
+
aria-label={`Actions for ${environment.slug}`}
|
|
361
|
+
>
|
|
362
|
+
<MoreHorizontal size={16} />
|
|
363
|
+
</Menu.Trigger>
|
|
364
|
+
<MenuPopup align="end">
|
|
365
|
+
<Menu.Item
|
|
366
|
+
className="menu-item"
|
|
367
|
+
onClick={() => {
|
|
368
|
+
setSlug(environment.slug);
|
|
369
|
+
setName(environment.name);
|
|
370
|
+
setRenaming(true);
|
|
371
|
+
}}
|
|
370
372
|
>
|
|
371
|
-
<
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
<
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
<Pencil size={14} />
|
|
385
|
-
Rename
|
|
386
|
-
</DropdownMenu.Item>
|
|
387
|
-
<DropdownMenu.Separator className="menu-sep" />
|
|
388
|
-
<DropdownMenu.Item
|
|
389
|
-
className={`menu-item${isArchived ? '' : ' menu-item-danger'}`}
|
|
390
|
-
onSelect={() => setConfirming(true)}
|
|
391
|
-
>
|
|
392
|
-
{isArchived ? <RotateBack size={14} /> : <Archive size={14} />}
|
|
393
|
-
{isArchived ? 'Restore' : 'Archive…'}
|
|
394
|
-
</DropdownMenu.Item>
|
|
395
|
-
</DropdownMenu.Content>
|
|
396
|
-
</DropdownMenu.Portal>
|
|
397
|
-
</DropdownMenu.Root>
|
|
373
|
+
<Pencil size={14} />
|
|
374
|
+
Rename
|
|
375
|
+
</Menu.Item>
|
|
376
|
+
<Menu.Separator className="menu-sep" />
|
|
377
|
+
<Menu.Item
|
|
378
|
+
className={`menu-item${isArchived ? '' : ' menu-item-danger'}`}
|
|
379
|
+
onClick={() => setConfirming(true)}
|
|
380
|
+
>
|
|
381
|
+
{isArchived ? <RotateBack size={14} /> : <Archive size={14} />}
|
|
382
|
+
{isArchived ? 'Restore' : 'Archive…'}
|
|
383
|
+
</Menu.Item>
|
|
384
|
+
</MenuPopup>
|
|
385
|
+
</Menu.Root>
|
|
398
386
|
)}
|
|
399
387
|
|
|
400
388
|
{manageable && (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
3
|
-
import {
|
|
3
|
+
import { Link } from '@tanstack/react-router';
|
|
4
4
|
import { createProject, projectsList } from '../lib/changes';
|
|
5
5
|
import { useCoffre } from '../lib/coffre';
|
|
6
6
|
import type { ItemStatus } from '../lib/optimistic';
|
|
@@ -20,12 +20,7 @@ import {
|
|
|
20
20
|
RootAdminOnly,
|
|
21
21
|
} from '../components/affordances';
|
|
22
22
|
|
|
23
|
-
export
|
|
24
|
-
loader: ({ context: { client, queryClient } }) => queryClient.fetchQuery(queries.projects(client)),
|
|
25
|
-
component: ProjectsPage,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
function ProjectsPage() {
|
|
23
|
+
export function ProjectsPage() {
|
|
29
24
|
const { data: result, refetch } = useSuspenseQuery(queries.projects(useCoffre()));
|
|
30
25
|
const { capabilities } = useShell();
|
|
31
26
|
const { failedAdds } = useChangeStatus(projectsList.queryKey);
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { Link } from '@tanstack/react-router';
|
|
3
3
|
import { useCoffre } from '../lib/coffre';
|
|
4
|
-
import {
|
|
4
|
+
import { queries } from '../lib/queries';
|
|
5
5
|
import { useShell } from '../lib/use-shell';
|
|
6
6
|
import { Card, Fact, PageHeader } from '../components/page';
|
|
7
7
|
|
|
8
8
|
/** The instance's settings. Your own are under Account, at the sidebar's foot. */
|
|
9
|
-
export const Route = createFileRoute('/settings')({
|
|
10
|
-
// Instance facts come from the directory, which only owners may list.
|
|
11
|
-
// Asking on everyone's behalf would write a refusal to the audit log for
|
|
12
|
-
// every user who opens the page, so it is only asked for them.
|
|
13
|
-
loader: ({ context: { client, queryClient } }) => loadDirectory(queryClient, client),
|
|
14
|
-
component: SettingsPage,
|
|
15
|
-
});
|
|
16
9
|
|
|
17
10
|
const listFormat = new Intl.ListFormat('en', { type: 'disjunction' });
|
|
18
11
|
|
|
19
|
-
function SettingsPage() {
|
|
12
|
+
export function SettingsPage() {
|
|
20
13
|
const { auth, capabilities } = useShell();
|
|
21
14
|
const { data: directory } = useSuspenseQuery(queries.directory(useCoffre(), capabilities.canManageGrants));
|
|
22
15
|
const providers = auth?.signin?.providers.map((provider) => provider.label) ?? [];
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { PrincipalPage } from '../components/principal-page';
|
|
4
4
|
import { ServiceTokens } from '../components/service-tokens';
|
|
5
5
|
import { TrustedWorkloads } from '../components/trusted-workloads';
|
|
6
6
|
import { memberRef, useCoffre } from '../lib/coffre';
|
|
7
|
-
import {
|
|
7
|
+
import { queries } from '../lib/queries';
|
|
8
8
|
import { useShell } from '../lib/use-shell';
|
|
9
|
+
import { pageRoute } from '../lib/page-route';
|
|
10
|
+
import type { token } from '../options';
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
loader: ({ context: { client, queryClient }, params }) => loadPrincipal(queryClient, client, 'service', params.token),
|
|
12
|
-
component: TokenPage,
|
|
13
|
-
});
|
|
12
|
+
const Route = pageRoute<typeof token>();
|
|
14
13
|
|
|
15
|
-
function TokenPage() {
|
|
14
|
+
export function TokenPage() {
|
|
16
15
|
const { token } = Route.useParams();
|
|
17
16
|
const client = useCoffre();
|
|
18
17
|
const { auth, capabilities } = useShell();
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { AddPrincipal, DirectoryTable } from '../components/directory';
|
|
4
4
|
import { useCoffre } from '../lib/coffre';
|
|
5
|
-
import {
|
|
5
|
+
import { queries } from '../lib/queries';
|
|
6
6
|
import { useShell } from '../lib/use-shell';
|
|
7
7
|
import { ClosedDoor, PageHeader } from '../components/page';
|
|
8
8
|
import { RemovedList } from '../components/offboarding';
|
|
9
9
|
import { Key } from '../components/icons';
|
|
10
10
|
|
|
11
|
-
export
|
|
12
|
-
loader: ({ context: { client, queryClient } }) => loadDirectory(queryClient, client),
|
|
13
|
-
component: TokensPage,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
function TokensPage() {
|
|
11
|
+
export function TokensPage() {
|
|
17
12
|
const { capabilities } = useShell();
|
|
18
13
|
const { data: result } = useSuspenseQuery(queries.directory(useCoffre(), capabilities.canManageGrants));
|
|
19
14
|
|
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
import { createFileRoute } from '@tanstack/react-router';
|
|
2
1
|
import { useShell } from '../lib/use-shell';
|
|
3
2
|
|
|
4
3
|
import { ClosedDoor } from '../components/page';
|
|
5
4
|
import { User } from '../components/icons';
|
|
6
5
|
|
|
7
|
-
export const Route = createFileRoute('/unregistered')({
|
|
8
|
-
component: UnregisteredPage,
|
|
9
|
-
});
|
|
10
|
-
|
|
11
6
|
/**
|
|
12
7
|
* Cloudflare Access has authenticated this person, but Coffre has not
|
|
13
8
|
* registered them as a member. Keep this deliberately actionless: registration is
|
|
14
9
|
* an owner decision, not a self-service privilege escalation path.
|
|
15
10
|
*/
|
|
16
|
-
function UnregisteredPage() {
|
|
11
|
+
export function UnregisteredPage() {
|
|
17
12
|
const { principal, accessTampered } = useShell();
|
|
18
13
|
|
|
19
14
|
if (accessTampered) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PrincipalPage } from '../components/principal-page';
|
|
2
|
+
import { pageRoute } from '../lib/page-route';
|
|
3
|
+
import type { user } from '../options';
|
|
4
|
+
|
|
5
|
+
const Route = pageRoute<typeof user>();
|
|
6
|
+
|
|
7
|
+
export function UserPage() {
|
|
8
|
+
const { user } = Route.useParams();
|
|
9
|
+
return <PrincipalPage principalType="user" principalId={user} />;
|
|
10
|
+
}
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { AddPrincipal, DirectoryTable } from '../components/directory';
|
|
4
4
|
import { useCoffre } from '../lib/coffre';
|
|
5
|
-
import {
|
|
5
|
+
import { queries } from '../lib/queries';
|
|
6
6
|
import { useShell } from '../lib/use-shell';
|
|
7
7
|
import { ClosedDoor, PageHeader } from '../components/page';
|
|
8
8
|
import { RemovedList } from '../components/offboarding';
|
|
9
9
|
import { Users } from '../components/icons';
|
|
10
10
|
|
|
11
|
-
export
|
|
12
|
-
loader: ({ context: { client, queryClient } }) => loadDirectory(queryClient, client),
|
|
13
|
-
component: UsersPage,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
function UsersPage() {
|
|
11
|
+
export function UsersPage() {
|
|
17
12
|
const { capabilities } = useShell();
|
|
18
13
|
const { data: result } = useSuspenseQuery(queries.directory(useCoffre(), capabilities.canManageGrants));
|
|
19
14
|
|
package/src/register.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// coffre's whole route tree, mounted as a deployment mounts it, in plain
|
|
2
|
+
// TanStack, for this package's own typecheck: its links are checked against
|
|
3
|
+
// every route it defines. Nothing imports this file, so the build, and a
|
|
4
|
+
// deployment, never runs it: there the deployment's tree is the one
|
|
5
|
+
// registered.
|
|
6
|
+
import { createRootRouteWithContext, createRoute } from '@tanstack/react-router';
|
|
7
|
+
|
|
8
|
+
import type { createRouter } from './router';
|
|
9
|
+
import { access, account, audit, deviceLogin, environment, home, login, project, projects, settings, shell, solo, token, tokens, unregistered, user, users, type CoffreContext } from './options';
|
|
10
|
+
import { AccountPage } from './pages/account';
|
|
11
|
+
import { AuditPage } from './pages/audit';
|
|
12
|
+
import { DevicePage } from './pages/device-login';
|
|
13
|
+
import { EnvironmentPage } from './pages/environment';
|
|
14
|
+
import { LoginPage } from './pages/login';
|
|
15
|
+
import { ProjectPage } from './pages/project';
|
|
16
|
+
import { ProjectsPage } from './pages/projects';
|
|
17
|
+
import { SettingsPage } from './pages/settings';
|
|
18
|
+
import { TokenPage } from './pages/token';
|
|
19
|
+
import { TokensPage } from './pages/tokens';
|
|
20
|
+
import { UnregisteredPage } from './pages/unregistered';
|
|
21
|
+
import { UserPage } from './pages/user';
|
|
22
|
+
import { UsersPage } from './pages/users';
|
|
23
|
+
|
|
24
|
+
const root = createRootRouteWithContext<CoffreContext>()({});
|
|
25
|
+
const nav = createRoute({ getParentRoute: () => root, id: '_coffre', ...shell });
|
|
26
|
+
const frame = createRoute({ getParentRoute: () => root, id: '_solo', ...solo });
|
|
27
|
+
const under = <T extends string>(path: T) => ({ getParentRoute: () => nav, path });
|
|
28
|
+
|
|
29
|
+
const routeTree = root.addChildren([
|
|
30
|
+
frame.addChildren([
|
|
31
|
+
createRoute({ getParentRoute: () => frame, path: '/login', ...login, component: LoginPage }),
|
|
32
|
+
createRoute({ getParentRoute: () => frame, path: '/unregistered', ...unregistered, component: UnregisteredPage }),
|
|
33
|
+
createRoute({ getParentRoute: () => frame, path: '/auth/device', ...deviceLogin, component: DevicePage }),
|
|
34
|
+
]),
|
|
35
|
+
nav.addChildren([
|
|
36
|
+
createRoute({ ...under('/'), ...home }),
|
|
37
|
+
createRoute({ ...under('/projects'), ...projects, component: ProjectsPage }),
|
|
38
|
+
createRoute({ ...under('/projects/$project'), ...project, component: ProjectPage }),
|
|
39
|
+
createRoute({ ...under('/projects/$project/$environment'), ...environment, component: EnvironmentPage }),
|
|
40
|
+
createRoute({ ...under('/audit'), ...audit, component: AuditPage }),
|
|
41
|
+
createRoute({ ...under('/access'), ...access }),
|
|
42
|
+
createRoute({ ...under('/users'), ...users, component: UsersPage }),
|
|
43
|
+
createRoute({ ...under('/users/$user'), ...user, component: UserPage }),
|
|
44
|
+
createRoute({ ...under('/tokens'), ...tokens, component: TokensPage }),
|
|
45
|
+
createRoute({ ...under('/tokens/$token'), ...token, component: TokenPage }),
|
|
46
|
+
createRoute({ ...under('/settings'), ...settings, component: SettingsPage }),
|
|
47
|
+
createRoute({ ...under('/account'), ...account, component: AccountPage }),
|
|
48
|
+
]),
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
declare module '@tanstack/react-router' {
|
|
52
|
+
interface Register {
|
|
53
|
+
router: ReturnType<typeof createRouter<typeof routeTree>>;
|
|
54
|
+
}
|
|
55
|
+
}
|
package/src/router.tsx
CHANGED
|
@@ -1,25 +1,34 @@
|
|
|
1
1
|
import { createClient, type CoffreClient } from '@coffre/client';
|
|
2
|
-
import type
|
|
3
|
-
import { createRouter as createTanStackRouter } from '@tanstack/react-router';
|
|
2
|
+
import { createRouter as createTanStackRouter, type AnyRoute } from '@tanstack/react-router';
|
|
4
3
|
import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query';
|
|
5
|
-
import { getGlobalStartContext } from '@tanstack/react-start';
|
|
6
|
-
import { routeTree } from './routeTree.gen';
|
|
7
4
|
import { NotFound, RouteError } from './components/route-states';
|
|
8
5
|
import { createQueryClient } from './lib/queries';
|
|
6
|
+
import { DEFAULT_PREFERENCES, requestPage } from './lib/page-context';
|
|
7
|
+
import { browserPreferences, type Preferences } from './lib/preferences';
|
|
8
|
+
import type { CoffreContext } from './options';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The router
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The deployment's router, around its route tree, which holds coffre's
|
|
12
|
+
* routes: `export const getRouter = () => createRouter(routeTree)`. It gives
|
|
13
|
+
* the routes coffre's context (`CoffreContext`). TanStack
|
|
14
|
+
* Start calls it once per request on the server and once on the client, so
|
|
15
|
+
* each gets a query cache of its own: a request's reads are never another
|
|
16
|
+
* visitor's. The server's reads travel with the page, so the browser starts
|
|
17
|
+
* from them rather than asking again.
|
|
15
18
|
*
|
|
16
19
|
* Loaders read through the query cache (`lib/queries.ts`, which says how
|
|
17
20
|
* fresh it keeps a page), so the router keeps no copy of its own: it runs a
|
|
18
21
|
* route's loader on every navigation and every hover, and the cache answers
|
|
19
22
|
* whatever it already holds. A hover is then a read the click reuses.
|
|
20
23
|
*/
|
|
21
|
-
export function
|
|
24
|
+
export function createRouter<TRouteTree extends AnyRoute>(routeTree: TRouteTree) {
|
|
22
25
|
const queryClient = createQueryClient();
|
|
26
|
+
const page = typeof window === 'undefined' ? requestPage() : undefined;
|
|
27
|
+
const context: RouterContext = {
|
|
28
|
+
coffre: page?.client ?? browserClient(),
|
|
29
|
+
queryClient,
|
|
30
|
+
preferences: page?.preferences ?? (typeof window === 'undefined' ? DEFAULT_PREFERENCES : browserPreferences()),
|
|
31
|
+
};
|
|
23
32
|
const router = createTanStackRouter({
|
|
24
33
|
routeTree,
|
|
25
34
|
defaultPreload: 'intent',
|
|
@@ -28,65 +37,25 @@ export function getRouter() {
|
|
|
28
37
|
scrollRestoration: true,
|
|
29
38
|
defaultNotFoundComponent: NotFound,
|
|
30
39
|
defaultErrorComponent: RouteError,
|
|
31
|
-
|
|
32
|
-
|
|
40
|
+
// The nonce coffre's middleware minted for this response's policy, which
|
|
41
|
+
// the router puts on every script it renders. The browser has none to
|
|
42
|
+
// give: hydration reads it back from the page.
|
|
43
|
+
ssr: { nonce: page?.cspNonce },
|
|
44
|
+
context,
|
|
33
45
|
});
|
|
34
46
|
setupRouterSsrQueryIntegration({ router, queryClient });
|
|
35
47
|
return router;
|
|
36
48
|
}
|
|
37
49
|
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
* `context.client.secrets.list('market/dev')`. On the server `@coffre/server`
|
|
41
|
-
* builds it per request, calling the API in process with the visitor's
|
|
42
|
-
* credential (`server/fetch-api.ts`); the UI only uses it. In the browser it
|
|
43
|
-
* is plain `fetch` to `/api`, which sends the session cookie itself.
|
|
44
|
-
*/
|
|
45
|
-
function requestClient(): CoffreClient {
|
|
46
|
-
if (typeof window !== 'undefined') return createClient({ url: window.location.origin });
|
|
47
|
-
try {
|
|
48
|
-
const client = getGlobalStartContext()?.client;
|
|
49
|
-
if (client !== undefined) return client;
|
|
50
|
-
} catch {
|
|
51
|
-
// As for the nonce, below: outside a request there is no one to ask as.
|
|
52
|
-
}
|
|
53
|
-
return createClient({
|
|
54
|
-
url: 'http://coffre.invalid',
|
|
55
|
-
transport: () => Promise.reject(new Error('no request to call the API for')),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
50
|
+
/** What the router gives every route: coffre's context, and how the visitor has the pages drawn, for `<CoffreProvider>`. */
|
|
51
|
+
export type RouterContext = CoffreContext & { preferences: Preferences };
|
|
58
52
|
|
|
59
53
|
/**
|
|
60
|
-
* The
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
54
|
+
* The API as this visitor in the browser, which every loader reads through
|
|
55
|
+
* (`context.coffre.secrets.list('market/dev')`): plain `fetch` to `/api`,
|
|
56
|
+
* which sends the session cookie itself. On the server, coffre's
|
|
57
|
+
* middleware builds it per request; outside one, nothing calls it.
|
|
64
58
|
*/
|
|
65
|
-
function
|
|
66
|
-
|
|
67
|
-
return getGlobalStartContext()?.cspNonce;
|
|
68
|
-
} catch {
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** What `@coffre/server` hands every request; see `types.ts`. */
|
|
74
|
-
type RequestContext = { cspNonce: string; client: CoffreClient };
|
|
75
|
-
|
|
76
|
-
/** What every loader and component can reach through the router. */
|
|
77
|
-
export type RouterContext = { client: CoffreClient; queryClient: QueryClient };
|
|
78
|
-
|
|
79
|
-
// Start's server entry reads this `Register`, and its context helpers the
|
|
80
|
-
// one below: the two do not merge, so each hears of the request context.
|
|
81
|
-
declare module '@tanstack/react-router' {
|
|
82
|
-
interface Register {
|
|
83
|
-
router: ReturnType<typeof getRouter>;
|
|
84
|
-
server: { requestContext: RequestContext };
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
declare module '@tanstack/react-start' {
|
|
89
|
-
interface Register {
|
|
90
|
-
server: { requestContext: RequestContext };
|
|
91
|
-
}
|
|
59
|
+
function browserClient(): CoffreClient {
|
|
60
|
+
return createClient({ url: typeof window === 'undefined' ? 'http://coffre.invalid' : window.location.origin });
|
|
92
61
|
}
|