@coffre/ui 0.1.17 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -3
- package/dist/{server/_coffre/assets/affordances-CKANXDTG.js → chunks/affordances-DAvsVz7u.js} +12 -7
- package/dist/chunks/affordances-DAvsVz7u.js.map +1 -0
- package/dist/chunks/directory-CSjWWUQ1.js +370 -0
- package/dist/chunks/directory-CSjWWUQ1.js.map +1 -0
- package/dist/{server/_coffre/assets/grants-DdKT11Ny.js → chunks/grants-saMQagmG.js} +41 -39
- package/dist/chunks/grants-saMQagmG.js.map +1 -0
- package/dist/chunks/icons-D-PfAfnH.js +203 -0
- package/dist/chunks/icons-D-PfAfnH.js.map +1 -0
- package/dist/chunks/mounted-jJmqqV_n.js +17 -0
- package/dist/chunks/mounted-jJmqqV_n.js.map +1 -0
- package/dist/{server/_coffre/assets/offboarding-CRz-K82H.js → chunks/offboarding-C6l30DZR.js} +70 -69
- package/dist/chunks/offboarding-C6l30DZR.js.map +1 -0
- package/dist/chunks/page-C5HcNqf2.js +190 -0
- package/dist/chunks/page-C5HcNqf2.js.map +1 -0
- package/dist/chunks/page-route-Drfw7lmn.js +20 -0
- package/dist/chunks/page-route-Drfw7lmn.js.map +1 -0
- package/dist/{server/_coffre/assets/principal-page-C-EFwJQw.js → chunks/principal-page-D_91OA0l.js} +105 -103
- package/dist/chunks/principal-page-D_91OA0l.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/project-environments-lEzFHUt4.js +2 -0
- package/dist/chunks/project-environments-lEzFHUt4.js.map +1 -0
- package/dist/chunks/queries-CQ81o4so.js +376 -0
- package/dist/chunks/queries-CQ81o4so.js.map +1 -0
- package/dist/{server/_coffre/assets/row-state-C2P57xT1.js → chunks/row-state-0PsrEzOL.js} +22 -21
- package/dist/chunks/row-state-0PsrEzOL.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/signin-errors-BEFlVDbQ.js +2 -0
- package/dist/chunks/signin-errors-BEFlVDbQ.js.map +1 -0
- package/dist/chunks/theme-B2vQolVR.js +86 -0
- package/dist/chunks/theme-B2vQolVR.js.map +1 -0
- package/dist/chunks/ui-DixXLQvQ.js +405 -0
- package/dist/chunks/ui-DixXLQvQ.js.map +1 -0
- package/dist/{server/_coffre/assets/use-action-B-xpvVRO.js → chunks/use-action-CWsg_YWU.js} +8 -6
- package/dist/chunks/use-action-CWsg_YWU.js.map +1 -0
- package/dist/{server/_coffre/assets/use-change-C8BCf3oU.js → chunks/use-change-c6CeLRin.js} +10 -474
- package/dist/chunks/use-change-c6CeLRin.js.map +1 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js +26 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/validation-BQtqPe2V.js +2 -0
- package/dist/chunks/validation-BQtqPe2V.js.map +1 -0
- package/dist/index.d.ts +386 -18
- package/dist/index.js +1147 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/account.d.ts +9 -0
- package/dist/pages/account.js +334 -0
- package/dist/pages/account.js.map +1 -0
- package/dist/pages/audit.d.ts +3 -0
- package/dist/{server/_coffre/assets/audit-qB9G2AQJ.js → pages/audit.js} +102 -100
- package/dist/pages/audit.js.map +1 -0
- package/dist/pages/device-login.d.ts +9 -0
- package/dist/pages/device-login.js +211 -0
- package/dist/pages/device-login.js.map +1 -0
- package/dist/pages/environment.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects._project._environment-C6uybzeU.js → pages/environment.js} +323 -469
- package/dist/pages/environment.js.map +1 -0
- package/dist/pages/login.d.ts +10 -0
- package/dist/pages/login.js +104 -0
- package/dist/pages/login.js.map +1 -0
- package/dist/pages/project.d.ts +2 -0
- package/dist/{server/_coffre/assets/projects._project.index-3CXwkyTh.js → pages/project.js} +223 -225
- package/dist/pages/project.js.map +1 -0
- package/dist/pages/projects.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects.index-iSoBpRFz.js → pages/projects.js} +83 -81
- package/dist/pages/projects.js.map +1 -0
- package/dist/pages/settings.d.ts +3 -0
- package/dist/{server/_coffre/assets/settings-BDQTF5XW.js → pages/settings.js} +20 -18
- package/dist/pages/settings.js.map +1 -0
- package/dist/pages/token.d.ts +3 -0
- package/dist/{server/_coffre/assets/tokens._token-CrBMpcbN.js → pages/token.js} +195 -265
- package/dist/pages/token.js.map +1 -0
- package/dist/pages/tokens.d.ts +3 -0
- package/dist/pages/tokens.js +39 -0
- package/dist/pages/tokens.js.map +1 -0
- package/dist/pages/unregistered.d.ts +8 -0
- package/dist/pages/unregistered.js +54 -0
- package/dist/pages/unregistered.js.map +1 -0
- package/dist/pages/user.d.ts +3 -0
- package/dist/pages/user.js +16 -0
- package/dist/pages/user.js.map +1 -0
- package/dist/pages/users.d.ts +3 -0
- package/dist/pages/users.js +39 -0
- package/dist/pages/users.js.map +1 -0
- package/dist/project-BqIy8gYR.d.ts +5 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.js +52 -0
- package/package.json +36 -21
- package/src/assets/icon.svg +1 -0
- package/src/components/affordances.ts +10 -4
- package/src/components/command-palette.tsx +229 -203
- package/src/components/directory.tsx +34 -38
- package/src/components/principal.tsx +7 -3
- package/src/components/shell.tsx +89 -127
- package/src/components/theme.tsx +14 -81
- package/src/components/ui.tsx +97 -68
- package/src/index.ts +29 -0
- package/src/layout.tsx +113 -0
- package/src/lib/coffre.ts +8 -4
- package/src/lib/mounted.ts +13 -0
- package/src/lib/page-context.ts +31 -0
- package/src/lib/page-route.ts +22 -0
- package/src/lib/preferences.tsx +46 -0
- package/src/options.ts +240 -0
- package/src/{routes → pages}/account.tsx +7 -24
- package/src/{routes → pages}/audit.tsx +5 -16
- package/src/{routes/auth.device.tsx → pages/device-login.tsx} +8 -21
- package/src/{routes/projects.$project.$environment.tsx → pages/environment.tsx} +43 -52
- package/src/{routes → pages}/login.tsx +5 -16
- package/src/{routes/projects.$project.index.tsx → pages/project.tsx} +38 -50
- package/src/{routes/projects.index.tsx → pages/projects.tsx} +2 -7
- package/src/{routes → pages}/settings.tsx +3 -10
- package/src/{routes/tokens.$token.tsx → pages/token.tsx} +6 -7
- package/src/{routes/tokens.index.tsx → pages/tokens.tsx} +3 -8
- package/src/{routes → pages}/unregistered.tsx +1 -6
- package/src/pages/user.tsx +10 -0
- package/src/{routes/users.index.tsx → pages/users.tsx} +3 -8
- package/src/register.ts +55 -0
- package/src/router.tsx +31 -62
- package/src/styles/globals.css +104 -46
- package/src/vite.ts +78 -0
- package/dist/client/.assetsignore +0 -2
- package/dist/client/_coffre/assets/account-BoLGAxbD.js +0 -2
- package/dist/client/_coffre/assets/account-CnnuRTDB.js +0 -1
- package/dist/client/_coffre/assets/affordances-CEafRJcN.js +0 -1
- package/dist/client/_coffre/assets/audit-CHSvKLWX.js +0 -1
- package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +0 -2
- package/dist/client/_coffre/assets/auth.device-Co5vrpaA.js +0 -2
- package/dist/client/_coffre/assets/auth.device-DAlqWacc.js +0 -1
- package/dist/client/_coffre/assets/directory-H8Eh3MnS.js +0 -1
- package/dist/client/_coffre/assets/dist-Braunv_x.js +0 -1
- package/dist/client/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/client/_coffre/assets/grants-DPDxJXU1.js +0 -1
- package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +0 -1
- package/dist/client/_coffre/assets/index-sUCIXRgJ.js +0 -12
- package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/client/_coffre/assets/link-DBINMwm6.js +0 -1
- package/dist/client/_coffre/assets/login-BZFYfL1Y.js +0 -1
- package/dist/client/_coffre/assets/login-CYCKWTOD.js +0 -2
- package/dist/client/_coffre/assets/offboarding-Bwpftp3g.js +0 -1
- package/dist/client/_coffre/assets/page-C_hnzdaR.js +0 -1
- package/dist/client/_coffre/assets/preload-helper-CLkO85Nq.js +0 -1
- package/dist/client/_coffre/assets/principal-page-DLho8TSJ.js +0 -1
- package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +0 -3
- package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-DGl921dP.js +0 -1
- package/dist/client/_coffre/assets/projects.index-BDn7Bhoo.js +0 -1
- package/dist/client/_coffre/assets/row-state-DJ-KLamZ.js +0 -1
- package/dist/client/_coffre/assets/settings-q9G1QvR_.js +0 -1
- package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +0 -1
- package/dist/client/_coffre/assets/suspense-O8sP0mEC.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-CcXSZnAG.js +0 -1
- package/dist/client/_coffre/assets/ui-BXP2IqrW.js +0 -46
- package/dist/client/_coffre/assets/unregistered-D2JXJ90x.js +0 -1
- package/dist/client/_coffre/assets/use-action-BpzKWhgg.js +0 -1
- package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +0 -1
- package/dist/client/_coffre/assets/use-shell-W0SusPkz.js +0 -1
- package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +0 -1
- package/dist/client/_coffre/assets/useSuspenseQuery-BZ-nzHST.js +0 -1
- package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +0 -1
- package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +0 -2
- package/dist/client/_coffre/assets/users.index-BvzP3qwW.js +0 -1
- package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +0 -1
- package/dist/server/.vite/manifest.json +0 -668
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +0 -162
- package/dist/server/_coffre/assets/account-CV-a2IU2.js +0 -329
- package/dist/server/_coffre/assets/account-hk6wcIXU.js +0 -162
- package/dist/server/_coffre/assets/async-local-storage-C10uQtMM.js +0 -3108
- package/dist/server/_coffre/assets/audit-C1_Ej6YB.js +0 -31
- package/dist/server/_coffre/assets/auth.device-6JRrWbSV.js +0 -210
- package/dist/server/_coffre/assets/auth.device-CLoAxC2T.js +0 -29
- package/dist/server/_coffre/assets/directory-B-_rqsPx.js +0 -371
- package/dist/server/_coffre/assets/dist-CnnV3t2g.js +0 -908
- package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +0 -5
- package/dist/server/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/server/_coffre/assets/icons-DOFT-eWB.js +0 -1704
- package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +0 -480
- package/dist/server/_coffre/assets/link-42ZWdjzZ.js +0 -422
- package/dist/server/_coffre/assets/login-DRKUKkaW.js +0 -22
- package/dist/server/_coffre/assets/login-DnwxVl4Y.js +0 -102
- package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +0 -56
- package/dist/server/_coffre/assets/page-D6n45dcK.js +0 -3561
- package/dist/server/_coffre/assets/projects._project._environment-CS8DdSMY.js +0 -48
- package/dist/server/_coffre/assets/projects._project.index-BGfcNpj0.js +0 -23
- package/dist/server/_coffre/assets/react-dom-bBoJXlK2.js +0 -1718
- package/dist/server/_coffre/assets/router-9BTgJhWG.js +0 -2322
- package/dist/server/_coffre/assets/start-DR3rN0St.js +0 -4
- package/dist/server/_coffre/assets/suspense-C-2QfDd2.js +0 -602
- package/dist/server/_coffre/assets/tokens._token-rY86Cjgp.js +0 -10
- package/dist/server/_coffre/assets/tokens.index-Bq5qDW9q.js +0 -37
- package/dist/server/_coffre/assets/ui-Cc0CGMtr.js +0 -14881
- package/dist/server/_coffre/assets/unregistered-D9ZKLOPJ.js +0 -53
- package/dist/server/_coffre/assets/use-shell-DwOzEi87.js +0 -462
- package/dist/server/_coffre/assets/useQuery-CTe86qFq.js +0 -8
- package/dist/server/_coffre/assets/useRouter-CaUSUNsw.js +0 -473
- package/dist/server/_coffre/assets/useSuspenseQuery-CSoHzrMb.js +0 -117
- package/dist/server/_coffre/assets/users._user-BmLKYeo_.js +0 -10
- package/dist/server/_coffre/assets/users._user-BmiHwQx3.js +0 -14
- package/dist/server/_coffre/assets/users.index-BiEax90r.js +0 -37
- package/dist/server/index.js +0 -13911
- package/src/assets/favicon-32.png +0 -0
- package/src/components/agentation.tsx +0 -34
- package/src/entry.ts +0 -19
- package/src/routeTree.gen.ts +0 -367
- package/src/routes/__root.tsx +0 -169
- package/src/routes/access.tsx +0 -11
- package/src/routes/index.tsx +0 -15
- package/src/routes/users.$user.tsx +0 -13
- package/src/types.ts +0 -21
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
import { n as
|
|
9
|
-
import {
|
|
10
|
-
import { t as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
1
|
+
import { t as hasEnvironmentDetails } from "../chunks/project-environments-lEzFHUt4.js";
|
|
2
|
+
import { a as ErrorLine, c as Notice, i as EmptyState, l as Spinner, n as ConfirmDialog, o as MenuPopup, s as Modal } from "../chunks/ui-DixXLQvQ.js";
|
|
3
|
+
import { A as Pencil, F as Settings, H as User, N as RotateBack, O as MoreHorizontal, P as Search, W as Users, a as Check, i as Archive, j as Plus, p as Folder, v as Key, y as Layers } from "../chunks/icons-D-PfAfnH.js";
|
|
4
|
+
import { i as PageHeader, n as ClosedDoor, t as Card, u as useCoffre } from "../chunks/page-C5HcNqf2.js";
|
|
5
|
+
import { a as rowClass, i as RowPending, t as ItemFailure } from "../chunks/row-state-0PsrEzOL.js";
|
|
6
|
+
import { l as projectOf, r as keys, t as affects, u as queries } from "../chunks/queries-CQ81o4so.js";
|
|
7
|
+
import { t as useShell } from "../chunks/use-shell-jxd7Tzd-.js";
|
|
8
|
+
import { D as projectAccessLabel, E as parseProjectAccess, O as projectAccessOptions, d as environmentId, f as grantAccess, i as archiveEnvironment, n as useChangeStatus, p as grantId, s as createEnvironment, t as useChange, v as renameEnvironment } from "../chunks/use-change-c6CeLRin.js";
|
|
9
|
+
import { i as KIND, o as PrincipalAvatar, s as PrincipalLink } from "../chunks/directory-CSjWWUQ1.js";
|
|
10
|
+
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
11
|
+
import { t as useAction } from "../chunks/use-action-CWsg_YWU.js";
|
|
12
|
+
import { n as slugProblem } from "../chunks/validation-BQtqPe2V.js";
|
|
13
|
+
import { i as useRefusedGrants, n as GrantsTable, r as RefusedGrants, t as GrantRowView } from "../chunks/grants-saMQagmG.js";
|
|
14
|
+
import { useEffect, useId, useState } from "react";
|
|
15
|
+
import { Link, useRouter } from "@tanstack/react-router";
|
|
16
|
+
import { toast } from "sonner";
|
|
17
|
+
import { Menu } from "@base-ui/react/menu";
|
|
18
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
18
20
|
//#region src/components/principal-picker.tsx
|
|
19
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
20
|
-
var import_jsx_runtime = require_jsx_runtime();
|
|
21
21
|
/**
|
|
22
22
|
* Who a grant is for: picked from the registered users or tokens, each shown
|
|
23
23
|
* with what it already holds on this project, or typed when the list is not
|
|
@@ -32,18 +32,18 @@ var import_jsx_runtime = require_jsx_runtime();
|
|
|
32
32
|
function PrincipalPicker({ principalType, canList, grants, value, onChange }) {
|
|
33
33
|
const coffre = useCoffre();
|
|
34
34
|
const directory = useQuery(queries.directory(coffre, canList)).data ?? null;
|
|
35
|
-
const [query, setQuery] =
|
|
36
|
-
const name =
|
|
35
|
+
const [query, setQuery] = useState("");
|
|
36
|
+
const name = useId();
|
|
37
37
|
const kind = KIND[principalType];
|
|
38
38
|
const label = principalType === "user" ? "User" : "Token";
|
|
39
|
-
if (!canList || directory?.ok === false) return /* @__PURE__ */
|
|
39
|
+
if (!canList || directory?.ok === false) return /* @__PURE__ */ jsxs("label", {
|
|
40
40
|
className: "field",
|
|
41
41
|
children: [
|
|
42
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ jsx("span", {
|
|
43
43
|
className: "label",
|
|
44
44
|
children: principalType === "user" ? "Email" : "Service token common name"
|
|
45
45
|
}),
|
|
46
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ jsx("input", {
|
|
47
47
|
className: "input input-mono",
|
|
48
48
|
autoFocus: true,
|
|
49
49
|
spellCheck: false,
|
|
@@ -52,7 +52,7 @@ function PrincipalPicker({ principalType, canList, grants, value, onChange }) {
|
|
|
52
52
|
value,
|
|
53
53
|
onChange: (event) => onChange(event.target.value)
|
|
54
54
|
}),
|
|
55
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ jsxs("span", {
|
|
56
56
|
className: "hint",
|
|
57
57
|
children: [
|
|
58
58
|
"The ",
|
|
@@ -67,17 +67,17 @@ function PrincipalPicker({ principalType, canList, grants, value, onChange }) {
|
|
|
67
67
|
const registered = directory?.principals.filter((principal) => principal.principalType === principalType) ?? [];
|
|
68
68
|
const needle = query.trim().toLowerCase();
|
|
69
69
|
const matches = registered.filter((principal) => principal.principalId.toLowerCase().includes(needle));
|
|
70
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
71
71
|
className: "field picker",
|
|
72
72
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ jsx("legend", {
|
|
74
74
|
className: "label",
|
|
75
75
|
children: label
|
|
76
76
|
}),
|
|
77
|
-
/* @__PURE__ */
|
|
77
|
+
/* @__PURE__ */ jsxs("label", {
|
|
78
78
|
className: "input-group",
|
|
79
79
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ jsxs("span", {
|
|
81
81
|
className: "visually-hidden",
|
|
82
82
|
children: [
|
|
83
83
|
"Filter ",
|
|
@@ -85,11 +85,11 @@ function PrincipalPicker({ principalType, canList, grants, value, onChange }) {
|
|
|
85
85
|
"s by name"
|
|
86
86
|
]
|
|
87
87
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ jsx(Search, {
|
|
89
89
|
size: 14,
|
|
90
90
|
className: "input-icon"
|
|
91
91
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ jsx("input", {
|
|
93
93
|
className: "input",
|
|
94
94
|
type: "search",
|
|
95
95
|
autoFocus: true,
|
|
@@ -107,30 +107,30 @@ function PrincipalPicker({ principalType, canList, grants, value, onChange }) {
|
|
|
107
107
|
})
|
|
108
108
|
]
|
|
109
109
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ jsx("div", {
|
|
111
111
|
className: "picker-list",
|
|
112
|
-
children: directory === null ? /* @__PURE__ */
|
|
112
|
+
children: directory === null ? /* @__PURE__ */ jsxs("p", {
|
|
113
113
|
className: "picker-empty",
|
|
114
114
|
children: [
|
|
115
|
-
/* @__PURE__ */
|
|
115
|
+
/* @__PURE__ */ jsx(Spinner, { size: 13 }),
|
|
116
116
|
"Loading ",
|
|
117
117
|
kind,
|
|
118
118
|
"s…"
|
|
119
119
|
]
|
|
120
|
-
}) : registered.length === 0 ? /* @__PURE__ */
|
|
120
|
+
}) : registered.length === 0 ? /* @__PURE__ */ jsxs("p", {
|
|
121
121
|
className: "picker-empty",
|
|
122
122
|
children: [
|
|
123
123
|
"No ",
|
|
124
124
|
kind,
|
|
125
125
|
"s are registered yet.",
|
|
126
126
|
" ",
|
|
127
|
-
/* @__PURE__ */
|
|
127
|
+
/* @__PURE__ */ jsx(Link, {
|
|
128
128
|
to: principalType === "user" ? "/users" : "/tokens",
|
|
129
129
|
children: "Add one"
|
|
130
130
|
}),
|
|
131
131
|
" first."
|
|
132
132
|
]
|
|
133
|
-
}) : matches.length === 0 ? /* @__PURE__ */
|
|
133
|
+
}) : matches.length === 0 ? /* @__PURE__ */ jsxs("p", {
|
|
134
134
|
className: "picker-empty",
|
|
135
135
|
children: [
|
|
136
136
|
"No registered ",
|
|
@@ -142,10 +142,10 @@ function PrincipalPicker({ principalType, canList, grants, value, onChange }) {
|
|
|
142
142
|
}) : matches.map((principal) => {
|
|
143
143
|
const held = grants.filter((grant) => grant.principalType === principalType && grant.principalId === principal.principalId).map(projectAccessLabel);
|
|
144
144
|
const chosen = principal.principalId === value;
|
|
145
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
146
146
|
className: `picker-option${chosen ? " is-chosen" : ""}`,
|
|
147
147
|
children: [
|
|
148
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ jsx("input", {
|
|
149
149
|
type: "radio",
|
|
150
150
|
className: "visually-hidden",
|
|
151
151
|
name,
|
|
@@ -153,25 +153,25 @@ function PrincipalPicker({ principalType, canList, grants, value, onChange }) {
|
|
|
153
153
|
checked: chosen,
|
|
154
154
|
onChange: () => onChange(principal.principalId)
|
|
155
155
|
}),
|
|
156
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ jsx(PrincipalAvatar, {
|
|
157
157
|
type: principalType,
|
|
158
158
|
id: principal.principalId
|
|
159
159
|
}),
|
|
160
|
-
/* @__PURE__ */
|
|
160
|
+
/* @__PURE__ */ jsx("span", {
|
|
161
161
|
className: "picker-name",
|
|
162
162
|
children: principal.principalId
|
|
163
163
|
}),
|
|
164
|
-
held.length > 0 && /* @__PURE__ */
|
|
164
|
+
held.length > 0 && /* @__PURE__ */ jsxs("span", {
|
|
165
165
|
className: "picker-held",
|
|
166
|
-
children: [/* @__PURE__ */
|
|
166
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
167
167
|
className: "visually-hidden",
|
|
168
168
|
children: "holds"
|
|
169
|
-
}), held.map((access) => /* @__PURE__ */
|
|
169
|
+
}), held.map((access) => /* @__PURE__ */ jsx("span", {
|
|
170
170
|
className: "tag",
|
|
171
171
|
children: access
|
|
172
172
|
}, access))]
|
|
173
173
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ jsx(Check, {
|
|
175
175
|
size: 14,
|
|
176
176
|
className: "picker-check"
|
|
177
177
|
})
|
|
@@ -183,48 +183,49 @@ function PrincipalPicker({ principalType, canList, grants, value, onChange }) {
|
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
//#endregion
|
|
186
|
-
//#region src/
|
|
186
|
+
//#region src/pages/project.tsx
|
|
187
|
+
var Route = pageRoute();
|
|
187
188
|
var TABS = [
|
|
188
189
|
{
|
|
189
190
|
key: "environments",
|
|
190
191
|
label: "Environments",
|
|
191
|
-
icon: /* @__PURE__ */
|
|
192
|
+
icon: /* @__PURE__ */ jsx(Layers, { size: 15 })
|
|
192
193
|
},
|
|
193
194
|
{
|
|
194
195
|
key: "users",
|
|
195
196
|
label: "Users",
|
|
196
|
-
icon: /* @__PURE__ */
|
|
197
|
+
icon: /* @__PURE__ */ jsx(Users, { size: 15 })
|
|
197
198
|
},
|
|
198
199
|
{
|
|
199
200
|
key: "tokens",
|
|
200
201
|
label: "Tokens",
|
|
201
|
-
icon: /* @__PURE__ */
|
|
202
|
+
icon: /* @__PURE__ */ jsx(Key, { size: 15 })
|
|
202
203
|
},
|
|
203
204
|
{
|
|
204
205
|
key: "settings",
|
|
205
206
|
label: "Settings",
|
|
206
|
-
icon: /* @__PURE__ */
|
|
207
|
+
icon: /* @__PURE__ */ jsx(Settings, { size: 15 })
|
|
207
208
|
}
|
|
208
209
|
];
|
|
209
210
|
function ProjectPage() {
|
|
210
211
|
const { project: projectSlug } = Route.useParams();
|
|
211
212
|
const { data: projects } = useSuspenseQuery(queries.projects(useCoffre()));
|
|
212
213
|
const result = projectOf(projects, projectSlug);
|
|
213
|
-
if (!result.ok) return /* @__PURE__ */
|
|
214
|
-
icon: /* @__PURE__ */
|
|
215
|
-
label: /* @__PURE__ */
|
|
214
|
+
if (!result.ok) return /* @__PURE__ */ jsx(ClosedDoor, {
|
|
215
|
+
icon: /* @__PURE__ */ jsx(Folder, { size: 18 }),
|
|
216
|
+
label: /* @__PURE__ */ jsx("span", {
|
|
216
217
|
className: "mono",
|
|
217
218
|
children: projectSlug
|
|
218
219
|
}),
|
|
219
220
|
title: "No project here for you",
|
|
220
|
-
actions: /* @__PURE__ */
|
|
221
|
+
actions: /* @__PURE__ */ jsx(Link, {
|
|
221
222
|
className: "btn",
|
|
222
223
|
to: "/projects",
|
|
223
224
|
children: "All projects"
|
|
224
225
|
}),
|
|
225
226
|
children: result.error ?? "There is no such project, or you hold no grant on it. The two look the same on purpose: an answer that told them apart would let anyone list project names."
|
|
226
227
|
});
|
|
227
|
-
return result.managesAccess ? /* @__PURE__ */
|
|
228
|
+
return result.managesAccess ? /* @__PURE__ */ jsx(ManagedProject, { project: result.project }) : /* @__PURE__ */ jsx(ProjectView, {
|
|
228
229
|
project: result.project,
|
|
229
230
|
grants: [],
|
|
230
231
|
grantsError: null
|
|
@@ -233,11 +234,11 @@ function ProjectPage() {
|
|
|
233
234
|
/** A project whose access you manage, with its grants. */
|
|
234
235
|
function ManagedProject({ project }) {
|
|
235
236
|
const { data: result } = useSuspenseQuery(queries.grants(useCoffre(), project.slug));
|
|
236
|
-
return result.ok ? /* @__PURE__ */
|
|
237
|
+
return result.ok ? /* @__PURE__ */ jsx(ProjectView, {
|
|
237
238
|
project,
|
|
238
239
|
grants: result.grants,
|
|
239
240
|
grantsError: null
|
|
240
|
-
}) : /* @__PURE__ */
|
|
241
|
+
}) : /* @__PURE__ */ jsx(ProjectView, {
|
|
241
242
|
project,
|
|
242
243
|
grants: [],
|
|
243
244
|
grantsError: result.error
|
|
@@ -251,32 +252,32 @@ function ProjectView({ project, grants, grantsError }) {
|
|
|
251
252
|
const allowed = TABS.filter(({ key }) => key === "environments" || (key === "users" || key === "tokens") && canManageGrants || key === "settings" && canManageProject);
|
|
252
253
|
const tab = allowed.find(({ key }) => key === search.tab)?.key ?? "environments";
|
|
253
254
|
const principalType = tab === "users" ? "user" : "service";
|
|
254
|
-
return /* @__PURE__ */
|
|
255
|
-
/* @__PURE__ */
|
|
255
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
256
|
+
/* @__PURE__ */ jsx(PageHeader, {
|
|
256
257
|
tile: project.slug,
|
|
257
258
|
title: project.name,
|
|
258
|
-
aside: /* @__PURE__ */
|
|
259
|
+
aside: /* @__PURE__ */ jsx("span", {
|
|
259
260
|
className: "page-title-slug",
|
|
260
261
|
children: project.slug
|
|
261
262
|
}),
|
|
262
|
-
actions: tab === "environments" ? canManageEnvironments && /* @__PURE__ */
|
|
263
|
+
actions: tab === "environments" ? canManageEnvironments && /* @__PURE__ */ jsx(NewEnvironment, { project: project.slug }) : (tab === "users" || tab === "tokens") && grantsError === null && /* @__PURE__ */ jsx(NewGrant, {
|
|
263
264
|
principalType,
|
|
264
265
|
project: project.slug,
|
|
265
266
|
environments: project.environments,
|
|
266
267
|
grants
|
|
267
268
|
})
|
|
268
269
|
}),
|
|
269
|
-
project.archivedAt !== null && /* @__PURE__ */
|
|
270
|
+
project.archivedAt !== null && /* @__PURE__ */ jsx("div", {
|
|
270
271
|
style: { marginBottom: "1.25rem" },
|
|
271
|
-
children: /* @__PURE__ */
|
|
272
|
+
children: /* @__PURE__ */ jsxs(Notice, {
|
|
272
273
|
tone: "bad",
|
|
273
|
-
children: [/* @__PURE__ */
|
|
274
|
+
children: [/* @__PURE__ */ jsx("strong", { children: "This project is archived." }), " Its environments serve no reads, to people or to machines, until it is restored."]
|
|
274
275
|
})
|
|
275
276
|
}),
|
|
276
|
-
allowed.length > 1 && /* @__PURE__ */
|
|
277
|
+
allowed.length > 1 && /* @__PURE__ */ jsx("nav", {
|
|
277
278
|
className: "tabs",
|
|
278
279
|
"aria-label": "Project sections",
|
|
279
|
-
children: allowed.map(({ key, label, icon }) => /* @__PURE__ */
|
|
280
|
+
children: allowed.map(({ key, label, icon }) => /* @__PURE__ */ jsxs(Link, {
|
|
280
281
|
to: "/projects/$project",
|
|
281
282
|
params: { project: project.slug },
|
|
282
283
|
search: { tab: key === "environments" ? void 0 : key },
|
|
@@ -288,19 +289,19 @@ function ProjectView({ project, grants, grantsError }) {
|
|
|
288
289
|
children: [icon, label]
|
|
289
290
|
}, key))
|
|
290
291
|
}),
|
|
291
|
-
tab === "environments" && /* @__PURE__ */
|
|
292
|
+
tab === "environments" && /* @__PURE__ */ jsx(EnvironmentsPanel, {
|
|
292
293
|
project,
|
|
293
294
|
canManage: canManageEnvironments
|
|
294
295
|
}),
|
|
295
|
-
(tab === "users" || tab === "tokens") && (grantsError !== null ? /* @__PURE__ */
|
|
296
|
+
(tab === "users" || tab === "tokens") && (grantsError !== null ? /* @__PURE__ */ jsx(Notice, {
|
|
296
297
|
tone: "bad",
|
|
297
298
|
children: grantsError
|
|
298
|
-
}) : /* @__PURE__ */
|
|
299
|
+
}) : /* @__PURE__ */ jsx(AccessPanel, {
|
|
299
300
|
principalType,
|
|
300
301
|
project: project.slug,
|
|
301
302
|
grants: grants.filter((grant) => grant.principalType === principalType)
|
|
302
303
|
})),
|
|
303
|
-
tab === "settings" && /* @__PURE__ */
|
|
304
|
+
tab === "settings" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(GeneralSettings, { project }), /* @__PURE__ */ jsx(DangerZone, { project })] })
|
|
304
305
|
] });
|
|
305
306
|
}
|
|
306
307
|
function EnvironmentsPanel({ project, canManage }) {
|
|
@@ -308,48 +309,48 @@ function EnvironmentsPanel({ project, canManage }) {
|
|
|
308
309
|
const current = project.environments.filter((environment) => environment.details === null || environment.details.archivedAt === null);
|
|
309
310
|
const { failedAdds, dismiss } = useChangeStatus(keys.projects);
|
|
310
311
|
const refused = failedAdds(project.environments.map((environment) => environmentId(project.slug, environment.slug))).filter(({ ids }) => ids.every((id) => id.startsWith(`${project.slug}/`)));
|
|
311
|
-
return /* @__PURE__ */
|
|
312
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [current.length === 0 && refused.length === 0 ? /* @__PURE__ */ jsx("div", {
|
|
312
313
|
className: "card",
|
|
313
|
-
children: /* @__PURE__ */
|
|
314
|
+
children: /* @__PURE__ */ jsx(EmptyState, {
|
|
314
315
|
title: "No environments yet",
|
|
315
316
|
children: canManage ? "Add the first with Add environment." : "Creating environments needs environment.manage on this project."
|
|
316
317
|
})
|
|
317
|
-
}) : /* @__PURE__ */
|
|
318
|
+
}) : /* @__PURE__ */ jsxs("ul", {
|
|
318
319
|
className: "env-grid",
|
|
319
320
|
"aria-label": "Environments",
|
|
320
|
-
children: [current.map((environment) => /* @__PURE__ */
|
|
321
|
+
children: [current.map((environment) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(EnvironmentCard, {
|
|
321
322
|
project: project.slug,
|
|
322
323
|
environment,
|
|
323
324
|
isAdmin: canManage
|
|
324
|
-
}) }, `${project.slug}:${environment.slug}`)), refused.map(({ mutationId, vars, status }) => /* @__PURE__ */
|
|
325
|
+
}) }, `${project.slug}:${environment.slug}`)), refused.map(({ mutationId, vars, status }) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("div", {
|
|
325
326
|
className: "env-card is-muted is-failed",
|
|
326
|
-
children: [/* @__PURE__ */
|
|
327
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
327
328
|
className: "env-card-text",
|
|
328
|
-
children: [/* @__PURE__ */
|
|
329
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
329
330
|
className: "env-card-name",
|
|
330
331
|
children: vars.name
|
|
331
|
-
}), /* @__PURE__ */
|
|
332
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
332
333
|
className: "env-card-meta",
|
|
333
|
-
children: /* @__PURE__ */
|
|
334
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
334
335
|
className: "mono",
|
|
335
336
|
children: vars.slug
|
|
336
337
|
})
|
|
337
338
|
})]
|
|
338
|
-
}), /* @__PURE__ */
|
|
339
|
+
}), /* @__PURE__ */ jsx(ItemFailure, {
|
|
339
340
|
status,
|
|
340
341
|
onDismiss: () => dismiss(mutationId),
|
|
341
342
|
children: "Not added."
|
|
342
343
|
})]
|
|
343
344
|
}) }, mutationId))]
|
|
344
|
-
}), archived.length > 0 && /* @__PURE__ */
|
|
345
|
+
}), archived.length > 0 && /* @__PURE__ */ jsxs("section", {
|
|
345
346
|
"aria-labelledby": "archived-environments",
|
|
346
|
-
children: [/* @__PURE__ */
|
|
347
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
347
348
|
className: "section-title",
|
|
348
349
|
id: "archived-environments",
|
|
349
350
|
children: "Archived"
|
|
350
|
-
}), /* @__PURE__ */
|
|
351
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
351
352
|
className: "env-grid",
|
|
352
|
-
children: archived.map((environment) => /* @__PURE__ */
|
|
353
|
+
children: archived.map((environment) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(EnvironmentCard, {
|
|
353
354
|
project: project.slug,
|
|
354
355
|
environment,
|
|
355
356
|
isAdmin: canManage
|
|
@@ -362,10 +363,10 @@ function EnvironmentsPanel({ project, canManage }) {
|
|
|
362
363
|
* that link.
|
|
363
364
|
*/
|
|
364
365
|
function EnvironmentCard({ project, environment, isAdmin }) {
|
|
365
|
-
const [renaming, setRenaming] =
|
|
366
|
-
const [confirming, setConfirming] =
|
|
367
|
-
const [slug, setSlug] =
|
|
368
|
-
const [name, setName] =
|
|
366
|
+
const [renaming, setRenaming] = useState(false);
|
|
367
|
+
const [confirming, setConfirming] = useState(false);
|
|
368
|
+
const [slug, setSlug] = useState(environment.slug);
|
|
369
|
+
const [name, setName] = useState(environment.name);
|
|
369
370
|
const coffre = useCoffre();
|
|
370
371
|
const rename = useChange(renameEnvironment(coffre, project));
|
|
371
372
|
const archive = useChange(archiveEnvironment(coffre, project));
|
|
@@ -378,12 +379,12 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
378
379
|
const opens = details !== null && !isArchived && environment.accessible && !pending;
|
|
379
380
|
const manageable = isAdmin && details !== null;
|
|
380
381
|
const slugError = slug === "" ? null : slugProblem(slug);
|
|
381
|
-
return /* @__PURE__ */
|
|
382
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
382
383
|
className: `env-card${opens ? " is-link" : " is-muted"} ${rowClass(state)}`,
|
|
383
384
|
children: [
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
+
/* @__PURE__ */ jsxs("div", {
|
|
385
386
|
className: "env-card-text",
|
|
386
|
-
children: [opens ? /* @__PURE__ */
|
|
387
|
+
children: [opens ? /* @__PURE__ */ jsx(Link, {
|
|
387
388
|
className: "env-card-name stretch",
|
|
388
389
|
to: "/projects/$project/$environment",
|
|
389
390
|
params: {
|
|
@@ -391,64 +392,59 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
391
392
|
environment: environment.slug
|
|
392
393
|
},
|
|
393
394
|
children: environment.name
|
|
394
|
-
}) : /* @__PURE__ */
|
|
395
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
395
396
|
className: "env-card-name",
|
|
396
397
|
children: environment.name
|
|
397
|
-
}), /* @__PURE__ */
|
|
398
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
398
399
|
className: "env-card-meta",
|
|
399
|
-
children: [/* @__PURE__ */
|
|
400
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
400
401
|
className: "mono",
|
|
401
402
|
children: environment.slug
|
|
402
|
-
}), isArchived ? /* @__PURE__ */
|
|
403
|
+
}), isArchived ? /* @__PURE__ */ jsx("span", {
|
|
403
404
|
className: "tag tag-red",
|
|
404
405
|
children: "archived"
|
|
405
|
-
}) : !environment.accessible && !pending ? /* @__PURE__ */
|
|
406
|
+
}) : !environment.accessible && !pending ? /* @__PURE__ */ jsx("span", {
|
|
406
407
|
className: "tag tag-outline",
|
|
407
408
|
children: "no secret access"
|
|
408
|
-
}) : secretCount !== null && /* @__PURE__ */
|
|
409
|
+
}) : secretCount !== null && /* @__PURE__ */ jsxs("span", { children: [
|
|
409
410
|
secretCount,
|
|
410
411
|
" secret",
|
|
411
412
|
secretCount === 1 ? "" : "s"
|
|
412
413
|
] })]
|
|
413
414
|
})]
|
|
414
415
|
}),
|
|
415
|
-
pending && /* @__PURE__ */
|
|
416
|
-
manageable && !pending && /* @__PURE__ */
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MoreHorizontal, { size: 16 })
|
|
422
|
-
})
|
|
423
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
|
|
424
|
-
className: "menu",
|
|
425
|
-
sideOffset: 6,
|
|
416
|
+
pending && /* @__PURE__ */ jsx(RowPending, { status: state }),
|
|
417
|
+
manageable && !pending && /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
418
|
+
className: "act act-quiet env-card-menu",
|
|
419
|
+
"aria-label": `Actions for ${environment.slug}`,
|
|
420
|
+
children: /* @__PURE__ */ jsx(MoreHorizontal, { size: 16 })
|
|
421
|
+
}), /* @__PURE__ */ jsxs(MenuPopup, {
|
|
426
422
|
align: "end",
|
|
427
423
|
children: [
|
|
428
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ jsxs(Menu.Item, {
|
|
429
425
|
className: "menu-item",
|
|
430
|
-
|
|
426
|
+
onClick: () => {
|
|
431
427
|
setSlug(environment.slug);
|
|
432
428
|
setName(environment.name);
|
|
433
429
|
setRenaming(true);
|
|
434
430
|
},
|
|
435
|
-
children: [/* @__PURE__ */
|
|
431
|
+
children: [/* @__PURE__ */ jsx(Pencil, { size: 14 }), "Rename"]
|
|
436
432
|
}),
|
|
437
|
-
/* @__PURE__ */
|
|
438
|
-
/* @__PURE__ */
|
|
433
|
+
/* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }),
|
|
434
|
+
/* @__PURE__ */ jsxs(Menu.Item, {
|
|
439
435
|
className: `menu-item${isArchived ? "" : " menu-item-danger"}`,
|
|
440
|
-
|
|
441
|
-
children: [isArchived ? /* @__PURE__ */
|
|
436
|
+
onClick: () => setConfirming(true),
|
|
437
|
+
children: [isArchived ? /* @__PURE__ */ jsx(RotateBack, { size: 14 }) : /* @__PURE__ */ jsx(Archive, { size: 14 }), isArchived ? "Restore" : "Archive…"]
|
|
442
438
|
})
|
|
443
439
|
]
|
|
444
|
-
})
|
|
445
|
-
manageable && /* @__PURE__ */
|
|
440
|
+
})] }),
|
|
441
|
+
manageable && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Modal, {
|
|
446
442
|
open: renaming,
|
|
447
443
|
onOpenChange: setRenaming,
|
|
448
|
-
title: /* @__PURE__ */
|
|
444
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
449
445
|
"Rename",
|
|
450
446
|
" ",
|
|
451
|
-
/* @__PURE__ */
|
|
447
|
+
/* @__PURE__ */ jsxs("span", {
|
|
452
448
|
className: "mono",
|
|
453
449
|
children: [
|
|
454
450
|
project,
|
|
@@ -457,7 +453,7 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
457
453
|
]
|
|
458
454
|
})
|
|
459
455
|
] }),
|
|
460
|
-
children: /* @__PURE__ */
|
|
456
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
461
457
|
className: "form",
|
|
462
458
|
onSubmit: (event) => {
|
|
463
459
|
event.preventDefault();
|
|
@@ -469,14 +465,14 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
469
465
|
setRenaming(false);
|
|
470
466
|
},
|
|
471
467
|
children: [
|
|
472
|
-
/* @__PURE__ */
|
|
468
|
+
/* @__PURE__ */ jsxs("label", {
|
|
473
469
|
className: "field",
|
|
474
470
|
children: [
|
|
475
|
-
/* @__PURE__ */
|
|
471
|
+
/* @__PURE__ */ jsx("span", {
|
|
476
472
|
className: "label",
|
|
477
473
|
children: "Slug"
|
|
478
474
|
}),
|
|
479
|
-
/* @__PURE__ */
|
|
475
|
+
/* @__PURE__ */ jsx("input", {
|
|
480
476
|
className: "input input-mono",
|
|
481
477
|
autoFocus: true,
|
|
482
478
|
spellCheck: false,
|
|
@@ -484,31 +480,31 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
484
480
|
"aria-invalid": slugError !== null,
|
|
485
481
|
onChange: (event) => setSlug(event.target.value)
|
|
486
482
|
}),
|
|
487
|
-
/* @__PURE__ */
|
|
483
|
+
/* @__PURE__ */ jsx("span", {
|
|
488
484
|
className: `hint${slugError !== null ? " edit-note-error" : ""}`,
|
|
489
485
|
children: slugError ?? `Anything running coffre run ${project}/${environment.slug} will need the new path.`
|
|
490
486
|
})
|
|
491
487
|
]
|
|
492
488
|
}),
|
|
493
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ jsxs("label", {
|
|
494
490
|
className: "field",
|
|
495
|
-
children: [/* @__PURE__ */
|
|
491
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
496
492
|
className: "label",
|
|
497
493
|
children: "Display name"
|
|
498
|
-
}), /* @__PURE__ */
|
|
494
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
499
495
|
className: "input",
|
|
500
496
|
value: name,
|
|
501
497
|
onChange: (event) => setName(event.target.value)
|
|
502
498
|
})]
|
|
503
499
|
}),
|
|
504
|
-
/* @__PURE__ */
|
|
500
|
+
/* @__PURE__ */ jsxs("div", {
|
|
505
501
|
className: "dialog-actions",
|
|
506
|
-
children: [/* @__PURE__ */
|
|
502
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
507
503
|
className: "btn",
|
|
508
504
|
type: "button",
|
|
509
505
|
onClick: () => setRenaming(false),
|
|
510
506
|
children: "Cancel"
|
|
511
|
-
}), /* @__PURE__ */
|
|
507
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
512
508
|
className: "btn btn-primary",
|
|
513
509
|
type: "submit",
|
|
514
510
|
disabled: slug === "" || slugError !== null || name.trim() === "",
|
|
@@ -517,13 +513,13 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
517
513
|
})
|
|
518
514
|
]
|
|
519
515
|
})
|
|
520
|
-
}), /* @__PURE__ */
|
|
516
|
+
}), /* @__PURE__ */ jsx(ConfirmDialog, {
|
|
521
517
|
open: confirming,
|
|
522
518
|
onOpenChange: setConfirming,
|
|
523
|
-
title: /* @__PURE__ */
|
|
519
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
524
520
|
isArchived ? "Restore" : "Archive",
|
|
525
521
|
" ",
|
|
526
|
-
/* @__PURE__ */
|
|
522
|
+
/* @__PURE__ */ jsxs("span", {
|
|
527
523
|
className: "mono",
|
|
528
524
|
children: [
|
|
529
525
|
project,
|
|
@@ -533,22 +529,22 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
533
529
|
}),
|
|
534
530
|
"?"
|
|
535
531
|
] }),
|
|
536
|
-
body: secretCount === null ? /* @__PURE__ */
|
|
532
|
+
body: secretCount === null ? /* @__PURE__ */ jsx(Fragment$1, { children: "This changes whether the environment serves secrets to principals who have access. Values and history remain stored." }) : isArchived ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
537
533
|
"The environment starts serving its ",
|
|
538
534
|
secretCount,
|
|
539
535
|
" secret",
|
|
540
536
|
secretCount === 1 ? "" : "s",
|
|
541
537
|
" again, to everyone who holds a grant on it."
|
|
542
|
-
] }) : /* @__PURE__ */
|
|
538
|
+
] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
543
539
|
"Its ",
|
|
544
540
|
secretCount,
|
|
545
541
|
" secret",
|
|
546
542
|
secretCount === 1 ? "" : "s",
|
|
547
543
|
" stop being served, so anything running ",
|
|
548
|
-
/* @__PURE__ */
|
|
544
|
+
/* @__PURE__ */ jsx("code", { children: "coffre run" }),
|
|
549
545
|
" against",
|
|
550
546
|
" ",
|
|
551
|
-
/* @__PURE__ */
|
|
547
|
+
/* @__PURE__ */ jsxs("span", {
|
|
552
548
|
className: "mono",
|
|
553
549
|
children: [
|
|
554
550
|
project,
|
|
@@ -566,7 +562,7 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
566
562
|
archived: !isArchived
|
|
567
563
|
})
|
|
568
564
|
})] }),
|
|
569
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ jsx(ItemFailure, {
|
|
570
566
|
status: state,
|
|
571
567
|
onDismiss: () => state.state === "failed" && dismiss(state.mutationId)
|
|
572
568
|
})
|
|
@@ -574,26 +570,26 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
574
570
|
});
|
|
575
571
|
}
|
|
576
572
|
function NewEnvironment({ project }) {
|
|
577
|
-
const [open, setOpen] =
|
|
578
|
-
const [slug, setSlug] =
|
|
579
|
-
const [name, setName] =
|
|
573
|
+
const [open, setOpen] = useState(false);
|
|
574
|
+
const [slug, setSlug] = useState("");
|
|
575
|
+
const [name, setName] = useState("");
|
|
580
576
|
const create = useChange(createEnvironment(useCoffre(), project));
|
|
581
577
|
const slugError = slug === "" ? null : slugProblem(slug);
|
|
582
578
|
function close() {
|
|
583
579
|
setOpen(false);
|
|
584
580
|
}
|
|
585
|
-
return /* @__PURE__ */
|
|
581
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
586
582
|
className: "btn btn-primary",
|
|
587
583
|
onClick: () => setOpen(true),
|
|
588
|
-
children: [/* @__PURE__ */
|
|
589
|
-
}), /* @__PURE__ */
|
|
584
|
+
children: [/* @__PURE__ */ jsx(Plus, { size: 14 }), "Add environment"]
|
|
585
|
+
}), /* @__PURE__ */ jsx(Modal, {
|
|
590
586
|
open,
|
|
591
587
|
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
592
|
-
title: /* @__PURE__ */
|
|
588
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: ["New environment in ", /* @__PURE__ */ jsx("span", {
|
|
593
589
|
className: "mono",
|
|
594
590
|
children: project
|
|
595
591
|
})] }),
|
|
596
|
-
children: /* @__PURE__ */
|
|
592
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
597
593
|
className: "form",
|
|
598
594
|
onSubmit: (event) => {
|
|
599
595
|
event.preventDefault();
|
|
@@ -606,14 +602,14 @@ function NewEnvironment({ project }) {
|
|
|
606
602
|
close();
|
|
607
603
|
},
|
|
608
604
|
children: [
|
|
609
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ jsxs("label", {
|
|
610
606
|
className: "field",
|
|
611
607
|
children: [
|
|
612
|
-
/* @__PURE__ */
|
|
608
|
+
/* @__PURE__ */ jsx("span", {
|
|
613
609
|
className: "label",
|
|
614
610
|
children: "Slug"
|
|
615
611
|
}),
|
|
616
|
-
/* @__PURE__ */
|
|
612
|
+
/* @__PURE__ */ jsx("input", {
|
|
617
613
|
className: "input input-mono",
|
|
618
614
|
autoFocus: true,
|
|
619
615
|
spellCheck: false,
|
|
@@ -623,12 +619,12 @@ function NewEnvironment({ project }) {
|
|
|
623
619
|
"aria-invalid": slugError !== null,
|
|
624
620
|
onChange: (event) => setSlug(event.target.value)
|
|
625
621
|
}),
|
|
626
|
-
/* @__PURE__ */
|
|
622
|
+
/* @__PURE__ */ jsx("span", {
|
|
627
623
|
className: `hint${slugError !== null ? " edit-note-error" : ""}`,
|
|
628
|
-
children: slugError ?? /* @__PURE__ */
|
|
624
|
+
children: slugError ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
629
625
|
"The CLI will address it as",
|
|
630
626
|
" ",
|
|
631
|
-
/* @__PURE__ */
|
|
627
|
+
/* @__PURE__ */ jsxs("span", {
|
|
632
628
|
className: "mono",
|
|
633
629
|
children: [
|
|
634
630
|
project,
|
|
@@ -641,26 +637,26 @@ function NewEnvironment({ project }) {
|
|
|
641
637
|
})
|
|
642
638
|
]
|
|
643
639
|
}),
|
|
644
|
-
/* @__PURE__ */
|
|
640
|
+
/* @__PURE__ */ jsxs("label", {
|
|
645
641
|
className: "field",
|
|
646
|
-
children: [/* @__PURE__ */
|
|
642
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
647
643
|
className: "label",
|
|
648
644
|
children: "Display name"
|
|
649
|
-
}), /* @__PURE__ */
|
|
645
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
650
646
|
className: "input",
|
|
651
647
|
placeholder: "Staging",
|
|
652
648
|
value: name,
|
|
653
649
|
onChange: (event) => setName(event.target.value)
|
|
654
650
|
})]
|
|
655
651
|
}),
|
|
656
|
-
/* @__PURE__ */
|
|
652
|
+
/* @__PURE__ */ jsxs("div", {
|
|
657
653
|
className: "dialog-actions",
|
|
658
|
-
children: [/* @__PURE__ */
|
|
654
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
659
655
|
className: "btn",
|
|
660
656
|
type: "button",
|
|
661
657
|
onClick: close,
|
|
662
658
|
children: "Cancel"
|
|
663
|
-
}), /* @__PURE__ */
|
|
659
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
664
660
|
className: "btn btn-primary",
|
|
665
661
|
type: "submit",
|
|
666
662
|
disabled: slug === "" || slugError !== null || name.trim() === "",
|
|
@@ -674,69 +670,69 @@ function NewEnvironment({ project }) {
|
|
|
674
670
|
function AccessPanel({ principalType, project, grants }) {
|
|
675
671
|
const people = principalType === "user";
|
|
676
672
|
const refused = useRefusedGrants(project, grants, principalType);
|
|
677
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ jsx("section", {
|
|
678
674
|
className: "card",
|
|
679
675
|
"aria-label": people ? "Users with access" : "Tokens with access",
|
|
680
|
-
children: grants.length === 0 && refused.length === 0 ? /* @__PURE__ */
|
|
676
|
+
children: grants.length === 0 && refused.length === 0 ? /* @__PURE__ */ jsxs(EmptyState, {
|
|
681
677
|
title: people ? "No user has access" : "No token has access",
|
|
682
678
|
children: [
|
|
683
679
|
"Add ",
|
|
684
680
|
people ? "a user" : "a token",
|
|
685
681
|
" with permissions on the whole project or on one environment."
|
|
686
682
|
]
|
|
687
|
-
}) : /* @__PURE__ */
|
|
688
|
-
lead: /* @__PURE__ */
|
|
683
|
+
}) : /* @__PURE__ */ jsxs(GrantsTable, {
|
|
684
|
+
lead: /* @__PURE__ */ jsxs("span", {
|
|
689
685
|
className: "th",
|
|
690
|
-
children: [people ? /* @__PURE__ */
|
|
686
|
+
children: [people ? /* @__PURE__ */ jsx(User, { size: 14 }) : /* @__PURE__ */ jsx(Key, { size: 14 }), people ? "Email" : "Name"]
|
|
691
687
|
}),
|
|
692
|
-
children: [grants.map((grant, index) => /* @__PURE__ */
|
|
688
|
+
children: [grants.map((grant, index) => /* @__PURE__ */ jsx(GrantRowView, {
|
|
693
689
|
number: index + 1,
|
|
694
690
|
project,
|
|
695
691
|
grant,
|
|
696
692
|
leadLabel: people ? "Email" : "Name",
|
|
697
|
-
lead: /* @__PURE__ */
|
|
693
|
+
lead: /* @__PURE__ */ jsx(PrincipalLink, {
|
|
698
694
|
type: grant.principalType,
|
|
699
695
|
id: grant.principalId
|
|
700
696
|
})
|
|
701
|
-
}, grantId(grant))), /* @__PURE__ */
|
|
697
|
+
}, grantId(grant))), /* @__PURE__ */ jsx(RefusedGrants, { refused })]
|
|
702
698
|
})
|
|
703
699
|
});
|
|
704
700
|
}
|
|
705
701
|
function NewGrant({ principalType, project, environments, grants }) {
|
|
706
702
|
const { capabilities } = useShell();
|
|
707
|
-
const [open, setOpen] =
|
|
708
|
-
const [principalId, setPrincipalId] =
|
|
709
|
-
const [permission, setPermission] =
|
|
710
|
-
const [expiresAt, setExpiresAt] =
|
|
703
|
+
const [open, setOpen] = useState(false);
|
|
704
|
+
const [principalId, setPrincipalId] = useState("");
|
|
705
|
+
const [permission, setPermission] = useState("viewer:");
|
|
706
|
+
const [expiresAt, setExpiresAt] = useState("");
|
|
711
707
|
const grant = useChange(grantAccess(useCoffre(), project));
|
|
712
708
|
const permissionOptions = projectAccessOptions(environments);
|
|
713
709
|
const kind = principalType === "user" ? "user" : "token";
|
|
714
710
|
function close() {
|
|
715
711
|
setOpen(false);
|
|
716
712
|
}
|
|
717
|
-
return /* @__PURE__ */
|
|
713
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
718
714
|
className: "btn btn-primary",
|
|
719
715
|
onClick: () => setOpen(true),
|
|
720
716
|
children: [
|
|
721
|
-
/* @__PURE__ */
|
|
717
|
+
/* @__PURE__ */ jsx(Plus, { size: 14 }),
|
|
722
718
|
"Add ",
|
|
723
719
|
kind
|
|
724
720
|
]
|
|
725
|
-
}), /* @__PURE__ */
|
|
721
|
+
}), /* @__PURE__ */ jsx(Modal, {
|
|
726
722
|
open,
|
|
727
723
|
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
728
|
-
title: /* @__PURE__ */
|
|
724
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
729
725
|
"Give a ",
|
|
730
726
|
kind,
|
|
731
727
|
" access to ",
|
|
732
|
-
/* @__PURE__ */
|
|
728
|
+
/* @__PURE__ */ jsx("span", {
|
|
733
729
|
className: "mono",
|
|
734
730
|
children: project
|
|
735
731
|
})
|
|
736
732
|
] }),
|
|
737
733
|
wide: true,
|
|
738
734
|
description: "Owners manage the whole project and its access. Read and write can cover every environment, or one.",
|
|
739
|
-
children: /* @__PURE__ */
|
|
735
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
740
736
|
className: "form",
|
|
741
737
|
onSubmit: (event) => {
|
|
742
738
|
event.preventDefault();
|
|
@@ -755,39 +751,39 @@ function NewGrant({ principalType, project, environments, grants }) {
|
|
|
755
751
|
close();
|
|
756
752
|
},
|
|
757
753
|
children: [
|
|
758
|
-
/* @__PURE__ */
|
|
754
|
+
/* @__PURE__ */ jsx(PrincipalPicker, {
|
|
759
755
|
principalType,
|
|
760
756
|
canList: capabilities.canManageGrants,
|
|
761
757
|
grants,
|
|
762
758
|
value: principalId,
|
|
763
759
|
onChange: setPrincipalId
|
|
764
760
|
}),
|
|
765
|
-
/* @__PURE__ */
|
|
761
|
+
/* @__PURE__ */ jsxs("div", {
|
|
766
762
|
className: "form-row",
|
|
767
|
-
children: [/* @__PURE__ */
|
|
763
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
768
764
|
className: "field",
|
|
769
765
|
style: { flexGrow: 2 },
|
|
770
|
-
children: [/* @__PURE__ */
|
|
766
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
771
767
|
className: "label",
|
|
772
768
|
children: "Permissions"
|
|
773
|
-
}), /* @__PURE__ */
|
|
769
|
+
}), /* @__PURE__ */ jsx("select", {
|
|
774
770
|
className: "select",
|
|
775
771
|
value: permission,
|
|
776
772
|
onChange: (event) => setPermission(event.target.value),
|
|
777
|
-
children: permissionOptions.map((option) => /* @__PURE__ */
|
|
773
|
+
children: permissionOptions.map((option) => /* @__PURE__ */ jsx("option", {
|
|
778
774
|
value: option.value,
|
|
779
775
|
children: option.label
|
|
780
776
|
}, option.value))
|
|
781
777
|
})]
|
|
782
|
-
}), /* @__PURE__ */
|
|
778
|
+
}), /* @__PURE__ */ jsxs("label", {
|
|
783
779
|
className: "field",
|
|
784
|
-
children: [/* @__PURE__ */
|
|
780
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
785
781
|
className: "label",
|
|
786
|
-
children: ["Expires ", /* @__PURE__ */
|
|
782
|
+
children: ["Expires ", /* @__PURE__ */ jsx("span", {
|
|
787
783
|
className: "hint",
|
|
788
784
|
children: "(optional)"
|
|
789
785
|
})]
|
|
790
|
-
}), /* @__PURE__ */
|
|
786
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
791
787
|
className: "input",
|
|
792
788
|
type: "date",
|
|
793
789
|
value: expiresAt,
|
|
@@ -795,14 +791,14 @@ function NewGrant({ principalType, project, environments, grants }) {
|
|
|
795
791
|
})]
|
|
796
792
|
})]
|
|
797
793
|
}),
|
|
798
|
-
/* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ jsxs("div", {
|
|
799
795
|
className: "dialog-actions",
|
|
800
|
-
children: [/* @__PURE__ */
|
|
796
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
801
797
|
className: "btn",
|
|
802
798
|
type: "button",
|
|
803
799
|
onClick: close,
|
|
804
800
|
children: "Cancel"
|
|
805
|
-
}), /* @__PURE__ */
|
|
801
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
806
802
|
className: "btn btn-primary",
|
|
807
803
|
type: "submit",
|
|
808
804
|
disabled: principalId.trim() === "",
|
|
@@ -822,27 +818,27 @@ function NewGrant({ principalType, project, environments, grants }) {
|
|
|
822
818
|
*/
|
|
823
819
|
function GeneralSettings({ project }) {
|
|
824
820
|
const router = useRouter();
|
|
825
|
-
const [slug, setSlug] =
|
|
826
|
-
const [name, setName] =
|
|
821
|
+
const [slug, setSlug] = useState(project.slug);
|
|
822
|
+
const [name, setName] = useState(project.name);
|
|
827
823
|
const coffre = useCoffre();
|
|
828
824
|
const { pending, error, run } = useAction();
|
|
829
825
|
const slugError = slug === "" ? null : slugProblem(slug);
|
|
830
826
|
const dirty = slug !== project.slug || name.trim() !== project.name;
|
|
831
|
-
|
|
827
|
+
useEffect(() => {
|
|
832
828
|
setSlug(project.slug);
|
|
833
829
|
setName(project.name);
|
|
834
830
|
}, [project.slug, project.name]);
|
|
835
|
-
return /* @__PURE__ */
|
|
831
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
836
832
|
className: "card",
|
|
837
833
|
"aria-labelledby": "general-settings",
|
|
838
|
-
children: [/* @__PURE__ */
|
|
834
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
839
835
|
className: "card-head",
|
|
840
|
-
children: /* @__PURE__ */
|
|
836
|
+
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h2", {
|
|
841
837
|
className: "card-title",
|
|
842
838
|
id: "general-settings",
|
|
843
839
|
children: "General"
|
|
844
840
|
}) })
|
|
845
|
-
}), /* @__PURE__ */
|
|
841
|
+
}), /* @__PURE__ */ jsxs("form", {
|
|
846
842
|
onSubmit: (event) => {
|
|
847
843
|
event.preventDefault();
|
|
848
844
|
run(() => coffre.projects.update(project.slug, {
|
|
@@ -860,98 +856,98 @@ function GeneralSettings({ project }) {
|
|
|
860
856
|
}
|
|
861
857
|
});
|
|
862
858
|
},
|
|
863
|
-
children: [/* @__PURE__ */
|
|
859
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
864
860
|
className: "card-body form-row",
|
|
865
|
-
children: [/* @__PURE__ */
|
|
861
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
866
862
|
className: "field",
|
|
867
863
|
children: [
|
|
868
|
-
/* @__PURE__ */
|
|
864
|
+
/* @__PURE__ */ jsx("span", {
|
|
869
865
|
className: "label",
|
|
870
866
|
children: "Slug"
|
|
871
867
|
}),
|
|
872
|
-
/* @__PURE__ */
|
|
868
|
+
/* @__PURE__ */ jsx("input", {
|
|
873
869
|
className: "input input-mono",
|
|
874
870
|
spellCheck: false,
|
|
875
871
|
value: slug,
|
|
876
872
|
"aria-invalid": slugError !== null,
|
|
877
873
|
onChange: (event) => setSlug(event.target.value)
|
|
878
874
|
}),
|
|
879
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__PURE__ */ jsx("span", {
|
|
880
876
|
className: `hint${slugError !== null ? " edit-note-error" : ""}`,
|
|
881
877
|
children: slugError ?? "Scripts that name the old slug will need the new one."
|
|
882
878
|
})
|
|
883
879
|
]
|
|
884
|
-
}), /* @__PURE__ */
|
|
880
|
+
}), /* @__PURE__ */ jsxs("label", {
|
|
885
881
|
className: "field",
|
|
886
|
-
children: [/* @__PURE__ */
|
|
882
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
887
883
|
className: "label",
|
|
888
884
|
children: "Display name"
|
|
889
|
-
}), /* @__PURE__ */
|
|
885
|
+
}), /* @__PURE__ */ jsx("input", {
|
|
890
886
|
className: "input",
|
|
891
887
|
value: name,
|
|
892
888
|
onChange: (event) => setName(event.target.value)
|
|
893
889
|
})]
|
|
894
890
|
})]
|
|
895
|
-
}), /* @__PURE__ */
|
|
891
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
896
892
|
className: "card-foot",
|
|
897
|
-
children: [error !== null && /* @__PURE__ */
|
|
893
|
+
children: [error !== null && /* @__PURE__ */ jsx("span", {
|
|
898
894
|
className: "hint",
|
|
899
|
-
children: /* @__PURE__ */
|
|
900
|
-
}), /* @__PURE__ */
|
|
895
|
+
children: /* @__PURE__ */ jsx(ErrorLine, { error })
|
|
896
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
901
897
|
className: "btn btn-primary",
|
|
902
898
|
type: "submit",
|
|
903
899
|
disabled: !dirty || pending || slug === "" || slugError !== null || name.trim() === "",
|
|
904
|
-
children: [pending && /* @__PURE__ */
|
|
900
|
+
children: [pending && /* @__PURE__ */ jsx(Spinner, {}), "Save"]
|
|
905
901
|
})]
|
|
906
902
|
})]
|
|
907
903
|
})]
|
|
908
904
|
});
|
|
909
905
|
}
|
|
910
906
|
function DangerZone({ project }) {
|
|
911
|
-
const [confirming, setConfirming] =
|
|
907
|
+
const [confirming, setConfirming] = useState(false);
|
|
912
908
|
const coffre = useCoffre();
|
|
913
909
|
const { pending, error, run } = useAction();
|
|
914
910
|
const isArchived = project.archivedAt !== null;
|
|
915
|
-
return /* @__PURE__ */
|
|
911
|
+
return /* @__PURE__ */ jsxs(Card, {
|
|
916
912
|
labelledBy: "danger-zone",
|
|
917
913
|
title: "Danger zone",
|
|
918
914
|
tone: "danger",
|
|
919
|
-
children: [/* @__PURE__ */
|
|
915
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
920
916
|
className: "card-row",
|
|
921
|
-
children: [/* @__PURE__ */
|
|
922
|
-
/* @__PURE__ */
|
|
917
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
918
|
+
/* @__PURE__ */ jsx("p", {
|
|
923
919
|
className: "card-row-title",
|
|
924
920
|
children: isArchived ? "Restore project" : "Archive project"
|
|
925
921
|
}),
|
|
926
|
-
/* @__PURE__ */
|
|
922
|
+
/* @__PURE__ */ jsx("p", {
|
|
927
923
|
className: "card-row-desc",
|
|
928
924
|
children: isArchived ? "The project reappears in listings and its environments serve reads again, for everyone who holds a grant on it." : "Every environment stops serving reads, including to machine callers already running. Nothing is deleted, and you can restore it here at any time."
|
|
929
925
|
}),
|
|
930
|
-
error !== null && /* @__PURE__ */
|
|
926
|
+
error !== null && /* @__PURE__ */ jsx("div", {
|
|
931
927
|
style: { marginTop: "0.5rem" },
|
|
932
|
-
children: /* @__PURE__ */
|
|
928
|
+
children: /* @__PURE__ */ jsx(ErrorLine, { error })
|
|
933
929
|
})
|
|
934
|
-
] }), /* @__PURE__ */
|
|
930
|
+
] }), /* @__PURE__ */ jsxs("button", {
|
|
935
931
|
className: `btn ${isArchived ? "" : "btn-danger-outline"}`,
|
|
936
932
|
onClick: () => setConfirming(true),
|
|
937
933
|
disabled: pending,
|
|
938
|
-
children: [pending ? /* @__PURE__ */
|
|
934
|
+
children: [pending ? /* @__PURE__ */ jsx(Spinner, {}) : isArchived ? /* @__PURE__ */ jsx(RotateBack, { size: 14 }) : /* @__PURE__ */ jsx(Archive, { size: 14 }), isArchived ? "Restore project" : "Archive project…"]
|
|
939
935
|
})]
|
|
940
|
-
}), /* @__PURE__ */
|
|
936
|
+
}), /* @__PURE__ */ jsx(ConfirmDialog, {
|
|
941
937
|
open: confirming,
|
|
942
938
|
onOpenChange: setConfirming,
|
|
943
|
-
title: /* @__PURE__ */
|
|
939
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
944
940
|
isArchived ? "Restore" : "Archive",
|
|
945
941
|
" ",
|
|
946
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ jsx("span", {
|
|
947
943
|
className: "mono",
|
|
948
944
|
children: project.slug
|
|
949
945
|
}),
|
|
950
946
|
"?"
|
|
951
947
|
] }),
|
|
952
|
-
body: isArchived ? /* @__PURE__ */
|
|
948
|
+
body: isArchived ? /* @__PURE__ */ jsx(Fragment$1, { children: "The project reappears in listings and its environments start serving reads again, for everyone who holds a grant on it." }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
953
949
|
"Every environment in ",
|
|
954
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ jsx("span", {
|
|
955
951
|
className: "mono",
|
|
956
952
|
children: project.slug
|
|
957
953
|
}),
|
|
@@ -967,4 +963,6 @@ function DangerZone({ project }) {
|
|
|
967
963
|
});
|
|
968
964
|
}
|
|
969
965
|
//#endregion
|
|
970
|
-
export { ProjectPage
|
|
966
|
+
export { ProjectPage };
|
|
967
|
+
|
|
968
|
+
//# sourceMappingURL=project.js.map
|