@coffre/ui 0.1.18 → 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,31 +0,0 @@
|
|
|
1
|
-
import { n as createFileRoute, t as lazyRouteComponent } from "./lazyRouteComponent-CqBNCGuZ.js";
|
|
2
|
-
import { h as queries } from "./page-D6n45dcK.js";
|
|
3
|
-
//#region src/routes/audit.tsx
|
|
4
|
-
var $$splitComponentImporter = () => import("./audit-qB9G2AQJ.js");
|
|
5
|
-
var Route = createFileRoute("/audit")({
|
|
6
|
-
validateSearch: (search) => ({
|
|
7
|
-
decision: search.decision === "deny" ? "deny" : void 0,
|
|
8
|
-
actorId: typeof search.actorId === "string" && search.actorId !== "" ? search.actorId : void 0,
|
|
9
|
-
detail: search.detail === "1" || search.detail === 1 ? "1" : void 0
|
|
10
|
-
}),
|
|
11
|
-
loaderDeps: ({ search }) => search,
|
|
12
|
-
loader: ({ context: { client, queryClient }, deps }) => queryClient.fetchQuery(queries.auditEntries(client, deps)),
|
|
13
|
-
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
14
|
-
});
|
|
15
|
-
/** One action: an entry, or a batch of them under one operation, which opens to each. */
|
|
16
|
-
/** A sentence, its people and places links to their pages. */
|
|
17
|
-
/** The entry the log breaks at, said in words as well as in red. */
|
|
18
|
-
/**
|
|
19
|
-
* Whether the log still verifies, beside the title.
|
|
20
|
-
*
|
|
21
|
-
* This replaced a card with a "Verify chain" button on it. A green result you
|
|
22
|
-
* have to ask for is reassurance rather than evidence: it is checked when
|
|
23
|
-
* someone is already feeling confident, and not on the morning it would have
|
|
24
|
-
* mattered. Recomputing on load makes the claim continuous.
|
|
25
|
-
*
|
|
26
|
-
* It is not waited for, though: verifying re-reads the whole log, so until
|
|
27
|
-
* it answers the badge says it is verifying, and a check that could not run
|
|
28
|
-
* says so and offers to run again, rather than passing for a broken log.
|
|
29
|
-
*/
|
|
30
|
-
//#endregion
|
|
31
|
-
export { Route as t };
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import { i as require_react, r as require_jsx_runtime, s as __toESM } from "./useRouter-CaUSUNsw.js";
|
|
2
|
-
import { t as Link } from "./link-42ZWdjzZ.js";
|
|
3
|
-
import { i as useNavigate } from "./lazyRouteComponent-CqBNCGuZ.js";
|
|
4
|
-
import { C as useCoffre, n as ClosedDoor, x as statusOf, y as failureMessage } from "./page-D6n45dcK.js";
|
|
5
|
-
import { a as ErrorLine, c as Spinner, l as Timestamp } from "./ui-Cc0CGMtr.js";
|
|
6
|
-
import { B as Terminal, R as SlashCircle, o as CheckCircle } from "./icons-DOFT-eWB.js";
|
|
7
|
-
import { t as Route } from "./auth.device-CLoAxC2T.js";
|
|
8
|
-
//#region src/routes/auth.device.tsx?tsr-split=component
|
|
9
|
-
/**
|
|
10
|
-
* Where `coffre login` sends you: approve a terminal's sign-in with the
|
|
11
|
-
* session this browser already has. The terminal shows a code; this page
|
|
12
|
-
* shows the same code and where the request came from, and nothing happens
|
|
13
|
-
* until you press Approve.
|
|
14
|
-
*/
|
|
15
|
-
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
16
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
17
|
-
function DevicePage() {
|
|
18
|
-
const loaded = Route.useLoaderData();
|
|
19
|
-
const [decided, setDecided] = (0, import_react.useState)(null);
|
|
20
|
-
if (decided === "approved") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
|
|
21
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CheckCircle, { size: 18 }),
|
|
22
|
-
label: "coffre CLI",
|
|
23
|
-
title: "Your terminal is signed in",
|
|
24
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "You can close this tab and go back to the terminal." })
|
|
25
|
-
});
|
|
26
|
-
if (decided === "denied") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
|
|
27
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlashCircle, { size: 18 }),
|
|
28
|
-
label: "coffre CLI",
|
|
29
|
-
title: "Sign-in refused",
|
|
30
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
31
|
-
"The terminal that asked gets nothing. If you did not run ",
|
|
32
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
33
|
-
className: "mono",
|
|
34
|
-
children: "coffre login"
|
|
35
|
-
}),
|
|
36
|
-
" yourself, someone may be trying to get you to approve theirs; the refusal is in the audit log."
|
|
37
|
-
] })
|
|
38
|
-
});
|
|
39
|
-
if (loaded === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeEntry, {});
|
|
40
|
-
if (!loaded.ok) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeEntry, { error: loaded.error });
|
|
41
|
-
if (loaded.request === null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeEntry, { error: "That code is unknown, already used, or expired. Run coffre login again for a new one." });
|
|
42
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Approve, {
|
|
43
|
-
request: loaded.request,
|
|
44
|
-
sessionDays: loaded.sessionDays,
|
|
45
|
-
onDecided: setDecided
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function CodeEntry({ error = null }) {
|
|
49
|
-
const navigate = useNavigate();
|
|
50
|
-
const [code, setCode] = (0, import_react.useState)("");
|
|
51
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
52
|
-
className: "card signin",
|
|
53
|
-
"aria-labelledby": "device-title",
|
|
54
|
-
children: [
|
|
55
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
56
|
-
className: "signin-head",
|
|
57
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
58
|
-
className: "signin-title",
|
|
59
|
-
id: "device-title",
|
|
60
|
-
children: "Sign in the coffre CLI"
|
|
61
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
62
|
-
className: "signin-lede",
|
|
63
|
-
children: [
|
|
64
|
-
"Enter the code your terminal shows after ",
|
|
65
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
66
|
-
className: "mono",
|
|
67
|
-
children: "coffre login"
|
|
68
|
-
}),
|
|
69
|
-
"."
|
|
70
|
-
]
|
|
71
|
-
})]
|
|
72
|
-
}),
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
74
|
-
className: "signin-form",
|
|
75
|
-
onSubmit: (event) => {
|
|
76
|
-
event.preventDefault();
|
|
77
|
-
navigate({
|
|
78
|
-
to: "/auth/device",
|
|
79
|
-
search: { code: code.trim() }
|
|
80
|
-
});
|
|
81
|
-
},
|
|
82
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
83
|
-
className: "field",
|
|
84
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
85
|
-
className: "label",
|
|
86
|
-
children: "Code"
|
|
87
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
88
|
-
className: "input mono device-code-input",
|
|
89
|
-
name: "code",
|
|
90
|
-
autoComplete: "off",
|
|
91
|
-
autoCapitalize: "characters",
|
|
92
|
-
spellCheck: false,
|
|
93
|
-
placeholder: "XXXX-XXXX",
|
|
94
|
-
maxLength: 16,
|
|
95
|
-
value: code,
|
|
96
|
-
onChange: (event) => setCode(event.target.value)
|
|
97
|
-
})]
|
|
98
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
99
|
-
className: "btn btn-primary",
|
|
100
|
-
type: "submit",
|
|
101
|
-
style: { height: "2.125rem" },
|
|
102
|
-
disabled: code.trim() === "",
|
|
103
|
-
children: "Continue"
|
|
104
|
-
})]
|
|
105
|
-
}),
|
|
106
|
-
error !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
107
|
-
className: "signin-error",
|
|
108
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error })
|
|
109
|
-
})
|
|
110
|
-
]
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function Approve({ request, sessionDays, onDecided }) {
|
|
114
|
-
const coffre = useCoffre();
|
|
115
|
-
const [pending, setPending] = (0, import_react.useState)(null);
|
|
116
|
-
const [error, setError] = (0, import_react.useState)(null);
|
|
117
|
-
async function decide(approve) {
|
|
118
|
-
setPending(approve ? "approve" : "deny");
|
|
119
|
-
try {
|
|
120
|
-
await coffre.deviceLogins.decide(request.userCode, approve);
|
|
121
|
-
onDecided(approve ? "approved" : "denied");
|
|
122
|
-
} catch (error) {
|
|
123
|
-
setError(statusOf(error) === 404 ? "That code is unknown, already used, or expired. Run coffre login again." : statusOf(error) === void 0 ? "The decision could not be sent. Nothing was approved." : failureMessage(error));
|
|
124
|
-
} finally {
|
|
125
|
-
setPending(null);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
129
|
-
className: "card signin",
|
|
130
|
-
"aria-labelledby": "device-title",
|
|
131
|
-
children: [
|
|
132
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
133
|
-
className: "signin-head",
|
|
134
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
135
|
-
className: "signin-title",
|
|
136
|
-
id: "device-title",
|
|
137
|
-
children: "Approve this terminal?"
|
|
138
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
139
|
-
className: "signin-lede",
|
|
140
|
-
children: [
|
|
141
|
-
"Only if you just ran ",
|
|
142
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
143
|
-
className: "mono",
|
|
144
|
-
children: "coffre login"
|
|
145
|
-
}),
|
|
146
|
-
" yourself and it shows this code. It gets your access, in your name, for ",
|
|
147
|
-
sessionDays,
|
|
148
|
-
" days or until you end it from your account page."
|
|
149
|
-
]
|
|
150
|
-
})]
|
|
151
|
-
}),
|
|
152
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
153
|
-
className: "device-code",
|
|
154
|
-
"aria-label": "Code",
|
|
155
|
-
children: request.userCode
|
|
156
|
-
}),
|
|
157
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("dl", {
|
|
158
|
-
className: "facts device-facts",
|
|
159
|
-
children: [
|
|
160
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
161
|
-
className: "fact",
|
|
162
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "Client" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
163
|
-
className: "cell-account",
|
|
164
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Terminal, { size: 14 }), request.clientLabel ?? "coffre CLI"]
|
|
165
|
-
}) })]
|
|
166
|
-
}),
|
|
167
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
168
|
-
className: "fact",
|
|
169
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "Requested from" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", {
|
|
170
|
-
className: "mono",
|
|
171
|
-
children: request.clientIp ?? "an unknown address"
|
|
172
|
-
})]
|
|
173
|
-
}),
|
|
174
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
175
|
-
className: "fact",
|
|
176
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("dt", { children: "Requested (UTC)" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, { iso: request.createdAt }) })]
|
|
177
|
-
})
|
|
178
|
-
]
|
|
179
|
-
}),
|
|
180
|
-
error !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
181
|
-
className: "signin-error",
|
|
182
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error })
|
|
183
|
-
}),
|
|
184
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
185
|
-
className: "device-actions",
|
|
186
|
-
children: [
|
|
187
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
188
|
-
className: "btn btn-quiet",
|
|
189
|
-
to: "/projects",
|
|
190
|
-
children: "Cancel"
|
|
191
|
-
}),
|
|
192
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
193
|
-
className: "btn",
|
|
194
|
-
disabled: pending !== null,
|
|
195
|
-
onClick: () => void decide(false),
|
|
196
|
-
children: [pending === "deny" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), "Deny"]
|
|
197
|
-
}),
|
|
198
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
199
|
-
className: "btn btn-primary",
|
|
200
|
-
disabled: pending !== null,
|
|
201
|
-
onClick: () => void decide(true),
|
|
202
|
-
children: [pending === "approve" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), "Approve"]
|
|
203
|
-
})
|
|
204
|
-
]
|
|
205
|
-
})
|
|
206
|
-
]
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
//#endregion
|
|
210
|
-
export { DevicePage as component };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { n as createFileRoute, t as lazyRouteComponent } from "./lazyRouteComponent-CqBNCGuZ.js";
|
|
2
|
-
import { S as uiResult, f as loadShell } from "./page-D6n45dcK.js";
|
|
3
|
-
//#region src/routes/auth.device.tsx
|
|
4
|
-
var $$splitComponentImporter = () => import("./auth.device-6JRrWbSV.js");
|
|
5
|
-
/**
|
|
6
|
-
* Where `coffre login` sends you: approve a terminal's sign-in with the
|
|
7
|
-
* session this browser already has. The terminal shows a code; this page
|
|
8
|
-
* shows the same code and where the request came from, and nothing happens
|
|
9
|
-
* until you press Approve.
|
|
10
|
-
*/
|
|
11
|
-
var Route = createFileRoute("/auth/device")({
|
|
12
|
-
validateSearch: (search) => {
|
|
13
|
-
const code = search.code;
|
|
14
|
-
return typeof code === "string" && code.length <= 16 ? { code } : {};
|
|
15
|
-
},
|
|
16
|
-
loaderDeps: ({ search }) => ({ code: search.code }),
|
|
17
|
-
loader: async ({ context: { client, queryClient }, deps }) => {
|
|
18
|
-
if (deps.code === void 0) return null;
|
|
19
|
-
if (!(await loadShell(queryClient, client)).auth.signin) return {
|
|
20
|
-
ok: false,
|
|
21
|
-
error: "This instance has no CLI sign-in."
|
|
22
|
-
};
|
|
23
|
-
const code = deps.code;
|
|
24
|
-
return uiResult(() => client.deviceLogins.get(code));
|
|
25
|
-
},
|
|
26
|
-
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
27
|
-
});
|
|
28
|
-
//#endregion
|
|
29
|
-
export { Route as t };
|
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
import { i as require_react, r as require_jsx_runtime, s as __toESM } from "./useRouter-CaUSUNsw.js";
|
|
2
|
-
import { t as Link } from "./link-42ZWdjzZ.js";
|
|
3
|
-
import { C as useCoffre, b as memberRef } from "./page-D6n45dcK.js";
|
|
4
|
-
import { _ as removeMember, l as directoryList, m as invite, n as useChangeStatus, o as changeRole, t as useChange } from "./use-change-C8BCf3oU.js";
|
|
5
|
-
import { c as Spinner, d as Toggletip, h as dropdown_menu_exports, i as EmptyState, n as ConfirmDialog, o as Modal } from "./ui-Cc0CGMtr.js";
|
|
6
|
-
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-DOFT-eWB.js";
|
|
7
|
-
import { a as rowClass, i as RowPending, r as RowFailure } from "./row-state-C2P57xT1.js";
|
|
8
|
-
//#region src/components/principal.tsx
|
|
9
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
10
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
11
|
-
/** A person's initial, or a key for a machine. */
|
|
12
|
-
function PrincipalAvatar({ type, id, size = "sm" }) {
|
|
13
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
14
|
-
className: `avatar${type === "service" ? " avatar-token" : ""}${size === "lg" ? " avatar-lg" : ""}`,
|
|
15
|
-
"aria-hidden": true,
|
|
16
|
-
children: type === "service" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: size === "lg" ? 18 : 13 }) : id.slice(0, 1)
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A user or token, linking to its own page. `stretch` makes the link cover
|
|
21
|
-
* the whole table row it sits in.
|
|
22
|
-
*/
|
|
23
|
-
function PrincipalLink({ type, id, stretch = false }) {
|
|
24
|
-
const className = `cell-link${stretch ? " stretch" : ""}`;
|
|
25
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
26
|
-
className: "cell-principal",
|
|
27
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrincipalAvatar, {
|
|
28
|
-
type,
|
|
29
|
-
id
|
|
30
|
-
}), type === "user" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
31
|
-
className,
|
|
32
|
-
to: "/users/$user",
|
|
33
|
-
params: { user: id },
|
|
34
|
-
children: id
|
|
35
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
36
|
-
className,
|
|
37
|
-
to: "/tokens/$token",
|
|
38
|
-
params: { token: id },
|
|
39
|
-
children: id
|
|
40
|
-
})]
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/components/directory.tsx
|
|
45
|
-
/** How the directory, and its changes, name someone: `user:…`, `token:…`. */
|
|
46
|
-
var memberOf = (principal) => memberRef(principal.principalType, principal.principalId);
|
|
47
|
-
var ROLE_LABEL = {
|
|
48
|
-
"root-admin": "Root admin",
|
|
49
|
-
owner: "Owner",
|
|
50
|
-
user: "Member"
|
|
51
|
-
};
|
|
52
|
-
/** What each kind of principal is called in the interface. */
|
|
53
|
-
var KIND = {
|
|
54
|
-
user: "user",
|
|
55
|
-
service: "token"
|
|
56
|
-
};
|
|
57
|
-
function DirectoryTable({ principalType, principals, hasRemoved = false }) {
|
|
58
|
-
const users = principalType === "user";
|
|
59
|
-
const columns = users ? 4 : 3;
|
|
60
|
-
const { status, failedAdds, dismiss } = useChangeStatus(directoryList.queryKey);
|
|
61
|
-
const refused = failedAdds(principals.map(memberOf)).filter(({ vars }) => vars.principalType === principalType);
|
|
62
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {
|
|
63
|
-
className: "card",
|
|
64
|
-
"aria-label": users ? "Users" : "Tokens",
|
|
65
|
-
children: principals.length === 0 && refused.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyState, {
|
|
66
|
-
title: hasRemoved ? `No active ${KIND[principalType]}s` : users ? "Nobody is registered" : "No tokens yet",
|
|
67
|
-
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."]
|
|
68
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
69
|
-
className: "dt-wrap",
|
|
70
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
71
|
-
className: `dt directory directory-${principalType} stacks`,
|
|
72
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
74
|
-
className: "n",
|
|
75
|
-
children: "#"
|
|
76
|
-
}),
|
|
77
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
78
|
-
className: "col-principal",
|
|
79
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
80
|
-
className: "th",
|
|
81
|
-
children: [users ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(User, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 14 }), users ? "Email" : "Name"]
|
|
82
|
-
})
|
|
83
|
-
}),
|
|
84
|
-
users && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
85
|
-
className: "col-role",
|
|
86
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
87
|
-
className: "th",
|
|
88
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShieldCheck, { size: 14 }), "Instance role"]
|
|
89
|
-
})
|
|
90
|
-
}),
|
|
91
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
92
|
-
className: "col-actions",
|
|
93
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
94
|
-
className: "visually-hidden",
|
|
95
|
-
children: "Actions"
|
|
96
|
-
})
|
|
97
|
-
})
|
|
98
|
-
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", { children: [principals.map((principal, index) => {
|
|
99
|
-
const state = status(memberOf(principal));
|
|
100
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
|
|
101
|
-
className: `row-link ${rowClass(state)}`,
|
|
102
|
-
children: [
|
|
103
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
104
|
-
className: "n",
|
|
105
|
-
children: index + 1
|
|
106
|
-
}),
|
|
107
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
108
|
-
className: "col-lead",
|
|
109
|
-
"data-label": principal.principalType === "user" ? "Email" : "Name",
|
|
110
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrincipalLink, {
|
|
111
|
-
type: principal.principalType,
|
|
112
|
-
id: principal.principalId,
|
|
113
|
-
stretch: true
|
|
114
|
-
})
|
|
115
|
-
}),
|
|
116
|
-
users && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
117
|
-
className: "col-role",
|
|
118
|
-
"data-label": "Instance role",
|
|
119
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(InstanceRole, { principal })
|
|
120
|
-
}),
|
|
121
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
122
|
-
className: "col-actions",
|
|
123
|
-
children: state.state === "pending" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowPending, { status: state }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrincipalActions, { principal })
|
|
124
|
-
})
|
|
125
|
-
]
|
|
126
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowFailure, {
|
|
127
|
-
status: state,
|
|
128
|
-
columns,
|
|
129
|
-
onDismiss: () => state.state === "failed" && dismiss(state.mutationId)
|
|
130
|
-
})] }, principal.principalId);
|
|
131
|
-
}), refused.map(({ mutationId, vars, status: failed }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(RowFailure, {
|
|
132
|
-
status: failed,
|
|
133
|
-
columns,
|
|
134
|
-
onDismiss: () => dismiss(mutationId),
|
|
135
|
-
children: [vars.principalId, " was not added."]
|
|
136
|
-
}, mutationId))] })]
|
|
137
|
-
})
|
|
138
|
-
})
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* A user's instance role. Tokens have none worth showing: every one is a
|
|
143
|
-
* plain member. A root admin's role comes from the deployment, so its tag says
|
|
144
|
-
* so on hover or tap instead of offering a menu that could not work.
|
|
145
|
-
*/
|
|
146
|
-
function InstanceRole({ principal }) {
|
|
147
|
-
if (principal.tampered === true) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggletip, {
|
|
148
|
-
label: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "Their record was changed outside coffre, so the vault refuses them everything. Remove them to start them over, then add them again." }),
|
|
149
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
150
|
-
type: "button",
|
|
151
|
-
className: "tag tag-red tag-button",
|
|
152
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lock, { size: 11 }), "Integrity check failed"]
|
|
153
|
-
})
|
|
154
|
-
});
|
|
155
|
-
if (principal.isRootAdmin) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggletip, {
|
|
156
|
-
label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
157
|
-
"Set by ",
|
|
158
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: "rootAdmins" }),
|
|
159
|
-
" in the vault's configuration, so it cannot be changed or removed here."
|
|
160
|
-
] }),
|
|
161
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
162
|
-
type: "button",
|
|
163
|
-
className: "tag tag-violet tag-button",
|
|
164
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lock, { size: 11 }), "Root admin"]
|
|
165
|
-
})
|
|
166
|
-
});
|
|
167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
168
|
-
className: `tag${principal.instanceRole === "user" ? "" : " tag-violet"}`,
|
|
169
|
-
children: ROLE_LABEL[principal.instanceRole]
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Change role and Remove, behind one menu. Root admins get none: the
|
|
174
|
-
* deployment's configuration owns them.
|
|
175
|
-
*/
|
|
176
|
-
function PrincipalActions({ principal, trigger = "act act-quiet act-menu" }) {
|
|
177
|
-
const [editing, setEditing] = (0, import_react.useState)(false);
|
|
178
|
-
const [confirming, setConfirming] = (0, import_react.useState)(false);
|
|
179
|
-
const [instanceRole, setInstanceRole] = (0, import_react.useState)(principal.instanceRole === "owner" ? "owner" : "user");
|
|
180
|
-
const coffre = useCoffre();
|
|
181
|
-
const setRole = useChange(changeRole(coffre));
|
|
182
|
-
const remove = useChange(removeMember(coffre));
|
|
183
|
-
const { status } = useChangeStatus(directoryList.queryKey);
|
|
184
|
-
const pending = status(memberOf(principal)).state === "pending";
|
|
185
|
-
const kind = KIND[principal.principalType];
|
|
186
|
-
if (principal.isRootAdmin) return null;
|
|
187
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
188
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Root, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Trigger, {
|
|
189
|
-
asChild: true,
|
|
190
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
191
|
-
className: trigger,
|
|
192
|
-
"aria-label": `Actions for ${principal.principalId}`,
|
|
193
|
-
disabled: pending,
|
|
194
|
-
children: pending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: 13 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MoreHorizontal, { size: 16 })
|
|
195
|
-
})
|
|
196
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
|
|
197
|
-
className: "menu",
|
|
198
|
-
sideOffset: 6,
|
|
199
|
-
align: "end",
|
|
200
|
-
children: [principal.principalType === "user" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
|
|
201
|
-
className: "menu-item",
|
|
202
|
-
onSelect: () => {
|
|
203
|
-
setInstanceRole(principal.instanceRole === "owner" ? "owner" : "user");
|
|
204
|
-
setEditing(true);
|
|
205
|
-
},
|
|
206
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Pencil, { size: 14 }), "Change role"]
|
|
207
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Separator, { className: "menu-sep" })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Item, {
|
|
208
|
-
className: "menu-item menu-item-danger",
|
|
209
|
-
onSelect: () => setConfirming(true),
|
|
210
|
-
children: [
|
|
211
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 14 }),
|
|
212
|
-
"Remove ",
|
|
213
|
-
kind,
|
|
214
|
-
"…"
|
|
215
|
-
]
|
|
216
|
-
})]
|
|
217
|
-
}) })] }),
|
|
218
|
-
principal.principalType === "user" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, {
|
|
219
|
-
open: editing,
|
|
220
|
-
onOpenChange: setEditing,
|
|
221
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["Role of ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
222
|
-
className: "mono",
|
|
223
|
-
children: principal.principalId
|
|
224
|
-
})] }),
|
|
225
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
226
|
-
className: "form",
|
|
227
|
-
onSubmit: (event) => {
|
|
228
|
-
event.preventDefault();
|
|
229
|
-
setRole({
|
|
230
|
-
principalId: principal.principalId,
|
|
231
|
-
owner: instanceRole === "owner"
|
|
232
|
-
});
|
|
233
|
-
setEditing(false);
|
|
234
|
-
},
|
|
235
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoleField, {
|
|
236
|
-
value: instanceRole,
|
|
237
|
-
onChange: setInstanceRole
|
|
238
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
239
|
-
className: "dialog-actions",
|
|
240
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
241
|
-
className: "btn",
|
|
242
|
-
type: "button",
|
|
243
|
-
onClick: () => setEditing(false),
|
|
244
|
-
children: "Cancel"
|
|
245
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
246
|
-
className: "btn btn-primary",
|
|
247
|
-
type: "submit",
|
|
248
|
-
children: "Save"
|
|
249
|
-
})]
|
|
250
|
-
})]
|
|
251
|
-
})
|
|
252
|
-
}),
|
|
253
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmDialog, {
|
|
254
|
-
open: confirming,
|
|
255
|
-
onOpenChange: setConfirming,
|
|
256
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
257
|
-
"Remove ",
|
|
258
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
259
|
-
className: "mono",
|
|
260
|
-
children: principal.principalId
|
|
261
|
-
}),
|
|
262
|
-
"?"
|
|
263
|
-
] }),
|
|
264
|
-
body: principal.principalType === "user" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { 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__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { 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." }),
|
|
265
|
-
confirmLabel: `Remove ${kind}`,
|
|
266
|
-
onConfirm: () => remove(principal)
|
|
267
|
-
})
|
|
268
|
-
] });
|
|
269
|
-
}
|
|
270
|
-
function AddPrincipal({ principalType }) {
|
|
271
|
-
const [open, setOpen] = (0, import_react.useState)(false);
|
|
272
|
-
const [principalId, setPrincipalId] = (0, import_react.useState)("");
|
|
273
|
-
const [instanceRole, setInstanceRole] = (0, import_react.useState)("user");
|
|
274
|
-
const add = useChange(invite(useCoffre()));
|
|
275
|
-
const kind = KIND[principalType];
|
|
276
|
-
function close() {
|
|
277
|
-
setOpen(false);
|
|
278
|
-
setPrincipalId("");
|
|
279
|
-
setInstanceRole("user");
|
|
280
|
-
}
|
|
281
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
282
|
-
className: "btn btn-primary",
|
|
283
|
-
onClick: () => setOpen(true),
|
|
284
|
-
children: [
|
|
285
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { size: 14 }),
|
|
286
|
-
"Add ",
|
|
287
|
-
kind
|
|
288
|
-
]
|
|
289
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, {
|
|
290
|
-
open,
|
|
291
|
-
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
292
|
-
title: `Add a ${kind}`,
|
|
293
|
-
description: `This lets the ${kind} through the door and nothing more. Grant project access from its page or from each project's.`,
|
|
294
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
295
|
-
className: "form",
|
|
296
|
-
onSubmit: (event) => {
|
|
297
|
-
event.preventDefault();
|
|
298
|
-
add({
|
|
299
|
-
principalType,
|
|
300
|
-
principalId: principalId.trim(),
|
|
301
|
-
owner: instanceRole === "owner"
|
|
302
|
-
});
|
|
303
|
-
close();
|
|
304
|
-
},
|
|
305
|
-
children: [
|
|
306
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
307
|
-
className: "field",
|
|
308
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
309
|
-
className: "label",
|
|
310
|
-
children: principalType === "user" ? "Cloudflare Access email" : "Service token common name"
|
|
311
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
312
|
-
className: "input input-mono",
|
|
313
|
-
autoFocus: true,
|
|
314
|
-
spellCheck: false,
|
|
315
|
-
autoComplete: "off",
|
|
316
|
-
value: principalId,
|
|
317
|
-
placeholder: principalType === "user" ? "someone@acme.example" : "ci-deploy",
|
|
318
|
-
onChange: (event) => setPrincipalId(event.target.value)
|
|
319
|
-
})]
|
|
320
|
-
}),
|
|
321
|
-
principalType === "user" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RoleField, {
|
|
322
|
-
value: instanceRole,
|
|
323
|
-
onChange: setInstanceRole
|
|
324
|
-
}),
|
|
325
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
326
|
-
className: "dialog-actions",
|
|
327
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
328
|
-
className: "btn",
|
|
329
|
-
type: "button",
|
|
330
|
-
onClick: close,
|
|
331
|
-
children: "Cancel"
|
|
332
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
333
|
-
className: "btn btn-primary",
|
|
334
|
-
type: "submit",
|
|
335
|
-
disabled: principalId.trim() === "",
|
|
336
|
-
children: ["Add ", kind]
|
|
337
|
-
})]
|
|
338
|
-
})
|
|
339
|
-
]
|
|
340
|
-
})
|
|
341
|
-
})] });
|
|
342
|
-
}
|
|
343
|
-
function RoleField({ value, onChange }) {
|
|
344
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
345
|
-
className: "field",
|
|
346
|
-
children: [
|
|
347
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
348
|
-
className: "label",
|
|
349
|
-
children: "Instance role"
|
|
350
|
-
}),
|
|
351
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", {
|
|
352
|
-
className: "select",
|
|
353
|
-
value,
|
|
354
|
-
onChange: (event) => onChange(event.target.value),
|
|
355
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
356
|
-
value: "user",
|
|
357
|
-
children: "Member"
|
|
358
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
359
|
-
value: "owner",
|
|
360
|
-
children: "Owner"
|
|
361
|
-
})]
|
|
362
|
-
}),
|
|
363
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
364
|
-
className: "hint",
|
|
365
|
-
children: "Owners manage users and tokens, can create projects, and read the whole audit log. Neither role reads a secret without a project grant."
|
|
366
|
-
})
|
|
367
|
-
]
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
//#endregion
|
|
371
|
-
export { PrincipalActions as a, KIND as i, DirectoryTable as n, PrincipalAvatar as o, InstanceRole as r, PrincipalLink as s, AddPrincipal as t };
|