@coffre/ui 0.6.1 → 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.
Files changed (100) hide show
  1. package/dist/chunks/{audit-sentence-CUUMshIp.js → audit-sentence-BVv_9_nq.js} +2 -2
  2. package/dist/chunks/{audit-sentence-CUUMshIp.js.map → audit-sentence-BVv_9_nq.js.map} +1 -1
  3. package/dist/chunks/{connected-apps-DTpatjge.js → connected-apps-rBF9XUob.js} +4 -4
  4. package/dist/chunks/{connected-apps-DTpatjge.js.map → connected-apps-rBF9XUob.js.map} +1 -1
  5. package/dist/chunks/{delete-place-SOOYVt6A.js → delete-place-CkGezx5R.js} +4 -4
  6. package/dist/chunks/{delete-place-SOOYVt6A.js.map → delete-place-CkGezx5R.js.map} +1 -1
  7. package/dist/chunks/{directory-DrtdKny2.js → directory-SRN01yP6.js} +21 -19
  8. package/dist/chunks/directory-SRN01yP6.js.map +1 -0
  9. package/dist/chunks/{folders-hR2Lnk0k.js → folders-Dw240WMJ.js} +2 -2
  10. package/dist/chunks/{folders-hR2Lnk0k.js.map → folders-Dw240WMJ.js.map} +1 -1
  11. package/dist/chunks/{grants-DDBui9YD.js → grants-1E1vqkM0.js} +5 -5
  12. package/dist/chunks/{grants-DDBui9YD.js.map → grants-1E1vqkM0.js.map} +1 -1
  13. package/dist/chunks/multi-combobox-CsIXihuc.js +99 -0
  14. package/dist/chunks/multi-combobox-CsIXihuc.js.map +1 -0
  15. package/dist/chunks/{offboarding-C7ECW5o0.js → offboarding-Bt7KSixm.js} +3 -3
  16. package/dist/chunks/{offboarding-C7ECW5o0.js.map → offboarding-Bt7KSixm.js.map} +1 -1
  17. package/dist/chunks/{principal-page-CB6dAABC.js → principal-page-Cbx2l6XL.js} +21 -24
  18. package/dist/chunks/principal-page-Cbx2l6XL.js.map +1 -0
  19. package/dist/chunks/{project-page-BHNUvr2L.js → project-page-DKo2AFYg.js} +2 -2
  20. package/dist/chunks/{project-page-BHNUvr2L.js.map → project-page-DKo2AFYg.js.map} +1 -1
  21. package/dist/chunks/{queries-DgQo3mC-.js → queries-BvSw1xBN.js} +85 -14
  22. package/dist/chunks/queries-BvSw1xBN.js.map +1 -0
  23. package/dist/chunks/{references-BQc35Q9g.js → references-DCoSPtvw.js} +4 -4
  24. package/dist/chunks/{references-BQc35Q9g.js.map → references-DCoSPtvw.js.map} +1 -1
  25. package/dist/chunks/{role-field-BfWRCqzl.js → role-field-D98CvNEg.js} +2 -2
  26. package/dist/chunks/{role-field-BfWRCqzl.js.map → role-field-D98CvNEg.js.map} +1 -1
  27. package/dist/chunks/{row-state-Zf3kZVhd.js → row-state-BsIHspy4.js} +2 -2
  28. package/dist/chunks/{row-state-Zf3kZVhd.js.map → row-state-BsIHspy4.js.map} +1 -1
  29. package/dist/chunks/{theme-B6-V9JvY.js → theme-3b4DnCow.js} +2 -2
  30. package/dist/chunks/{theme-B6-V9JvY.js.map → theme-3b4DnCow.js.map} +1 -1
  31. package/dist/chunks/{ui-Br-dNUTc.js → ui-2kwXXfrX.js} +95 -22
  32. package/dist/chunks/ui-2kwXXfrX.js.map +1 -0
  33. package/dist/chunks/{use-action-DthL5hL8.js → use-action-Bv7yQ0DW.js} +2 -2
  34. package/dist/chunks/{use-action-DthL5hL8.js.map → use-action-Bv7yQ0DW.js.map} +1 -1
  35. package/dist/chunks/{use-change-By4cG8bT.js → use-change-DIQTGXER.js} +58 -17
  36. package/dist/chunks/use-change-DIQTGXER.js.map +1 -0
  37. package/dist/chunks/{use-shell-D6kjSPls.js → use-shell-DhFoHjDS.js} +2 -2
  38. package/dist/chunks/{use-shell-D6kjSPls.js.map → use-shell-DhFoHjDS.js.map} +1 -1
  39. package/dist/index.d.ts +13 -164
  40. package/dist/index.js +141 -128
  41. package/dist/index.js.map +1 -1
  42. package/dist/pages/account.js +8 -8
  43. package/dist/pages/approval.js +1 -1
  44. package/dist/pages/audit.js +46 -60
  45. package/dist/pages/audit.js.map +1 -1
  46. package/dist/pages/device-login.js +1 -1
  47. package/dist/pages/environment.js +444 -235
  48. package/dist/pages/environment.js.map +1 -1
  49. package/dist/pages/login.js +2 -2
  50. package/dist/pages/oauth-authorize.js +1 -1
  51. package/dist/pages/project-access.js +8 -8
  52. package/dist/pages/project-environments.js +19 -58
  53. package/dist/pages/project-environments.js.map +1 -1
  54. package/dist/pages/project-settings.d.ts +1 -1
  55. package/dist/pages/project-settings.js +54 -75
  56. package/dist/pages/project-settings.js.map +1 -1
  57. package/dist/pages/project.js +3 -7
  58. package/dist/pages/project.js.map +1 -1
  59. package/dist/pages/projects.js +50 -77
  60. package/dist/pages/projects.js.map +1 -1
  61. package/dist/pages/service-account.js +11 -136
  62. package/dist/pages/service-account.js.map +1 -1
  63. package/dist/pages/service-accounts.js +4 -4
  64. package/dist/pages/settings.js +5 -5
  65. package/dist/pages/unregistered.js +1 -1
  66. package/dist/pages/user.js +5 -5
  67. package/dist/pages/users.js +4 -4
  68. package/package.json +3 -3
  69. package/src/components/actions-log.tsx +1 -1
  70. package/src/components/command-palette.tsx +4 -5
  71. package/src/components/directory.tsx +6 -14
  72. package/src/components/missing.tsx +63 -67
  73. package/src/components/principal-page.tsx +10 -14
  74. package/src/components/service-tokens.tsx +2 -11
  75. package/src/components/shell.tsx +79 -75
  76. package/src/components/trusted-workloads.tsx +2 -11
  77. package/src/components/ui.tsx +35 -25
  78. package/src/lib/changes.ts +63 -12
  79. package/src/lib/clipboard.ts +40 -0
  80. package/src/lib/copy-attempts.ts +103 -0
  81. package/src/lib/dismissal.ts +24 -0
  82. package/src/lib/optimistic.ts +3 -1
  83. package/src/lib/queries.ts +106 -13
  84. package/src/lib/row-reads.ts +64 -0
  85. package/src/options.ts +38 -50
  86. package/src/pages/audit.tsx +15 -24
  87. package/src/pages/environment.tsx +307 -91
  88. package/src/pages/project-environments.tsx +8 -34
  89. package/src/pages/project-settings.tsx +9 -20
  90. package/src/pages/project.tsx +1 -5
  91. package/src/pages/projects.tsx +13 -28
  92. package/src/parity.ts +3 -3
  93. package/src/styles/globals.css +87 -128
  94. package/dist/chunks/directory-DrtdKny2.js.map +0 -1
  95. package/dist/chunks/principal-page-CB6dAABC.js.map +0 -1
  96. package/dist/chunks/project-environments-lEzFHUt4.js +0 -11
  97. package/dist/chunks/project-environments-lEzFHUt4.js.map +0 -1
  98. package/dist/chunks/queries-DgQo3mC-.js.map +0 -1
  99. package/dist/chunks/ui-Br-dNUTc.js.map +0 -1
  100. package/dist/chunks/use-change-By4cG8bT.js.map +0 -1
@@ -58,7 +58,7 @@ function EnvironmentsPanel({
58
58
  (environment) => environment.details === null || environment.details.archivedAt === null,
59
59
  );
60
60
  const { failedAdds, dismiss } = useChangeStatus(keys.projects);
61
- const refused = failedAdds<{ slug: string; name: string }>(
61
+ const refused = failedAdds<{ slug: string }>(
62
62
  project.environments.map((environment) => environmentId(project.slug, environment.slug)),
63
63
  ).filter(({ ids }) => ids.every((id) => id.startsWith(`${project.slug}/`)));
64
64
 
@@ -88,10 +88,7 @@ function EnvironmentsPanel({
88
88
  <li key={mutationId}>
89
89
  <div className="env-card is-muted is-failed">
90
90
  <div className="env-card-text">
91
- <span className="env-card-name">{vars.name}</span>
92
- <span className="env-card-meta">
93
- <span className="mono">{vars.slug}</span>
94
- </span>
91
+ <span className="env-card-name">{vars.slug}</span>
95
92
  </div>
96
93
  <ItemFailure status={status} onDismiss={() => dismiss(mutationId)}>
97
94
  Not added.
@@ -182,7 +179,6 @@ function EnvironmentCard({
182
179
  const [deleting, setDeleting] = useState(false);
183
180
  const { capabilities } = useShell();
184
181
  const [slug, setSlug] = useState(environment.slug);
185
- const [name, setName] = useState(environment.name);
186
182
  const coffre = useCoffre();
187
183
  const rename = useChange(renameEnvironment(coffre, project));
188
184
  const archive = useChange(archiveEnvironment(coffre, project));
@@ -220,12 +216,11 @@ function EnvironmentCard({
220
216
  to="/projects/$project/$environment"
221
217
  params={{ project, environment: environment.slug }}
222
218
  >
223
- {environment.name}
219
+ {environment.slug}
224
220
  </Link>
225
221
  ) : (
226
- <span className="env-card-name">{environment.name}</span>
222
+ <span className="env-card-name">{environment.slug}</span>
227
223
  )}
228
- <span className="env-card-slug mono">{environment.slug}</span>
229
224
  </span>
230
225
 
231
226
  {isArchived ? (
@@ -288,7 +283,6 @@ function EnvironmentCard({
288
283
  className="menu-item"
289
284
  onClick={() => {
290
285
  setSlug(environment.slug);
291
- setName(environment.name);
292
286
  setRenaming(true);
293
287
  }}
294
288
  >
@@ -332,7 +326,7 @@ function EnvironmentCard({
332
326
  onSubmit={(event) => {
333
327
  event.preventDefault();
334
328
  // Shown on the card at once; the card says if the server refuses.
335
- rename({ from: environment.slug, slug, name: name.trim() });
329
+ rename({ from: environment.slug, slug });
336
330
  setRenaming(false);
337
331
  }}
338
332
  >
@@ -351,15 +345,6 @@ function EnvironmentCard({
351
345
  `Anything running coffre run ${project}/${environment.slug} will need the new path.`}
352
346
  </span>
353
347
  </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
348
  {reslugged && (
364
349
  <Notice tone="info">
365
350
  Instance roles scoped to <span className="mono">{environment.slug}</span> stop reaching it; those scoped
@@ -374,7 +359,7 @@ function EnvironmentCard({
374
359
  <button
375
360
  className="btn btn-primary"
376
361
  type="submit"
377
- disabled={slug === '' || slugError !== null || name.trim() === ''}
362
+ disabled={slug === environment.slug || slug === '' || slugError !== null}
378
363
  >
379
364
  Save
380
365
  </button>
@@ -451,7 +436,6 @@ function EnvironmentCard({
451
436
  function NewEnvironment({ project, sources }: { project: string; sources: string[] }) {
452
437
  const [open, setOpen] = useState(false);
453
438
  const [slug, setSlug] = useState('');
454
- const [name, setName] = useState('');
455
439
  // '' for empty, 'copy:prod' for a copy, 'ref:prod' for references to prod.
456
440
  const [start, setStart] = useState('');
457
441
  const [how, from] = start === '' ? ['', ''] : (start.split(':') as ['copy' | 'ref', string]);
@@ -489,9 +473,8 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
489
473
  onSubmit={(event) => {
490
474
  event.preventDefault();
491
475
  // Listed at once, as saving; the list says if the server refuses.
492
- create({ slug, name: name.trim(), ...(from === '' ? {} : { from }), ...(how === 'ref' ? { references: true } : {}) });
476
+ create({ slug, ...(from === '' ? {} : { from }), ...(how === 'ref' ? { references: true } : {}) });
493
477
  setSlug('');
494
- setName('');
495
478
  setStart('');
496
479
  close();
497
480
  }}
@@ -520,15 +503,6 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
520
503
  )}
521
504
  </span>
522
505
  </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
506
  {sources.length > 0 && (
533
507
  <label className="field">
534
508
  <span className="label">Start from</span>
@@ -567,7 +541,7 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
567
541
  <button
568
542
  className="btn btn-primary"
569
543
  type="submit"
570
- disabled={slug === '' || slugError !== null || name.trim() === ''}
544
+ disabled={slug === '' || slugError !== null}
571
545
  >
572
546
  Add environment
573
547
  </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, name and folder, and archiving or deleting it. */
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 name and slug, as a form on the page.
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 || name.trim() !== project.name || nextFolder !== project.folder;
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.name, project.folder]);
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 && name.trim() === project.name ? 'Project moved' : 'Project saved');
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 || name.trim() === '' || folderError !== 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.name}` : `Archive ${project.name}…`}
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.name}…`}
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.name}` : `Archive ${project.name}`}
227
+ confirmLabel={isArchived ? `Restore ${project.slug}` : `Archive ${project.slug}`}
239
228
  confirmDisabled={asking || blockers.length > 0}
240
229
  destructive={!isArchived}
241
230
  onConfirm={() =>
@@ -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' }}>
@@ -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
- <span className="cell-stack">
212
- {pending ? (
213
- <span>{project.name}</span>
214
- ) : (
215
- <Link
216
- className="cell-link stretch"
217
- to="/projects/$project"
218
- params={{ project: project.slug }}
219
- >
220
- {project.name}
221
- </Link>
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, name: name.trim() });
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 || name.trim() === ''}
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, name)', in: 'pages/project-settings.tsx', call: 'projects.update' },
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
  },
@@ -58,12 +58,12 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
58
58
  ui: [{ does: "an environment: the keys its siblings have and it lacks", in: 'lib/queries.ts', call: 'environments.missing' }],
59
59
  },
60
60
  'PATCH /projects/:project/:environment/dismissals': {
61
- ui: [{ does: 'an environment › Missing keys › Dismiss, Dismiss all, Restore', in: 'components/missing.tsx', call: 'environments.dismiss' }],
61
+ ui: [{ does: 'an environment › Missing keys › Dismiss, Dismiss all, and Undo after either', in: 'components/missing.tsx', call: 'environments.dismiss' }],
62
62
  },
63
63
  'GET /secrets/:project/:environment': { ui: [{ does: 'an environment: its secrets', in: 'pages/environment.tsx', call: 'secrets.list' }] },
64
64
  'PATCH /secrets/:project/:environment': {
65
65
  ui: [
66
- { does: 'an environment › New secret, Edit, then Save', in: 'pages/environment.tsx', call: 'secrets.set' },
66
+ { does: 'an environment › Add secret, Edit, then Save', in: 'pages/environment.tsx', call: 'secrets.set' },
67
67
  { does: 'an environment › Import .env, after its plan', in: 'pages/environment.tsx', call: 'secrets.set' },
68
68
  ],
69
69
  },