@coffre/ui 0.2.0 → 0.4.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.
Files changed (177) hide show
  1. package/dist/chunks/audit-sentence-BhHmvQX_.js +660 -0
  2. package/dist/chunks/audit-sentence-BhHmvQX_.js.map +1 -0
  3. package/dist/chunks/delete-place-CRX7ntE8.js +206 -0
  4. package/dist/chunks/delete-place-CRX7ntE8.js.map +1 -0
  5. package/dist/chunks/{directory-CSjWWUQ1.js → directory-zr3ek7Mc.js} +175 -60
  6. package/dist/chunks/directory-zr3ek7Mc.js.map +1 -0
  7. package/dist/chunks/folders-DoBmCwOi.js +207 -0
  8. package/dist/chunks/folders-DoBmCwOi.js.map +1 -0
  9. package/dist/chunks/grants-Cw1FyGID.js +669 -0
  10. package/dist/chunks/grants-Cw1FyGID.js.map +1 -0
  11. package/dist/chunks/offboarding-CE6d7um1.js +305 -0
  12. package/dist/chunks/offboarding-CE6d7um1.js.map +1 -0
  13. package/dist/chunks/one-time-DXEl9hbg.js +35 -0
  14. package/dist/chunks/one-time-DXEl9hbg.js.map +1 -0
  15. package/dist/chunks/page-DvsgZ2Hd.js +391 -0
  16. package/dist/chunks/page-DvsgZ2Hd.js.map +1 -0
  17. package/dist/chunks/principal-BIN-xwZw.js +42 -0
  18. package/dist/chunks/principal-BIN-xwZw.js.map +1 -0
  19. package/dist/chunks/{principal-page-D_91OA0l.js → principal-page-DhjO76GH.js} +245 -251
  20. package/dist/chunks/principal-page-DhjO76GH.js.map +1 -0
  21. package/dist/chunks/project-page-SRCtRe2g.js +17 -0
  22. package/dist/chunks/project-page-SRCtRe2g.js.map +1 -0
  23. package/dist/chunks/{queries-CQ81o4so.js → queries-DVR_i3rA.js} +132 -30
  24. package/dist/chunks/queries-DVR_i3rA.js.map +1 -0
  25. package/dist/chunks/references-B6pLT1uQ.js +343 -0
  26. package/dist/chunks/references-B6pLT1uQ.js.map +1 -0
  27. package/dist/chunks/{row-state-0PsrEzOL.js → row-state-DOPUsjQK.js} +3 -3
  28. package/dist/chunks/{row-state-0PsrEzOL.js.map → row-state-DOPUsjQK.js.map} +1 -1
  29. package/dist/chunks/signin-errors--ykMFuqN.js +57 -0
  30. package/dist/chunks/signin-errors--ykMFuqN.js.map +1 -0
  31. package/dist/chunks/tabs-BmwKfUeK.js +22 -0
  32. package/dist/chunks/tabs-BmwKfUeK.js.map +1 -0
  33. package/dist/chunks/{theme-B2vQolVR.js → theme-DJuz-xLM.js} +3 -3
  34. package/dist/chunks/{theme-B2vQolVR.js.map → theme-DJuz-xLM.js.map} +1 -1
  35. package/dist/chunks/{ui-DixXLQvQ.js → ui-DJje3gST.js} +6 -3
  36. package/dist/chunks/ui-DJje3gST.js.map +1 -0
  37. package/dist/chunks/{use-change-c6CeLRin.js → use-change-DUiGO19U.js} +52 -21
  38. package/dist/chunks/use-change-DUiGO19U.js.map +1 -0
  39. package/dist/chunks/{use-shell-jxd7Tzd-.js → use-shell-rNKfGjdj.js} +3 -3
  40. package/dist/chunks/{use-shell-jxd7Tzd-.js.map → use-shell-rNKfGjdj.js.map} +1 -1
  41. package/dist/chunks/validation-D312_NLf.js +87 -0
  42. package/dist/chunks/validation-D312_NLf.js.map +1 -0
  43. package/dist/index.d.ts +361 -27
  44. package/dist/index.js +188 -98
  45. package/dist/index.js.map +1 -1
  46. package/dist/pages/account.d.ts +2 -2
  47. package/dist/pages/account.js +297 -135
  48. package/dist/pages/account.js.map +1 -1
  49. package/dist/pages/approval.d.ts +9 -0
  50. package/dist/pages/approval.js +207 -0
  51. package/dist/pages/approval.js.map +1 -0
  52. package/dist/pages/audit.js +17 -542
  53. package/dist/pages/audit.js.map +1 -1
  54. package/dist/pages/device-login.js +2 -3
  55. package/dist/pages/device-login.js.map +1 -1
  56. package/dist/pages/environment.js +647 -257
  57. package/dist/pages/environment.js.map +1 -1
  58. package/dist/pages/login.js +18 -7
  59. package/dist/pages/login.js.map +1 -1
  60. package/dist/pages/oauth-authorize.d.ts +10 -0
  61. package/dist/pages/oauth-authorize.js +249 -0
  62. package/dist/pages/oauth-authorize.js.map +1 -0
  63. package/dist/pages/project-access.d.ts +6 -0
  64. package/dist/pages/project-access.js +370 -0
  65. package/dist/pages/project-access.js.map +1 -0
  66. package/dist/pages/project-environments.d.ts +4 -0
  67. package/dist/pages/project-environments.js +593 -0
  68. package/dist/pages/project-environments.js.map +1 -0
  69. package/dist/pages/project-settings.d.ts +4 -0
  70. package/dist/pages/project-settings.js +242 -0
  71. package/dist/pages/project-settings.js.map +1 -0
  72. package/dist/pages/project.d.ts +10 -2
  73. package/dist/pages/project.js +57 -934
  74. package/dist/pages/project.js.map +1 -1
  75. package/dist/pages/projects.js +53 -21
  76. package/dist/pages/projects.js.map +1 -1
  77. package/dist/pages/service-account.d.ts +10 -0
  78. package/dist/pages/{token.js → service-account.js} +115 -56
  79. package/dist/pages/service-account.js.map +1 -0
  80. package/dist/pages/service-accounts.d.ts +3 -0
  81. package/dist/pages/service-accounts.js +38 -0
  82. package/dist/pages/service-accounts.js.map +1 -0
  83. package/dist/pages/settings.d.ts +1 -0
  84. package/dist/pages/settings.js +104 -42
  85. package/dist/pages/settings.js.map +1 -1
  86. package/dist/pages/unregistered.js +2 -3
  87. package/dist/pages/unregistered.js.map +1 -1
  88. package/dist/pages/user.d.ts +6 -1
  89. package/dist/pages/user.js +18 -6
  90. package/dist/pages/user.js.map +1 -1
  91. package/dist/pages/users.js +6 -10
  92. package/dist/pages/users.js.map +1 -1
  93. package/package.json +3 -3
  94. package/src/components/actions-log.tsx +117 -0
  95. package/src/components/audit-sentence.tsx +55 -0
  96. package/src/components/command-palette.tsx +4 -4
  97. package/src/components/delete-place.tsx +180 -0
  98. package/src/components/directory.tsx +259 -110
  99. package/src/components/every-project.tsx +287 -0
  100. package/src/components/expiry-field.tsx +42 -0
  101. package/src/components/folders.tsx +219 -0
  102. package/src/components/grants.tsx +11 -4
  103. package/src/components/icons.tsx +2 -0
  104. package/src/components/missing.tsx +110 -0
  105. package/src/components/offboarding.tsx +61 -33
  106. package/src/components/page.tsx +4 -1
  107. package/src/components/principal-page.tsx +136 -106
  108. package/src/components/principal-picker.tsx +5 -5
  109. package/src/components/principal.tsx +4 -4
  110. package/src/components/references.tsx +323 -0
  111. package/src/components/service-tokens.tsx +115 -95
  112. package/src/components/shell.tsx +11 -32
  113. package/src/components/tabs.tsx +18 -0
  114. package/src/components/trusted-workloads.tsx +97 -79
  115. package/src/components/ui.tsx +8 -1
  116. package/src/index.ts +13 -2
  117. package/src/layout.tsx +2 -2
  118. package/src/lib/access-plan.ts +2 -2
  119. package/src/lib/audit-sentences.ts +161 -77
  120. package/src/lib/changes.ts +56 -5
  121. package/src/lib/coffre.ts +3 -2
  122. package/src/lib/one-time.ts +32 -0
  123. package/src/lib/project-access.ts +11 -23
  124. package/src/lib/project-page.ts +14 -0
  125. package/src/lib/queries.ts +126 -32
  126. package/src/lib/search.ts +25 -0
  127. package/src/lib/signin-errors.ts +45 -1
  128. package/src/lib/validation.ts +14 -0
  129. package/src/options.ts +187 -35
  130. package/src/pages/account.tsx +274 -129
  131. package/src/pages/approval.tsx +197 -0
  132. package/src/pages/audit.tsx +9 -61
  133. package/src/pages/environment.tsx +585 -286
  134. package/src/pages/login.tsx +8 -2
  135. package/src/pages/oauth-authorize.tsx +233 -0
  136. package/src/pages/project-access.tsx +219 -0
  137. package/src/pages/project-environments.tsx +582 -0
  138. package/src/pages/project-settings.tsx +259 -0
  139. package/src/pages/project.tsx +52 -879
  140. package/src/pages/projects.tsx +55 -18
  141. package/src/pages/service-account.tsx +50 -0
  142. package/src/pages/{tokens.tsx → service-accounts.tsx} +9 -6
  143. package/src/pages/settings.tsx +62 -8
  144. package/src/pages/user.tsx +16 -4
  145. package/src/pages/users.tsx +2 -2
  146. package/src/parity.ts +160 -0
  147. package/src/register.ts +58 -9
  148. package/src/router.tsx +4 -0
  149. package/src/shared/models.ts +6 -2
  150. package/src/styles/globals.css +536 -31
  151. package/dist/chunks/directory-CSjWWUQ1.js.map +0 -1
  152. package/dist/chunks/grants-saMQagmG.js +0 -160
  153. package/dist/chunks/grants-saMQagmG.js.map +0 -1
  154. package/dist/chunks/icons-D-PfAfnH.js +0 -203
  155. package/dist/chunks/icons-D-PfAfnH.js.map +0 -1
  156. package/dist/chunks/offboarding-C6l30DZR.js +0 -263
  157. package/dist/chunks/offboarding-C6l30DZR.js.map +0 -1
  158. package/dist/chunks/page-C5HcNqf2.js +0 -190
  159. package/dist/chunks/page-C5HcNqf2.js.map +0 -1
  160. package/dist/chunks/principal-page-D_91OA0l.js.map +0 -1
  161. package/dist/chunks/queries-CQ81o4so.js.map +0 -1
  162. package/dist/chunks/signin-errors-BEFlVDbQ.js +0 -30
  163. package/dist/chunks/signin-errors-BEFlVDbQ.js.map +0 -1
  164. package/dist/chunks/ui-DixXLQvQ.js.map +0 -1
  165. package/dist/chunks/use-action-CWsg_YWU.js +0 -49
  166. package/dist/chunks/use-action-CWsg_YWU.js.map +0 -1
  167. package/dist/chunks/use-change-c6CeLRin.js.map +0 -1
  168. package/dist/chunks/validation-BQtqPe2V.js +0 -29
  169. package/dist/chunks/validation-BQtqPe2V.js.map +0 -1
  170. package/dist/pages/token.d.ts +0 -3
  171. package/dist/pages/token.js.map +0 -1
  172. package/dist/pages/tokens.d.ts +0 -3
  173. package/dist/pages/tokens.js +0 -39
  174. package/dist/pages/tokens.js.map +0 -1
  175. package/dist/project-BqIy8gYR.d.ts +0 -5
  176. package/src/lib/instance.ts +0 -13
  177. package/src/pages/token.tsx +0 -34
@@ -8,9 +8,8 @@ import {
8
8
  import { Link, useNavigate, useRouterState } from '@tanstack/react-router';
9
9
  import { Dialog } from '@base-ui/react/dialog';
10
10
  import { Menu } from '@base-ui/react/menu';
11
- import type { InstanceState } from '@coffre/client';
11
+ import { PROJECT_PAGES } from '@coffre/core/pages';
12
12
  import type { ProjectSummary } from '../shared/models';
13
- import { pendingMigrations, UPGRADE_DOC } from '../lib/instance';
14
13
  import type { UiCapabilities } from '../lib/capabilities';
15
14
  import { isActiveAccessibleEnvironment } from '../lib/project-environments';
16
15
  import { useMounted } from '../lib/mounted';
@@ -19,7 +18,7 @@ import { AdministrationItems } from './affordances';
19
18
  import { CommandPalette } from './command-palette';
20
19
  import { ThemeMenuItems } from './theme';
21
20
  import { Tile } from './tile';
22
- import { MenuPopup, Notice, Tip } from './ui';
21
+ import { MenuPopup, Tip } from './ui';
23
22
  import {
24
23
  Check,
25
24
  ChevronsUpDown,
@@ -45,7 +44,6 @@ type ShellProps = {
45
44
  principal: Principal;
46
45
  instanceRole: InstanceRole;
47
46
  capabilities: UiCapabilities;
48
- instance: InstanceState | null;
49
47
  children: ReactNode;
50
48
  };
51
49
 
@@ -71,26 +69,6 @@ function roleLabel(principal: Principal, instanceRole: InstanceRole): string {
71
69
  return 'Member';
72
70
  }
73
71
 
74
- /**
75
- * Above every page, for owners and root admins, while the database is behind
76
- * the code this instance runs: what to run, and where the steps are.
77
- */
78
- function MigrationBanner({ instance }: { instance: InstanceState | null }) {
79
- const pending = pendingMigrations(instance);
80
- if (pending.length === 0) return null;
81
- return (
82
- <div className="migration-banner">
83
- <Notice tone="info">
84
- <strong>Database migrations pending:</strong> run <code>coffre migrate</code> to apply{' '}
85
- <span className="mono">{pending.join(', ')}</span>, which coffre {instance?.version} ships.{' '}
86
- <a href={UPGRADE_DOC} target="_blank" rel="noreferrer">
87
- How to upgrade
88
- </a>
89
- </Notice>
90
- </div>
91
- );
92
- }
93
-
94
72
  /** The product's mark and name, for the pages you see before signing in. */
95
73
  export function Brand() {
96
74
  return (
@@ -112,7 +90,7 @@ export function Brand() {
112
90
  * navigation lives outside the pages themselves. Everywhere else the page's
113
91
  * own title says where you are, so the bar leaves it out rather than repeat it.
114
92
  */
115
- export function Shell({ projects, principal, instanceRole, capabilities, instance, children }: ShellProps) {
93
+ export function Shell({ projects, principal, instanceRole, capabilities, children }: ShellProps) {
116
94
  const { portal } = usePreferences();
117
95
  const pathname = useRouterState({ select: (state) => state.location.pathname });
118
96
  const [drawerOpen, setDrawerOpen] = useState(false);
@@ -220,7 +198,6 @@ export function Shell({ projects, principal, instanceRole, capabilities, instanc
220
198
  </header>
221
199
 
222
200
  <main className="content" id="content">
223
- <MigrationBanner instance={instance} />
224
201
  {children}
225
202
  </main>
226
203
  </div>
@@ -268,7 +245,7 @@ function Sidebar({
268
245
  users={
269
246
  <>
270
247
  <NavLink to="/users" label="Users" icon={<Users size={16} />} collapsed={collapsed} />
271
- <NavLink to="/tokens" label="Tokens" icon={<Key size={16} />} collapsed={collapsed} />
248
+ <NavLink to="/service-accounts" label="Service accounts" icon={<Key size={16} />} collapsed={collapsed} />
272
249
  </>
273
250
  }
274
251
  audit={
@@ -330,7 +307,7 @@ function NavLink({
330
307
  icon,
331
308
  collapsed,
332
309
  }: {
333
- to: '/projects' | '/users' | '/tokens' | '/audit' | '/settings';
310
+ to: '/projects' | '/users' | '/service-accounts' | '/audit' | '/settings';
334
311
  label: string;
335
312
  icon: ReactNode;
336
313
  collapsed: boolean;
@@ -412,20 +389,22 @@ function Breadcrumbs({
412
389
  projects: ProjectSummary[];
413
390
  canListPrincipals: boolean;
414
391
  }) {
415
- const [section, projectSlug, environmentSlug] = pathname
392
+ const [section, projectSlug, place] = pathname
416
393
  .split('/')
417
394
  .filter((segment) => segment !== '')
418
395
  .map(decodeURIComponent);
396
+ // A project's tab sits where an environment would, and no environment takes its name.
397
+ const environmentSlug = place !== undefined && (PROJECT_PAGES as readonly string[]).includes(place) ? undefined : place;
419
398
 
420
399
  // A user's or token's own page sits under its list, like an environment
421
400
  // under its project. Someone who manages one project's access reaches the
422
401
  // page without being able to open the list, so the root is then just a label.
423
- if ((section === 'users' || section === 'tokens') && projectSlug !== undefined) {
424
- const label = <span>{section === 'users' ? 'Users' : 'Tokens'}</span>;
402
+ if ((section === 'users' || section === 'service-accounts') && projectSlug !== undefined) {
403
+ const label = <span>{section === 'users' ? 'Users' : 'Service accounts'}</span>;
425
404
  return (
426
405
  <nav className="crumbs" aria-label="Breadcrumb">
427
406
  {canListPrincipals ? (
428
- <Link className="crumb-link crumb-root" to={section === 'users' ? '/users' : '/tokens'}>
407
+ <Link className="crumb-link crumb-root" to={section === 'users' ? '/users' : '/service-accounts'}>
429
408
  {label}
430
409
  </Link>
431
410
  ) : (
@@ -0,0 +1,18 @@
1
+ import { Children, type ReactNode } from 'react';
2
+
3
+ /**
4
+ * A page's sections as tabs under its header. Each is a `<Link>` to a route
5
+ * nested under the page's layout, the first to its index with
6
+ * `activeOptions={{ exact: true, includeSearch: false }}`, and the router
7
+ * marks the one shown `aria-current="page"`. The caller leaves out a tab
8
+ * nobody may open.
9
+ */
10
+ export function PageTabs({ label, children }: { label: string; children: ReactNode }) {
11
+ // One tab is no choice at all.
12
+ if (Children.toArray(children).length < 2) return null;
13
+ return (
14
+ <nav className="tabs" aria-label={label}>
15
+ {children}
16
+ </nav>
17
+ );
18
+ }
@@ -24,86 +24,104 @@ export function TrustedWorkloads({ serviceId, bindings }: { serviceId: string; b
24
24
  const { status, dismiss } = useChangeStatus(change.list.queryKey);
25
25
 
26
26
  return (
27
- <Card
28
- labelledBy="trusted-workloads"
29
- title="Trusted workloads"
30
- description="CI runs that may sign in as this service with the ID token their platform signs, when every claim of a binding matches. Nothing long-lived is stored."
31
- actions={<TrustWorkload serviceId={serviceId} />}
32
- >
33
- {bindings.length === 0 ? (
34
- <EmptyState title="No trusted workloads">
35
- CI can still use a token. Trust a workflow to let its runs sign in without one.
36
- </EmptyState>
37
- ) : (
38
- <div className="dt-wrap">
39
- <table className="dt">
40
- <thead>
41
- <tr>
42
- <th>Workload</th>
43
- <th className="col-shrink">Added (UTC)</th>
44
- <th className="col-shrink">Last used</th>
45
- <th className="col-actions">
46
- <span className="visually-hidden">Actions</span>
47
- </th>
48
- </tr>
49
- </thead>
50
- <tbody>
51
- {bindings.map((binding) => {
52
- const state = status(binding.id);
53
- const { title, detail } = summary(binding);
54
- return (
55
- <Fragment key={binding.id}>
56
- <tr className={rowClass(state)}>
57
- <td>
58
- <span className="cell-account">
59
- {binding.profile.startsWith('github') ? <GitHub size={15} /> : <Link size={15} />}
27
+ <>
28
+ <Card
29
+ labelledBy="trusted-workloads"
30
+ title="Sign in with OIDC"
31
+ description="The way with nothing to store: CI runs sign in as this service account with the ID token their platform signs, when every claim of a trust binding matches. Recommended wherever the CI signs one."
32
+ >
33
+ {bindings.length === 0 ? (
34
+ <EmptyState title="No trust bindings">
35
+ Trust a CI workflow to let its runs sign in as this service account with no stored secret. Until then, CI needs a bearer token.
36
+ </EmptyState>
37
+ ) : (
38
+ <div className="dt-wrap">
39
+ <table className="dt">
40
+ <thead>
41
+ <tr>
42
+ <th>Workload</th>
43
+ <th className="col-shrink">Added (UTC)</th>
44
+ <th className="col-shrink">Last used</th>
45
+ <th className="col-actions">
46
+ <span className="visually-hidden">Actions</span>
47
+ </th>
48
+ </tr>
49
+ </thead>
50
+ <tbody>
51
+ {bindings.map((binding) => {
52
+ const state = status(binding.id);
53
+ const { title, detail } = summary(binding);
54
+ return (
55
+ <Fragment key={binding.id}>
56
+ <tr className={rowClass(state)}>
57
+ <td>
58
+ <span className="cell-account">
59
+ {binding.profile.startsWith('github') ? <GitHub size={15} /> : <Link size={15} />}
60
+ <span className="cell-stack">
61
+ <span>{binding.label ?? title}</span>
62
+ <small>{binding.label === null ? detail : `${title} · ${detail}`}</small>
63
+ <details className="claims">
64
+ <summary>Claims</summary>
65
+ <Claims binding={binding} />
66
+ </details>
67
+ </span>
68
+ </span>
69
+ </td>
70
+ <td className="nowrap">
60
71
  <span className="cell-stack">
61
- <span>{binding.label ?? title}</span>
62
- <small>{binding.label === null ? detail : `${title} · ${detail}`}</small>
63
- <details className="claims">
64
- <summary>Claims</summary>
65
- <Claims binding={binding} />
66
- </details>
72
+ <Timestamp iso={binding.createdAt} />
73
+ <small>by {binding.createdBy}</small>
67
74
  </span>
68
- </span>
69
- </td>
70
- <td className="nowrap">
71
- <span className="cell-stack">
72
- <Timestamp iso={binding.createdAt} />
73
- <small>by {binding.createdBy}</small>
74
- </span>
75
- </td>
76
- <td className="nowrap cell-muted">
77
- {binding.lastUsedAt === null ? 'Never' : <Timestamp iso={binding.lastUsedAt} display="relative" />}
78
- </td>
79
- <td className="col-actions">
80
- {state.state === 'pending' ? (
81
- <RowPending status={state} />
82
- ) : (
83
- <ConfirmButton
84
- trigger={
85
- <button className="act">
86
- <X size={13} />
87
- Remove
88
- </button>
89
- }
90
- title={<>Stop trusting {binding.label ?? title}?</>}
91
- body="Its runs are refused from their next sign-in, and credentials they hold stop working. A binding removed is never trusted again; to trust the runs again, add a new one."
92
- confirmLabel="Remove binding"
93
- onConfirm={() => remove(binding)}
94
- />
95
- )}
96
- </td>
97
- </tr>
98
- <RowFailure status={state} columns={4} onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)} />
99
- </Fragment>
100
- );
101
- })}
102
- </tbody>
103
- </table>
104
- </div>
105
- )}
106
- </Card>
75
+ </td>
76
+ <td className="nowrap cell-muted">
77
+ {binding.lastUsedAt === null ? 'Never' : <Timestamp iso={binding.lastUsedAt} display="relative" />}
78
+ </td>
79
+ <td className="col-actions">
80
+ {state.state === 'pending' ? (
81
+ <RowPending status={state} />
82
+ ) : (
83
+ <ConfirmButton
84
+ trigger={
85
+ <button className="act">
86
+ <X size={13} />
87
+ Remove
88
+ </button>
89
+ }
90
+ title={<>Stop trusting {binding.label ?? title}?</>}
91
+ body={
92
+ <>
93
+ Runs of <strong>{title}</strong> ({detail}) can no longer sign in as{' '}
94
+ <span className="mono">service:{serviceId}</span>, and credentials they hold stop
95
+ working at once.{' '}
96
+ {binding.lastUsedAt === null ? (
97
+ 'It was never used.'
98
+ ) : (
99
+ <>
100
+ It was last used <Timestamp iso={binding.lastUsedAt} display="relative" />.
101
+ </>
102
+ )}{' '}
103
+ A binding removed is never trusted again; to trust the runs again, add a new one.
104
+ </>
105
+ }
106
+ confirmLabel="Remove binding"
107
+ onConfirm={() => remove(binding)}
108
+ />
109
+ )}
110
+ </td>
111
+ </tr>
112
+ <RowFailure status={state} columns={4} onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)} />
113
+ </Fragment>
114
+ );
115
+ })}
116
+ </tbody>
117
+ </table>
118
+ </div>
119
+ )}
120
+ </Card>
121
+ <div className="table-actions">
122
+ <TrustWorkload serviceId={serviceId} />
123
+ </div>
124
+ </>
107
125
  );
108
126
  }
109
127
 
@@ -191,7 +209,7 @@ function TrustWorkload({ serviceId }: { serviceId: string }) {
191
209
 
192
210
  return (
193
211
  <>
194
- <button className="btn btn-sm" onClick={() => setOpen(true)}>
212
+ <button className="btn" onClick={() => setOpen(true)}>
195
213
  <Plus size={14} />
196
214
  Trust a workload
197
215
  </button>
@@ -166,6 +166,7 @@ const NOTICE_ICON = {
166
166
  info: Info,
167
167
  good: Check,
168
168
  bad: AlertTriangle,
169
+ warn: AlertTriangle,
169
170
  neutral: Info,
170
171
  } as const;
171
172
 
@@ -300,12 +301,16 @@ export function CopyButton({
300
301
  type ConfirmProps = {
301
302
  title: ReactNode;
302
303
  body: ReactNode;
304
+ /** What the body's sentence cannot hold, such as a list: after it, outside its paragraph. */
305
+ detail?: ReactNode;
303
306
  confirmLabel: string;
304
307
  destructive?: boolean;
308
+ /** While something must happen first, which `detail` says. */
309
+ confirmDisabled?: boolean;
305
310
  onConfirm: () => void;
306
311
  };
307
312
 
308
- function ConfirmContent({ title, body, confirmLabel, destructive, onConfirm }: ConfirmProps) {
313
+ function ConfirmContent({ title, body, detail, confirmLabel, destructive, confirmDisabled, onConfirm }: ConfirmProps) {
309
314
  const { portal } = usePreferences();
310
315
  return (
311
316
  <AlertDialog.Portal container={portal}>
@@ -313,11 +318,13 @@ function ConfirmContent({ title, body, confirmLabel, destructive, onConfirm }: C
313
318
  <AlertDialog.Popup className="dialog dialog-confirm">
314
319
  <AlertDialog.Title className="dialog-title">{title}</AlertDialog.Title>
315
320
  <AlertDialog.Description className="dialog-body">{body}</AlertDialog.Description>
321
+ {detail}
316
322
  <div className="dialog-actions">
317
323
  <AlertDialog.Close className="btn">Cancel</AlertDialog.Close>
318
324
  <AlertDialog.Close
319
325
  className={`btn ${destructive === false ? 'btn-primary' : 'btn-danger'}`}
320
326
  onClick={onConfirm}
327
+ disabled={confirmDisabled}
321
328
  >
322
329
  {confirmLabel}
323
330
  </AlertDialog.Close>
package/src/index.ts CHANGED
@@ -10,20 +10,31 @@ export { createRouter } from './router.tsx';
10
10
  export {
11
11
  access,
12
12
  account,
13
+ approval,
13
14
  audit,
14
15
  deviceLogin,
15
16
  environment,
16
17
  home,
17
18
  login,
19
+ oauthAuthorize,
18
20
  project,
21
+ projectEnvironments,
19
22
  projects,
23
+ projectServiceAccounts,
24
+ projectSettings,
25
+ projectUsers,
26
+ serviceAccount,
27
+ serviceAccountAccess,
28
+ serviceAccountActivity,
29
+ serviceAccounts,
30
+ serviceAccountSignIn,
20
31
  settings,
21
32
  shell,
22
33
  solo,
23
- token,
24
- tokens,
25
34
  unregistered,
26
35
  user,
36
+ userAccess,
37
+ userActivity,
27
38
  users,
28
39
  type CoffreContext,
29
40
  } from './options.ts';
package/src/layout.tsx CHANGED
@@ -84,13 +84,13 @@ export function CoffreProvider({ children }: { children: ReactNode }) {
84
84
 
85
85
  /** coffre's shell: the nav, around the signed-in pages. */
86
86
  export function ShellLayout() {
87
- const { principal, instanceRole, projects, capabilities, instance } = useShell();
87
+ const { principal, instanceRole, projects, capabilities } = useShell();
88
88
  return (
89
89
  <>
90
90
  <a className="skip-link" href="#content">
91
91
  Skip to content
92
92
  </a>
93
- <Shell projects={projects} principal={principal} instanceRole={instanceRole} capabilities={capabilities} instance={instance}>
93
+ <Shell projects={projects} principal={principal} instanceRole={instanceRole} capabilities={capabilities}>
94
94
  <Outlet />
95
95
  </Shell>
96
96
  </>
@@ -4,7 +4,7 @@ import type { Role } from '@coffre/core/access';
4
4
  import type { GrantRow } from '../shared/models';
5
5
 
6
6
  /** Read or write on one environment, and when it ends: an ISO instant, or null for never. */
7
- export type EnvironmentAccess = { role: 'viewer' | 'developer'; expiresAt: string | null };
7
+ export type EnvironmentAccess = { role: Extract<Role, 'viewer' | 'developer'>; expiresAt: string | null };
8
8
 
9
9
  /**
10
10
  * What one project is set to in a principal's access editor: nothing, owner,
@@ -16,7 +16,7 @@ export type EnvironmentAccess = { role: 'viewer' | 'developer'; expiresAt: strin
16
16
  * leaves them alone unless another setting is picked.
17
17
  */
18
18
  export type AccessPlan = {
19
- level: 'none' | 'owner' | 'viewer' | 'developer' | 'env' | 'custom';
19
+ level: 'none' | Extract<Role, 'owner' | 'viewer' | 'developer'> | 'env' | 'custom';
20
20
  /** When the project-wide level ends. */
21
21
  expiresAt: string | null;
22
22
  /** Environments without an entry get no access. */