@coffre/ui 0.1.10 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/_coffre/assets/account-CyJDFhek.js +2 -0
- package/dist/client/_coffre/assets/account-DHSs5h2f.js +1 -0
- package/dist/client/_coffre/assets/affordances-BQD5B421.js +1 -0
- package/dist/client/_coffre/assets/audit-Bcyp_dU1.js +2 -0
- package/dist/client/_coffre/assets/audit-rMy9mU9Q.js +1 -0
- package/dist/client/_coffre/assets/auth.device-DuvaComb.js +1 -0
- package/dist/client/_coffre/assets/auth.device-yBt_sLZW.js +2 -0
- package/dist/client/_coffre/assets/directory-C4BMGC7-.js +1 -0
- package/dist/client/_coffre/assets/dist-BNkBTkxj.js +1 -0
- package/dist/client/_coffre/assets/globals-BJkzu6T5.css +1 -0
- package/dist/client/_coffre/assets/grants-CyDW25eX.js +1 -0
- package/dist/client/_coffre/assets/icons-BRl8DlXW.js +1 -0
- package/dist/client/_coffre/assets/index-CA1mtrIx.js +12 -0
- package/dist/client/_coffre/assets/link-CqlAJWBd.js +1 -0
- package/dist/client/_coffre/assets/login-B73b6bsJ.js +1 -0
- package/dist/client/_coffre/assets/login-BO1KAGPU.js +2 -0
- package/dist/client/_coffre/assets/offboarding--5vSKNHv.js +1 -0
- package/dist/client/_coffre/assets/page-Dngv8FMr.js +1 -0
- package/dist/client/_coffre/assets/preload-helper-DBha3tys.js +1 -0
- package/dist/client/_coffre/assets/principal-page-C4qDD-d8.js +1 -0
- package/dist/client/_coffre/assets/projects._project._environment-eBKxOZ0_.js +2 -0
- package/dist/client/_coffre/assets/projects._project._environment-or_AX6o5.js +3 -0
- package/dist/client/_coffre/assets/projects._project.index-DHdXfEh-.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-iynQgenH.js +1 -0
- package/dist/client/_coffre/assets/projects.index-CGW8mRil.js +1 -0
- package/dist/client/_coffre/assets/row-state-BlarvG7E.js +1 -0
- package/dist/client/_coffre/assets/settings-D-7RJIDf.js +1 -0
- package/dist/client/_coffre/assets/suspense-q_eJaZ18.js +1 -0
- package/dist/client/_coffre/assets/tokens._token-0u7midqA.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-C53NqScg.js +1 -0
- package/dist/client/_coffre/assets/tokens.index-DBZTLnbi.js +1 -0
- package/dist/client/_coffre/assets/ui-BPWFJNz7.js +46 -0
- package/dist/client/_coffre/assets/unregistered-CLhgtwUt.js +1 -0
- package/dist/client/_coffre/assets/use-action-LULgF26O.js +1 -0
- package/dist/client/_coffre/assets/use-change-Bd6NZJj9.js +1 -0
- package/dist/client/_coffre/assets/use-shell-Dx92Huhb.js +1 -0
- package/dist/client/_coffre/assets/useQuery-BIIZz1CB.js +1 -0
- package/dist/client/_coffre/assets/useSuspenseQuery-tP9HFZ8w.js +1 -0
- package/dist/client/_coffre/assets/users._user-BXtaL8Ee.js +2 -0
- package/dist/client/_coffre/assets/users._user-CNYVkXaY.js +1 -0
- package/dist/client/_coffre/assets/users.index-Cs9tibIv.js +1 -0
- package/dist/server/.vite/manifest.json +342 -246
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-T9tMsCwo.js +162 -0
- package/dist/server/_coffre/assets/{account-CUQYGCYh.js → account-BUhhOS5-.js} +150 -117
- package/dist/server/_coffre/assets/{account-DMlUoBxQ.js → account-B_h55GCs.js} +10 -24
- package/dist/server/_coffre/assets/{affordances-BNaXjMOb.js → affordances-CKANXDTG.js} +2 -22
- package/dist/server/_coffre/assets/{async-local-storage-C0cwgkEr.js → async-local-storage-C10uQtMM.js} +3 -2
- package/dist/server/_coffre/assets/{audit-CCdSLmvK.js → audit-B8Ck358-.js} +46 -16
- package/dist/server/_coffre/assets/audit-DFsXfeAQ.js +31 -0
- package/dist/server/_coffre/assets/{auth.device-BoFM1jcf.js → auth.device-BXf_JjT7.js} +5 -5
- package/dist/server/_coffre/assets/{auth.device-C05u5ROO.js → auth.device-cqjWACvB.js} +7 -5
- package/dist/server/_coffre/assets/{directory-GsnYkse0.js → directory-C9SfNgpM.js} +87 -112
- package/dist/server/_coffre/assets/{use-action-DwEmf58L.js → dist-CnnV3t2g.js} +3 -48
- package/dist/server/_coffre/assets/globals-BJkzu6T5.css +1 -0
- package/dist/server/_coffre/assets/grants--315KmXu.js +158 -0
- package/dist/server/_coffre/assets/{page-BdnhpwvH.js → icons-CWsTEfpn.js} +125 -436
- package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +480 -0
- package/dist/server/_coffre/assets/link-42ZWdjzZ.js +422 -0
- package/dist/server/_coffre/assets/{login-DUtCQju5.js → login-CQSkYW_D.js} +7 -5
- package/dist/server/_coffre/assets/{login-B2njIq_o.js → login-LBpXXfsQ.js} +2 -2
- package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +56 -0
- package/dist/server/_coffre/assets/{offboarding-8yMa7ViM.js → offboarding-CykelNis.js} +11 -79
- package/dist/server/_coffre/assets/page-BGeDoQO5.js +3531 -0
- package/dist/server/_coffre/assets/{principal-page-B8zPcS2b.js → principal-page-CRdoAQOq.js} +51 -42
- package/dist/server/_coffre/assets/{projects._project._environment-DdIOc7wx.js → projects._project._environment-BXU1Mee5.js} +4 -11
- package/dist/server/_coffre/assets/{projects._project._environment-BZ5Z80V8.js → projects._project._environment-BrDqn8kW.js} +129 -748
- package/dist/server/_coffre/assets/{projects._project.index-CuEAUwGn.js → projects._project.index-CAxBU4tY.js} +134 -96
- package/dist/server/_coffre/assets/{projects._project.index-DvbcU1kh.js → projects._project.index-CYyUVTCl.js} +5 -4
- package/dist/server/_coffre/assets/{projects.index-5HI0wOuG.js → projects.index-D6ZoDE_0.js} +57 -55
- package/dist/server/_coffre/assets/{react-dom-qCTiwGGR.js → react-dom-bBoJXlK2.js} +417 -51
- package/dist/server/_coffre/assets/{router-CQDoql8s.js → router-Bu2qtyqw.js} +376 -92
- package/dist/server/_coffre/assets/row-state-CAItu3n_.js +117 -0
- package/dist/server/_coffre/assets/{settings-BVz78wjP.js → settings-ByeF6hBa.js} +8 -6
- package/dist/server/_coffre/assets/suspense-beD01bb8.js +602 -0
- package/dist/server/_coffre/assets/tokens._token-CM01QPCq.js +10 -0
- package/dist/server/_coffre/assets/{tokens._token-CWs3Mtki.js → tokens._token-D2E4P3Qc.js} +97 -79
- package/dist/server/_coffre/assets/{tokens.index-Ck0LN7aC.js → tokens.index-Cmrgn3mU.js} +9 -6
- package/dist/server/_coffre/assets/{ui-D_slKpSF.js → ui-DvlGkmaH.js} +7 -836
- package/dist/server/_coffre/assets/{unregistered-Z17da4Rc.js → unregistered-DSArejP9.js} +5 -3
- package/dist/server/_coffre/assets/use-action-C2wz34kq.js +47 -0
- package/dist/server/_coffre/assets/use-change-CJpGSNIq.js +1212 -0
- package/dist/server/_coffre/assets/use-shell-C3iYcyP1.js +462 -0
- package/dist/server/_coffre/assets/useQuery-ChxaQ4Cb.js +8 -0
- package/dist/server/_coffre/assets/{useStore-DWGPqzXR.js → useRouter-CaUSUNsw.js} +1 -420
- package/dist/server/_coffre/assets/useSuspenseQuery-BjAmlGZl.js +117 -0
- package/dist/server/_coffre/assets/users._user-BVeR9fZP.js +10 -0
- package/dist/server/_coffre/assets/{users._user-CMwj-VI9.js → users._user-Cih2Etf4.js} +4 -5
- package/dist/server/_coffre/assets/{users.index-fWHv6A30.js → users.index-Bo2_a95G.js} +9 -6
- package/dist/server/index.js +6 -5
- package/package.json +5 -3
- package/src/components/directory.tsx +75 -104
- package/src/components/grants.tsx +60 -112
- package/src/components/icons.tsx +0 -34
- package/src/components/offboarding.tsx +1 -52
- package/src/components/principal-page.tsx +54 -67
- package/src/components/principal-picker.tsx +7 -16
- package/src/components/row-state.tsx +95 -0
- package/src/components/service-tokens.tsx +75 -64
- package/src/components/shell.tsx +1 -1
- package/src/lib/announce.ts +36 -0
- package/src/lib/changes.ts +498 -0
- package/src/lib/coffre.ts +1 -1
- package/src/lib/optimistic.ts +233 -0
- package/src/lib/queries.ts +385 -0
- package/src/lib/use-action.ts +20 -15
- package/src/lib/use-change.ts +42 -0
- package/src/lib/use-shell.ts +17 -0
- package/src/router.tsx +17 -9
- package/src/routes/__root.tsx +8 -38
- package/src/routes/account.tsx +163 -154
- package/src/routes/audit.tsx +51 -72
- package/src/routes/auth.device.tsx +4 -2
- package/src/routes/login.tsx +3 -2
- package/src/routes/projects.$project.$environment.tsx +223 -238
- package/src/routes/projects.$project.index.tsx +136 -118
- package/src/routes/projects.index.tsx +117 -145
- package/src/routes/settings.tsx +7 -7
- package/src/routes/tokens.$token.tsx +14 -17
- package/src/routes/tokens.index.tsx +8 -4
- package/src/routes/unregistered.tsx +3 -2
- package/src/routes/users.$user.tsx +4 -4
- package/src/routes/users.index.tsx +8 -4
- package/src/shared/models.ts +1 -5
- package/src/styles/globals.css +80 -50
- package/dist/client/_coffre/assets/account-B48wuSF8.js +0 -1
- package/dist/client/_coffre/assets/account-BkNyIDT7.js +0 -2
- package/dist/client/_coffre/assets/affordances-CmoY-8Xf.js +0 -1
- package/dist/client/_coffre/assets/audit-BvwKYb-5.js +0 -2
- package/dist/client/_coffre/assets/audit-D02H-zxS.js +0 -1
- package/dist/client/_coffre/assets/auth.device-BP5FY0K1.js +0 -1
- package/dist/client/_coffre/assets/auth.device-DYOONgFF.js +0 -2
- package/dist/client/_coffre/assets/coffre-BBp7cKVa.js +0 -1
- package/dist/client/_coffre/assets/directory-Bu0EIxqI.js +0 -1
- package/dist/client/_coffre/assets/globals-Bh2x1gBM.css +0 -1
- package/dist/client/_coffre/assets/grants-DavcwofW.js +0 -1
- package/dist/client/_coffre/assets/index-CDPlq5rM.js +0 -12
- package/dist/client/_coffre/assets/login-C-wTm_t1.js +0 -2
- package/dist/client/_coffre/assets/login-CLLv1om9.js +0 -1
- package/dist/client/_coffre/assets/offboarding-DWsE2FSa.js +0 -1
- package/dist/client/_coffre/assets/page-DbSS7pYH.js +0 -1
- package/dist/client/_coffre/assets/preload-helper-DduCCcmc.js +0 -46
- package/dist/client/_coffre/assets/principal-page-Bp_iwuSd.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-BMeX_B8l.js +0 -2
- package/dist/client/_coffre/assets/projects._project._environment-CT0A-hIU.js +0 -3
- package/dist/client/_coffre/assets/projects._project.index-C_xYOGLT.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-Chcf-cUd.js +0 -1
- package/dist/client/_coffre/assets/projects.index-CfOtb1X5.js +0 -2
- package/dist/client/_coffre/assets/projects.index-DSjOhLDh.js +0 -1
- package/dist/client/_coffre/assets/settings-BC9cUJNK.js +0 -1
- package/dist/client/_coffre/assets/settings-Bkj_E21y.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-BA0KqvaW.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-Dh9jLOkm.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-BgAMWkHT.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-CHueIAv1.js +0 -1
- package/dist/client/_coffre/assets/unregistered-D5go1AfR.js +0 -1
- package/dist/client/_coffre/assets/use-action-l__xZDYY.js +0 -1
- package/dist/client/_coffre/assets/users._user-Dwqa0gv5.js +0 -1
- package/dist/client/_coffre/assets/users._user-xJAb3T6Y.js +0 -2
- package/dist/client/_coffre/assets/users.index-BJoF-L37.js +0 -2
- package/dist/client/_coffre/assets/users.index-YUjtbTGy.js +0 -1
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-BKg2AlPu.js +0 -133
- package/dist/server/_coffre/assets/audit-CThXn2v7.js +0 -74
- package/dist/server/_coffre/assets/coffre-C2ANsTAz.js +0 -281
- package/dist/server/_coffre/assets/globals-Bh2x1gBM.css +0 -1
- package/dist/server/_coffre/assets/grants-B6k4Fu9z.js +0 -243
- package/dist/server/_coffre/assets/projects.index-uiomWX_l.js +0 -54
- package/dist/server/_coffre/assets/settings-4oRyDizv.js +0 -18
- package/dist/server/_coffre/assets/tokens._token-CF_deAwq.js +0 -18
- package/dist/server/_coffre/assets/tokens.index-DF_07KEe.js +0 -10
- package/dist/server/_coffre/assets/users._user-DUzwkSKT.js +0 -10
- package/dist/server/_coffre/assets/users.index-BbuweTwH.js +0 -10
- package/src/components/syncs.tsx +0 -581
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { s as
|
|
5
|
-
import {
|
|
1
|
+
import { i as require_react, r as require_jsx_runtime, s as __toESM, t as useRouter } from "./useRouter-CaUSUNsw.js";
|
|
2
|
+
import { t as Link } from "./link-42ZWdjzZ.js";
|
|
3
|
+
import { C as useCoffre, c as keys, h as queries, i as PageHeader, m as projectOf, n as ClosedDoor, o as affects, t as Card } from "./page-BGeDoQO5.js";
|
|
4
|
+
import { D as projectAccessOptions, E as projectAccessLabel, T as parseProjectAccess, _ as renameEnvironment, d as environmentId, f as grantAccess, i as archiveEnvironment, n as useChangeStatus, p as grantId, s as createEnvironment, t as useChange } from "./use-change-CJpGSNIq.js";
|
|
5
|
+
import { t as useShell } from "./use-shell-C3iYcyP1.js";
|
|
6
|
+
import { t as useSuspenseQuery } from "./useSuspenseQuery-BjAmlGZl.js";
|
|
7
|
+
import { t as useQuery } from "./useQuery-ChxaQ4Cb.js";
|
|
8
|
+
import { n as toast } from "./dist-CnnV3t2g.js";
|
|
9
|
+
import { a as ErrorLine, c as Spinner, h as dropdown_menu_exports, i as EmptyState, n as ConfirmDialog, o as Modal, s as Notice } from "./ui-DvlGkmaH.js";
|
|
6
10
|
import { t as hasEnvironmentDetails } from "./project-environments-lEzFHUt4.js";
|
|
7
|
-
import {
|
|
8
|
-
import { a as
|
|
9
|
-
import { t as Route } from "./projects._project.index-
|
|
11
|
+
import { A as Plus, D as MoreHorizontal, M as RotateBack, N as Search, P as Settings, U as Users, V as User, a as Check, i as Archive, k as Pencil, p as Folder, v as Key, y as Layers } from "./icons-CWsTEfpn.js";
|
|
12
|
+
import { a as rowClass, i as RowPending, t as ItemFailure } from "./row-state-CAItu3n_.js";
|
|
13
|
+
import { t as Route } from "./projects._project.index-CYyUVTCl.js";
|
|
14
|
+
import { i as KIND, o as PrincipalAvatar, s as PrincipalLink } from "./directory-C9SfNgpM.js";
|
|
15
|
+
import { t as useAction } from "./use-action-C2wz34kq.js";
|
|
10
16
|
import { n as slugProblem } from "./validation-BQtqPe2V.js";
|
|
17
|
+
import { i as useRefusedGrants, n as GrantsTable, r as RefusedGrants, t as GrantRowView } from "./grants--315KmXu.js";
|
|
11
18
|
//#region src/components/principal-picker.tsx
|
|
12
19
|
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
13
20
|
var import_jsx_runtime = require_jsx_runtime();
|
|
@@ -19,25 +26,16 @@ var import_jsx_runtime = require_jsx_runtime();
|
|
|
19
26
|
* Only instance owners may list the directory. Asking on anyone else's behalf
|
|
20
27
|
* would write a refusal to the audit log in their name, so they get a text
|
|
21
28
|
* field and the server's answer instead. The list is asked for when the
|
|
22
|
-
* dialog opens rather than with the page, since most visits never open it
|
|
29
|
+
* dialog opens rather than with the page, since most visits never open it,
|
|
30
|
+
* and shared with the Users and Tokens pages through the cache.
|
|
23
31
|
*/
|
|
24
32
|
function PrincipalPicker({ principalType, canList, grants, value, onChange }) {
|
|
25
33
|
const coffre = useCoffre();
|
|
26
|
-
const
|
|
34
|
+
const directory = useQuery(queries.directory(coffre, canList)).data ?? null;
|
|
27
35
|
const [query, setQuery] = (0, import_react.useState)("");
|
|
28
36
|
const name = (0, import_react.useId)();
|
|
29
37
|
const kind = KIND[principalType];
|
|
30
38
|
const label = principalType === "user" ? "User" : "Token";
|
|
31
|
-
(0, import_react.useEffect)(() => {
|
|
32
|
-
if (!canList) return;
|
|
33
|
-
let live = true;
|
|
34
|
-
loadDirectory(coffre, true).then((result) => {
|
|
35
|
-
if (live) setDirectory(result);
|
|
36
|
-
});
|
|
37
|
-
return () => {
|
|
38
|
-
live = false;
|
|
39
|
-
};
|
|
40
|
-
}, [canList, coffre]);
|
|
41
39
|
if (!canList || directory?.ok === false) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
42
40
|
className: "field",
|
|
43
41
|
children: [
|
|
@@ -209,9 +207,9 @@ var TABS = [
|
|
|
209
207
|
}
|
|
210
208
|
];
|
|
211
209
|
function ProjectPage() {
|
|
212
|
-
const result = Route.useLoaderData();
|
|
213
210
|
const { project: projectSlug } = Route.useParams();
|
|
214
|
-
const
|
|
211
|
+
const { data: projects } = useSuspenseQuery(queries.projects(useCoffre()));
|
|
212
|
+
const result = projectOf(projects, projectSlug);
|
|
215
213
|
if (!result.ok) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
|
|
216
214
|
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Folder, { size: 18 }),
|
|
217
215
|
label: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
@@ -226,7 +224,27 @@ function ProjectPage() {
|
|
|
226
224
|
}),
|
|
227
225
|
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."
|
|
228
226
|
});
|
|
229
|
-
|
|
227
|
+
return result.managesAccess ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ManagedProject, { project: result.project }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectView, {
|
|
228
|
+
project: result.project,
|
|
229
|
+
grants: [],
|
|
230
|
+
grantsError: null
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/** A project whose access you manage, with its grants. */
|
|
234
|
+
function ManagedProject({ project }) {
|
|
235
|
+
const { data: result } = useSuspenseQuery(queries.grants(useCoffre(), project.slug));
|
|
236
|
+
return result.ok ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectView, {
|
|
237
|
+
project,
|
|
238
|
+
grants: result.grants,
|
|
239
|
+
grantsError: null
|
|
240
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectView, {
|
|
241
|
+
project,
|
|
242
|
+
grants: [],
|
|
243
|
+
grantsError: result.error
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
function ProjectView({ project, grants, grantsError }) {
|
|
247
|
+
const search = Route.useSearch();
|
|
230
248
|
const canManageProject = project.permissions.includes("project.manage");
|
|
231
249
|
const canManageEnvironments = project.permissions.includes("environment.manage");
|
|
232
250
|
const canManageGrants = project.permissions.includes("grant.manage");
|
|
@@ -288,20 +306,41 @@ function ProjectPage() {
|
|
|
288
306
|
function EnvironmentsPanel({ project, canManage }) {
|
|
289
307
|
const archived = project.environments.filter(hasEnvironmentDetails).filter((environment) => environment.details.archivedAt !== null);
|
|
290
308
|
const current = project.environments.filter((environment) => environment.details === null || environment.details.archivedAt === null);
|
|
291
|
-
|
|
309
|
+
const { failedAdds, dismiss } = useChangeStatus(keys.projects);
|
|
310
|
+
const refused = failedAdds(project.environments.map((environment) => environmentId(project.slug, environment.slug))).filter(({ ids }) => ids.every((id) => id.startsWith(`${project.slug}/`)));
|
|
311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [current.length === 0 && refused.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
292
312
|
className: "card",
|
|
293
313
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {
|
|
294
314
|
title: "No environments yet",
|
|
295
315
|
children: canManage ? "Add the first with Add environment." : "Creating environments needs environment.manage on this project."
|
|
296
316
|
})
|
|
297
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.
|
|
317
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("ul", {
|
|
298
318
|
className: "env-grid",
|
|
299
319
|
"aria-label": "Environments",
|
|
300
|
-
children: current.map((environment) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EnvironmentCard, {
|
|
320
|
+
children: [current.map((environment) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EnvironmentCard, {
|
|
301
321
|
project: project.slug,
|
|
302
322
|
environment,
|
|
303
323
|
isAdmin: canManage
|
|
304
|
-
}) }, `${project.slug}:${environment.slug}`))
|
|
324
|
+
}) }, `${project.slug}:${environment.slug}`)), refused.map(({ mutationId, vars, status }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
325
|
+
className: "env-card is-muted is-failed",
|
|
326
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
327
|
+
className: "env-card-text",
|
|
328
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
329
|
+
className: "env-card-name",
|
|
330
|
+
children: vars.name
|
|
331
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
332
|
+
className: "env-card-meta",
|
|
333
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
334
|
+
className: "mono",
|
|
335
|
+
children: vars.slug
|
|
336
|
+
})
|
|
337
|
+
})]
|
|
338
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemFailure, {
|
|
339
|
+
status,
|
|
340
|
+
onDismiss: () => dismiss(mutationId),
|
|
341
|
+
children: "Not added."
|
|
342
|
+
})]
|
|
343
|
+
}) }, mutationId))]
|
|
305
344
|
}), archived.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
306
345
|
"aria-labelledby": "archived-environments",
|
|
307
346
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
|
|
@@ -328,18 +367,19 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
328
367
|
const [slug, setSlug] = (0, import_react.useState)(environment.slug);
|
|
329
368
|
const [name, setName] = (0, import_react.useState)(environment.name);
|
|
330
369
|
const coffre = useCoffre();
|
|
331
|
-
const
|
|
370
|
+
const rename = useChange(renameEnvironment(coffre, project));
|
|
371
|
+
const archive = useChange(archiveEnvironment(coffre, project));
|
|
372
|
+
const { status, dismiss } = useChangeStatus(keys.projects);
|
|
373
|
+
const state = status(environmentId(project, environment.slug));
|
|
374
|
+
const pending = state.state === "pending";
|
|
332
375
|
const details = environment.details;
|
|
333
376
|
const isArchived = details !== null && details.archivedAt !== null;
|
|
334
377
|
const secretCount = details?.secretCount ?? null;
|
|
335
|
-
const opens = details !== null && !isArchived && environment.accessible;
|
|
378
|
+
const opens = details !== null && !isArchived && environment.accessible && !pending;
|
|
336
379
|
const manageable = isAdmin && details !== null;
|
|
337
380
|
const slugError = slug === "" ? null : slugProblem(slug);
|
|
338
|
-
(0, import_react.useEffect)(() => {
|
|
339
|
-
if (error !== null && !renaming) toast.error(error);
|
|
340
|
-
}, [error, renaming]);
|
|
341
381
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
342
|
-
className: `env-card${opens ? " is-link" : " is-muted"}`,
|
|
382
|
+
className: `env-card${opens ? " is-link" : " is-muted"} ${rowClass(state)}`,
|
|
343
383
|
children: [
|
|
344
384
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
345
385
|
className: "env-card-text",
|
|
@@ -362,7 +402,7 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
362
402
|
}), isArchived ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
363
403
|
className: "tag tag-red",
|
|
364
404
|
children: "archived"
|
|
365
|
-
}) : !environment.accessible ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
405
|
+
}) : !environment.accessible && !pending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
366
406
|
className: "tag tag-outline",
|
|
367
407
|
children: "no secret access"
|
|
368
408
|
}) : secretCount !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
@@ -372,13 +412,13 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
372
412
|
] })]
|
|
373
413
|
})]
|
|
374
414
|
}),
|
|
375
|
-
|
|
415
|
+
pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowPending, { status: state }),
|
|
416
|
+
manageable && !pending && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Root, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Trigger, {
|
|
376
417
|
asChild: true,
|
|
377
418
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
378
419
|
className: "act act-quiet env-card-menu",
|
|
379
420
|
"aria-label": `Actions for ${environment.slug}`,
|
|
380
|
-
|
|
381
|
-
children: pending ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MoreHorizontal, { size: 16 })
|
|
421
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MoreHorizontal, { size: 16 })
|
|
382
422
|
})
|
|
383
423
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
|
|
384
424
|
className: "menu",
|
|
@@ -404,10 +444,7 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
404
444
|
}) })] }),
|
|
405
445
|
manageable && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, {
|
|
406
446
|
open: renaming,
|
|
407
|
-
onOpenChange:
|
|
408
|
-
setRenaming(open);
|
|
409
|
-
if (!open) setError(null);
|
|
410
|
-
},
|
|
447
|
+
onOpenChange: setRenaming,
|
|
411
448
|
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
412
449
|
"Rename",
|
|
413
450
|
" ",
|
|
@@ -424,13 +461,12 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
424
461
|
className: "form",
|
|
425
462
|
onSubmit: (event) => {
|
|
426
463
|
event.preventDefault();
|
|
427
|
-
|
|
464
|
+
rename({
|
|
465
|
+
from: environment.slug,
|
|
428
466
|
slug,
|
|
429
|
-
name
|
|
430
|
-
}), () => {
|
|
431
|
-
setRenaming(false);
|
|
432
|
-
toast.success("Environment renamed");
|
|
467
|
+
name: name.trim()
|
|
433
468
|
});
|
|
469
|
+
setRenaming(false);
|
|
434
470
|
},
|
|
435
471
|
children: [
|
|
436
472
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
@@ -465,7 +501,6 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
465
501
|
onChange: (event) => setName(event.target.value)
|
|
466
502
|
})]
|
|
467
503
|
}),
|
|
468
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error }),
|
|
469
504
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
470
505
|
className: "dialog-actions",
|
|
471
506
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
@@ -473,11 +508,11 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
473
508
|
type: "button",
|
|
474
509
|
onClick: () => setRenaming(false),
|
|
475
510
|
children: "Cancel"
|
|
476
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.
|
|
511
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
477
512
|
className: "btn btn-primary",
|
|
478
513
|
type: "submit",
|
|
479
|
-
disabled:
|
|
480
|
-
children:
|
|
514
|
+
disabled: slug === "" || slugError !== null || name.trim() === "",
|
|
515
|
+
children: "Save"
|
|
481
516
|
})]
|
|
482
517
|
})
|
|
483
518
|
]
|
|
@@ -526,8 +561,15 @@ function EnvironmentCard({ project, environment, isAdmin }) {
|
|
|
526
561
|
] }),
|
|
527
562
|
confirmLabel: isArchived ? "Restore environment" : "Archive environment",
|
|
528
563
|
destructive: !isArchived,
|
|
529
|
-
onConfirm: () =>
|
|
530
|
-
|
|
564
|
+
onConfirm: () => archive({
|
|
565
|
+
slug: environment.slug,
|
|
566
|
+
archived: !isArchived
|
|
567
|
+
})
|
|
568
|
+
})] }),
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ItemFailure, {
|
|
570
|
+
status: state,
|
|
571
|
+
onDismiss: () => state.state === "failed" && dismiss(state.mutationId)
|
|
572
|
+
})
|
|
531
573
|
]
|
|
532
574
|
});
|
|
533
575
|
}
|
|
@@ -535,12 +577,10 @@ function NewEnvironment({ project }) {
|
|
|
535
577
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
536
578
|
const [slug, setSlug] = (0, import_react.useState)("");
|
|
537
579
|
const [name, setName] = (0, import_react.useState)("");
|
|
538
|
-
const
|
|
539
|
-
const { pending, error, setError, run } = useAction();
|
|
580
|
+
const create = useChange(createEnvironment(useCoffre(), project));
|
|
540
581
|
const slugError = slug === "" ? null : slugProblem(slug);
|
|
541
582
|
function close() {
|
|
542
583
|
setOpen(false);
|
|
543
|
-
setError(null);
|
|
544
584
|
}
|
|
545
585
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
546
586
|
className: "btn btn-primary",
|
|
@@ -557,15 +597,13 @@ function NewEnvironment({ project }) {
|
|
|
557
597
|
className: "form",
|
|
558
598
|
onSubmit: (event) => {
|
|
559
599
|
event.preventDefault();
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
}, () => {
|
|
564
|
-
toast.success(`Environment ${slug} added`);
|
|
565
|
-
setSlug("");
|
|
566
|
-
setName("");
|
|
567
|
-
close();
|
|
600
|
+
create({
|
|
601
|
+
slug,
|
|
602
|
+
name: name.trim()
|
|
568
603
|
});
|
|
604
|
+
setSlug("");
|
|
605
|
+
setName("");
|
|
606
|
+
close();
|
|
569
607
|
},
|
|
570
608
|
children: [
|
|
571
609
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
@@ -615,7 +653,6 @@ function NewEnvironment({ project }) {
|
|
|
615
653
|
onChange: (event) => setName(event.target.value)
|
|
616
654
|
})]
|
|
617
655
|
}),
|
|
618
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error }),
|
|
619
656
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
620
657
|
className: "dialog-actions",
|
|
621
658
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
@@ -623,11 +660,11 @@ function NewEnvironment({ project }) {
|
|
|
623
660
|
type: "button",
|
|
624
661
|
onClick: close,
|
|
625
662
|
children: "Cancel"
|
|
626
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.
|
|
663
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
627
664
|
className: "btn btn-primary",
|
|
628
665
|
type: "submit",
|
|
629
|
-
disabled:
|
|
630
|
-
children:
|
|
666
|
+
disabled: slug === "" || slugError !== null || name.trim() === "",
|
|
667
|
+
children: "Add environment"
|
|
631
668
|
})]
|
|
632
669
|
})
|
|
633
670
|
]
|
|
@@ -636,22 +673,23 @@ function NewEnvironment({ project }) {
|
|
|
636
673
|
}
|
|
637
674
|
function AccessPanel({ principalType, project, grants }) {
|
|
638
675
|
const people = principalType === "user";
|
|
676
|
+
const refused = useRefusedGrants(project, grants, principalType);
|
|
639
677
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {
|
|
640
678
|
className: "card",
|
|
641
679
|
"aria-label": people ? "Users with access" : "Tokens with access",
|
|
642
|
-
children: grants.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyState, {
|
|
680
|
+
children: grants.length === 0 && refused.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(EmptyState, {
|
|
643
681
|
title: people ? "No user has access" : "No token has access",
|
|
644
682
|
children: [
|
|
645
683
|
"Add ",
|
|
646
684
|
people ? "a user" : "a token",
|
|
647
685
|
" with permissions on the whole project or on one environment."
|
|
648
686
|
]
|
|
649
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime.
|
|
687
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(GrantsTable, {
|
|
650
688
|
lead: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
651
689
|
className: "th",
|
|
652
690
|
children: [people ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(User, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 14 }), people ? "Email" : "Name"]
|
|
653
691
|
}),
|
|
654
|
-
children: grants.map((grant, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GrantRowView, {
|
|
692
|
+
children: [grants.map((grant, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GrantRowView, {
|
|
655
693
|
number: index + 1,
|
|
656
694
|
project,
|
|
657
695
|
grant,
|
|
@@ -660,23 +698,21 @@ function AccessPanel({ principalType, project, grants }) {
|
|
|
660
698
|
type: grant.principalType,
|
|
661
699
|
id: grant.principalId
|
|
662
700
|
})
|
|
663
|
-
}, grant.
|
|
701
|
+
}, grantId(grant))), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RefusedGrants, { refused })]
|
|
664
702
|
})
|
|
665
703
|
});
|
|
666
704
|
}
|
|
667
705
|
function NewGrant({ principalType, project, environments, grants }) {
|
|
668
|
-
const { capabilities } =
|
|
706
|
+
const { capabilities } = useShell();
|
|
669
707
|
const [open, setOpen] = (0, import_react.useState)(false);
|
|
670
708
|
const [principalId, setPrincipalId] = (0, import_react.useState)("");
|
|
671
709
|
const [permission, setPermission] = (0, import_react.useState)("viewer:");
|
|
672
710
|
const [expiresAt, setExpiresAt] = (0, import_react.useState)("");
|
|
673
|
-
const
|
|
674
|
-
const { pending, error, setError, run } = useAction();
|
|
711
|
+
const grant = useChange(grantAccess(useCoffre(), project));
|
|
675
712
|
const permissionOptions = projectAccessOptions(environments);
|
|
676
713
|
const kind = principalType === "user" ? "user" : "token";
|
|
677
714
|
function close() {
|
|
678
715
|
setOpen(false);
|
|
679
|
-
setError(null);
|
|
680
716
|
}
|
|
681
717
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
682
718
|
className: "btn btn-primary",
|
|
@@ -705,21 +741,18 @@ function NewGrant({ principalType, project, environments, grants }) {
|
|
|
705
741
|
onSubmit: (event) => {
|
|
706
742
|
event.preventDefault();
|
|
707
743
|
const access = parseProjectAccess(permission);
|
|
708
|
-
|
|
709
|
-
project,
|
|
744
|
+
grant({
|
|
710
745
|
principalType,
|
|
711
746
|
principalId: principalId.trim(),
|
|
712
747
|
role: access.role,
|
|
748
|
+
roleName: permissionOptions.find((option) => option.value === permission)?.label ?? access.role,
|
|
713
749
|
environmentSlug: access.environmentSlug,
|
|
714
750
|
expiresAt: expiresAt === "" ? null : (/* @__PURE__ */ new Date(`${expiresAt}T23:59:59Z`)).toISOString()
|
|
715
|
-
}), ({ existed }) => {
|
|
716
|
-
const label = permissionOptions.find((option) => option.value === permission)?.label ?? "access";
|
|
717
|
-
toast.success(existed ? `${principalId} already has ${label}` : `${principalId} granted ${label.toLowerCase()}`);
|
|
718
|
-
setPrincipalId("");
|
|
719
|
-
setExpiresAt("");
|
|
720
|
-
setPermission("viewer:");
|
|
721
|
-
close();
|
|
722
751
|
});
|
|
752
|
+
setPrincipalId("");
|
|
753
|
+
setExpiresAt("");
|
|
754
|
+
setPermission("viewer:");
|
|
755
|
+
close();
|
|
723
756
|
},
|
|
724
757
|
children: [
|
|
725
758
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrincipalPicker, {
|
|
@@ -762,7 +795,6 @@ function NewGrant({ principalType, project, environments, grants }) {
|
|
|
762
795
|
})]
|
|
763
796
|
})]
|
|
764
797
|
}),
|
|
765
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error }),
|
|
766
798
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
767
799
|
className: "dialog-actions",
|
|
768
800
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
@@ -770,11 +802,11 @@ function NewGrant({ principalType, project, environments, grants }) {
|
|
|
770
802
|
type: "button",
|
|
771
803
|
onClick: close,
|
|
772
804
|
children: "Cancel"
|
|
773
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.
|
|
805
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
774
806
|
className: "btn btn-primary",
|
|
775
807
|
type: "submit",
|
|
776
|
-
disabled:
|
|
777
|
-
children:
|
|
808
|
+
disabled: principalId.trim() === "",
|
|
809
|
+
children: "Grant access"
|
|
778
810
|
})]
|
|
779
811
|
})
|
|
780
812
|
]
|
|
@@ -816,13 +848,16 @@ function GeneralSettings({ project }) {
|
|
|
816
848
|
run(() => coffre.projects.update(project.slug, {
|
|
817
849
|
slug,
|
|
818
850
|
name
|
|
819
|
-
}),
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
851
|
+
}), {
|
|
852
|
+
affects: affects.places(),
|
|
853
|
+
onSuccess: async () => {
|
|
854
|
+
toast.success("Project renamed");
|
|
855
|
+
if (slug !== project.slug) await router.navigate({
|
|
856
|
+
to: "/projects/$project",
|
|
857
|
+
params: { project: slug },
|
|
858
|
+
search: { tab: "settings" }
|
|
859
|
+
});
|
|
860
|
+
}
|
|
826
861
|
});
|
|
827
862
|
},
|
|
828
863
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
@@ -924,7 +959,10 @@ function DangerZone({ project }) {
|
|
|
924
959
|
] }),
|
|
925
960
|
confirmLabel: isArchived ? "Restore project" : "Archive project",
|
|
926
961
|
destructive: !isArchived,
|
|
927
|
-
onConfirm: () => run(() => coffre.projects.update(project.slug, { archived: !isArchived }),
|
|
962
|
+
onConfirm: () => run(() => coffre.projects.update(project.slug, { archived: !isArchived }), {
|
|
963
|
+
affects: affects.places(),
|
|
964
|
+
onSuccess: () => toast.success(isArchived ? `${project.slug} restored` : `${project.slug} archived`)
|
|
965
|
+
})
|
|
928
966
|
})]
|
|
929
967
|
});
|
|
930
968
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as createFileRoute, t as lazyRouteComponent } from "./lazyRouteComponent-CqBNCGuZ.js";
|
|
2
|
+
import { d as loadProject } from "./page-BGeDoQO5.js";
|
|
3
3
|
//#region src/routes/projects.$project.index.tsx
|
|
4
|
-
var $$splitComponentImporter = () => import("./projects._project.index-
|
|
4
|
+
var $$splitComponentImporter = () => import("./projects._project.index-CAxBU4tY.js");
|
|
5
5
|
var Route = createFileRoute("/projects/$project/")({
|
|
6
6
|
validateSearch: (search) => ({ tab: search.tab === "users" || search.tab === "tokens" || search.tab === "settings" ? search.tab : void 0 }),
|
|
7
|
-
loader: ({ context: { client }, params }) => loadProject(client, params.project),
|
|
7
|
+
loader: ({ context: { client, queryClient }, params }) => loadProject(queryClient, client, params.project),
|
|
8
8
|
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
9
9
|
});
|
|
10
|
+
/** A project whose access you manage, with its grants. */
|
|
10
11
|
/**
|
|
11
12
|
* One environment. The whole card opens it when you can; its menu sits above
|
|
12
13
|
* that link.
|