@coffre/ui 0.6.1 → 0.7.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/dist/chunks/{audit-sentence-CUUMshIp.js → audit-sentence-C1_gRxWW.js} +91 -26
- package/dist/chunks/audit-sentence-C1_gRxWW.js.map +1 -0
- package/dist/chunks/{connected-apps-DTpatjge.js → connected-apps-Bn5rEoV2.js} +4 -4
- package/dist/chunks/{connected-apps-DTpatjge.js.map → connected-apps-Bn5rEoV2.js.map} +1 -1
- package/dist/chunks/{delete-place-SOOYVt6A.js → delete-place-CQCDHkne.js} +4 -4
- package/dist/chunks/{delete-place-SOOYVt6A.js.map → delete-place-CQCDHkne.js.map} +1 -1
- package/dist/chunks/{directory-DrtdKny2.js → directory-BQNOdze_.js} +22 -19
- package/dist/chunks/directory-BQNOdze_.js.map +1 -0
- package/dist/chunks/{folders-hR2Lnk0k.js → folders-Dw240WMJ.js} +2 -2
- package/dist/chunks/{folders-hR2Lnk0k.js.map → folders-Dw240WMJ.js.map} +1 -1
- package/dist/chunks/{grants-DDBui9YD.js → grants-CJIBrkod.js} +5 -5
- package/dist/chunks/{grants-DDBui9YD.js.map → grants-CJIBrkod.js.map} +1 -1
- package/dist/chunks/multi-combobox-CsIXihuc.js +99 -0
- package/dist/chunks/multi-combobox-CsIXihuc.js.map +1 -0
- package/dist/chunks/{offboarding-C7ECW5o0.js → offboarding-CrgwaetA.js} +4 -4
- package/dist/chunks/offboarding-CrgwaetA.js.map +1 -0
- package/dist/chunks/personal-tokens-B8rkT-DI.js +138 -0
- package/dist/chunks/personal-tokens-B8rkT-DI.js.map +1 -0
- package/dist/chunks/{principal-page-CB6dAABC.js → principal-page-DDmmV1KQ.js} +37 -27
- package/dist/chunks/principal-page-DDmmV1KQ.js.map +1 -0
- package/dist/chunks/{project-page-BHNUvr2L.js → project-page-BI--vjt3.js} +2 -2
- package/dist/chunks/{project-page-BHNUvr2L.js.map → project-page-BI--vjt3.js.map} +1 -1
- package/dist/chunks/{queries-DgQo3mC-.js → queries-epz4MIuW.js} +103 -18
- package/dist/chunks/queries-epz4MIuW.js.map +1 -0
- package/dist/chunks/{references-BQc35Q9g.js → references-DImfw0cz.js} +4 -4
- package/dist/chunks/{references-BQc35Q9g.js.map → references-DImfw0cz.js.map} +1 -1
- package/dist/chunks/{role-field-BfWRCqzl.js → role-field-C1KhNaIR.js} +2 -2
- package/dist/chunks/{role-field-BfWRCqzl.js.map → role-field-C1KhNaIR.js.map} +1 -1
- package/dist/chunks/{row-state-Zf3kZVhd.js → row-state-BsIHspy4.js} +2 -2
- package/dist/chunks/{row-state-Zf3kZVhd.js.map → row-state-BsIHspy4.js.map} +1 -1
- package/dist/chunks/{theme-B6-V9JvY.js → theme-3b4DnCow.js} +2 -2
- package/dist/chunks/{theme-B6-V9JvY.js.map → theme-3b4DnCow.js.map} +1 -1
- package/dist/chunks/{ui-Br-dNUTc.js → ui-2kwXXfrX.js} +95 -22
- package/dist/chunks/ui-2kwXXfrX.js.map +1 -0
- package/dist/chunks/{use-action-DthL5hL8.js → use-action-BB-RcHo1.js} +2 -2
- package/dist/chunks/{use-action-DthL5hL8.js.map → use-action-BB-RcHo1.js.map} +1 -1
- package/dist/chunks/{use-change-By4cG8bT.js → use-change-CQyDpCqw.js} +323 -31
- package/dist/chunks/use-change-CQyDpCqw.js.map +1 -0
- package/dist/chunks/{use-shell-D6kjSPls.js → use-shell-C_NmvCt_.js} +2 -2
- package/dist/chunks/{use-shell-D6kjSPls.js.map → use-shell-C_NmvCt_.js.map} +1 -1
- package/dist/index.d.ts +46 -164
- package/dist/index.js +143 -129
- package/dist/index.js.map +1 -1
- package/dist/pages/account.d.ts +1 -1
- package/dist/pages/account.js +29 -12
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/approval.js +1 -1
- package/dist/pages/audit.js +96 -90
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +1 -1
- package/dist/pages/environment.js +949 -412
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +2 -2
- package/dist/pages/oauth-authorize.js +1 -1
- package/dist/pages/project-access.js +9 -9
- package/dist/pages/project-access.js.map +1 -1
- package/dist/pages/project-environments.js +112 -64
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.d.ts +1 -1
- package/dist/pages/project-settings.js +54 -75
- package/dist/pages/project-settings.js.map +1 -1
- package/dist/pages/project.js +3 -7
- package/dist/pages/project.js.map +1 -1
- package/dist/pages/projects.js +50 -77
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +284 -160
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +4 -4
- package/dist/pages/settings.js +5 -5
- package/dist/pages/unregistered.js +1 -1
- package/dist/pages/user.js +5 -5
- package/dist/pages/users.js +4 -4
- package/package.json +3 -3
- package/src/components/actions-log.tsx +3 -2
- package/src/components/command-palette.tsx +4 -5
- package/src/components/directory.tsx +7 -14
- package/src/components/generate-value.tsx +15 -7
- package/src/components/missing.tsx +63 -67
- package/src/components/offboarding.tsx +1 -1
- package/src/components/personal-tokens.tsx +131 -0
- package/src/components/principal-page.tsx +30 -17
- package/src/components/regenerate.tsx +72 -0
- package/src/components/service-tokens.tsx +5 -14
- package/src/components/shell.tsx +79 -75
- package/src/components/trusted-workloads.tsx +179 -19
- package/src/components/ui.tsx +35 -25
- package/src/lib/audit-sentences.ts +100 -12
- package/src/lib/bindings.ts +41 -3
- package/src/lib/changes.ts +215 -29
- package/src/lib/clipboard.ts +40 -0
- package/src/lib/copy-attempts.ts +103 -0
- package/src/lib/dismissal.ts +24 -0
- package/src/lib/generate.ts +3 -146
- package/src/lib/optimistic.ts +3 -1
- package/src/lib/queries.ts +121 -17
- package/src/lib/recipes.ts +63 -0
- package/src/lib/reveal.ts +7 -1
- package/src/lib/row-reads.ts +64 -0
- package/src/lib/secret-edit-batch.ts +64 -5
- package/src/options.ts +43 -51
- package/src/pages/account.tsx +27 -5
- package/src/pages/audit.tsx +38 -31
- package/src/pages/environment.tsx +655 -121
- package/src/pages/project-access.tsx +1 -1
- package/src/pages/project-environments.tsx +92 -45
- package/src/pages/project-settings.tsx +9 -20
- package/src/pages/project.tsx +1 -5
- package/src/pages/projects.tsx +13 -28
- package/src/parity.ts +20 -4
- package/src/styles/globals.css +143 -131
- package/dist/chunks/audit-sentence-CUUMshIp.js.map +0 -1
- package/dist/chunks/directory-DrtdKny2.js.map +0 -1
- package/dist/chunks/offboarding-C7ECW5o0.js.map +0 -1
- package/dist/chunks/principal-page-CB6dAABC.js.map +0 -1
- package/dist/chunks/project-environments-lEzFHUt4.js +0 -11
- package/dist/chunks/project-environments-lEzFHUt4.js.map +0 -1
- package/dist/chunks/queries-DgQo3mC-.js.map +0 -1
- package/dist/chunks/ui-Br-dNUTc.js.map +0 -1
- package/dist/chunks/use-change-By4cG8bT.js.map +0 -1
|
@@ -40,7 +40,7 @@ function ProjectAccess({ slug, principalType, children }: { slug: string; princi
|
|
|
40
40
|
if (!result.ok) return <Notice tone="bad">{result.error}</Notice>;
|
|
41
41
|
return (
|
|
42
42
|
<>
|
|
43
|
-
<AccessPanel principalType={principalType} project={slug} environments={project.environments} grants={result.grants} />
|
|
43
|
+
<AccessPanel principalType={principalType} project={slug} environments={project.environments.filter((environment) => !environment.personal)} grants={result.grants} />
|
|
44
44
|
{children}
|
|
45
45
|
</>
|
|
46
46
|
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
+
import type { PersonalConfig } from '@coffre/client';
|
|
2
3
|
import { useQuery, useSuspenseQuery } from '@tanstack/react-query';
|
|
3
4
|
import { Link } from '@tanstack/react-router';
|
|
4
5
|
import { useShell } from '../lib/use-shell';
|
|
@@ -6,14 +7,16 @@ import { Menu } from '@base-ui/react/menu';
|
|
|
6
7
|
import { toast } from 'sonner';
|
|
7
8
|
import { useCoffre } from '../lib/coffre';
|
|
8
9
|
import { archiveEnvironment, createEnvironment, environmentId, renameEnvironment } from '../lib/changes';
|
|
9
|
-
import { keys, queries } from '../lib/queries';
|
|
10
|
+
import { affects, keys, queries } from '../lib/queries';
|
|
10
11
|
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
11
12
|
import { ItemFailure, RowPending, rowClass } from '../components/row-state';
|
|
12
13
|
import type { GrantRow, ProjectSummary } from '../shared/models';
|
|
13
14
|
import { ArchiveBlocked, archiveBlockers } from '../components/references';
|
|
14
15
|
import { hasEnvironmentDetails, isActiveAccessibleEnvironment, type ProjectEnvironment } from '../lib/project-environments';
|
|
15
16
|
import { environmentSlugProblem } from '../lib/validation';
|
|
16
|
-
import { ConfirmDialog, EmptyState, MenuPopup, Modal, Notice, Timestamp } from '../components/ui';
|
|
17
|
+
import { ConfirmDialog, EmptyState, ErrorLine, MenuPopup, Modal, Notice, Timestamp } from '../components/ui';
|
|
18
|
+
import { Card } from '../components/page';
|
|
19
|
+
import { useAction } from '../lib/use-action';
|
|
17
20
|
import { DeletePlaceDialog } from '../components/delete-place';
|
|
18
21
|
import { PrincipalAvatar } from '../components/principal';
|
|
19
22
|
import { Archive, ChevronRight, MoreHorizontal, Pencil, Plus, RotateBack, Trash } from '../components/icons';
|
|
@@ -58,7 +61,7 @@ function EnvironmentsPanel({
|
|
|
58
61
|
(environment) => environment.details === null || environment.details.archivedAt === null,
|
|
59
62
|
);
|
|
60
63
|
const { failedAdds, dismiss } = useChangeStatus(keys.projects);
|
|
61
|
-
const refused = failedAdds<{ slug: string
|
|
64
|
+
const refused = failedAdds<{ slug: string }>(
|
|
62
65
|
project.environments.map((environment) => environmentId(project.slug, environment.slug)),
|
|
63
66
|
).filter(({ ids }) => ids.every((id) => id.startsWith(`${project.slug}/`)));
|
|
64
67
|
|
|
@@ -88,10 +91,7 @@ function EnvironmentsPanel({
|
|
|
88
91
|
<li key={mutationId}>
|
|
89
92
|
<div className="env-card is-muted is-failed">
|
|
90
93
|
<div className="env-card-text">
|
|
91
|
-
<span className="env-card-name">{vars.
|
|
92
|
-
<span className="env-card-meta">
|
|
93
|
-
<span className="mono">{vars.slug}</span>
|
|
94
|
-
</span>
|
|
94
|
+
<span className="env-card-name">{vars.slug}</span>
|
|
95
95
|
</div>
|
|
96
96
|
<ItemFailure status={status} onDismiss={() => dismiss(mutationId)}>
|
|
97
97
|
Not added.
|
|
@@ -106,11 +106,14 @@ function EnvironmentsPanel({
|
|
|
106
106
|
<div className="table-actions">
|
|
107
107
|
<NewEnvironment
|
|
108
108
|
project={project.slug}
|
|
109
|
-
|
|
109
|
+
// Your personal config is nobody's source: its values are yours alone.
|
|
110
|
+
sources={current.filter((environment) => isActiveAccessibleEnvironment(environment) && !environment.personal).map((environment) => environment.slug)}
|
|
110
111
|
/>
|
|
111
112
|
</div>
|
|
112
113
|
)}
|
|
113
114
|
|
|
115
|
+
{canManage && <PersonalConfigs project={project.slug} />}
|
|
116
|
+
|
|
114
117
|
{archived.length > 0 && (
|
|
115
118
|
<section aria-labelledby="archived-environments">
|
|
116
119
|
<h2 className="section-title" id="archived-environments">
|
|
@@ -182,7 +185,6 @@ function EnvironmentCard({
|
|
|
182
185
|
const [deleting, setDeleting] = useState(false);
|
|
183
186
|
const { capabilities } = useShell();
|
|
184
187
|
const [slug, setSlug] = useState(environment.slug);
|
|
185
|
-
const [name, setName] = useState(environment.name);
|
|
186
188
|
const coffre = useCoffre();
|
|
187
189
|
const rename = useChange(renameEnvironment(coffre, project));
|
|
188
190
|
const archive = useChange(archiveEnvironment(coffre, project));
|
|
@@ -204,7 +206,8 @@ function EnvironmentCard({
|
|
|
204
206
|
const deletable = manageable && isArchived && capabilities.runsInstance;
|
|
205
207
|
const slugError = slug === '' ? null : environmentSlugProblem(slug);
|
|
206
208
|
const lastChange = useLastChange(project, environment.slug, opens);
|
|
207
|
-
|
|
209
|
+
// A personal config is its owner's alone: no grant reaches it, so none is shown on its card.
|
|
210
|
+
const holders = environment.personal === true ? [] : holdersOf(grants, environment.slug);
|
|
208
211
|
// Scopes match environments by slug: a new one is said to move them before the rename is saved.
|
|
209
212
|
const reslugged = slug !== environment.slug && slug !== '' && slugError === null;
|
|
210
213
|
|
|
@@ -220,12 +223,15 @@ function EnvironmentCard({
|
|
|
220
223
|
to="/projects/$project/$environment"
|
|
221
224
|
params={{ project, environment: environment.slug }}
|
|
222
225
|
>
|
|
223
|
-
{environment.
|
|
226
|
+
{environment.slug}
|
|
224
227
|
</Link>
|
|
225
228
|
) : (
|
|
226
|
-
<span className="env-card-name">{environment.
|
|
229
|
+
<span className="env-card-name">{environment.slug}</span>
|
|
227
230
|
)}
|
|
228
|
-
|
|
231
|
+
{/* A fork: its keys are its parent's, but for those it sets or removes. An instance before 0.7 says nothing. */}
|
|
232
|
+
{environment.personal === true
|
|
233
|
+
? <span className="tag tag-blue">yours alone</span>
|
|
234
|
+
: environment.parent != null && <span className="tag tag-outline">inherits {environment.parent}</span>}
|
|
229
235
|
</span>
|
|
230
236
|
|
|
231
237
|
{isArchived ? (
|
|
@@ -275,7 +281,8 @@ function EnvironmentCard({
|
|
|
275
281
|
|
|
276
282
|
{pending && <RowPending status={state} />}
|
|
277
283
|
|
|
278
|
-
{
|
|
284
|
+
{/* Your personal config is deleted from its own page; it is no environment of the team's to rename or archive. */}
|
|
285
|
+
{manageable && !pending && environment.personal !== true && (
|
|
279
286
|
<Menu.Root>
|
|
280
287
|
<Menu.Trigger
|
|
281
288
|
className="act act-quiet env-card-menu"
|
|
@@ -288,7 +295,6 @@ function EnvironmentCard({
|
|
|
288
295
|
className="menu-item"
|
|
289
296
|
onClick={() => {
|
|
290
297
|
setSlug(environment.slug);
|
|
291
|
-
setName(environment.name);
|
|
292
298
|
setRenaming(true);
|
|
293
299
|
}}
|
|
294
300
|
>
|
|
@@ -332,7 +338,7 @@ function EnvironmentCard({
|
|
|
332
338
|
onSubmit={(event) => {
|
|
333
339
|
event.preventDefault();
|
|
334
340
|
// Shown on the card at once; the card says if the server refuses.
|
|
335
|
-
rename({ from: environment.slug, slug
|
|
341
|
+
rename({ from: environment.slug, slug });
|
|
336
342
|
setRenaming(false);
|
|
337
343
|
}}
|
|
338
344
|
>
|
|
@@ -351,15 +357,6 @@ function EnvironmentCard({
|
|
|
351
357
|
`Anything running coffre run ${project}/${environment.slug} will need the new path.`}
|
|
352
358
|
</span>
|
|
353
359
|
</label>
|
|
354
|
-
<label className="field">
|
|
355
|
-
<span className="label">Display name</span>
|
|
356
|
-
<input
|
|
357
|
-
className="input"
|
|
358
|
-
value={name}
|
|
359
|
-
onChange={(event) => setName(event.target.value)}
|
|
360
|
-
/>
|
|
361
|
-
</label>
|
|
362
|
-
|
|
363
360
|
{reslugged && (
|
|
364
361
|
<Notice tone="info">
|
|
365
362
|
Instance roles scoped to <span className="mono">{environment.slug}</span> stop reaching it; those scoped
|
|
@@ -374,7 +371,7 @@ function EnvironmentCard({
|
|
|
374
371
|
<button
|
|
375
372
|
className="btn btn-primary"
|
|
376
373
|
type="submit"
|
|
377
|
-
disabled={slug === '' || slugError !== null
|
|
374
|
+
disabled={slug === environment.slug || slug === '' || slugError !== null}
|
|
378
375
|
>
|
|
379
376
|
Save
|
|
380
377
|
</button>
|
|
@@ -444,17 +441,70 @@ function EnvironmentCard({
|
|
|
444
441
|
}
|
|
445
442
|
|
|
446
443
|
/**
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
444
|
+
* The project's personal configs, `dev@me` (docs/design/forking.md), for
|
|
445
|
+
* whoever manages its environments: that they exist, whose, of what, and
|
|
446
|
+
* their key names, never a value, which only their owners read. Delete is
|
|
447
|
+
* how offboarding cleans one up: its values are erased.
|
|
448
|
+
*/
|
|
449
|
+
function PersonalConfigs({ project }: { project: string }) {
|
|
450
|
+
const coffre = useCoffre();
|
|
451
|
+
const { data } = useQuery(queries.personal(coffre, project));
|
|
452
|
+
const [deleting, setDeleting] = useState<PersonalConfig | null>(null);
|
|
453
|
+
const { error, run } = useAction();
|
|
454
|
+
if (data === undefined || !data.ok || data.configs.length === 0) return null;
|
|
455
|
+
return (
|
|
456
|
+
<Card
|
|
457
|
+
labelledBy="personal-configs"
|
|
458
|
+
title="Personal configs"
|
|
459
|
+
description="Members' own forks of an environment, its keys and their values over it. Only their owner reads the values; you see whose they are and their key names."
|
|
460
|
+
>
|
|
461
|
+
{error !== null && <ErrorLine error={error} />}
|
|
462
|
+
{data.configs.map((config) => (
|
|
463
|
+
<div className="card-row" key={config.slug}>
|
|
464
|
+
<div>
|
|
465
|
+
<p className="card-row-title">
|
|
466
|
+
<span className="mono">{config.of}</span> · {config.owner.replace(/^user:/, '')}
|
|
467
|
+
{config.archived && <span className="tag tag-outline">archived</span>}
|
|
468
|
+
</p>
|
|
469
|
+
<p className="card-row-desc mono">{config.keys.length === 0 ? 'no keys of its own' : config.keys.join(', ')}</p>
|
|
470
|
+
</div>
|
|
471
|
+
<button type="button" className="btn btn-sm" onClick={() => setDeleting(config)}>
|
|
472
|
+
<Trash size={14} />
|
|
473
|
+
Delete…
|
|
474
|
+
</button>
|
|
475
|
+
</div>
|
|
476
|
+
))}
|
|
477
|
+
<ConfirmDialog
|
|
478
|
+
open={deleting !== null}
|
|
479
|
+
onOpenChange={(open) => !open && setDeleting(null)}
|
|
480
|
+
title={<>Delete {deleting?.owner.replace(/^user:/, '')}'s <span className="mono">{deleting?.of}</span>?</>}
|
|
481
|
+
body={`Its ${deleting?.keys.length ?? 0} ${deleting?.keys.length === 1 ? 'value is' : 'values are'} erased for good; ${project}/${deleting?.of} itself is untouched.`}
|
|
482
|
+
confirmLabel="Delete"
|
|
483
|
+
onConfirm={() => {
|
|
484
|
+
const doomed = deleting!;
|
|
485
|
+
void run(() => coffre.environments.delete(`${project}/${doomed.slug}`), {
|
|
486
|
+
// The list, and the owner's own `dev@me` when it is theirs: its card and its keys go.
|
|
487
|
+
affects: [...affects.places(), ...affects.secrets({ project, environment: `${doomed.of}@me` })],
|
|
488
|
+
onSuccess: () => toast.success(`Deleted ${doomed.owner.replace(/^user:/, '')}'s ${doomed.of}`),
|
|
489
|
+
});
|
|
490
|
+
}}
|
|
491
|
+
/>
|
|
492
|
+
</Card>
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* A new environment, empty, or forked from one you can read: inheriting
|
|
498
|
+
* its keys live (docs/design/forking.md), or each of them copied, value and
|
|
499
|
+
* folder, without history, or a reference to it. Copying is a read, and
|
|
500
|
+
* logged as one; inheriting reads nothing until the fork is read.
|
|
450
501
|
*/
|
|
451
502
|
function NewEnvironment({ project, sources }: { project: string; sources: string[] }) {
|
|
452
503
|
const [open, setOpen] = useState(false);
|
|
453
504
|
const [slug, setSlug] = useState('');
|
|
454
|
-
|
|
455
|
-
// '' for empty, 'copy:prod' for a copy, 'ref:prod' for references to prod.
|
|
505
|
+
// '' for empty, 'inherit:prod' for a fork that inherits, 'copy:prod' for a copy, 'ref:prod' for references to prod.
|
|
456
506
|
const [start, setStart] = useState('');
|
|
457
|
-
const [how, from] = start === '' ? ['', ''] : (start.split(':') as ['copy' | 'ref', string]);
|
|
507
|
+
const [how, from] = start === '' ? ['', ''] : (start.split(':') as ['inherit' | 'copy' | 'ref', string]);
|
|
458
508
|
const coffre = useCoffre();
|
|
459
509
|
// A fork as references copies the keys whose source you read only through their parent: said before you confirm.
|
|
460
510
|
const { data: parent } = useQuery({ ...queries.secrets(coffre, { project, environment: from }), enabled: how === 'ref' });
|
|
@@ -489,9 +539,8 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
|
|
|
489
539
|
onSubmit={(event) => {
|
|
490
540
|
event.preventDefault();
|
|
491
541
|
// Listed at once, as saving; the list says if the server refuses.
|
|
492
|
-
create({ slug,
|
|
542
|
+
create({ slug, ...(from === '' ? {} : { from }), ...(how === 'ref' ? { references: true } : {}), ...(how === 'inherit' ? { inherit: true } : {}) });
|
|
493
543
|
setSlug('');
|
|
494
|
-
setName('');
|
|
495
544
|
setStart('');
|
|
496
545
|
close();
|
|
497
546
|
}}
|
|
@@ -520,20 +569,16 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
|
|
|
520
569
|
)}
|
|
521
570
|
</span>
|
|
522
571
|
</label>
|
|
523
|
-
<label className="field">
|
|
524
|
-
<span className="label">Display name</span>
|
|
525
|
-
<input
|
|
526
|
-
className="input"
|
|
527
|
-
placeholder="Staging"
|
|
528
|
-
value={name}
|
|
529
|
-
onChange={(event) => setName(event.target.value)}
|
|
530
|
-
/>
|
|
531
|
-
</label>
|
|
532
572
|
{sources.length > 0 && (
|
|
533
573
|
<label className="field">
|
|
534
574
|
<span className="label">Start from</span>
|
|
535
575
|
<select className="select" value={start} onChange={(event) => setStart(event.target.value)}>
|
|
536
576
|
<option value="">Empty</option>
|
|
577
|
+
{sources.map((source) => (
|
|
578
|
+
<option key={`inherit:${source}`} value={`inherit:${source}`}>
|
|
579
|
+
Inheriting from {source}
|
|
580
|
+
</option>
|
|
581
|
+
))}
|
|
537
582
|
{sources.map((source) => (
|
|
538
583
|
<option key={`copy:${source}`} value={`copy:${source}`}>
|
|
539
584
|
A copy of {source}
|
|
@@ -548,7 +593,9 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
|
|
|
548
593
|
<span className="hint">
|
|
549
594
|
{how === ''
|
|
550
595
|
? 'No secrets yet.'
|
|
551
|
-
: how === '
|
|
596
|
+
: how === 'inherit'
|
|
597
|
+
? `Keeps reading ${from}'s keys, live, except those you set or remove here. Whoever reads ${slug === '' ? 'the new environment' : slug} needs read on ${from} too, for those.`
|
|
598
|
+
: how === 'copy'
|
|
552
599
|
? `Each of ${from}'s keys, with its current value and folder, without history.`
|
|
553
600
|
: `Each key follows ${from}'s until it gets a value of its own. Whoever can read ${slug === '' ? 'the new environment' : slug} will read ${from}'s values through them, even without access to ${from}.`}
|
|
554
601
|
</span>
|
|
@@ -567,7 +614,7 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
|
|
|
567
614
|
<button
|
|
568
615
|
className="btn btn-primary"
|
|
569
616
|
type="submit"
|
|
570
|
-
disabled={slug === '' || slugError !== null
|
|
617
|
+
disabled={slug === '' || slugError !== null}
|
|
571
618
|
>
|
|
572
619
|
Add environment
|
|
573
620
|
</button>
|
|
@@ -19,7 +19,7 @@ import type { projectSettings } from '../options';
|
|
|
19
19
|
|
|
20
20
|
const Route = pageRoute<typeof projectSettings>();
|
|
21
21
|
|
|
22
|
-
/** A project's settings: its slug
|
|
22
|
+
/** A project's settings: its slug and folder, and archiving or deleting it. */
|
|
23
23
|
export function ProjectSettingsPage() {
|
|
24
24
|
const { project } = useProject(Route.useParams().project);
|
|
25
25
|
return (
|
|
@@ -31,7 +31,7 @@ export function ProjectSettingsPage() {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* The project's
|
|
34
|
+
* The project's slug and folder, as a form on the page.
|
|
35
35
|
*
|
|
36
36
|
* Renaming changes paths other people and scripts use, so it is laid out in
|
|
37
37
|
* plain sight with what it does and does not affect, rather than tucked
|
|
@@ -40,22 +40,20 @@ export function ProjectSettingsPage() {
|
|
|
40
40
|
function GeneralSettings({ project }: { project: ProjectSummary }) {
|
|
41
41
|
const router = useRouter();
|
|
42
42
|
const [slug, setSlug] = useState(project.slug);
|
|
43
|
-
const [name, setName] = useState(project.name);
|
|
44
43
|
const [folder, setFolder] = useState(project.folder ?? '');
|
|
45
44
|
const coffre = useCoffre();
|
|
46
45
|
const { pending, error, run } = useAction();
|
|
47
46
|
const slugError = slug === '' ? null : slugProblem(slug);
|
|
48
47
|
const folderError = folderProblem(folder);
|
|
49
48
|
const nextFolder = folder === '' ? null : folder;
|
|
50
|
-
const dirty = slug !== project.slug ||
|
|
49
|
+
const dirty = slug !== project.slug || nextFolder !== project.folder;
|
|
51
50
|
|
|
52
51
|
// Follow a rename made elsewhere (another tab, another person) rather than
|
|
53
52
|
// keep offering the old values back.
|
|
54
53
|
useEffect(() => {
|
|
55
54
|
setSlug(project.slug);
|
|
56
|
-
setName(project.name);
|
|
57
55
|
setFolder(project.folder ?? '');
|
|
58
|
-
}, [project.slug, project.
|
|
56
|
+
}, [project.slug, project.folder]);
|
|
59
57
|
|
|
60
58
|
// Two fields and their Save need no card: the tab already says what they are.
|
|
61
59
|
return (
|
|
@@ -66,14 +64,13 @@ function GeneralSettings({ project }: { project: ProjectSummary }) {
|
|
|
66
64
|
run(
|
|
67
65
|
() => coffre.projects.update(project.slug, {
|
|
68
66
|
slug,
|
|
69
|
-
name,
|
|
70
67
|
// Only when it moves: a move is logged, as `project.move`.
|
|
71
68
|
...(nextFolder === project.folder ? {} : { folder: nextFolder }),
|
|
72
69
|
}),
|
|
73
70
|
{
|
|
74
71
|
affects: affects.places(),
|
|
75
72
|
onSuccess: async () => {
|
|
76
|
-
toast.success(slug === project.slug
|
|
73
|
+
toast.success(slug === project.slug ? 'Project moved' : 'Project saved');
|
|
77
74
|
// The slug is part of the URL, so a rename has to navigate.
|
|
78
75
|
if (slug !== project.slug) {
|
|
79
76
|
await router.navigate({ to: '/projects/$project/settings', params: { project: slug } });
|
|
@@ -97,14 +94,6 @@ function GeneralSettings({ project }: { project: ProjectSummary }) {
|
|
|
97
94
|
{slugError ?? 'Scripts that name the old slug will need the new one.'}
|
|
98
95
|
</span>
|
|
99
96
|
</label>
|
|
100
|
-
<label className="field">
|
|
101
|
-
<span className="label">Display name</span>
|
|
102
|
-
<input
|
|
103
|
-
className="input"
|
|
104
|
-
value={name}
|
|
105
|
-
onChange={(event) => setName(event.target.value)}
|
|
106
|
-
/>
|
|
107
|
-
</label>
|
|
108
97
|
<label className="field">
|
|
109
98
|
<span className="label">Folder</span>
|
|
110
99
|
<input
|
|
@@ -124,7 +113,7 @@ function GeneralSettings({ project }: { project: ProjectSummary }) {
|
|
|
124
113
|
<button
|
|
125
114
|
className="btn btn-primary"
|
|
126
115
|
type="submit"
|
|
127
|
-
disabled={!dirty || pending || slug === '' || slugError !== null ||
|
|
116
|
+
disabled={!dirty || pending || slug === '' || slugError !== null || folderError !== null}
|
|
128
117
|
>
|
|
129
118
|
{pending && <Spinner />}
|
|
130
119
|
Save
|
|
@@ -183,7 +172,7 @@ function DangerZone({ project }: { project: ProjectSummary }) {
|
|
|
183
172
|
) : (
|
|
184
173
|
<Archive size={14} />
|
|
185
174
|
)}
|
|
186
|
-
{isArchived ? `Restore ${project.
|
|
175
|
+
{isArchived ? `Restore ${project.slug}` : `Archive ${project.slug}…`}
|
|
187
176
|
</button>
|
|
188
177
|
</div>
|
|
189
178
|
|
|
@@ -197,7 +186,7 @@ function DangerZone({ project }: { project: ProjectSummary }) {
|
|
|
197
186
|
</div>
|
|
198
187
|
<button className="btn btn-danger-outline" onClick={() => setDeleting(true)}>
|
|
199
188
|
<Trash size={14} />
|
|
200
|
-
{`Delete ${project.
|
|
189
|
+
{`Delete ${project.slug}…`}
|
|
201
190
|
</button>
|
|
202
191
|
</div>
|
|
203
192
|
)}
|
|
@@ -235,7 +224,7 @@ function DangerZone({ project }: { project: ProjectSummary }) {
|
|
|
235
224
|
)
|
|
236
225
|
}
|
|
237
226
|
detail={<ArchiveBlocked references={blockers} />}
|
|
238
|
-
confirmLabel={isArchived ? `Restore ${project.
|
|
227
|
+
confirmLabel={isArchived ? `Restore ${project.slug}` : `Archive ${project.slug}`}
|
|
239
228
|
confirmDisabled={asking || blockers.length > 0}
|
|
240
229
|
destructive={!isArchived}
|
|
241
230
|
onConfirm={() =>
|
package/src/pages/project.tsx
CHANGED
|
@@ -48,11 +48,7 @@ export function ProjectLayout() {
|
|
|
48
48
|
const params = { project: found.slug };
|
|
49
49
|
return (
|
|
50
50
|
<>
|
|
51
|
-
<PageHeader
|
|
52
|
-
tile={found.slug}
|
|
53
|
-
title={found.name}
|
|
54
|
-
aside={<span className="page-title-slug">{found.slug}</span>}
|
|
55
|
-
/>
|
|
51
|
+
<PageHeader tile={found.slug} title={found.slug} />
|
|
56
52
|
|
|
57
53
|
{found.archivedAt !== null && (
|
|
58
54
|
<div style={{ marginBottom: '1.25rem' }}>
|
package/src/pages/projects.tsx
CHANGED
|
@@ -208,20 +208,17 @@ function ProjectRow({
|
|
|
208
208
|
<td className="col-project">
|
|
209
209
|
<span className="cell-project">
|
|
210
210
|
<Tile name={project.slug} />
|
|
211
|
-
|
|
212
|
-
{
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
)}
|
|
223
|
-
<small className="mono">{project.slug}</small>
|
|
224
|
-
</span>
|
|
211
|
+
{pending ? (
|
|
212
|
+
<span>{project.slug}</span>
|
|
213
|
+
) : (
|
|
214
|
+
<Link
|
|
215
|
+
className="cell-link stretch"
|
|
216
|
+
to="/projects/$project"
|
|
217
|
+
params={{ project: project.slug }}
|
|
218
|
+
>
|
|
219
|
+
{project.slug}
|
|
220
|
+
</Link>
|
|
221
|
+
)}
|
|
225
222
|
</span>
|
|
226
223
|
</td>
|
|
227
224
|
<td className="col-envs" data-label="Environments">
|
|
@@ -281,7 +278,6 @@ function ProjectRow({
|
|
|
281
278
|
|
|
282
279
|
function NewProject() {
|
|
283
280
|
const [slug, setSlug] = useState('');
|
|
284
|
-
const [name, setName] = useState('');
|
|
285
281
|
const [open, setOpen] = useState(false);
|
|
286
282
|
const create = useChange(createProject(useCoffre()));
|
|
287
283
|
const slugError = slug === '' ? null : slugProblem(slug);
|
|
@@ -308,9 +304,8 @@ function NewProject() {
|
|
|
308
304
|
onSubmit={(event) => {
|
|
309
305
|
event.preventDefault();
|
|
310
306
|
// Listed at once, as saving; the list says if the server refuses.
|
|
311
|
-
create({ slug
|
|
307
|
+
create({ slug });
|
|
312
308
|
setSlug('');
|
|
313
|
-
setName('');
|
|
314
309
|
close();
|
|
315
310
|
}}
|
|
316
311
|
>
|
|
@@ -332,16 +327,6 @@ function NewProject() {
|
|
|
332
327
|
</span>
|
|
333
328
|
</label>
|
|
334
329
|
|
|
335
|
-
<label className="field">
|
|
336
|
-
<span className="label">Display name</span>
|
|
337
|
-
<input
|
|
338
|
-
className="input"
|
|
339
|
-
placeholder="Market data platform"
|
|
340
|
-
value={name}
|
|
341
|
-
onChange={(event) => setName(event.target.value)}
|
|
342
|
-
/>
|
|
343
|
-
</label>
|
|
344
|
-
|
|
345
330
|
<div className="dialog-actions">
|
|
346
331
|
<button className="btn" type="button" onClick={close}>
|
|
347
332
|
Cancel
|
|
@@ -349,7 +334,7 @@ function NewProject() {
|
|
|
349
334
|
<button
|
|
350
335
|
className="btn btn-primary"
|
|
351
336
|
type="submit"
|
|
352
|
-
disabled={slug === '' || slugError !== null
|
|
337
|
+
disabled={slug === '' || slugError !== null}
|
|
353
338
|
>
|
|
354
339
|
Create project
|
|
355
340
|
</button>
|
package/src/parity.ts
CHANGED
|
@@ -32,7 +32,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
32
32
|
'PUT /projects/:project': { ui: [{ does: 'Projects › New project', in: 'pages/projects.tsx', call: 'projects.create' }] },
|
|
33
33
|
'PATCH /projects/:project': {
|
|
34
34
|
ui: [
|
|
35
|
-
{ does: 'a project › Settings › Save (slug,
|
|
35
|
+
{ does: 'a project › Settings › Save (slug, folder)', in: 'pages/project-settings.tsx', call: 'projects.update' },
|
|
36
36
|
{ does: 'a project › Settings › Archive …, Restore …', in: 'pages/project-settings.tsx', call: 'projects.update' },
|
|
37
37
|
],
|
|
38
38
|
},
|
|
@@ -43,7 +43,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
43
43
|
],
|
|
44
44
|
},
|
|
45
45
|
'PUT /projects/:project/:environment': {
|
|
46
|
-
ui: [{ does: 'a project › Environments › Add environment', in: 'pages/project-environments.tsx', call: 'environments.create' }],
|
|
46
|
+
ui: [{ does: 'a project › Environments › Add environment, empty, inheriting, a copy or references', in: 'pages/project-environments.tsx', call: 'environments.create' }],
|
|
47
47
|
},
|
|
48
48
|
'PATCH /projects/:project/:environment': {
|
|
49
49
|
ui: [{ does: "an environment's card › ⋯ › Rename, Archive…, Restore", in: 'pages/project-environments.tsx', call: 'environments.update' }],
|
|
@@ -57,13 +57,22 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
57
57
|
'GET /projects/:project/:environment/missing': {
|
|
58
58
|
ui: [{ does: "an environment: the keys its siblings have and it lacks", in: 'lib/queries.ts', call: 'environments.missing' }],
|
|
59
59
|
},
|
|
60
|
+
'GET /personal/:project': {
|
|
61
|
+
ui: [{ does: "a project › Environments › Personal configs: whose, of what, and their key names", in: 'pages/project-environments.tsx', call: 'environments.personal' }],
|
|
62
|
+
},
|
|
63
|
+
'GET /projects/:project/:environment/version': {
|
|
64
|
+
not: 'for programs that poll an environment before reading it, `coffre export --watch` first; a page has its listing, which it reloads',
|
|
65
|
+
},
|
|
60
66
|
'PATCH /projects/:project/:environment/dismissals': {
|
|
61
|
-
ui: [
|
|
67
|
+
ui: [
|
|
68
|
+
{ does: 'an environment › Missing keys › Dismiss, Dismiss all, and Undo after either', in: 'components/missing.tsx', call: 'environments.dismiss' },
|
|
69
|
+
{ does: "a fork › an inherited key › ⋯ › Remove; a removed one › Restore; Undo after either", in: 'lib/changes.ts', call: 'environments.dismiss' },
|
|
70
|
+
],
|
|
62
71
|
},
|
|
63
72
|
'GET /secrets/:project/:environment': { ui: [{ does: 'an environment: its secrets', in: 'pages/environment.tsx', call: 'secrets.list' }] },
|
|
64
73
|
'PATCH /secrets/:project/:environment': {
|
|
65
74
|
ui: [
|
|
66
|
-
{ does: 'an environment ›
|
|
75
|
+
{ does: 'an environment › Add secret, Edit, then Save', in: 'pages/environment.tsx', call: 'secrets.set' },
|
|
67
76
|
{ does: 'an environment › Import .env, after its plan', in: 'pages/environment.tsx', call: 'secrets.set' },
|
|
68
77
|
],
|
|
69
78
|
},
|
|
@@ -71,6 +80,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
71
80
|
ui: [
|
|
72
81
|
{ does: "a secret › Edit: its name, then Save", in: 'pages/environment.tsx', call: 'secrets.rename' },
|
|
73
82
|
{ does: 'a secret › ⋯ › Archive; an archived one › ⋯ › Restore', in: 'pages/environment.tsx', call: 'secrets.update' },
|
|
83
|
+
{ does: "a fork › an override › ⋯ › Reset to its parent; a reset one › ⋯ › Use its own value again; Undo after either", in: 'lib/changes.ts', call: 'secrets.inherit' },
|
|
74
84
|
],
|
|
75
85
|
},
|
|
76
86
|
'GET /secrets/:project/:environment/:key/versions': {
|
|
@@ -131,6 +141,12 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
131
141
|
{ does: 'Trust a workload › Trust', in: 'components/trusted-workloads.tsx', call: 'bindings.create' },
|
|
132
142
|
],
|
|
133
143
|
},
|
|
144
|
+
'POST /members/:member/bindings/keys': {
|
|
145
|
+
ui: [
|
|
146
|
+
{ does: 'a trust binding with uploaded keys › Claims › Replace keys: the bindings replaced reviewed first', in: 'components/trusted-workloads.tsx', call: 'bindings.previewKeys' },
|
|
147
|
+
{ does: 'Replace keys › Save keys', in: 'components/trusted-workloads.tsx', call: 'bindings.replaceKeys' },
|
|
148
|
+
],
|
|
149
|
+
},
|
|
134
150
|
'DELETE /members/:member/bindings/:id': { ui: [{ does: 'a trust binding › Remove', in: 'components/trusted-workloads.tsx', call: 'bindings.remove' }] },
|
|
135
151
|
'GET /workloads/lookup': { ui: [{ does: 'Trust a workload: a repository named, its IDs looked up', in: 'components/trusted-workloads.tsx', call: 'bindings.lookup' }] },
|
|
136
152
|
'GET /workloads/repositories': { ui: [{ does: "Trust a workload: the repositories the deployment's GitHub App is installed on, offered as the name is typed", in: 'lib/queries.ts', call: 'bindings.repositories' }] },
|