Rework Secrets page into browser and detail panes

- Two panes: folder browser on the left, access detail card on the right, so
  selecting a secret no longer shifts the page. Stacks on narrow screens.
- Mount is the first crumb; the mount dropdown only shows with several engines.
- Drop emoji for chevrons; capability chips, red for delete/sudo; identity type
  tags; root token collapsed to "full access".

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Sonnet 5.5 committed 2026-10-20 12:10:58 +01:00
1 parent fbe9cc9262
commit 68e564eb6c
4 files changed
+180 -61

No files matched your search

+53 -41
View File
@@ -28,50 +28,62 @@ function Browser({ client }: { client: BaoClient }) {
if (mounts.isPending) return <p>Loading…</p>
if (!mount) return <p>No KV v2 secrets engines are mounted.</p>
const where = prefix ? `${mount}${prefix}` : mount
return (
<>
<label>
Mount
<select
value={mount}
onChange={(e) => {
setMount(e.target.value)
go('')
}}
>
{mounts.data.map((m) => (
<option key={m.path}>{m.path}</option>
))}
</select>
</label>
<nav aria-label="Path" className="crumbs">
<button type="button" onClick={() => go('')}>
{mount}
</button>
{crumbs.map((c, i) => (
<button key={i} type="button" onClick={() => go(crumbs.slice(0, i + 1).join('/') + '/')}>
{c}/
</button>
))}
</nav>
{entries.error && <p role="alert">{entries.error.message}</p>}
{entries.data?.length === 0 && <p>Nothing here.</p>}
<ul className="entries">
{entries.data?.map((e) => (
<li key={e.path}>
<button
type="button"
aria-pressed={selected === e.path}
onClick={() => (e.isFolder ? go(e.path) : setSelected(e.path))}
<div className="secrets-layout">
<div className="secrets-browser">
<nav aria-label="Path" className="crumbs">
{mounts.data.length > 1 && (
<select
aria-label="Mount"
value={mount}
onChange={(e) => {
setMount(e.target.value)
go('')
}}
>
{e.isFolder ? '📁 ' : '🔑 '}
{e.name}
{mounts.data.map((m) => (
<option key={m.path}>{m.path}</option>
))}
</select>
)}
<button type="button" onClick={() => go('')}>
{mount}
</button>
{crumbs.map((c, i) => (
<button key={i} type="button" onClick={() => go(crumbs.slice(0, i + 1).join('/') + '/')}>
{c}/
</button>
</li>
))}
</ul>
{selected && <AccessPanel client={client} mount={mount} secret={selected} />}
</>
))}
</nav>
{entries.isPending && <p className="hint">Loading…</p>}
{entries.error && <p role="alert">{entries.error.message}</p>}
{entries.data?.length === 0 && <p className="hint">No secrets in {where} yet.</p>}
{!!entries.data?.length && (
<ul className="entries" aria-label={`Contents of ${where}`}>
{entries.data.map((e) => (
<li key={e.path}>
<button
type="button"
className={e.isFolder ? 'entry-folder' : undefined}
aria-pressed={e.isFolder ? undefined : selected === e.path}
onClick={() => (e.isFolder ? go(e.path) : setSelected(e.path))}
>
{e.name}
{e.isFolder && <span aria-hidden="true">›</span>}
</button>
</li>
))}
</ul>
)}
</div>
{selected ? (
<AccessPanel client={client} mount={mount} secret={selected} />
) : (
<p className="secret-placeholder">Select a secret to see who can reach it.</p>
)}
</div>
)
}