@coffre/ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +8 -2
- package/dist/client/.assetsignore +2 -0
- package/dist/client/_coffre/assets/account-C3Zo1l5A.js +1 -0
- package/dist/client/_coffre/assets/account-C4bNbeO7.js +2 -0
- package/dist/client/_coffre/assets/affordances-DiuJIiR2.js +1 -0
- package/dist/client/_coffre/assets/audit-1xLyuxGz.js +2 -0
- package/dist/client/_coffre/assets/audit-Dab2GuRj.js +1 -0
- package/dist/client/_coffre/assets/auth.device-BfCfeBWe.js +2 -0
- package/dist/client/_coffre/assets/auth.device-D2pCLF-X.js +1 -0
- package/dist/client/_coffre/assets/coffre-C7qL3HGR.js +1 -0
- package/dist/client/_coffre/assets/directory-C2Ou4SQv.js +1 -0
- package/dist/client/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
- package/dist/client/_coffre/assets/grants-fqTtJ-aW.js +1 -0
- package/dist/client/_coffre/assets/index-BpGwbjmM.js +12 -0
- 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/login-CR9CBXlw.js +2 -0
- package/dist/client/_coffre/assets/login-DZizFxa4.js +1 -0
- package/dist/client/_coffre/assets/offboarding-DOLJQcXU.js +1 -0
- package/dist/client/_coffre/assets/page-BxW2MwaX.js +1 -0
- package/dist/client/_coffre/assets/preload-helper-BHuP8_FL.js +46 -0
- package/dist/client/_coffre/assets/principal-page-xnBZVURr.js +1 -0
- package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +1 -0
- package/dist/client/_coffre/assets/projects._project._environment-CrWjQmIA.js +2 -0
- package/dist/client/_coffre/assets/projects._project._environment-CwRVG9Ne.js +3 -0
- package/dist/client/_coffre/assets/projects._project.index-CCDEuE-z.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-DCJsmnD7.js +1 -0
- package/dist/client/_coffre/assets/projects.index-B8eV8JIn.js +1 -0
- package/dist/client/_coffre/assets/projects.index-BNEC7Oz8.js +2 -0
- package/dist/client/_coffre/assets/settings-2BPsenNM.js +2 -0
- package/dist/client/_coffre/assets/settings-BrS0-wEt.js +1 -0
- package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +1 -0
- package/dist/client/_coffre/assets/tokens._token-B3-YwuKp.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-D_hsbHx6.js +1 -0
- package/dist/client/_coffre/assets/tokens.index-BdKE2Jv8.js +2 -0
- package/dist/client/_coffre/assets/tokens.index-XvA4XRxh.js +1 -0
- package/dist/client/_coffre/assets/unregistered-CTRMtBIy.js +1 -0
- package/dist/client/_coffre/assets/use-action-DgAf-tiX.js +1 -0
- package/dist/client/_coffre/assets/users._user-BFPXcJ4y.js +2 -0
- package/dist/client/_coffre/assets/users._user-DEtMeSoh.js +1 -0
- package/dist/client/_coffre/assets/users.index-B03beUHq.js +1 -0
- package/dist/client/_coffre/assets/users.index-D8hwzM6P.js +2 -0
- package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/server/.vite/manifest.json +572 -0
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-B6CZDfrB.js +133 -0
- package/dist/server/_coffre/assets/account-B71_b5xc.js +296 -0
- package/dist/server/_coffre/assets/account-BoO6ZqMc.js +176 -0
- package/dist/server/_coffre/assets/affordances-BNaXjMOb.js +46 -0
- package/dist/server/_coffre/assets/async-local-storage-C0cwgkEr.js +3107 -0
- package/dist/server/_coffre/assets/audit-CwRFnSAY.js +74 -0
- package/dist/server/_coffre/assets/audit-t1sYjtrf.js +964 -0
- package/dist/server/_coffre/assets/auth.device-1IcJ475s.js +208 -0
- package/dist/server/_coffre/assets/auth.device-CJwZYYtn.js +29 -0
- package/dist/server/_coffre/assets/coffre-1hxT2E_U.js +278 -0
- package/dist/server/_coffre/assets/directory-wm_JQUfk.js +396 -0
- package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +5 -0
- package/dist/server/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
- package/dist/server/_coffre/assets/grants-BmhEY1vz.js +243 -0
- 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/login-B5O5LPXV.js +100 -0
- package/dist/server/_coffre/assets/login-Bvc4gp0X.js +22 -0
- package/dist/server/_coffre/assets/offboarding-CvSilnSm.js +330 -0
- package/dist/server/_coffre/assets/page-BjXk0Ehu.js +2003 -0
- package/dist/server/_coffre/assets/principal-page-DkwNGzM2.js +617 -0
- package/dist/server/_coffre/assets/project-environments-lEzFHUt4.js +9 -0
- package/dist/server/_coffre/assets/projects._project._environment-7grhqlgq.js +2227 -0
- package/dist/server/_coffre/assets/projects._project._environment-ByEf6pmz.js +55 -0
- package/dist/server/_coffre/assets/projects._project.index-B1bjowP-.js +932 -0
- package/dist/server/_coffre/assets/projects._project.index-DU8wtoHD.js +22 -0
- package/dist/server/_coffre/assets/projects.index-B0DoHbCz.js +280 -0
- package/dist/server/_coffre/assets/projects.index-kMDA6pMy.js +54 -0
- package/dist/server/_coffre/assets/react-dom-qCTiwGGR.js +1352 -0
- package/dist/server/_coffre/assets/router-ChU_CwCX.js +2028 -0
- package/dist/server/_coffre/assets/settings-CM9-h7in.js +18 -0
- package/dist/server/_coffre/assets/settings-Cg5qOGij.js +60 -0
- package/dist/server/_coffre/assets/signin-errors-BEFlVDbQ.js +28 -0
- package/dist/server/_coffre/assets/start-DR3rN0St.js +4 -0
- package/dist/server/_coffre/assets/tokens._token-CCpaPMAk.js +268 -0
- package/dist/server/_coffre/assets/tokens._token-Di4OZdAA.js +18 -0
- package/dist/server/_coffre/assets/tokens.index-Do3OHR31.js +34 -0
- package/dist/server/_coffre/assets/tokens.index-tDKq4AFh.js +10 -0
- package/dist/server/_coffre/assets/ui-BNzhIAQP.js +15710 -0
- package/dist/server/_coffre/assets/unregistered-BqaWYFJK.js +51 -0
- package/dist/server/_coffre/assets/use-action-BkJXC5JM.js +953 -0
- package/dist/server/_coffre/assets/useStore-DWGPqzXR.js +892 -0
- package/dist/server/_coffre/assets/users._user-BenYva93.js +15 -0
- package/dist/server/_coffre/assets/users._user-Cp039Va-.js +10 -0
- package/dist/server/_coffre/assets/users.index-BrzG1Ecq.js +10 -0
- package/dist/server/_coffre/assets/users.index-DQ_45DQl.js +34 -0
- package/dist/server/_coffre/assets/validation-BQtqPe2V.js +27 -0
- package/dist/server/index.js +13910 -0
- package/package.json +58 -3
- package/src/components/affordances.ts +80 -0
- package/src/components/agentation.tsx +34 -0
- package/src/components/command-palette.tsx +271 -0
- package/src/components/directory.tsx +448 -0
- package/src/components/grants.tsx +204 -0
- package/src/components/icons.tsx +283 -0
- package/src/components/offboarding.tsx +286 -0
- package/src/components/page.tsx +128 -0
- package/src/components/principal-page.tsx +549 -0
- package/src/components/principal-picker.tsx +168 -0
- package/src/components/principal.tsx +53 -0
- package/src/components/route-states.tsx +60 -0
- package/src/components/service-tokens.tsx +212 -0
- package/src/components/shell.tsx +641 -0
- package/src/components/syncs.tsx +581 -0
- package/src/components/theme.tsx +141 -0
- package/src/components/tile.tsx +22 -0
- package/src/components/ui.tsx +440 -0
- package/src/entry.ts +19 -0
- package/src/lib/access-plan.ts +201 -0
- package/src/lib/audit-sentences.ts +468 -0
- package/src/lib/capabilities.ts +45 -0
- package/src/lib/coffre.ts +57 -0
- package/src/lib/project-access.ts +95 -0
- package/src/lib/project-environments.ts +23 -0
- package/src/lib/reveal.ts +21 -0
- package/src/lib/secret-edit-batch.ts +181 -0
- package/src/lib/signin-errors.ts +33 -0
- package/src/lib/use-action.ts +50 -0
- package/src/lib/validation.ts +27 -0
- package/src/routeTree.gen.ts +367 -0
- package/src/router.tsx +84 -0
- package/src/routes/__root.tsx +192 -0
- package/src/routes/access.tsx +11 -0
- package/src/routes/account.tsx +359 -0
- package/src/routes/audit.tsx +545 -0
- package/src/routes/auth.device.tsx +200 -0
- package/src/routes/index.tsx +15 -0
- package/src/routes/login.tsx +129 -0
- package/src/routes/projects.$project.$environment.tsx +1659 -0
- package/src/routes/projects.$project.index.tsx +917 -0
- package/src/routes/projects.index.tsx +353 -0
- package/src/routes/settings.tsx +72 -0
- package/src/routes/tokens.$token.tsx +35 -0
- package/src/routes/tokens.index.tsx +37 -0
- package/src/routes/unregistered.tsx +59 -0
- package/src/routes/users.$user.tsx +13 -0
- package/src/routes/users.index.tsx +37 -0
- package/src/shared/models.ts +55 -0
- package/src/styles/globals.css +4118 -0
- package/src/types.ts +21 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { C as lazyRouteComponent, w as createFileRoute } from "./ui-BNzhIAQP.js";
|
|
2
|
+
import { i as loadProject } from "./grants-BmhEY1vz.js";
|
|
3
|
+
//#region src/routes/projects.$project.index.tsx
|
|
4
|
+
var $$splitComponentImporter = () => import("./projects._project.index-B1bjowP-.js");
|
|
5
|
+
var Route = createFileRoute("/projects/$project/")({
|
|
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),
|
|
8
|
+
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* One environment. The whole card opens it when you can; its menu sits above
|
|
12
|
+
* that link.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The project's name and slug, as a form on the page.
|
|
16
|
+
*
|
|
17
|
+
* Renaming changes paths other people and scripts use, so it is laid out in
|
|
18
|
+
* plain sight with what it does and does not affect, rather than tucked
|
|
19
|
+
* behind a menu.
|
|
20
|
+
*/
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Route as t };
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { C as require_react, E as __toESM, o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
|
|
2
|
+
import { E as Link, a as ErrorLine, c as Spinner, i as EmptyState, o as Modal } from "./ui-BNzhIAQP.js";
|
|
3
|
+
import { R as Plus, a as Tile, b as Hash, c as AlertTriangle, i as PageHeader, n as ClosedDoor, v as Folder, w as Layers } from "./page-BjXk0Ehu.js";
|
|
4
|
+
import { s as useCoffre, t as Refusal } from "./coffre-1hxT2E_U.js";
|
|
5
|
+
import { r as toast, t as useAction } from "./use-action-BkJXC5JM.js";
|
|
6
|
+
import { n as ProjectEmptyStateCopy, r as RootAdminOnly } from "./affordances-BNaXjMOb.js";
|
|
7
|
+
import { n as isActiveAccessibleEnvironment } from "./project-environments-lEzFHUt4.js";
|
|
8
|
+
import { t as Route } from "./projects.index-kMDA6pMy.js";
|
|
9
|
+
import { n as slugProblem } from "./validation-BQtqPe2V.js";
|
|
10
|
+
//#region src/routes/projects.index.tsx?tsr-split=component
|
|
11
|
+
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
12
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
13
|
+
/**
|
|
14
|
+
* Distinct secret names per project, across the environments you can open.
|
|
15
|
+
*
|
|
16
|
+
* The project summary only counts secrets per environment, and the same key
|
|
17
|
+
* in dev and prod is one secret, not two. So this lists the keys of every
|
|
18
|
+
* environment you can open and counts the names. Listing keys reads no value
|
|
19
|
+
* and writes no audit row. Environments you cannot open are not asked: the
|
|
20
|
+
* refusal would be audited.
|
|
21
|
+
*
|
|
22
|
+
* A project whose keys could not all be listed gets no count rather than a
|
|
23
|
+
* short one.
|
|
24
|
+
*/
|
|
25
|
+
function ProjectsPage() {
|
|
26
|
+
const { result, secrets } = Route.useLoaderData();
|
|
27
|
+
if (!result.ok) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
|
|
28
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTriangle, { size: 18 }),
|
|
29
|
+
title: "Projects could not be listed",
|
|
30
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
31
|
+
className: "btn",
|
|
32
|
+
to: "/login",
|
|
33
|
+
children: "Sign in again"
|
|
34
|
+
}),
|
|
35
|
+
children: result.error
|
|
36
|
+
});
|
|
37
|
+
const active = result.projects.filter((project) => project.archivedAt === null);
|
|
38
|
+
const archived = result.projects.filter((project) => project.archivedAt !== null);
|
|
39
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
40
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageHeader, {
|
|
41
|
+
title: "Projects",
|
|
42
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RootAdminOnly, {
|
|
43
|
+
capabilities: result.capabilities,
|
|
44
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(NewProject, {})
|
|
45
|
+
})
|
|
46
|
+
}),
|
|
47
|
+
active.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
48
|
+
className: "card",
|
|
49
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {
|
|
50
|
+
title: "Nothing here for you yet",
|
|
51
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectEmptyStateCopy, {
|
|
52
|
+
capabilities: result.capabilities,
|
|
53
|
+
hasArchivedProjects: archived.length > 0
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {
|
|
57
|
+
className: "card",
|
|
58
|
+
"aria-label": "Projects",
|
|
59
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectTable, {
|
|
60
|
+
projects: active,
|
|
61
|
+
secrets
|
|
62
|
+
})
|
|
63
|
+
}),
|
|
64
|
+
archived.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
65
|
+
"aria-labelledby": "archived-projects",
|
|
66
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", {
|
|
67
|
+
className: "section-title",
|
|
68
|
+
id: "archived-projects",
|
|
69
|
+
children: "Archived"
|
|
70
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
71
|
+
className: "card",
|
|
72
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectTable, {
|
|
73
|
+
projects: archived,
|
|
74
|
+
secrets
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
77
|
+
})
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
function ProjectTable({ projects, secrets }) {
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
82
|
+
className: "dt-wrap",
|
|
83
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
84
|
+
className: "dt projects stacks",
|
|
85
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
87
|
+
className: "n",
|
|
88
|
+
children: "#"
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
91
|
+
className: "col-project",
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
93
|
+
className: "th",
|
|
94
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Folder, { size: 14 }), "Project"]
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
98
|
+
className: "th",
|
|
99
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Layers, { size: 14 }), "Environments"]
|
|
100
|
+
}) }),
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
102
|
+
className: "col-shrink col-secrets",
|
|
103
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
104
|
+
className: "th",
|
|
105
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Hash, { size: 14 }), "Secrets"]
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: projects.map((project, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProjectRow, {
|
|
109
|
+
number: index + 1,
|
|
110
|
+
project,
|
|
111
|
+
secrets: secrets[project.slug] ?? null
|
|
112
|
+
}, project.slug)) })]
|
|
113
|
+
})
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* One project. The whole row opens it; the environment links inside it sit
|
|
118
|
+
* above that and go straight to the environment.
|
|
119
|
+
*/
|
|
120
|
+
function ProjectRow({ number, project, secrets }) {
|
|
121
|
+
const isArchived = project.archivedAt !== null;
|
|
122
|
+
const listedEnvironments = project.environments.filter((environment) => environment.details === null || environment.details.archivedAt === null);
|
|
123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
|
|
124
|
+
className: "row-link",
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
127
|
+
className: "n",
|
|
128
|
+
children: number
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
131
|
+
className: "col-project",
|
|
132
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
133
|
+
className: "cell-project",
|
|
134
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tile, { name: project.slug }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
135
|
+
className: "cell-stack",
|
|
136
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
137
|
+
className: "cell-link stretch",
|
|
138
|
+
to: "/projects/$project",
|
|
139
|
+
params: { project: project.slug },
|
|
140
|
+
children: project.name
|
|
141
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
|
|
142
|
+
className: "mono",
|
|
143
|
+
children: project.slug
|
|
144
|
+
})]
|
|
145
|
+
})]
|
|
146
|
+
})
|
|
147
|
+
}),
|
|
148
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
149
|
+
className: "col-envs",
|
|
150
|
+
"data-label": "Environments",
|
|
151
|
+
children: isArchived || listedEnvironments.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
152
|
+
className: "cell-muted",
|
|
153
|
+
children: listedEnvironments.length === 0 ? "No environments yet" : `${listedEnvironments.length} environment${listedEnvironments.length === 1 ? "" : "s"}`
|
|
154
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
155
|
+
className: "env-links",
|
|
156
|
+
"aria-label": `Environments in ${project.slug}`,
|
|
157
|
+
children: listedEnvironments.map((environment) => isActiveAccessibleEnvironment(environment) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
|
|
158
|
+
className: "env-link",
|
|
159
|
+
to: "/projects/$project/$environment",
|
|
160
|
+
params: {
|
|
161
|
+
project: project.slug,
|
|
162
|
+
environment: environment.slug
|
|
163
|
+
},
|
|
164
|
+
children: [environment.slug, /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
165
|
+
className: "count",
|
|
166
|
+
children: environment.details.secretCount
|
|
167
|
+
})]
|
|
168
|
+
}, environment.slug) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
169
|
+
className: "env-link",
|
|
170
|
+
title: "You can see this environment exists, but not open it",
|
|
171
|
+
children: environment.slug
|
|
172
|
+
}, environment.slug))
|
|
173
|
+
})
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
176
|
+
className: "col-secrets num nowrap",
|
|
177
|
+
children: secrets !== null && !isArchived ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [secrets, /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
178
|
+
className: "narrow-only",
|
|
179
|
+
children: [" secret", secrets === 1 ? "" : "s"]
|
|
180
|
+
})] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
181
|
+
className: "cell-muted wide-only",
|
|
182
|
+
children: "—"
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
function NewProject() {
|
|
189
|
+
const [slug, setSlug] = (0, import_react.useState)("");
|
|
190
|
+
const [name, setName] = (0, import_react.useState)("");
|
|
191
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
192
|
+
const coffre = useCoffre();
|
|
193
|
+
const { pending, error, setError, run } = useAction();
|
|
194
|
+
const slugError = slug === "" ? null : slugProblem(slug);
|
|
195
|
+
function close() {
|
|
196
|
+
setOpen(false);
|
|
197
|
+
setError(null);
|
|
198
|
+
}
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
200
|
+
className: "btn btn-primary",
|
|
201
|
+
onClick: () => setOpen(true),
|
|
202
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { size: 14 }), "New project"]
|
|
203
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, {
|
|
204
|
+
open,
|
|
205
|
+
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
206
|
+
title: "New project",
|
|
207
|
+
description: "A project holds environments, and access is granted on it or on one of its environments. You become its owner.",
|
|
208
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
209
|
+
className: "form",
|
|
210
|
+
onSubmit: (event) => {
|
|
211
|
+
event.preventDefault();
|
|
212
|
+
run(async () => {
|
|
213
|
+
const { created } = await coffre.projects.create(slug, { name });
|
|
214
|
+
if (!created) throw new Refusal(`A project named "${slug}" already exists.`);
|
|
215
|
+
}, () => {
|
|
216
|
+
toast.success(`Project ${slug} created`);
|
|
217
|
+
setSlug("");
|
|
218
|
+
setName("");
|
|
219
|
+
setOpen(false);
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
children: [
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
224
|
+
className: "field",
|
|
225
|
+
children: [
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
227
|
+
className: "label",
|
|
228
|
+
children: "Slug"
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
231
|
+
className: "input input-mono",
|
|
232
|
+
autoFocus: true,
|
|
233
|
+
spellCheck: false,
|
|
234
|
+
autoComplete: "off",
|
|
235
|
+
placeholder: "market",
|
|
236
|
+
value: slug,
|
|
237
|
+
"aria-invalid": slugError !== null,
|
|
238
|
+
"aria-describedby": "new-project-slug-hint",
|
|
239
|
+
onChange: (event) => setSlug(event.target.value)
|
|
240
|
+
}),
|
|
241
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
242
|
+
className: `hint${slugError !== null ? " edit-note-error" : ""}`,
|
|
243
|
+
id: "new-project-slug-hint",
|
|
244
|
+
children: slugError ?? "Used in paths, as in market/prod. Renaming it later is safe."
|
|
245
|
+
})
|
|
246
|
+
]
|
|
247
|
+
}),
|
|
248
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
249
|
+
className: "field",
|
|
250
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
251
|
+
className: "label",
|
|
252
|
+
children: "Display name"
|
|
253
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
254
|
+
className: "input",
|
|
255
|
+
placeholder: "Market data platform",
|
|
256
|
+
value: name,
|
|
257
|
+
onChange: (event) => setName(event.target.value)
|
|
258
|
+
})]
|
|
259
|
+
}),
|
|
260
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error }),
|
|
261
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
262
|
+
className: "dialog-actions",
|
|
263
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
264
|
+
className: "btn",
|
|
265
|
+
type: "button",
|
|
266
|
+
onClick: close,
|
|
267
|
+
children: "Cancel"
|
|
268
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
269
|
+
className: "btn btn-primary",
|
|
270
|
+
type: "submit",
|
|
271
|
+
disabled: pending || slug === "" || slugError !== null || name.trim() === "",
|
|
272
|
+
children: [pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), "Create project"]
|
|
273
|
+
})]
|
|
274
|
+
})
|
|
275
|
+
]
|
|
276
|
+
})
|
|
277
|
+
})] });
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
export { ProjectsPage as component };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { C as lazyRouteComponent, w as createFileRoute } from "./ui-BNzhIAQP.js";
|
|
2
|
+
import { o as uiResult } from "./coffre-1hxT2E_U.js";
|
|
3
|
+
import { s as deriveUiCapabilities } from "./affordances-BNaXjMOb.js";
|
|
4
|
+
import { n as isActiveAccessibleEnvironment } from "./project-environments-lEzFHUt4.js";
|
|
5
|
+
//#region src/routes/projects.index.tsx
|
|
6
|
+
var $$splitComponentImporter = () => import("./projects.index-B0DoHbCz.js");
|
|
7
|
+
var Route = createFileRoute("/projects/")({
|
|
8
|
+
loader: async ({ context: { client } }) => {
|
|
9
|
+
const result = await uiResult(async () => {
|
|
10
|
+
const [me, { projects }] = await Promise.all([client.me(), client.projects.list()]);
|
|
11
|
+
return {
|
|
12
|
+
projects,
|
|
13
|
+
capabilities: deriveUiCapabilities(me, projects)
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
result,
|
|
18
|
+
secrets: result.ok ? await countSecrets(client, result.projects) : {}
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Distinct secret names per project, across the environments you can open.
|
|
25
|
+
*
|
|
26
|
+
* The project summary only counts secrets per environment, and the same key
|
|
27
|
+
* in dev and prod is one secret, not two. So this lists the keys of every
|
|
28
|
+
* environment you can open and counts the names. Listing keys reads no value
|
|
29
|
+
* and writes no audit row. Environments you cannot open are not asked: the
|
|
30
|
+
* refusal would be audited.
|
|
31
|
+
*
|
|
32
|
+
* A project whose keys could not all be listed gets no count rather than a
|
|
33
|
+
* short one.
|
|
34
|
+
*/
|
|
35
|
+
async function countSecrets(client, projects) {
|
|
36
|
+
const counts = await Promise.all(projects.filter((project) => project.archivedAt === null).map(async (project) => {
|
|
37
|
+
const environments = project.environments.filter(isActiveAccessibleEnvironment);
|
|
38
|
+
if (environments.length === 0) return [project.slug, null];
|
|
39
|
+
const lists = await Promise.all(environments.map((environment) => uiResult(() => client.secrets.list(`${project.slug}/${environment.slug}`))));
|
|
40
|
+
const names = /* @__PURE__ */ new Set();
|
|
41
|
+
for (const list of lists) {
|
|
42
|
+
if (!list.ok) return [project.slug, null];
|
|
43
|
+
for (const key of list.keys) if (!key.archived) names.add(key.key);
|
|
44
|
+
}
|
|
45
|
+
return [project.slug, names.size];
|
|
46
|
+
}));
|
|
47
|
+
return Object.fromEntries(counts);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* One project. The whole row opens it; the environment links inside it sit
|
|
51
|
+
* above that and go straight to the environment.
|
|
52
|
+
*/
|
|
53
|
+
//#endregion
|
|
54
|
+
export { Route as t };
|