@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
package/README.md
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
# @coffre/ui
|
|
2
2
|
|
|
3
|
-
coffre's web pages
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
coffre's web pages, for a deployment's own TanStack Start app, whose pages
|
|
4
|
+
read only through `@coffre/client`; and `@coffre/ui/vite`, the Vite plugin
|
|
5
|
+
the app's build adds. Each page and layout is route options the app mounts
|
|
6
|
+
as Start's file routes, which is what `coffre init` writes:
|
|
7
|
+
|
|
8
|
+
```tsx
|
|
9
|
+
// app/src/routes/_coffre.tsx: coffre's nav
|
|
10
|
+
export const Route = createFileRoute('/_coffre')({ ...shell });
|
|
11
|
+
|
|
12
|
+
// app/src/routes/_coffre/projects.index.tsx
|
|
13
|
+
import { projects } from '@coffre/ui';
|
|
14
|
+
import { ProjectsPage } from '@coffre/ui/pages/projects';
|
|
15
|
+
|
|
16
|
+
export const Route = createFileRoute('/_coffre/projects/')({ ...projects, component: ProjectsPage });
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The app's root puts `<CoffreProvider>` around them, and links
|
|
20
|
+
`@coffre/ui/styles.css`, `icon.svg` and `apple-touch-icon.png`; its router
|
|
21
|
+
is `createRouter(routeTree)`. An app that prefers routes in code mounts
|
|
22
|
+
the same options with TanStack's `createRoute`.
|
|
23
|
+
`useCoffre()` gives an app's own page the API as the signed-in visitor.
|
|
24
|
+
React, TanStack Router, Start, Query and Vite are peers, pinned exactly:
|
|
25
|
+
the app has them at those versions, and its build stops when one differs.
|
|
6
26
|
|
|
7
27
|
Part of [coffre](https://github.com/erwinkn/coffre), a secrets manager you
|
|
8
28
|
deploy as a small project of your own. Its eight `@coffre/*` packages are
|
package/dist/{server/_coffre/assets/affordances-CKANXDTG.js → chunks/affordances-DAvsVz7u.js}
RENAMED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment, createElement } from "react";
|
|
2
2
|
//#region src/components/affordances.ts
|
|
3
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
4
3
|
/** The shared ordering and visibility rule for administration destinations. */
|
|
5
4
|
function AdministrationItems({ capabilities, users, audit }) {
|
|
6
|
-
return
|
|
5
|
+
return createElement(Fragment, null, ...administrationEntries(capabilities, {
|
|
6
|
+
users: [users],
|
|
7
|
+
audit: [audit]
|
|
8
|
+
}));
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
/** The same rule, for destinations kept as data (the command palette's). */
|
|
11
|
+
function administrationEntries(capabilities, { users, audit }) {
|
|
12
|
+
return [...capabilities.canManageGrants ? users : [], ...capabilities.canReadAudit ? audit : []];
|
|
10
13
|
}
|
|
11
14
|
/** Project creation exists before a grantable resource, so it is owner-only. */
|
|
12
15
|
function RootAdminOnly({ capabilities, children }) {
|
|
@@ -16,11 +19,13 @@ function RootAdminOnly({ capabilities, children }) {
|
|
|
16
19
|
function ProjectEmptyStateCopy({ capabilities, hasArchivedProjects }) {
|
|
17
20
|
if (hasArchivedProjects) return capabilities.canCreateProject ? "No active projects. Start a new one, or restore one from the archive below." : "No active projects. Your archived projects appear below.";
|
|
18
21
|
if (capabilities.canCreateProject) return "No projects exist yet. Start the first one with New project.";
|
|
19
|
-
return
|
|
22
|
+
return createElement(Fragment, null, "No project is visible to you. Someone holding ", createElement("span", { className: "mono" }, "grant.manage"), " on a project can add you.");
|
|
20
23
|
}
|
|
21
24
|
/** Reveal- and history-shaped controls require secret.read in this environment. */
|
|
22
25
|
function SecretReadOnly({ canReveal, children }) {
|
|
23
26
|
return canReveal ? children : null;
|
|
24
27
|
}
|
|
25
28
|
//#endregion
|
|
26
|
-
export {
|
|
29
|
+
export { administrationEntries as a, SecretReadOnly as i, ProjectEmptyStateCopy as n, RootAdminOnly as r, AdministrationItems as t };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=affordances-DAvsVz7u.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affordances-DAvsVz7u.js","names":[],"sources":["../../src/components/affordances.ts"],"sourcesContent":["import {\n createElement,\n Fragment,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport type { UiCapabilities } from '../lib/capabilities';\n\ntype AdministrationItemsProps = {\n capabilities: UiCapabilities;\n users: ReactNode;\n audit: ReactNode;\n};\n\n/** The shared ordering and visibility rule for administration destinations. */\nexport function AdministrationItems({\n capabilities,\n users,\n audit,\n}: AdministrationItemsProps): ReactElement {\n return createElement(\n Fragment,\n null,\n ...administrationEntries(capabilities, { users: [users], audit: [audit] }),\n );\n}\n\n/** The same rule, for destinations kept as data (the command palette's). */\nexport function administrationEntries<T>(\n capabilities: UiCapabilities,\n { users, audit }: { users: T[]; audit: T[] },\n): T[] {\n return [\n ...(capabilities.canManageGrants ? users : []),\n ...(capabilities.canReadAudit ? audit : []),\n ];\n}\n\n/** Project creation exists before a grantable resource, so it is owner-only. */\nexport function RootAdminOnly({\n capabilities,\n children,\n}: {\n capabilities: UiCapabilities;\n children: ReactNode;\n}): ReactNode {\n return capabilities.canCreateProject ? children : null;\n}\n\n/** Empty project copy must distinguish an empty instance from archived-only state. */\nexport function ProjectEmptyStateCopy({\n capabilities,\n hasArchivedProjects,\n}: {\n capabilities: UiCapabilities;\n hasArchivedProjects: boolean;\n}): ReactNode {\n if (hasArchivedProjects) {\n return capabilities.canCreateProject\n ? 'No active projects. Start a new one, or restore one from the archive below.'\n : 'No active projects. Your archived projects appear below.';\n }\n\n if (capabilities.canCreateProject) {\n return 'No projects exist yet. Start the first one with New project.';\n }\n\n return createElement(\n Fragment,\n null,\n 'No project is visible to you. Someone holding ',\n createElement('span', { className: 'mono' }, 'grant.manage'),\n ' on a project can add you.',\n );\n}\n\n/** Reveal- and history-shaped controls require secret.read in this environment. */\nexport function SecretReadOnly({\n canReveal,\n children,\n}: {\n canReveal: boolean;\n children: ReactNode;\n}): ReactNode {\n return canReveal ? children : null;\n}\n"],"mappings":";;;AAeA,SAAgB,oBAAoB,EAClC,cACA,OACA,SACyC;CACzC,OAAO,cACL,UACA,MACA,GAAG,sBAAsB,cAAc;EAAE,OAAO,CAAC,KAAK;EAAG,OAAO,CAAC,KAAK;CAAE,CAAC,CAC3E;AACF;;AAGA,SAAgB,sBACd,cACA,EAAE,OAAO,SACJ;CACL,OAAO,CACL,GAAI,aAAa,kBAAkB,QAAQ,CAAC,GAC5C,GAAI,aAAa,eAAe,QAAQ,CAAC,CAC3C;AACF;;AAGA,SAAgB,cAAc,EAC5B,cACA,YAIY;CACZ,OAAO,aAAa,mBAAmB,WAAW;AACpD;;AAGA,SAAgB,sBAAsB,EACpC,cACA,uBAIY;CACZ,IAAI,qBACF,OAAO,aAAa,mBAChB,gFACA;CAGN,IAAI,aAAa,kBACf,OAAO;CAGT,OAAO,cACL,UACA,MACA,kDACA,cAAc,QAAQ,EAAE,WAAW,OAAO,GAAG,cAAc,GAC3D,4BACF;AACF;;AAGA,SAAgB,eAAe,EAC7B,WACA,YAIY;CACZ,OAAO,YAAY,WAAW;AAChC"}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { t as useMounted } from "./mounted-jJmqqV_n.js";
|
|
2
|
+
import { f as Toggletip, i as EmptyState, l as Spinner, n as ConfirmDialog, o as MenuPopup, s as Modal } from "./ui-DixXLQvQ.js";
|
|
3
|
+
import { A as Pencil, C as Lock, G as X, H as User, I as ShieldCheck, O as MoreHorizontal, j as Plus, v as Key } from "./icons-D-PfAfnH.js";
|
|
4
|
+
import { s as memberRef, u as useCoffre } from "./page-C5HcNqf2.js";
|
|
5
|
+
import { a as rowClass, i as RowPending, r as RowFailure } from "./row-state-0PsrEzOL.js";
|
|
6
|
+
import { _ as removeMember, l as directoryList, m as invite, n as useChangeStatus, o as changeRole, t as useChange } from "./use-change-c6CeLRin.js";
|
|
7
|
+
import { Fragment, useState } from "react";
|
|
8
|
+
import { Link } from "@tanstack/react-router";
|
|
9
|
+
import { Menu } from "@base-ui/react/menu";
|
|
10
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/principal.tsx
|
|
12
|
+
/** A person's initial, or a key for a machine. */
|
|
13
|
+
function PrincipalAvatar({ type, id, size = "sm" }) {
|
|
14
|
+
return /* @__PURE__ */ jsx("span", {
|
|
15
|
+
className: `avatar${type === "service" ? " avatar-token" : ""}${size === "lg" ? " avatar-lg" : ""}`,
|
|
16
|
+
"aria-hidden": true,
|
|
17
|
+
children: type === "service" ? /* @__PURE__ */ jsx(Key, { size: size === "lg" ? 18 : 13 }) : id.slice(0, 1)
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A user or token, linking to its own page, if the deployment kept it.
|
|
22
|
+
* `stretch` makes the link cover the whole table row it sits in.
|
|
23
|
+
*/
|
|
24
|
+
function PrincipalLink({ type, id, stretch = false }) {
|
|
25
|
+
const className = `cell-link${stretch ? " stretch" : ""}`;
|
|
26
|
+
const mounted = useMounted();
|
|
27
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
28
|
+
className: "cell-principal",
|
|
29
|
+
children: [/* @__PURE__ */ jsx(PrincipalAvatar, {
|
|
30
|
+
type,
|
|
31
|
+
id
|
|
32
|
+
}), !mounted(type === "user" ? "/users/$user" : "/tokens/$token") ? /* @__PURE__ */ jsx("span", { children: id }) : type === "user" ? /* @__PURE__ */ jsx(Link, {
|
|
33
|
+
className,
|
|
34
|
+
to: "/users/$user",
|
|
35
|
+
params: { user: id },
|
|
36
|
+
children: id
|
|
37
|
+
}) : /* @__PURE__ */ jsx(Link, {
|
|
38
|
+
className,
|
|
39
|
+
to: "/tokens/$token",
|
|
40
|
+
params: { token: id },
|
|
41
|
+
children: id
|
|
42
|
+
})]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/components/directory.tsx
|
|
47
|
+
/** How the directory, and its changes, name someone: `user:…`, `token:…`. */
|
|
48
|
+
var memberOf = (principal) => memberRef(principal.principalType, principal.principalId);
|
|
49
|
+
var ROLE_LABEL = {
|
|
50
|
+
"root-admin": "Root admin",
|
|
51
|
+
owner: "Owner",
|
|
52
|
+
user: "Member"
|
|
53
|
+
};
|
|
54
|
+
/** What each kind of principal is called in the interface. */
|
|
55
|
+
var KIND = {
|
|
56
|
+
user: "user",
|
|
57
|
+
service: "token"
|
|
58
|
+
};
|
|
59
|
+
function DirectoryTable({ principalType, principals, hasRemoved = false }) {
|
|
60
|
+
const users = principalType === "user";
|
|
61
|
+
const columns = users ? 4 : 3;
|
|
62
|
+
const { status, failedAdds, dismiss } = useChangeStatus(directoryList.queryKey);
|
|
63
|
+
const refused = failedAdds(principals.map(memberOf)).filter(({ vars }) => vars.principalType === principalType);
|
|
64
|
+
return /* @__PURE__ */ jsx("section", {
|
|
65
|
+
className: "card",
|
|
66
|
+
"aria-label": users ? "Users" : "Tokens",
|
|
67
|
+
children: principals.length === 0 && refused.length === 0 ? /* @__PURE__ */ jsxs(EmptyState, {
|
|
68
|
+
title: hasRemoved ? `No active ${KIND[principalType]}s` : users ? "Nobody is registered" : "No tokens yet",
|
|
69
|
+
children: [hasRemoved ? `Add a ${KIND[principalType]}` : `Add the first ${KIND[principalType]}`, " to let it through the door. Project access is a separate step, granted from each project's page."]
|
|
70
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
71
|
+
className: "dt-wrap",
|
|
72
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
73
|
+
className: `dt directory directory-${principalType} stacks`,
|
|
74
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
75
|
+
/* @__PURE__ */ jsx("th", {
|
|
76
|
+
className: "n",
|
|
77
|
+
children: "#"
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx("th", {
|
|
80
|
+
className: "col-principal",
|
|
81
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
82
|
+
className: "th",
|
|
83
|
+
children: [users ? /* @__PURE__ */ jsx(User, { size: 14 }) : /* @__PURE__ */ jsx(Key, { size: 14 }), users ? "Email" : "Name"]
|
|
84
|
+
})
|
|
85
|
+
}),
|
|
86
|
+
users && /* @__PURE__ */ jsx("th", {
|
|
87
|
+
className: "col-role",
|
|
88
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
89
|
+
className: "th",
|
|
90
|
+
children: [/* @__PURE__ */ jsx(ShieldCheck, { size: 14 }), "Instance role"]
|
|
91
|
+
})
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsx("th", {
|
|
94
|
+
className: "col-actions",
|
|
95
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
96
|
+
className: "visually-hidden",
|
|
97
|
+
children: "Actions"
|
|
98
|
+
})
|
|
99
|
+
})
|
|
100
|
+
] }) }), /* @__PURE__ */ jsxs("tbody", { children: [principals.map((principal, index) => {
|
|
101
|
+
const state = status(memberOf(principal));
|
|
102
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
103
|
+
className: `row-link ${rowClass(state)}`,
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsx("td", {
|
|
106
|
+
className: "n",
|
|
107
|
+
children: index + 1
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx("td", {
|
|
110
|
+
className: "col-lead",
|
|
111
|
+
"data-label": principal.principalType === "user" ? "Email" : "Name",
|
|
112
|
+
children: /* @__PURE__ */ jsx(PrincipalLink, {
|
|
113
|
+
type: principal.principalType,
|
|
114
|
+
id: principal.principalId,
|
|
115
|
+
stretch: true
|
|
116
|
+
})
|
|
117
|
+
}),
|
|
118
|
+
users && /* @__PURE__ */ jsx("td", {
|
|
119
|
+
className: "col-role",
|
|
120
|
+
"data-label": "Instance role",
|
|
121
|
+
children: /* @__PURE__ */ jsx(InstanceRole, { principal })
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ jsx("td", {
|
|
124
|
+
className: "col-actions",
|
|
125
|
+
children: state.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status: state }) : /* @__PURE__ */ jsx(PrincipalActions, { principal })
|
|
126
|
+
})
|
|
127
|
+
]
|
|
128
|
+
}), /* @__PURE__ */ jsx(RowFailure, {
|
|
129
|
+
status: state,
|
|
130
|
+
columns,
|
|
131
|
+
onDismiss: () => state.state === "failed" && dismiss(state.mutationId)
|
|
132
|
+
})] }, principal.principalId);
|
|
133
|
+
}), refused.map(({ mutationId, vars, status: failed }) => /* @__PURE__ */ jsxs(RowFailure, {
|
|
134
|
+
status: failed,
|
|
135
|
+
columns,
|
|
136
|
+
onDismiss: () => dismiss(mutationId),
|
|
137
|
+
children: [vars.principalId, " was not added."]
|
|
138
|
+
}, mutationId))] })]
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A user's instance role. Tokens have none worth showing: every one is a
|
|
145
|
+
* plain member. A root admin's role comes from the deployment, so its tag says
|
|
146
|
+
* so on hover or tap instead of offering a menu that could not work.
|
|
147
|
+
*/
|
|
148
|
+
function InstanceRole({ principal }) {
|
|
149
|
+
if (principal.tampered === true) return /* @__PURE__ */ jsx(Toggletip, {
|
|
150
|
+
label: /* @__PURE__ */ jsx(Fragment$1, { children: "Their record was changed outside coffre, so the vault refuses them everything. Remove them to start them over, then add them again." }),
|
|
151
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
152
|
+
type: "button",
|
|
153
|
+
className: "tag tag-red tag-button",
|
|
154
|
+
children: [/* @__PURE__ */ jsx(Lock, { size: 11 }), "Integrity check failed"]
|
|
155
|
+
})
|
|
156
|
+
});
|
|
157
|
+
if (principal.isRootAdmin) return /* @__PURE__ */ jsx(Toggletip, {
|
|
158
|
+
label: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
159
|
+
"Set by ",
|
|
160
|
+
/* @__PURE__ */ jsx("code", { children: "rootAdmins" }),
|
|
161
|
+
" in the vault's configuration, so it cannot be changed or removed here."
|
|
162
|
+
] }),
|
|
163
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
164
|
+
type: "button",
|
|
165
|
+
className: "tag tag-violet tag-button",
|
|
166
|
+
children: [/* @__PURE__ */ jsx(Lock, { size: 11 }), "Root admin"]
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
return /* @__PURE__ */ jsx("span", {
|
|
170
|
+
className: `tag${principal.instanceRole === "user" ? "" : " tag-violet"}`,
|
|
171
|
+
children: ROLE_LABEL[principal.instanceRole]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Change role and Remove, behind one menu. Root admins get none: the
|
|
176
|
+
* deployment's configuration owns them.
|
|
177
|
+
*/
|
|
178
|
+
function PrincipalActions({ principal, trigger = "act act-quiet act-menu" }) {
|
|
179
|
+
const [editing, setEditing] = useState(false);
|
|
180
|
+
const [confirming, setConfirming] = useState(false);
|
|
181
|
+
const [instanceRole, setInstanceRole] = useState(principal.instanceRole === "owner" ? "owner" : "user");
|
|
182
|
+
const coffre = useCoffre();
|
|
183
|
+
const setRole = useChange(changeRole(coffre));
|
|
184
|
+
const remove = useChange(removeMember(coffre));
|
|
185
|
+
const { status } = useChangeStatus(directoryList.queryKey);
|
|
186
|
+
const pending = status(memberOf(principal)).state === "pending";
|
|
187
|
+
const kind = KIND[principal.principalType];
|
|
188
|
+
if (principal.isRootAdmin) return null;
|
|
189
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
190
|
+
/* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
191
|
+
className: trigger,
|
|
192
|
+
"aria-label": `Actions for ${principal.principalId}`,
|
|
193
|
+
disabled: pending,
|
|
194
|
+
children: pending ? /* @__PURE__ */ jsx(Spinner, { size: 13 }) : /* @__PURE__ */ jsx(MoreHorizontal, { size: 16 })
|
|
195
|
+
}), /* @__PURE__ */ jsxs(MenuPopup, {
|
|
196
|
+
align: "end",
|
|
197
|
+
children: [principal.principalType === "user" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(Menu.Item, {
|
|
198
|
+
className: "menu-item",
|
|
199
|
+
onClick: () => {
|
|
200
|
+
setInstanceRole(principal.instanceRole === "owner" ? "owner" : "user");
|
|
201
|
+
setEditing(true);
|
|
202
|
+
},
|
|
203
|
+
children: [/* @__PURE__ */ jsx(Pencil, { size: 14 }), "Change role"]
|
|
204
|
+
}), /* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" })] }), /* @__PURE__ */ jsxs(Menu.Item, {
|
|
205
|
+
className: "menu-item menu-item-danger",
|
|
206
|
+
onClick: () => setConfirming(true),
|
|
207
|
+
children: [
|
|
208
|
+
/* @__PURE__ */ jsx(X, { size: 14 }),
|
|
209
|
+
"Remove ",
|
|
210
|
+
kind,
|
|
211
|
+
"…"
|
|
212
|
+
]
|
|
213
|
+
})]
|
|
214
|
+
})] }),
|
|
215
|
+
principal.principalType === "user" && /* @__PURE__ */ jsx(Modal, {
|
|
216
|
+
open: editing,
|
|
217
|
+
onOpenChange: setEditing,
|
|
218
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: ["Role of ", /* @__PURE__ */ jsx("span", {
|
|
219
|
+
className: "mono",
|
|
220
|
+
children: principal.principalId
|
|
221
|
+
})] }),
|
|
222
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
223
|
+
className: "form",
|
|
224
|
+
onSubmit: (event) => {
|
|
225
|
+
event.preventDefault();
|
|
226
|
+
setRole({
|
|
227
|
+
principalId: principal.principalId,
|
|
228
|
+
owner: instanceRole === "owner"
|
|
229
|
+
});
|
|
230
|
+
setEditing(false);
|
|
231
|
+
},
|
|
232
|
+
children: [/* @__PURE__ */ jsx(RoleField, {
|
|
233
|
+
value: instanceRole,
|
|
234
|
+
onChange: setInstanceRole
|
|
235
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
236
|
+
className: "dialog-actions",
|
|
237
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
238
|
+
className: "btn",
|
|
239
|
+
type: "button",
|
|
240
|
+
onClick: () => setEditing(false),
|
|
241
|
+
children: "Cancel"
|
|
242
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
243
|
+
className: "btn btn-primary",
|
|
244
|
+
type: "submit",
|
|
245
|
+
children: "Save"
|
|
246
|
+
})]
|
|
247
|
+
})]
|
|
248
|
+
})
|
|
249
|
+
}),
|
|
250
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
251
|
+
open: confirming,
|
|
252
|
+
onOpenChange: setConfirming,
|
|
253
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
254
|
+
"Remove ",
|
|
255
|
+
/* @__PURE__ */ jsx("span", {
|
|
256
|
+
className: "mono",
|
|
257
|
+
children: principal.principalId
|
|
258
|
+
}),
|
|
259
|
+
"?"
|
|
260
|
+
] }),
|
|
261
|
+
body: principal.principalType === "user" ? /* @__PURE__ */ jsx(Fragment$1, { children: "They are signed out everywhere, and their CLI logins, linked sign-in accounts and project permissions are revoked at once. Their past actions stay in the audit log, and their page then lists the values they saw, to rotate." }) : /* @__PURE__ */ jsx(Fragment$1, { children: "Every token issued to it stops working and its project permissions are revoked at once, including for anything running with it right now. Its past actions stay in the audit log, and its page then lists the values it read, to rotate." }),
|
|
262
|
+
confirmLabel: `Remove ${kind}`,
|
|
263
|
+
onConfirm: () => remove(principal)
|
|
264
|
+
})
|
|
265
|
+
] });
|
|
266
|
+
}
|
|
267
|
+
function AddPrincipal({ principalType }) {
|
|
268
|
+
const [open, setOpen] = useState(false);
|
|
269
|
+
const [principalId, setPrincipalId] = useState("");
|
|
270
|
+
const [instanceRole, setInstanceRole] = useState("user");
|
|
271
|
+
const add = useChange(invite(useCoffre()));
|
|
272
|
+
const kind = KIND[principalType];
|
|
273
|
+
function close() {
|
|
274
|
+
setOpen(false);
|
|
275
|
+
setPrincipalId("");
|
|
276
|
+
setInstanceRole("user");
|
|
277
|
+
}
|
|
278
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
279
|
+
className: "btn btn-primary",
|
|
280
|
+
onClick: () => setOpen(true),
|
|
281
|
+
children: [
|
|
282
|
+
/* @__PURE__ */ jsx(Plus, { size: 14 }),
|
|
283
|
+
"Add ",
|
|
284
|
+
kind
|
|
285
|
+
]
|
|
286
|
+
}), /* @__PURE__ */ jsx(Modal, {
|
|
287
|
+
open,
|
|
288
|
+
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
289
|
+
title: `Add a ${kind}`,
|
|
290
|
+
description: `This lets the ${kind} through the door and nothing more. Grant project access from its page or from each project's.`,
|
|
291
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
292
|
+
className: "form",
|
|
293
|
+
onSubmit: (event) => {
|
|
294
|
+
event.preventDefault();
|
|
295
|
+
add({
|
|
296
|
+
principalType,
|
|
297
|
+
principalId: principalId.trim(),
|
|
298
|
+
owner: instanceRole === "owner"
|
|
299
|
+
});
|
|
300
|
+
close();
|
|
301
|
+
},
|
|
302
|
+
children: [
|
|
303
|
+
/* @__PURE__ */ jsxs("label", {
|
|
304
|
+
className: "field",
|
|
305
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
306
|
+
className: "label",
|
|
307
|
+
children: principalType === "user" ? "Cloudflare Access email" : "Service token common name"
|
|
308
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
309
|
+
className: "input input-mono",
|
|
310
|
+
autoFocus: true,
|
|
311
|
+
spellCheck: false,
|
|
312
|
+
autoComplete: "off",
|
|
313
|
+
value: principalId,
|
|
314
|
+
placeholder: principalType === "user" ? "someone@acme.example" : "ci-deploy",
|
|
315
|
+
onChange: (event) => setPrincipalId(event.target.value)
|
|
316
|
+
})]
|
|
317
|
+
}),
|
|
318
|
+
principalType === "user" && /* @__PURE__ */ jsx(RoleField, {
|
|
319
|
+
value: instanceRole,
|
|
320
|
+
onChange: setInstanceRole
|
|
321
|
+
}),
|
|
322
|
+
/* @__PURE__ */ jsxs("div", {
|
|
323
|
+
className: "dialog-actions",
|
|
324
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
325
|
+
className: "btn",
|
|
326
|
+
type: "button",
|
|
327
|
+
onClick: close,
|
|
328
|
+
children: "Cancel"
|
|
329
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
330
|
+
className: "btn btn-primary",
|
|
331
|
+
type: "submit",
|
|
332
|
+
disabled: principalId.trim() === "",
|
|
333
|
+
children: ["Add ", kind]
|
|
334
|
+
})]
|
|
335
|
+
})
|
|
336
|
+
]
|
|
337
|
+
})
|
|
338
|
+
})] });
|
|
339
|
+
}
|
|
340
|
+
function RoleField({ value, onChange }) {
|
|
341
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
342
|
+
className: "field",
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ jsx("span", {
|
|
345
|
+
className: "label",
|
|
346
|
+
children: "Instance role"
|
|
347
|
+
}),
|
|
348
|
+
/* @__PURE__ */ jsxs("select", {
|
|
349
|
+
className: "select",
|
|
350
|
+
value,
|
|
351
|
+
onChange: (event) => onChange(event.target.value),
|
|
352
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
353
|
+
value: "user",
|
|
354
|
+
children: "Member"
|
|
355
|
+
}), /* @__PURE__ */ jsx("option", {
|
|
356
|
+
value: "owner",
|
|
357
|
+
children: "Owner"
|
|
358
|
+
})]
|
|
359
|
+
}),
|
|
360
|
+
/* @__PURE__ */ jsx("span", {
|
|
361
|
+
className: "hint",
|
|
362
|
+
children: "Owners manage users and tokens, can create projects, and read the whole audit log. Neither role reads a secret without a project grant."
|
|
363
|
+
})
|
|
364
|
+
]
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
//#endregion
|
|
368
|
+
export { PrincipalActions as a, KIND as i, DirectoryTable as n, PrincipalAvatar as o, InstanceRole as r, PrincipalLink as s, AddPrincipal as t };
|
|
369
|
+
|
|
370
|
+
//# sourceMappingURL=directory-CSjWWUQ1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"directory-CSjWWUQ1.js","names":[],"sources":["../../src/components/principal.tsx","../../src/components/directory.tsx"],"sourcesContent":["import { Link } from '@tanstack/react-router';\nimport { useMounted } from '../lib/mounted';\nimport type { DirectoryPrincipal } from '../shared/models';\nimport { Key } from './icons';\n\ntype PrincipalType = DirectoryPrincipal['principalType'];\n\n/** A person's initial, or a key for a machine. */\nexport function PrincipalAvatar({\n type,\n id,\n size = 'sm',\n}: {\n type: PrincipalType;\n id: string;\n size?: 'sm' | 'lg';\n}) {\n const className = `avatar${type === 'service' ? ' avatar-token' : ''}${size === 'lg' ? ' avatar-lg' : ''}`;\n return (\n <span className={className} aria-hidden>\n {type === 'service' ? <Key size={size === 'lg' ? 18 : 13} /> : id.slice(0, 1)}\n </span>\n );\n}\n\n/**\n * A user or token, linking to its own page, if the deployment kept it.\n * `stretch` makes the link cover the whole table row it sits in.\n */\nexport function PrincipalLink({\n type,\n id,\n stretch = false,\n}: {\n type: PrincipalType;\n id: string;\n stretch?: boolean;\n}) {\n const className = `cell-link${stretch ? ' stretch' : ''}`;\n const mounted = useMounted();\n return (\n <span className=\"cell-principal\">\n <PrincipalAvatar type={type} id={id} />\n {!mounted(type === 'user' ? '/users/$user' : '/tokens/$token') ? (\n <span>{id}</span>\n ) : type === 'user' ? (\n <Link className={className} to=\"/users/$user\" params={{ user: id }}>\n {id}\n </Link>\n ) : (\n <Link className={className} to=\"/tokens/$token\" params={{ token: id }}>\n {id}\n </Link>\n )}\n </span>\n );\n}\n","import { Fragment, useState } from 'react';\nimport { Menu } from '@base-ui/react/menu';\nimport { changeRole, directoryList, invite, removeMember, type InviteVars } from '../lib/changes';\nimport { memberRef, useCoffre } from '../lib/coffre';\nimport { useChange, useChangeStatus } from '../lib/use-change';\nimport type { DirectoryPrincipal } from '../shared/models';\nimport { RowFailure, RowPending, rowClass } from './row-state';\nimport { ConfirmDialog, EmptyState, MenuPopup, Modal, Spinner, Toggletip } from './ui';\nimport { PrincipalLink } from './principal';\nimport { Key, Lock, MoreHorizontal, Pencil, Plus, ShieldCheck, User, X } from './icons';\n\n/**\n * The instance directory, shared by the Users and Tokens pages.\n *\n * Both are rows in the same table on the server (principals, typed user or\n * service); the pages split them because people and machines are looked after\n * differently, not because the model does.\n */\n\ntype PrincipalType = DirectoryPrincipal['principalType'];\n\n/** How the directory, and its changes, name someone: `user:…`, `token:…`. */\nexport const memberOf = (principal: Pick<DirectoryPrincipal, 'principalType' | 'principalId'>) =>\n memberRef(principal.principalType, principal.principalId);\n\nexport const ROLE_LABEL: Record<DirectoryPrincipal['instanceRole'], string> = {\n 'root-admin': 'Root admin',\n owner: 'Owner',\n user: 'Member',\n};\n\n/** What each kind of principal is called in the interface. */\nexport const KIND: Record<PrincipalType, string> = {\n user: 'user',\n service: 'token',\n};\n\nexport function DirectoryTable({\n principalType,\n principals,\n hasRemoved = false,\n}: {\n principalType: PrincipalType;\n principals: DirectoryPrincipal[];\n /** Whether some were removed, listed beneath, so an empty table is not \"yet\". */\n hasRemoved?: boolean;\n}) {\n const users = principalType === 'user';\n const columns = users ? 4 : 3;\n const { status, failedAdds, dismiss } = useChangeStatus(directoryList.queryKey);\n const refused = failedAdds<InviteVars>(principals.map(memberOf)).filter(\n ({ vars }) => vars.principalType === principalType,\n );\n return (\n <section className=\"card\" aria-label={users ? 'Users' : 'Tokens'}>\n {principals.length === 0 && refused.length === 0 ? (\n <EmptyState\n title={\n hasRemoved\n ? `No active ${KIND[principalType]}s`\n : users\n ? 'Nobody is registered'\n : 'No tokens yet'\n }\n >\n {hasRemoved ? `Add a ${KIND[principalType]}` : `Add the first ${KIND[principalType]}`} to let\n it through the door. Project access is a separate step, granted from each project's page.\n </EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className={`dt directory directory-${principalType} stacks`}>\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">\n <span className=\"th\">\n {users ? <User size={14} /> : <Key size={14} />}\n {users ? 'Email' : 'Name'}\n </span>\n </th>\n {users && (\n <th className=\"col-role\">\n <span className=\"th\">\n <ShieldCheck size={14} />\n Instance role\n </span>\n </th>\n )}\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Actions</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {principals.map((principal, index) => {\n const state = status(memberOf(principal));\n return (\n <Fragment key={principal.principalId}>\n <tr className={`row-link ${rowClass(state)}`}>\n <td className=\"n\">{index + 1}</td>\n <td\n className=\"col-lead\"\n data-label={principal.principalType === 'user' ? 'Email' : 'Name'}\n >\n <PrincipalLink\n type={principal.principalType}\n id={principal.principalId}\n stretch\n />\n </td>\n {users && (\n <td className=\"col-role\" data-label=\"Instance role\">\n <InstanceRole principal={principal} />\n </td>\n )}\n <td className=\"col-actions\">\n {state.state === 'pending' ? (\n <RowPending status={state} />\n ) : (\n <PrincipalActions principal={principal} />\n )}\n </td>\n </tr>\n <RowFailure\n status={state}\n columns={columns}\n onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}\n />\n </Fragment>\n );\n })}\n {refused.map(({ mutationId, vars, status: failed }) => (\n <RowFailure\n key={mutationId}\n status={failed}\n columns={columns}\n onDismiss={() => dismiss(mutationId)}\n >\n {vars.principalId} was not added.\n </RowFailure>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </section>\n );\n}\n\n/**\n * A user's instance role. Tokens have none worth showing: every one is a\n * plain member. A root admin's role comes from the deployment, so its tag says\n * so on hover or tap instead of offering a menu that could not work.\n */\nexport function InstanceRole({ principal }: { principal: DirectoryPrincipal }) {\n if (principal.tampered === true) {\n return (\n <Toggletip\n label={\n <>\n Their record was changed outside coffre, so the vault refuses them\n everything. Remove them to start them over, then add them again.\n </>\n }\n >\n <button type=\"button\" className=\"tag tag-red tag-button\">\n <Lock size={11} />\n Integrity check failed\n </button>\n </Toggletip>\n );\n }\n if (principal.isRootAdmin) {\n return (\n <Toggletip\n label={\n <>\n Set by <code>rootAdmins</code> in the vault's configuration, so it\n cannot be changed or removed here.\n </>\n }\n >\n <button type=\"button\" className=\"tag tag-violet tag-button\">\n <Lock size={11} />\n Root admin\n </button>\n </Toggletip>\n );\n }\n return (\n <span className={`tag${principal.instanceRole === 'user' ? '' : ' tag-violet'}`}>\n {ROLE_LABEL[principal.instanceRole]}\n </span>\n );\n}\n\n/**\n * Change role and Remove, behind one menu. Root admins get none: the\n * deployment's configuration owns them.\n */\nexport function PrincipalActions({\n principal,\n trigger = 'act act-quiet act-menu',\n}: {\n principal: DirectoryPrincipal;\n /** The menu button's classes: a row action in tables, a button in a page head. */\n trigger?: string;\n}) {\n const [editing, setEditing] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [instanceRole, setInstanceRole] = useState<'user' | 'owner'>(\n principal.instanceRole === 'owner' ? 'owner' : 'user',\n );\n const coffre = useCoffre();\n const setRole = useChange(changeRole(coffre));\n const remove = useChange(removeMember(coffre));\n const { status } = useChangeStatus(directoryList.queryKey);\n const pending = status(memberOf(principal)).state === 'pending';\n const kind = KIND[principal.principalType];\n\n if (principal.isRootAdmin) return null;\n\n return (\n <>\n <Menu.Root>\n <Menu.Trigger\n className={trigger}\n aria-label={`Actions for ${principal.principalId}`}\n disabled={pending}\n >\n {pending ? <Spinner size={13} /> : <MoreHorizontal size={16} />}\n </Menu.Trigger>\n <MenuPopup align=\"end\">\n {principal.principalType === 'user' && (\n <>\n <Menu.Item\n className=\"menu-item\"\n onClick={() => {\n setInstanceRole(principal.instanceRole === 'owner' ? 'owner' : 'user');\n setEditing(true);\n }}\n >\n <Pencil size={14} />\n Change role\n </Menu.Item>\n <Menu.Separator className=\"menu-sep\" />\n </>\n )}\n <Menu.Item\n className=\"menu-item menu-item-danger\"\n onClick={() => setConfirming(true)}\n >\n <X size={14} />\n Remove {kind}…\n </Menu.Item>\n </MenuPopup>\n </Menu.Root>\n\n {principal.principalType === 'user' && (\n <Modal\n open={editing}\n onOpenChange={setEditing}\n title={\n <>\n Role of <span className=\"mono\">{principal.principalId}</span>\n </>\n }\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n // Shown in the list at once; the row says if the server refuses.\n setRole({ principalId: principal.principalId, owner: instanceRole === 'owner' });\n setEditing(false);\n }}\n >\n <RoleField value={instanceRole} onChange={setInstanceRole} />\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => setEditing(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\">\n Save\n </button>\n </div>\n </form>\n </Modal>\n )}\n\n <ConfirmDialog\n open={confirming}\n onOpenChange={setConfirming}\n title={\n <>\n Remove <span className=\"mono\">{principal.principalId}</span>?\n </>\n }\n body={\n principal.principalType === 'user' ? (\n <>\n They are signed out everywhere, and their CLI logins, linked sign-in accounts and\n project permissions are revoked at once. Their past actions stay in the audit log,\n and their page then lists the values they saw, to rotate.\n </>\n ) : (\n <>\n Every token issued to it stops working and its project permissions are revoked at\n once, including for anything running with it right now. Its past actions stay in\n the audit log, and its page then lists the values it read, to rotate.\n </>\n )\n }\n confirmLabel={`Remove ${kind}`}\n onConfirm={() => remove(principal)}\n />\n </>\n );\n}\n\nexport function AddPrincipal({ principalType }: { principalType: PrincipalType }) {\n const [open, setOpen] = useState(false);\n const [principalId, setPrincipalId] = useState('');\n const [instanceRole, setInstanceRole] = useState<'user' | 'owner'>('user');\n const add = useChange(invite(useCoffre()));\n const kind = KIND[principalType];\n\n function close() {\n setOpen(false);\n setPrincipalId('');\n setInstanceRole('user');\n }\n\n return (\n <>\n <button className=\"btn btn-primary\" onClick={() => setOpen(true)}>\n <Plus size={14} />\n Add {kind}\n </button>\n\n <Modal\n open={open}\n onOpenChange={(next) => (next ? setOpen(true) : close())}\n title={`Add a ${kind}`}\n description={`This lets the ${kind} through the door and nothing more. Grant project access from its page or from each project's.`}\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n // Shown in the list at once; the list says if the server refuses.\n add({ principalType, principalId: principalId.trim(), owner: instanceRole === 'owner' });\n close();\n }}\n >\n <label className=\"field\">\n <span className=\"label\">\n {principalType === 'user' ? 'Cloudflare Access email' : 'Service token common name'}\n </span>\n <input\n className=\"input input-mono\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n value={principalId}\n placeholder={\n principalType === 'user' ? 'someone@acme.example' : 'ci-deploy'\n }\n onChange={(event) => setPrincipalId(event.target.value)}\n />\n </label>\n\n {principalType === 'user' && (\n <RoleField value={instanceRole} onChange={setInstanceRole} />\n )}\n\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={close}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={principalId.trim() === ''}>\n Add {kind}\n </button>\n </div>\n </form>\n </Modal>\n </>\n );\n}\n\nfunction RoleField({\n value,\n onChange,\n}: {\n value: 'user' | 'owner';\n onChange: (value: 'user' | 'owner') => void;\n}) {\n return (\n <label className=\"field\">\n <span className=\"label\">Instance role</span>\n <select\n className=\"select\"\n value={value}\n onChange={(event) => onChange(event.target.value as 'user' | 'owner')}\n >\n <option value=\"user\">Member</option>\n <option value=\"owner\">Owner</option>\n </select>\n <span className=\"hint\">\n Owners manage users and tokens, can create projects, and read the whole audit log.\n Neither role reads a secret without a project grant.\n </span>\n </label>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAQA,SAAgB,gBAAgB,EAC9B,MACA,IACA,OAAO,QAKN;CAED,OACE,oBAAC,QAAD;EAAiB,WAAA,SAFQ,SAAS,YAAY,kBAAkB,KAAK,SAAS,OAAO,eAAe;EAExE,eAAA;YACzB,SAAS,YAAY,oBAAC,KAAD,EAAK,MAAM,SAAS,OAAO,KAAK,GAAK,CAAA,IAAI,GAAG,MAAM,GAAG,CAAC;CACxE,CAAA;AAEV;;;;;AAMA,SAAgB,cAAc,EAC5B,MACA,IACA,UAAU,SAKT;CACD,MAAM,YAAY,YAAY,UAAU,aAAa;CACrD,MAAM,UAAU,WAAW;CAC3B,OACE,qBAAC,QAAD;EAAM,WAAU;YAAhB,CACE,oBAAC,iBAAD;GAAuB;GAAU;EAAK,CAAA,GACrC,CAAC,QAAQ,SAAS,SAAS,iBAAiB,gBAAgB,IAC3D,oBAAC,QAAD,EAAA,UAAO,GAAS,CAAA,IACd,SAAS,SACX,oBAAC,MAAD;GAAiB;GAAW,IAAG;GAAe,QAAQ,EAAE,MAAM,GAAG;aAC9D;EACG,CAAA,IAEN,oBAAC,MAAD;GAAiB;GAAW,IAAG;GAAiB,QAAQ,EAAE,OAAO,GAAG;aACjE;EACG,CAAA,CAEJ;;AAEV;;;;AClCA,IAAa,YAAY,cACvB,UAAU,UAAU,eAAe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