@coffre/ui 0.6.0 → 0.6.2
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/{affordances-D0GyCT-I.js → affordances-Dtyha68j.js} +10 -2
- package/dist/chunks/{affordances-D0GyCT-I.js.map → affordances-Dtyha68j.js.map} +1 -1
- package/dist/chunks/{audit-sentence-CUUMshIp.js → audit-sentence-BVv_9_nq.js} +2 -2
- package/dist/chunks/{audit-sentence-CUUMshIp.js.map → audit-sentence-BVv_9_nq.js.map} +1 -1
- package/dist/chunks/{connected-apps-IP0KfUjo.js → connected-apps-rBF9XUob.js} +4 -4
- package/dist/chunks/{connected-apps-IP0KfUjo.js.map → connected-apps-rBF9XUob.js.map} +1 -1
- package/dist/chunks/{delete-place-CVv6CN5y.js → delete-place-CkGezx5R.js} +4 -4
- package/dist/chunks/{delete-place-CVv6CN5y.js.map → delete-place-CkGezx5R.js.map} +1 -1
- package/dist/chunks/{directory-pMVS1m-c.js → directory-SRN01yP6.js} +38 -32
- package/dist/chunks/directory-SRN01yP6.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-CgC8Ybhu.js → grants-1E1vqkM0.js} +5 -5
- package/dist/chunks/{grants-CgC8Ybhu.js.map → grants-1E1vqkM0.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-3fzRjKla.js → offboarding-Bt7KSixm.js} +3 -3
- package/dist/chunks/{offboarding-3fzRjKla.js.map → offboarding-Bt7KSixm.js.map} +1 -1
- package/dist/chunks/{principal-page-CYJIJAdp.js → principal-page-Cbx2l6XL.js} +21 -24
- package/dist/chunks/principal-page-Cbx2l6XL.js.map +1 -0
- package/dist/chunks/{project-page-lO5P6iCb.js → project-page-DKo2AFYg.js} +2 -2
- package/dist/chunks/{project-page-lO5P6iCb.js.map → project-page-DKo2AFYg.js.map} +1 -1
- package/dist/chunks/{queries-gigcQOO_.js → queries-BvSw1xBN.js} +87 -15
- package/dist/chunks/queries-BvSw1xBN.js.map +1 -0
- package/dist/chunks/{references-DZ179hTJ.js → references-DCoSPtvw.js} +4 -4
- package/dist/chunks/{references-DZ179hTJ.js.map → references-DCoSPtvw.js.map} +1 -1
- package/dist/chunks/{role-field-DiqiFwm_.js → role-field-D98CvNEg.js} +2 -2
- package/dist/chunks/{role-field-DiqiFwm_.js.map → role-field-D98CvNEg.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-CQGGNqWb.js → use-action-Bv7yQ0DW.js} +2 -2
- package/dist/chunks/{use-action-CQGGNqWb.js.map → use-action-Bv7yQ0DW.js.map} +1 -1
- package/dist/chunks/{use-change-BdS1gzyo.js → use-change-DIQTGXER.js} +58 -17
- package/dist/chunks/use-change-DIQTGXER.js.map +1 -0
- package/dist/chunks/{use-shell-BCU505bx.js → use-shell-DhFoHjDS.js} +2 -2
- package/dist/chunks/{use-shell-BCU505bx.js.map → use-shell-DhFoHjDS.js.map} +1 -1
- package/dist/index.d.ts +13 -164
- package/dist/index.js +142 -129
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +8 -8
- package/dist/pages/approval.js +1 -1
- package/dist/pages/audit.js +46 -60
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +1 -1
- package/dist/pages/environment.js +458 -241
- 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 +8 -8
- package/dist/pages/project-environments.js +19 -58
- 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 +51 -78
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +11 -136
- 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 +1 -1
- package/src/components/affordances.ts +12 -0
- package/src/components/command-palette.tsx +4 -5
- package/src/components/directory.tsx +18 -18
- package/src/components/missing.tsx +63 -67
- package/src/components/principal-page.tsx +10 -14
- package/src/components/service-tokens.tsx +2 -11
- package/src/components/shell.tsx +79 -75
- package/src/components/trusted-workloads.tsx +2 -11
- package/src/components/ui.tsx +35 -25
- package/src/lib/changes.ts +63 -12
- 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/optimistic.ts +3 -1
- package/src/lib/queries.ts +108 -14
- package/src/lib/row-reads.ts +64 -0
- package/src/options.ts +38 -50
- package/src/pages/audit.tsx +15 -24
- package/src/pages/environment.tsx +326 -97
- package/src/pages/project-environments.tsx +8 -34
- 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 +3 -3
- package/src/styles/globals.css +87 -128
- package/dist/chunks/directory-pMVS1m-c.js.map +0 -1
- package/dist/chunks/principal-page-CYJIJAdp.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-gigcQOO_.js.map +0 -1
- package/dist/chunks/ui-Br-dNUTc.js.map +0 -1
- package/dist/chunks/use-change-BdS1gzyo.js.map +0 -1
|
@@ -88,3 +88,15 @@ export function SecretReadOnly({
|
|
|
88
88
|
}): ReactNode {
|
|
89
89
|
return canReveal ? children : null;
|
|
90
90
|
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Whether an Owner's tag greys out with "Set by deployment": the deployment names
|
|
94
|
+
* this Owner, and the viewer is someone who could otherwise change Owners. Anyone
|
|
95
|
+
* else sees the plain Owner tag, as nothing is theirs to change.
|
|
96
|
+
*/
|
|
97
|
+
export function setByDeployment(
|
|
98
|
+
principal: { instanceRole: string; declared?: boolean },
|
|
99
|
+
capabilities: Pick<UiCapabilities, 'ownsInstance'>,
|
|
100
|
+
): boolean {
|
|
101
|
+
return principal.declared === true && principal.instanceRole === 'owner' && capabilities.ownsInstance;
|
|
102
|
+
}
|
|
@@ -92,7 +92,7 @@ export function CommandPalette({
|
|
|
92
92
|
value: 'Environments',
|
|
93
93
|
items: active.flatMap((project) =>
|
|
94
94
|
project.environments.filter(isActiveAccessibleEnvironment).map((environment) => ({
|
|
95
|
-
value: `${project.slug}/${environment.slug}
|
|
95
|
+
value: `${project.slug}/${environment.slug}`,
|
|
96
96
|
icon: <Layers size={15} />,
|
|
97
97
|
label: (
|
|
98
98
|
<span className="mono">
|
|
@@ -115,10 +115,9 @@ export function CommandPalette({
|
|
|
115
115
|
{
|
|
116
116
|
value: 'Projects',
|
|
117
117
|
items: active.map((project) => ({
|
|
118
|
-
value:
|
|
118
|
+
value: project.slug,
|
|
119
119
|
icon: <Folder size={15} />,
|
|
120
120
|
label: <span className="mono">{project.slug}</span>,
|
|
121
|
-
hint: project.name,
|
|
122
121
|
path: '/projects/$project',
|
|
123
122
|
run: closing(() =>
|
|
124
123
|
navigate({ to: '/projects/$project', params: { project: project.slug } }),
|
|
@@ -165,9 +164,9 @@ export function CommandPalette({
|
|
|
165
164
|
{
|
|
166
165
|
value: 'audit denials denied refused',
|
|
167
166
|
icon: <SlashCircle size={15} />,
|
|
168
|
-
label: 'Audit, denials
|
|
167
|
+
label: 'Audit, denials',
|
|
169
168
|
path: '/audit',
|
|
170
|
-
run: closing(() => navigate({ to: '/audit', search: { decision: 'deny' } })),
|
|
169
|
+
run: closing(() => navigate({ to: '/audit', search: { decision: 'deny', detail: '1' } })),
|
|
171
170
|
},
|
|
172
171
|
],
|
|
173
172
|
}),
|
|
@@ -9,6 +9,7 @@ import { queries, waysFor } from '../lib/queries';
|
|
|
9
9
|
import { useShell } from '../lib/use-shell';
|
|
10
10
|
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
11
11
|
import type { DirectoryPrincipal } from '../shared/models';
|
|
12
|
+
import { setByDeployment } from './affordances';
|
|
12
13
|
import { RowFailure, RowPending, rowClass } from './row-state';
|
|
13
14
|
import { ConfirmDialog, EmptyState, MenuPopup, Modal, Spinner, Timestamp, Toggletip } from './ui';
|
|
14
15
|
import { PrincipalLink } from './principal';
|
|
@@ -142,7 +143,7 @@ export function DirectoryTable({
|
|
|
142
143
|
<InstanceRole principal={principal} />
|
|
143
144
|
</td>
|
|
144
145
|
) : (
|
|
145
|
-
<ServiceCells principal={principal} />
|
|
146
|
+
<ServiceCells principal={principal} adding={state.state === 'pending' && state.kind === 'saving'} />
|
|
146
147
|
)}
|
|
147
148
|
<td className="col-actions">
|
|
148
149
|
{state.state === 'pending' ? (
|
|
@@ -197,15 +198,15 @@ const PLATFORM: Record<string, string> = {
|
|
|
197
198
|
* it reaches, and whether it is still in use. Access comes with the list; the
|
|
198
199
|
* bindings and tokens are read per row, as its own page reads them.
|
|
199
200
|
*/
|
|
200
|
-
function ServiceCells({ principal }: { principal: DirectoryPrincipal }) {
|
|
201
|
+
function ServiceCells({ principal, adding }: { principal: DirectoryPrincipal; adding: boolean }) {
|
|
201
202
|
const client = useCoffre();
|
|
202
203
|
const shell = useShell();
|
|
203
204
|
const member = memberOf(principal);
|
|
204
205
|
// As `loadServiceDirectory` read them, so these come from its cache; an account just added is yours.
|
|
205
206
|
const ways = waysFor(shell, principal.managed !== false);
|
|
206
|
-
// Not suspended: an account added here is shown at once, its facts
|
|
207
|
-
const { data: bindings } = useQuery(queries.bindings(client, member, ways.workloads));
|
|
208
|
-
const { data: credentials } = useQuery(queries.credentials(client, member, ways.tokens));
|
|
207
|
+
// Not suspended: an account added here is shown at once, its facts once it is made, and not asked for before.
|
|
208
|
+
const { data: bindings } = useQuery({ ...queries.bindings(client, member, ways.workloads), enabled: !adding });
|
|
209
|
+
const { data: credentials } = useQuery({ ...queries.credentials(client, member, ways.tokens), enabled: !adding });
|
|
209
210
|
|
|
210
211
|
const platforms = new Map<string, number>();
|
|
211
212
|
const bindingList = bindings?.ok === true ? bindings.bindings : [];
|
|
@@ -276,6 +277,7 @@ function ServiceCells({ principal }: { principal: DirectoryPrincipal }) {
|
|
|
276
277
|
* plain member.
|
|
277
278
|
*/
|
|
278
279
|
export function InstanceRole({ principal }: { principal: DirectoryPrincipal }) {
|
|
280
|
+
const { capabilities } = useShell();
|
|
279
281
|
if (principal.tampered === true) {
|
|
280
282
|
return (
|
|
281
283
|
<Toggletip
|
|
@@ -293,15 +295,21 @@ export function InstanceRole({ principal }: { principal: DirectoryPrincipal }) {
|
|
|
293
295
|
</Toggletip>
|
|
294
296
|
);
|
|
295
297
|
}
|
|
298
|
+
const name = INSTANCE_ROLES[principal.instanceRole].name;
|
|
296
299
|
return (
|
|
297
300
|
<>
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
+
{setByDeployment(principal, capabilities) ? (
|
|
302
|
+
<Toggletip label="Set by deployment">
|
|
303
|
+
<button type="button" className="tag tag-button" aria-label={`${name}, set by deployment`}>
|
|
304
|
+
{name}
|
|
305
|
+
</button>
|
|
306
|
+
</Toggletip>
|
|
307
|
+
) : (
|
|
308
|
+
<span className={`tag${principal.instanceRole === 'member' ? '' : ' tag-violet'}`}>{name}</span>
|
|
309
|
+
)}
|
|
301
310
|
{principal.instanceRole !== 'member' && principal.scope !== null && !unscoped(principal.scope) && (
|
|
302
311
|
<span className="role-scope">{scopeInWords(principal.scope)}</span>
|
|
303
312
|
)}
|
|
304
|
-
{principal.declared === true && principal.instanceRole === 'owner' && <span className="role-scope">· set by deployment</span>}
|
|
305
313
|
</>
|
|
306
314
|
);
|
|
307
315
|
}
|
|
@@ -337,15 +345,7 @@ export function PrincipalActions({
|
|
|
337
345
|
if (!(capabilities.runsInstance || yours)) return null;
|
|
338
346
|
if (principal.declared === true) {
|
|
339
347
|
return (
|
|
340
|
-
<Toggletip
|
|
341
|
-
label={
|
|
342
|
-
<>
|
|
343
|
-
The deployment names them an Owner: <span className="mono">owners</span> in the vault's configuration. To
|
|
344
|
-
change or remove them, take them off that list and deploy.
|
|
345
|
-
</>
|
|
346
|
-
}
|
|
347
|
-
align="end"
|
|
348
|
-
>
|
|
348
|
+
<Toggletip label="Owner defined by the deployment configuration." align="end">
|
|
349
349
|
<button type="button" className={trigger} aria-label={`Why ${principal.principalId} can't be changed`}>
|
|
350
350
|
<Lock size={14} />
|
|
351
351
|
</button>
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useQuery } from '@tanstack/react-query';
|
|
1
|
+
import type { MissingKey } from '@coffre/client';
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
|
+
import { dismissMissing, missingList, restoreMissing } from '../lib/changes';
|
|
4
5
|
import { useCoffre } from '../lib/coffre';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { dismissWithUndo } from '../lib/dismissal';
|
|
7
|
+
import { changeOptions } from '../lib/optimistic';
|
|
8
|
+
import { queries } from '../lib/queries';
|
|
9
|
+
import { useChangeStatus } from '../lib/use-change';
|
|
7
10
|
import { Card } from './page';
|
|
8
|
-
import {
|
|
11
|
+
import { RowFailure, rowClass } from './row-state';
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* Keys the environment's siblings have and it lacks, by name, whether you
|
|
12
|
-
* read them or not (docs/design/environments.md): each with Add, which opens
|
|
13
|
-
* its name, and Dismiss, which the whole team then sees, and
|
|
14
|
-
* Dismiss all
|
|
15
|
-
*
|
|
15
|
+
* read them or not (docs/design/environments.md): each with Add, which opens
|
|
16
|
+
* a new row with its name, and Dismiss, which the whole team then sees, and
|
|
17
|
+
* below them Dismiss all. Nothing shows when nothing is missing, dismissed
|
|
18
|
+
* keys included: they are restored from the CLI (`coffre missing
|
|
19
|
+
* --dismissed`), or by Undo right after dismissing.
|
|
16
20
|
*/
|
|
17
21
|
export function MissingKeys({
|
|
18
22
|
project,
|
|
@@ -29,82 +33,74 @@ export function MissingKeys({
|
|
|
29
33
|
const coffre = useCoffre();
|
|
30
34
|
const place = { project, environment };
|
|
31
35
|
const { data } = useQuery(queries.missing(coffre, place));
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
36
|
+
const queryClient = useQueryClient();
|
|
37
|
+
// Each call's own promise, which `mutate`'s callbacks are not: they follow only the latest call.
|
|
38
|
+
const dismissKeys = useMutation(changeOptions(queryClient, dismissMissing(coffre, place))).mutateAsync;
|
|
39
|
+
const restoreKeys = useMutation(changeOptions(queryClient, restoreMissing(coffre, place))).mutateAsync;
|
|
40
|
+
const list = missingList(place);
|
|
41
|
+
const { status, dismiss: forget } = useChangeStatus(list.queryKey);
|
|
42
|
+
// What is missing, and only that: the dismissed are not listed.
|
|
43
|
+
const missing = data === undefined ? [] : list.items(data);
|
|
44
|
+
if (missing.length === 0) return null;
|
|
45
|
+
const columns = canWrite ? 3 : 2;
|
|
46
|
+
|
|
47
|
+
// Gone from the list at once, and said so at once, each dismissal with its
|
|
48
|
+
// own Undo. A refused one puts its rows back, saying why beneath them, and
|
|
49
|
+
// its toast says why too (`dismissWithUndo`).
|
|
50
|
+
const dismiss = (entries: MissingKey[]) => void dismissWithUndo(entries, { dismiss: dismissKeys, restore: restoreKeys });
|
|
38
51
|
|
|
39
52
|
return (
|
|
40
53
|
<>
|
|
41
54
|
<Card
|
|
42
55
|
wide
|
|
43
56
|
labelledBy="missing-keys"
|
|
44
|
-
title={
|
|
57
|
+
title={`${missing.length} ${missing.length === 1 ? 'key' : 'keys'} from other environments ${missing.length === 1 ? "isn't" : "aren't"} here`}
|
|
45
58
|
description="Compared with every other environment of the project, by key name."
|
|
46
59
|
>
|
|
47
60
|
<div className="dt-wrap">
|
|
48
61
|
<table className="dt stacks missing-keys">
|
|
49
62
|
<tbody>
|
|
50
|
-
{missing.map((entry) =>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
<td className="col-actions">
|
|
59
|
-
<div className="acts">
|
|
60
|
-
<button type="button" className="btn btn-sm" onClick={() => onAdd(entry.key)}>
|
|
61
|
-
Add
|
|
62
|
-
</button>
|
|
63
|
-
<button type="button" className="btn btn-sm btn-quiet" disabled={pending} onClick={() => dismiss({ [entry.key]: true })}>
|
|
64
|
-
Dismiss
|
|
65
|
-
</button>
|
|
66
|
-
</div>
|
|
67
|
-
</td>
|
|
68
|
-
)}
|
|
69
|
-
</tr>
|
|
70
|
-
))}
|
|
71
|
-
{showDismissed && dismissed.length > 0 && (
|
|
72
|
-
<tr className="folder-row">
|
|
73
|
-
<th colSpan={canWrite ? 3 : 2} scope="rowgroup">Dismissed</th>
|
|
74
|
-
</tr>
|
|
75
|
-
)}
|
|
76
|
-
{showDismissed && dismissed.map((entry) => (
|
|
77
|
-
<tr key={`dismissed:${entry.key}`}>
|
|
78
|
-
<td className="mono" data-label="Key">{entry.key}</td>
|
|
79
|
-
<td className="cell-muted" data-label="Dismissed">
|
|
80
|
-
By {entry.dismissedBy} <Timestamp iso={entry.dismissedAt} display="relative" />; in {entry.in.join(', ')}
|
|
81
|
-
</td>
|
|
82
|
-
{canWrite && (
|
|
83
|
-
<td className="col-actions">
|
|
84
|
-
<button type="button" className="btn btn-sm" disabled={pending} onClick={() => dismiss({ [entry.key]: null })}>
|
|
85
|
-
Restore
|
|
86
|
-
</button>
|
|
63
|
+
{missing.map((entry) => {
|
|
64
|
+
const state = status(entry.key);
|
|
65
|
+
return [
|
|
66
|
+
<tr key={entry.key} className={rowClass(state)}>
|
|
67
|
+
<td className="mono" data-label="Key">{entry.key}</td>
|
|
68
|
+
<td className="cell-muted" data-label="In">
|
|
69
|
+
In {entry.in.join(', ')}
|
|
70
|
+
{entry.folder !== null && <>, in {entry.folder}/</>}
|
|
87
71
|
</td>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
72
|
+
{canWrite && (
|
|
73
|
+
<td className="col-actions">
|
|
74
|
+
<div className="acts">
|
|
75
|
+
<button type="button" className="btn btn-sm" onClick={() => onAdd(entry.key)}>
|
|
76
|
+
Add
|
|
77
|
+
</button>
|
|
78
|
+
<button type="button" className="btn btn-sm btn-quiet" onClick={() => dismiss([entry])}>
|
|
79
|
+
Dismiss
|
|
80
|
+
</button>
|
|
81
|
+
</div>
|
|
82
|
+
</td>
|
|
83
|
+
)}
|
|
84
|
+
</tr>,
|
|
85
|
+
<RowFailure
|
|
86
|
+
key={`failure:${entry.key}`}
|
|
87
|
+
status={state}
|
|
88
|
+
columns={columns}
|
|
89
|
+
onDismiss={() => state.state === 'failed' && forget(state.mutationId)}
|
|
90
|
+
/>,
|
|
91
|
+
];
|
|
92
|
+
})}
|
|
91
93
|
</tbody>
|
|
92
94
|
</table>
|
|
93
95
|
</div>
|
|
94
|
-
{error !== null && <ErrorLine error={error} />}
|
|
95
96
|
</Card>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<button type="button" className="btn"
|
|
97
|
+
{canWrite && missing.length > 1 && (
|
|
98
|
+
<div className="table-actions">
|
|
99
|
+
<button type="button" className="btn" onClick={() => dismiss(missing)}>
|
|
99
100
|
Dismiss all
|
|
100
101
|
</button>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<button type="button" className="btn btn-quiet" aria-expanded={showDismissed} onClick={() => setShowDismissed((open) => !open)}>
|
|
104
|
-
{showDismissed ? 'Hide dismissed' : `Dismissed (${dismissed.length})`}
|
|
105
|
-
</button>
|
|
106
|
-
)}
|
|
107
|
-
</div>
|
|
102
|
+
</div>
|
|
103
|
+
)}
|
|
108
104
|
</>
|
|
109
105
|
);
|
|
110
106
|
}
|
|
@@ -270,9 +270,7 @@ export function PrincipalAccess({ principalType, principalId }: { principalType:
|
|
|
270
270
|
<UnreadAccess member={memberRef(principalType, principalId)} error={error} />
|
|
271
271
|
) : rows.length === 0 ? (
|
|
272
272
|
<EmptyState title="No project access yet">
|
|
273
|
-
{editable.length > 0
|
|
274
|
-
? `Edit access gives this ${kind} access to several projects at once.`
|
|
275
|
-
: `None of the projects where you manage access has a grant for this ${kind}.`}
|
|
273
|
+
{editable.length > 0 ? undefined : `None of the projects where you manage access has a grant for this ${kind}.`}
|
|
276
274
|
</EmptyState>
|
|
277
275
|
) : (
|
|
278
276
|
<GrantsTable
|
|
@@ -298,7 +296,7 @@ export function PrincipalAccess({ principalType, principalId }: { principalType:
|
|
|
298
296
|
to={people ? '/projects/$project/users' : '/projects/$project/service-accounts'}
|
|
299
297
|
params={{ project: project.slug }}
|
|
300
298
|
>
|
|
301
|
-
{project.
|
|
299
|
+
{project.slug}
|
|
302
300
|
</Link>
|
|
303
301
|
{project.archivedAt !== null && <span className="tag tag-red">Archived</span>}
|
|
304
302
|
</span>
|
|
@@ -315,11 +313,9 @@ export function PrincipalAccess({ principalType, principalId }: { principalType:
|
|
|
315
313
|
</div>
|
|
316
314
|
)}
|
|
317
315
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
: 'Only projects where you manage access are listed.'}
|
|
322
|
-
</p>
|
|
316
|
+
{!(held?.managed === true && principalType === 'service') && (
|
|
317
|
+
<p className="hint section-foot">Only projects where you manage access are listed.</p>
|
|
318
|
+
)}
|
|
323
319
|
|
|
324
320
|
</>
|
|
325
321
|
)}
|
|
@@ -473,7 +469,7 @@ function EditAccess({
|
|
|
473
469
|
<label className="plan-project" htmlFor={id}>
|
|
474
470
|
<Tile name={project.slug} />
|
|
475
471
|
<span className="plan-project-text">
|
|
476
|
-
<span className="plan-project-name">{project.
|
|
472
|
+
<span className="plan-project-name">{project.slug}</span>
|
|
477
473
|
{held.level === 'custom' && (
|
|
478
474
|
<span className="plan-project-held">
|
|
479
475
|
Holds {grants.map((grant) => projectAccessLabel(grant)).join(', ')}
|
|
@@ -502,14 +498,14 @@ function EditAccess({
|
|
|
502
498
|
plan.level === 'viewer' ||
|
|
503
499
|
plan.level === 'developer') && (
|
|
504
500
|
<ExpiryField
|
|
505
|
-
label={`${project.
|
|
501
|
+
label={`${project.slug} expires`}
|
|
506
502
|
expiresAt={plan.expiresAt}
|
|
507
503
|
onChange={(expiresAt) => edit({ ...plan, expiresAt })}
|
|
508
504
|
/>
|
|
509
505
|
)}
|
|
510
506
|
|
|
511
507
|
{plan.level === 'env' && (
|
|
512
|
-
<ul className="plan-envs" aria-label={`Environments of ${project.
|
|
508
|
+
<ul className="plan-envs" aria-label={`Environments of ${project.slug}`}>
|
|
513
509
|
{environments.map((slug) => {
|
|
514
510
|
const current = environmentAccess(plan, slug);
|
|
515
511
|
return (
|
|
@@ -540,7 +536,7 @@ function EditAccess({
|
|
|
540
536
|
</select>
|
|
541
537
|
{current !== null && (
|
|
542
538
|
<ExpiryField
|
|
543
|
-
label={`${slug} of ${project.
|
|
539
|
+
label={`${slug} of ${project.slug} expires`}
|
|
544
540
|
expiresAt={current.expiresAt}
|
|
545
541
|
onChange={(expiresAt) =>
|
|
546
542
|
edit(withEnvironment(plan, slug, { ...current, expiresAt }))
|
|
@@ -554,7 +550,7 @@ function EditAccess({
|
|
|
554
550
|
)}
|
|
555
551
|
|
|
556
552
|
{changes.length > 0 && (
|
|
557
|
-
<ul className="plan-changes" aria-label={`Changes to ${project.
|
|
553
|
+
<ul className="plan-changes" aria-label={`Changes to ${project.slug}`}>
|
|
558
554
|
{changes.map((change) => (
|
|
559
555
|
<li
|
|
560
556
|
key={
|
|
@@ -26,18 +26,9 @@ export function ServiceTokens({ serviceId, tokens, grants }: { serviceId: string
|
|
|
26
26
|
|
|
27
27
|
return (
|
|
28
28
|
<>
|
|
29
|
-
<Card
|
|
30
|
-
labelledBy="service-tokens"
|
|
31
|
-
title="Bearer tokens"
|
|
32
|
-
description={
|
|
33
|
-
<>
|
|
34
|
-
A long-lived secret, for CI that can't use OIDC. For example, a cron job on your own server runs{' '}
|
|
35
|
-
<span className="mono nowrap">coffre login <url> --token</span> with one. coffre shows it once.
|
|
36
|
-
</>
|
|
37
|
-
}
|
|
38
|
-
>
|
|
29
|
+
<Card labelledBy="service-tokens" title="Bearer tokens">
|
|
39
30
|
{tokens.length === 0 ? (
|
|
40
|
-
<EmptyState title="No bearer tokens"
|
|
31
|
+
<EmptyState title="No bearer tokens" />
|
|
41
32
|
) : (
|
|
42
33
|
<div className="dt-wrap">
|
|
43
34
|
<table className="dt">
|
package/src/components/shell.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
type ReactElement,
|
|
6
6
|
type ReactNode,
|
|
7
7
|
} from 'react';
|
|
8
|
-
import { Link,
|
|
8
|
+
import { Link, useRouterState } from '@tanstack/react-router';
|
|
9
9
|
import { Dialog } from '@base-ui/react/dialog';
|
|
10
10
|
import { Menu } from '@base-ui/react/menu';
|
|
11
11
|
import { INSTANCE_ROLES } from '@coffre/core/access';
|
|
@@ -410,7 +410,7 @@ function Breadcrumbs({
|
|
|
410
410
|
</span>
|
|
411
411
|
<span className="crumb">
|
|
412
412
|
<span className="crumb-link" aria-current="page">
|
|
413
|
-
<span>{projectSlug}</span>
|
|
413
|
+
<span className="crumb-name">{projectSlug}</span>
|
|
414
414
|
</span>
|
|
415
415
|
</span>
|
|
416
416
|
</nav>
|
|
@@ -419,7 +419,8 @@ function Breadcrumbs({
|
|
|
419
419
|
|
|
420
420
|
if (section !== 'projects' || projectSlug === undefined) return null;
|
|
421
421
|
|
|
422
|
-
|
|
422
|
+
// The active projects, and this one even archived: its page is its entry in the list.
|
|
423
|
+
const listed = projects.filter((project) => project.archivedAt === null || project.slug === projectSlug);
|
|
423
424
|
const project = projects.find((entry) => entry.slug === projectSlug);
|
|
424
425
|
|
|
425
426
|
return (
|
|
@@ -431,7 +432,7 @@ function Breadcrumbs({
|
|
|
431
432
|
<span className="crumb-sep" aria-hidden>
|
|
432
433
|
/
|
|
433
434
|
</span>
|
|
434
|
-
<ProjectCrumb slug={projectSlug} current={environmentSlug === undefined} projects={
|
|
435
|
+
<ProjectCrumb slug={projectSlug} current={environmentSlug === undefined} projects={listed} />
|
|
435
436
|
|
|
436
437
|
{environmentSlug !== undefined && (
|
|
437
438
|
<>
|
|
@@ -449,6 +450,11 @@ function Breadcrumbs({
|
|
|
449
450
|
);
|
|
450
451
|
}
|
|
451
452
|
|
|
453
|
+
/**
|
|
454
|
+
* The project you are in, one button that lists every project. Its own
|
|
455
|
+
* page, all its environments, is the current one in that list. Each entry
|
|
456
|
+
* is a link, so the router fetches its page as it is pointed at or focused.
|
|
457
|
+
*/
|
|
452
458
|
function ProjectCrumb({
|
|
453
459
|
slug,
|
|
454
460
|
current,
|
|
@@ -458,46 +464,39 @@ function ProjectCrumb({
|
|
|
458
464
|
current: boolean;
|
|
459
465
|
projects: ProjectSummary[];
|
|
460
466
|
}) {
|
|
461
|
-
const navigate = useNavigate();
|
|
462
467
|
return (
|
|
463
|
-
<
|
|
464
|
-
<
|
|
465
|
-
className="crumb-link"
|
|
466
|
-
|
|
467
|
-
params={{ project: slug }}
|
|
468
|
+
<Menu.Root>
|
|
469
|
+
<Menu.Trigger
|
|
470
|
+
className="crumb-link crumb-switch crumb-project"
|
|
471
|
+
aria-label={`${slug}, switch project`}
|
|
468
472
|
aria-current={current ? 'page' : undefined}
|
|
469
473
|
>
|
|
470
474
|
<Tile name={slug} />
|
|
471
|
-
<span className="crumb-project-name">{slug}</span>
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
</Menu.Item>
|
|
493
|
-
))}
|
|
494
|
-
</Menu.Group>
|
|
495
|
-
</MenuPopup>
|
|
496
|
-
</Menu.Root>
|
|
497
|
-
</span>
|
|
475
|
+
<span className="crumb-name crumb-project-name">{slug}</span>
|
|
476
|
+
<ChevronsUpDown size={14} className="crumb-chevron" />
|
|
477
|
+
</Menu.Trigger>
|
|
478
|
+
<MenuPopup align="start">
|
|
479
|
+
<Menu.Group>
|
|
480
|
+
<Menu.GroupLabel className="menu-label">Projects</Menu.GroupLabel>
|
|
481
|
+
{projects.map((project) => (
|
|
482
|
+
<Menu.LinkItem
|
|
483
|
+
key={project.slug}
|
|
484
|
+
className="menu-item"
|
|
485
|
+
closeOnClick
|
|
486
|
+
render={<Link to="/projects/$project" params={{ project: project.slug }} />}
|
|
487
|
+
>
|
|
488
|
+
<Tile name={project.slug} />
|
|
489
|
+
{project.slug}
|
|
490
|
+
{project.slug === slug && <Check size={14} className="menu-check" />}
|
|
491
|
+
</Menu.LinkItem>
|
|
492
|
+
))}
|
|
493
|
+
</Menu.Group>
|
|
494
|
+
</MenuPopup>
|
|
495
|
+
</Menu.Root>
|
|
498
496
|
);
|
|
499
497
|
}
|
|
500
498
|
|
|
499
|
+
/** The environment you are in, one button that lists its siblings you can open, as links like the project's. */
|
|
501
500
|
function EnvironmentCrumb({
|
|
502
501
|
projectSlug,
|
|
503
502
|
slug,
|
|
@@ -507,45 +506,50 @@ function EnvironmentCrumb({
|
|
|
507
506
|
slug: string;
|
|
508
507
|
environments: ProjectSummary['environments'];
|
|
509
508
|
}) {
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
<span className="crumb">
|
|
509
|
+
if (environments.length === 0) {
|
|
510
|
+
return (
|
|
513
511
|
<span className="crumb-link" aria-current="page">
|
|
514
|
-
<span>{slug}</span>
|
|
512
|
+
<span className="crumb-name">{slug}</span>
|
|
515
513
|
</span>
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
514
|
+
);
|
|
515
|
+
}
|
|
516
|
+
return (
|
|
517
|
+
<Menu.Root>
|
|
518
|
+
<Menu.Trigger
|
|
519
|
+
className="crumb-link crumb-switch"
|
|
520
|
+
aria-label={`${slug}, switch environment`}
|
|
521
|
+
aria-current="page"
|
|
522
|
+
>
|
|
523
|
+
<span className="crumb-name">{slug}</span>
|
|
524
|
+
<ChevronsUpDown size={14} className="crumb-chevron" />
|
|
525
|
+
</Menu.Trigger>
|
|
526
|
+
<MenuPopup align="start">
|
|
527
|
+
<Menu.Group>
|
|
528
|
+
<Menu.GroupLabel className="menu-label">
|
|
529
|
+
Environments in {projectSlug}
|
|
530
|
+
</Menu.GroupLabel>
|
|
531
|
+
{environments.map((environment) => (
|
|
532
|
+
<Menu.LinkItem
|
|
533
|
+
key={environment.slug}
|
|
534
|
+
className="menu-item"
|
|
535
|
+
closeOnClick
|
|
536
|
+
render={
|
|
537
|
+
<Link
|
|
538
|
+
to="/projects/$project/$environment"
|
|
539
|
+
params={{ project: projectSlug, environment: environment.slug }}
|
|
540
|
+
/>
|
|
541
|
+
}
|
|
542
|
+
>
|
|
543
|
+
<span className="mono">{environment.slug}</span>
|
|
544
|
+
<span className="menu-hint">
|
|
545
|
+
{environment.details?.secretCount ?? 0} secret
|
|
546
|
+
{environment.details?.secretCount === 1 ? '' : 's'}
|
|
547
|
+
</span>
|
|
548
|
+
{environment.slug === slug && <Check size={14} className="menu-check" />}
|
|
549
|
+
</Menu.LinkItem>
|
|
550
|
+
))}
|
|
551
|
+
</Menu.Group>
|
|
552
|
+
</MenuPopup>
|
|
553
|
+
</Menu.Root>
|
|
550
554
|
);
|
|
551
555
|
}
|
|
@@ -31,18 +31,9 @@ export function TrustedWorkloads({ serviceId, bindings, grants }: { serviceId: s
|
|
|
31
31
|
|
|
32
32
|
return (
|
|
33
33
|
<>
|
|
34
|
-
<Card
|
|
35
|
-
labelledBy="trusted-workloads"
|
|
36
|
-
title="Sign in with OIDC"
|
|
37
|
-
description={
|
|
38
|
-
<>
|
|
39
|
-
A CI run signs in with the ID token GitHub Actions or GitLab gives it, so there is no secret to store. For example,{' '}
|
|
40
|
-
<span className="mono">deploy.yml</span> in <span className="mono">acme/api</span>, on pushes to <span className="mono">main</span>.
|
|
41
|
-
</>
|
|
42
|
-
}
|
|
43
|
-
>
|
|
34
|
+
<Card labelledBy="trusted-workloads" title="Sign in with OIDC">
|
|
44
35
|
{bindings.length === 0 ? (
|
|
45
|
-
<EmptyState title="No trust bindings"
|
|
36
|
+
<EmptyState title="No trust bindings" />
|
|
46
37
|
) : (
|
|
47
38
|
<div className="dt-wrap">
|
|
48
39
|
<table className="dt">
|