Design sweep: tokens and base styles, connection summary, secret picker, access panel layout, sample data
- Add a token-based design system (light/dark colours, type and spacing scales) and style buttons, forms, tables, tabs and the app shell. - Show a server and session summary (version, status, cluster, server time, token expiry) instead of the connect form while connected. - Replace the free-text secret path in the Access panel with a browsable picker and an "everything inside" tickbox; typing a path is still available. - Re-lay out the Access panel: header bar, current access beside the grant form. - Seed the docker-compose stack with sample secrets, users, entities, a group, policies and a token via docker/seed.sh (safe to re-run). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a63f7c0faa
commit
fbe9cc9262
11 files changed
+1146
-127
No files matched your search
@@ -31,6 +31,8 @@ docker compose up --build
|
|||||||
|
|
||||||
Open http://localhost:8080 and connect to `http://localhost:8200` with token `root`. This starts a throwaway in-memory OpenBao dev server (CORS pre-configured for the UI and for OpenBao's own web UI at `:8200`) and the UI. Not for production.
|
Open http://localhost:8080 and connect to `http://localhost:8200` with token `root`. This starts a throwaway in-memory OpenBao dev server (CORS pre-configured for the UI and for OpenBao's own web UI at `:8200`) and the UI. Not for production.
|
||||||
|
|
||||||
|
The stack also loads sample data from [`docker/seed.sh`](docker/seed.sh): five secrets under `secret/` (`app/`, `shared/`, `team-a/`), userpass users `alice`, `bob` and `carol` (password `password123`), entities for alice and bob, a `platform` group, a few grants, and a `ci-deploy` token. Edit the script to change it. If you already have the stack running, `docker compose down` first: the setup step only runs on a fresh start.
|
||||||
|
|
||||||
To run just the UI image: `docker build -t envbao-admin . && docker run -p 8080:80 envbao-admin`.
|
To run just the UI image: `docker build -t envbao-admin . && docker run -p 8080:80 envbao-admin`.
|
||||||
|
|
||||||
## OpenBao setup
|
## OpenBao setup
|
||||||
|
|||||||
+5
-3
@@ -15,8 +15,8 @@ services:
|
|||||||
interval: 2s
|
interval: 2s
|
||||||
retries: 15
|
retries: 15
|
||||||
|
|
||||||
# One-shot: allow the UI origin to call OpenBao from the browser. OpenBao's own
|
# One-shot: allow the UI origin to call OpenBao from the browser, then load sample
|
||||||
# web UI (:8200) is same-origin but still sends an Origin header, so it is listed too.
|
# secrets, users, entities, a group and a token (see docker/seed.sh).
|
||||||
openbao-setup:
|
openbao-setup:
|
||||||
image: openbao/openbao:latest
|
image: openbao/openbao:latest
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -25,7 +25,9 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
BAO_ADDR: http://openbao:8200
|
BAO_ADDR: http://openbao:8200
|
||||||
BAO_TOKEN: root
|
BAO_TOKEN: root
|
||||||
entrypoint: ["bao", "write", "sys/config/cors", "enabled=true", "allowed_origins=http://localhost:8080,http://localhost:8200", "allowed_headers=X-Vault-Token,Content-Type"]
|
volumes:
|
||||||
|
- ./docker/seed.sh:/seed.sh:ro
|
||||||
|
entrypoint: ["sh", "/seed.sh"]
|
||||||
restart: "no"
|
restart: "no"
|
||||||
|
|
||||||
ui:
|
ui:
|
||||||
|
|||||||
Executable
+90
@@ -0,0 +1,90 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Sample data for the docker-compose demo. Throwaway: the dev server is in-memory, so this
|
||||||
|
# runs fresh on every `docker compose up`. All passwords and secret values here are fake.
|
||||||
|
# Expects BAO_ADDR and BAO_TOKEN in the environment.
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Allow the UI origin to call OpenBao from the browser. OpenBao's own web UI (:8200) is
|
||||||
|
# same-origin but still sends an Origin header, so it is listed too.
|
||||||
|
bao write sys/config/cors enabled=true \
|
||||||
|
allowed_origins="http://localhost:8080,http://localhost:8200" \
|
||||||
|
allowed_headers="X-Vault-Token,Content-Type"
|
||||||
|
|
||||||
|
# Compose re-runs this when other services are rebuilt; don't load the data twice.
|
||||||
|
if bao read sys/auth/userpass >/dev/null 2>&1; then
|
||||||
|
echo "Sample data already loaded."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Secrets (KV v2 at secret/ is mounted by dev mode) ---
|
||||||
|
put() { path=$1; shift; bao kv put "secret/$path" "$@" >/dev/null; }
|
||||||
|
put app/database host=db.internal user=app password=sample-not-a-real-secret
|
||||||
|
put app/api-keys stripe=sk_test_sample sendgrid=SG.sample
|
||||||
|
put shared/smtp host=smtp.internal user=mailer password=sample-not-a-real-secret
|
||||||
|
put team-a/deploy ssh_key=sample-not-a-real-key
|
||||||
|
put team-a/staging/database host=staging-db.internal password=sample-not-a-real-secret
|
||||||
|
|
||||||
|
# --- Policies ---
|
||||||
|
# The envbao-* ones are written the way EnvBao writes them (see src/model/managed.ts), so
|
||||||
|
# they show up as editable grants in the Access panel and in the graph.
|
||||||
|
bao policy write envbao-user-alice - >/dev/null <<'POLICY'
|
||||||
|
# Managed by EnvBao. Changes made outside EnvBao may be overwritten.
|
||||||
|
# envbao-owner: user:alice
|
||||||
|
|
||||||
|
path "secret/data/team-a/*" {
|
||||||
|
capabilities = ["read", "update"]
|
||||||
|
}
|
||||||
|
path "secret/metadata/team-a/*" {
|
||||||
|
capabilities = ["list"]
|
||||||
|
}
|
||||||
|
POLICY
|
||||||
|
|
||||||
|
bao policy write envbao-user-bob - >/dev/null <<'POLICY'
|
||||||
|
# Managed by EnvBao. Changes made outside EnvBao may be overwritten.
|
||||||
|
# envbao-owner: user:bob
|
||||||
|
|
||||||
|
path "secret/data/shared/smtp" {
|
||||||
|
capabilities = ["read"]
|
||||||
|
}
|
||||||
|
POLICY
|
||||||
|
|
||||||
|
bao policy write envbao-group-platform - >/dev/null <<'POLICY'
|
||||||
|
# Managed by EnvBao. Changes made outside EnvBao may be overwritten.
|
||||||
|
# envbao-owner: group:platform
|
||||||
|
|
||||||
|
path "secret/data/app/*" {
|
||||||
|
capabilities = ["read"]
|
||||||
|
}
|
||||||
|
path "secret/metadata/app/*" {
|
||||||
|
capabilities = ["list"]
|
||||||
|
}
|
||||||
|
POLICY
|
||||||
|
|
||||||
|
# Hand-written, so EnvBao shows it read-only.
|
||||||
|
bao policy write ops-readonly - >/dev/null <<'POLICY'
|
||||||
|
path "sys/health" {
|
||||||
|
capabilities = ["read"]
|
||||||
|
}
|
||||||
|
path "secret/metadata/*" {
|
||||||
|
capabilities = ["list"]
|
||||||
|
}
|
||||||
|
POLICY
|
||||||
|
|
||||||
|
# --- Users ---
|
||||||
|
bao auth enable userpass >/dev/null
|
||||||
|
bao write auth/userpass/users/alice password=password123 policies=envbao-user-alice >/dev/null
|
||||||
|
bao write auth/userpass/users/bob password=password123 policies=envbao-user-bob >/dev/null
|
||||||
|
bao write auth/userpass/users/carol password=password123 policies=ops-readonly >/dev/null
|
||||||
|
|
||||||
|
# --- Entities, aliases and a group ---
|
||||||
|
accessor=$(bao read -field=accessor sys/auth/userpass)
|
||||||
|
alice_id=$(bao write -field=id identity/entity name=alice)
|
||||||
|
bob_id=$(bao write -field=id identity/entity name=bob)
|
||||||
|
bao write identity/entity-alias name=alice canonical_id="$alice_id" mount_accessor="$accessor" >/dev/null
|
||||||
|
bao write identity/entity-alias name=bob canonical_id="$bob_id" mount_accessor="$accessor" >/dev/null
|
||||||
|
bao write identity/group name=platform member_entity_ids="$alice_id" policies=envbao-group-platform >/dev/null
|
||||||
|
|
||||||
|
# --- A token ---
|
||||||
|
bao token create -display-name=ci-deploy -policy=envbao-user-bob -ttl=24h >/dev/null
|
||||||
|
|
||||||
|
echo "Sample data loaded. Sign in as alice, bob or carol with password: password123"
|
||||||
@@ -20,6 +20,8 @@ export interface BaoHealth {
|
|||||||
standby: boolean
|
standby: boolean
|
||||||
version: string
|
version: string
|
||||||
cluster_name?: string
|
cluster_name?: string
|
||||||
|
/** Unix seconds. */
|
||||||
|
server_time_utc?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface TokenInfo {
|
export interface TokenInfo {
|
||||||
|
|||||||
+2
-2
@@ -7,8 +7,8 @@ test('README embeds the tested admin policy verbatim', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
test('README documents every origin the docker-compose setup allows', () => {
|
test('README documents every origin the docker-compose setup allows', () => {
|
||||||
const compose = readFileSync('docker-compose.yml', 'utf8')
|
const seed = readFileSync('docker/seed.sh', 'utf8')
|
||||||
const origins = /allowed_origins=([^"]+)"/.exec(compose)![1].split(',')
|
const origins = /allowed_origins="([^"]+)"/.exec(seed)![1].split(',')
|
||||||
const readme = readFileSync('README.md', 'utf8')
|
const readme = readFileSync('README.md', 'utf8')
|
||||||
for (const o of origins) expect(readme).toContain(o)
|
for (const o of origins) expect(readme).toContain(o)
|
||||||
})
|
})
|
||||||
@@ -30,6 +30,14 @@ const state = (over: Partial<grants.GrantState> = {}): grants.GrantState => ({
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.mocked(grants.getGrantState).mockResolvedValue(state())
|
vi.mocked(grants.getGrantState).mockResolvedValue(state())
|
||||||
vi.mocked(secrets.listKvMounts).mockResolvedValue([{ path: 'secret/' }])
|
vi.mocked(secrets.listKvMounts).mockResolvedValue([{ path: 'secret/' }])
|
||||||
|
vi.mocked(secrets.listSecrets).mockImplementation(async (_c, _m, prefix) =>
|
||||||
|
prefix === ''
|
||||||
|
? [
|
||||||
|
{ name: 'app/', path: 'app/', isFolder: true },
|
||||||
|
{ name: 'shared', path: 'shared', isFolder: false },
|
||||||
|
]
|
||||||
|
: [{ name: 'db', path: 'app/db', isFolder: false }],
|
||||||
|
)
|
||||||
vi.mocked(secrets.readPolicyHcl).mockResolvedValue('path "x" { capabilities = ["read"] }')
|
vi.mocked(secrets.readPolicyHcl).mockResolvedValue('path "x" { capabilities = ["read"] }')
|
||||||
})
|
})
|
||||||
afterEach(() => vi.resetAllMocks())
|
afterEach(() => vi.resetAllMocks())
|
||||||
@@ -54,6 +62,7 @@ test('shows managed grants and read-only other policies', async () => {
|
|||||||
test('grants KV access split into data and metadata rules', async () => {
|
test('grants KV access split into data and metadata rules', async () => {
|
||||||
vi.mocked(grants.grantAccess).mockResolvedValue()
|
vi.mocked(grants.grantAccess).mockResolvedValue()
|
||||||
const user = setup()
|
const user = setup()
|
||||||
|
await user.click(await screen.findByRole('button', { name: 'Type a path instead' }))
|
||||||
await user.type(await screen.findByLabelText('Secret path'), 'db/*')
|
await user.type(await screen.findByLabelText('Secret path'), 'db/*')
|
||||||
await user.click(screen.getByLabelText('update'))
|
await user.click(screen.getByLabelText('update'))
|
||||||
await user.click(screen.getByLabelText('list'))
|
await user.click(screen.getByLabelText('list'))
|
||||||
@@ -64,8 +73,41 @@ test('grants KV access split into data and metadata rules', async () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('grants a secret chosen from the browser', async () => {
|
||||||
|
vi.mocked(grants.grantAccess).mockResolvedValue()
|
||||||
|
const user = setup()
|
||||||
|
await user.click(await screen.findByRole('button', { name: 'Open app/' }))
|
||||||
|
await user.click(await screen.findByLabelText('db'))
|
||||||
|
await user.click(screen.getByRole('button', { name: 'Grant' }))
|
||||||
|
expect(grants.grantAccess).toHaveBeenCalledWith(client, target, [
|
||||||
|
{ path: 'secret/data/app/db', capabilities: ['read'] },
|
||||||
|
{ path: 'secret/metadata/app/db', capabilities: [] },
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
test('ticking "everything inside" grants the folder wildcard', async () => {
|
||||||
|
vi.mocked(grants.grantAccess).mockResolvedValue()
|
||||||
|
const user = setup()
|
||||||
|
await user.click(await screen.findByRole('button', { name: 'Open app/' }))
|
||||||
|
await user.click(await screen.findByLabelText(/Everything inside/))
|
||||||
|
expect(screen.getByLabelText('db')).toBeDisabled()
|
||||||
|
await user.click(screen.getByRole('button', { name: 'Grant' }))
|
||||||
|
expect(grants.grantAccess).toHaveBeenCalledWith(client, target, [
|
||||||
|
{ path: 'secret/data/app/*', capabilities: ['read'] },
|
||||||
|
{ path: 'secret/metadata/app/*', capabilities: [] },
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
test('asks for a choice before granting', async () => {
|
||||||
|
const user = setup()
|
||||||
|
await user.click(await screen.findByRole('button', { name: 'Grant' }))
|
||||||
|
expect(await screen.findByRole('alert')).toHaveTextContent('Path is required')
|
||||||
|
expect(grants.grantAccess).not.toHaveBeenCalled()
|
||||||
|
})
|
||||||
|
|
||||||
test('validates the path and capabilities before calling the API', async () => {
|
test('validates the path and capabilities before calling the API', async () => {
|
||||||
const user = setup()
|
const user = setup()
|
||||||
|
await user.click(await screen.findByRole('button', { name: 'Type a path instead' }))
|
||||||
await user.type(await screen.findByLabelText('Secret path'), '/bad')
|
await user.type(await screen.findByLabelText('Secret path'), '/bad')
|
||||||
await user.click(screen.getByRole('button', { name: 'Grant' }))
|
await user.click(screen.getByRole('button', { name: 'Grant' }))
|
||||||
expect(await screen.findByRole('alert')).toHaveTextContent('must not start with "/"')
|
expect(await screen.findByRole('alert')).toHaveTextContent('must not start with "/"')
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import type { BaoClient } from '../../api/bao'
|
|||||||
import { getGrantState, grantAccess, revokeAccess, type Target } from '../../api/grants'
|
import { getGrantState, grantAccess, revokeAccess, type Target } from '../../api/grants'
|
||||||
import { listKvMounts, readPolicyHcl } from '../../api/secrets'
|
import { listKvMounts, readPolicyHcl } from '../../api/secrets'
|
||||||
import { KV_CAPABILITIES, kvGrantRules, validateGrantPath, type KvCapability } from '../../model/managed'
|
import { KV_CAPABILITIES, kvGrantRules, validateGrantPath, type KvCapability } from '../../model/managed'
|
||||||
|
import { PathPicker } from './PathPicker'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
client: BaoClient
|
client: BaoClient
|
||||||
@@ -66,21 +67,32 @@ export function AccessEditor({ client, target, onClose }: Props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<section aria-label={`Access for ${target.name}`} className="access-editor">
|
<section aria-label={`Access for ${target.name}`} className="access-editor">
|
||||||
|
<header className="access-head">
|
||||||
<h2>
|
<h2>
|
||||||
Access: {target.kind} “{target.name}”
|
Access for <strong>{target.name}</strong> <span className="kind">{target.kind}</span>
|
||||||
</h2>
|
</h2>
|
||||||
<button type="button" onClick={onClose}>
|
<button type="button" onClick={onClose}>
|
||||||
Close
|
Close
|
||||||
</button>
|
</button>
|
||||||
|
</header>
|
||||||
{state.error && <p role="alert">{state.error.message}</p>}
|
{state.error && <p role="alert">{state.error.message}</p>}
|
||||||
{s && (
|
{s && (
|
||||||
<>
|
<div className="access-body">
|
||||||
|
<div className="access-current">
|
||||||
|
<div className="section-head">
|
||||||
<h3>Granted by EnvBao</h3>
|
<h3>Granted by EnvBao</h3>
|
||||||
|
{s.hcl && (
|
||||||
|
<button type="button" className="link" aria-expanded={showRaw} onClick={() => setShowRaw(!showRaw)}>
|
||||||
|
{showRaw ? 'Hide' : 'Show'} policy HCL ({s.policyName})
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
{s.managed && !s.managed.editable && (
|
{s.managed && !s.managed.editable && (
|
||||||
<p role="alert">
|
<p role="alert">
|
||||||
This policy was changed outside EnvBao and is read-only here: {s.managed.reasons.join('; ')}
|
This policy was changed outside EnvBao and is read-only here: {s.managed.reasons.join('; ')}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
|
{showRaw && <pre>{s.hcl}</pre>}
|
||||||
{s.managed?.grants.length ? (
|
{s.managed?.grants.length ? (
|
||||||
<table aria-label="Granted by EnvBao">
|
<table aria-label="Granted by EnvBao">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -112,34 +124,42 @@ export function AccessEditor({ client, target, onClose }: Props) {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
) : (
|
) : (
|
||||||
<p>No access granted through EnvBao yet.</p>
|
<p className="hint">No access granted through EnvBao yet.</p>
|
||||||
)}
|
)}
|
||||||
{s.hcl && (
|
|
||||||
<p>
|
|
||||||
<button type="button" aria-expanded={showRaw} onClick={() => setShowRaw(!showRaw)}>
|
|
||||||
{showRaw ? 'Hide' : 'Show'} policy HCL ({s.policyName})
|
|
||||||
</button>
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
{showRaw && <pre>{s.hcl}</pre>}
|
|
||||||
{revoke.error && <p role="alert">{revoke.error.message}</p>}
|
{revoke.error && <p role="alert">{revoke.error.message}</p>}
|
||||||
|
|
||||||
|
<h3>Other policies</h3>
|
||||||
|
<p className="hint">Set outside EnvBao, so they can only be viewed here.</p>
|
||||||
|
{s.otherPolicies.length ? (
|
||||||
|
<ul className="policy-list">
|
||||||
|
{s.otherPolicies.map((p) => (
|
||||||
|
<PolicyView key={p} client={client} name={p} />
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
) : (
|
||||||
|
<p className="hint">None.</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
{editable && (
|
{editable && (
|
||||||
<form onSubmit={submit} aria-label="Grant access">
|
<form onSubmit={submit} aria-label="Grant access" className="access-grant">
|
||||||
<h3>Grant access</h3>
|
<h3>Grant access</h3>
|
||||||
<label>
|
<label>
|
||||||
Secrets engine
|
Secrets engine
|
||||||
<select value={mount} onChange={(e) => setMount(e.target.value)}>
|
<select
|
||||||
|
value={mount}
|
||||||
|
onChange={(e) => {
|
||||||
|
setMount(e.target.value)
|
||||||
|
setSecretPath('')
|
||||||
|
}}
|
||||||
|
>
|
||||||
{mounts.data?.map((m) => (
|
{mounts.data?.map((m) => (
|
||||||
<option key={m.path}>{m.path}</option>
|
<option key={m.path}>{m.path}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
{mount && <PathPicker key={mount} client={client} mount={mount} value={secretPath} onChange={setSecretPath} />}
|
||||||
Secret path
|
<fieldset className="caps">
|
||||||
<input value={secretPath} onChange={(e) => setSecretPath(e.target.value)} placeholder="app/db or app/*" />
|
|
||||||
</label>
|
|
||||||
<fieldset>
|
|
||||||
<legend>Capabilities</legend>
|
<legend>Capabilities</legend>
|
||||||
{KV_CAPABILITIES.map((c) => (
|
{KV_CAPABILITIES.map((c) => (
|
||||||
<label key={c} className="check">
|
<label key={c} className="check">
|
||||||
@@ -154,7 +174,6 @@ export function AccessEditor({ client, target, onClose }: Props) {
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<p className="hint">
|
<p className="hint">
|
||||||
Granting a path that already has a grant replaces its capabilities. “list” applies to the secret’s metadata path.
|
Granting a path that already has a grant replaces its capabilities. “list” applies to the secret’s metadata path.
|
||||||
A trailing * matches everything below.
|
|
||||||
</p>
|
</p>
|
||||||
{(formError || grant.error) && <p role="alert">{formError ?? grant.error?.message}</p>}
|
{(formError || grant.error) && <p role="alert">{formError ?? grant.error?.message}</p>}
|
||||||
<button type="submit" disabled={grant.isPending || !mount}>
|
<button type="submit" disabled={grant.isPending || !mount}>
|
||||||
@@ -162,18 +181,7 @@ export function AccessEditor({ client, target, onClose }: Props) {
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
<h3>Other policies (not managed by EnvBao, read-only)</h3>
|
|
||||||
{s.otherPolicies.length ? (
|
|
||||||
<ul>
|
|
||||||
{s.otherPolicies.map((p) => (
|
|
||||||
<PolicyView key={p} client={client} name={p} />
|
|
||||||
))}
|
|
||||||
</ul>
|
|
||||||
) : (
|
|
||||||
<p>None.</p>
|
|
||||||
)}
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
import { useQuery } from '@tanstack/react-query'
|
||||||
|
import { useId, useState } from 'react'
|
||||||
|
import type { BaoClient } from '../../api/bao'
|
||||||
|
import { listSecrets } from '../../api/secrets'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
client: BaoClient
|
||||||
|
mount: string
|
||||||
|
/** Path within the mount: a secret ("app/db"), or a folder wildcard ("app/*", "*"). */
|
||||||
|
value: string
|
||||||
|
onChange: (path: string) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pick a secret by browsing the mount, or tick "everything inside" to grant a whole folder.
|
||||||
|
* Lists names only; secret values are never read.
|
||||||
|
*/
|
||||||
|
export function PathPicker({ client, mount, value, onChange }: Props) {
|
||||||
|
const id = useId()
|
||||||
|
const [prefix, setPrefix] = useState('')
|
||||||
|
const [manual, setManual] = useState(false)
|
||||||
|
const entries = useQuery({ queryKey: ['secrets', mount, prefix], queryFn: () => listSecrets(client, mount, prefix) })
|
||||||
|
|
||||||
|
const wildcard = value === `${prefix}*`
|
||||||
|
const crumbs = prefix.split('/').filter(Boolean)
|
||||||
|
|
||||||
|
function open(next: string) {
|
||||||
|
setPrefix(next)
|
||||||
|
// Keep the "everything inside" intent while moving between folders.
|
||||||
|
onChange(wildcard ? `${next}*` : '')
|
||||||
|
}
|
||||||
|
|
||||||
|
if (manual) {
|
||||||
|
return (
|
||||||
|
<div className="path-picker">
|
||||||
|
<label>
|
||||||
|
Secret path
|
||||||
|
<input value={value} onChange={(e) => onChange(e.target.value)} placeholder="app/db or app/*" />
|
||||||
|
</label>
|
||||||
|
<p className="hint">
|
||||||
|
For a secret that doesn’t exist yet. A trailing * matches everything below.{' '}
|
||||||
|
<button type="button" className="link" onClick={() => setManual(false)}>
|
||||||
|
Browse secrets instead
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const where = prefix ? `${mount}${prefix}` : mount
|
||||||
|
|
||||||
|
return (
|
||||||
|
<fieldset className="path-picker">
|
||||||
|
<legend>Secret</legend>
|
||||||
|
<nav aria-label="Folder" className="crumbs">
|
||||||
|
<button type="button" onClick={() => open('')}>
|
||||||
|
{mount}
|
||||||
|
</button>
|
||||||
|
{crumbs.map((c, i) => (
|
||||||
|
<button key={i} type="button" onClick={() => open(`${crumbs.slice(0, i + 1).join('/')}/`)}>
|
||||||
|
{c}/
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
{entries.isPending && <p className="hint">Loading…</p>}
|
||||||
|
{entries.error && <p role="alert">Can’t list secrets here: {entries.error.message}</p>}
|
||||||
|
{entries.data?.length === 0 && <p className="hint">Nothing in {where} yet.</p>}
|
||||||
|
{!!entries.data?.length && (
|
||||||
|
<ul className="entries" aria-label={`Contents of ${where}`}>
|
||||||
|
{entries.data.map((e) => (
|
||||||
|
<li key={e.path}>
|
||||||
|
{e.isFolder ? (
|
||||||
|
<button type="button" className="entry-folder" aria-label={`Open ${e.name}`} onClick={() => open(e.path)}>
|
||||||
|
{e.name}
|
||||||
|
<span aria-hidden="true">›</span>
|
||||||
|
</button>
|
||||||
|
) : (
|
||||||
|
<label className="entry-secret">
|
||||||
|
<input
|
||||||
|
type="radio"
|
||||||
|
name={`${id}-secret`}
|
||||||
|
checked={value === e.path}
|
||||||
|
disabled={wildcard}
|
||||||
|
onChange={() => onChange(e.path)}
|
||||||
|
/>
|
||||||
|
{e.name}
|
||||||
|
</label>
|
||||||
|
)}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<label className="check">
|
||||||
|
<input type="checkbox" checked={wildcard} onChange={(e) => onChange(e.target.checked ? `${prefix}*` : '')} />
|
||||||
|
<span>
|
||||||
|
Everything inside <code>{where}</code>, including subfolders and new secrets
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<p className="hint" aria-live="polite">
|
||||||
|
{value ? (
|
||||||
|
<>
|
||||||
|
Granting on <code>{wildcard ? `${where}*` : `${mount}${value}`}</code>.
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
'Choose a secret or tick the box above.'
|
||||||
|
)}{' '}
|
||||||
|
<button type="button" className="link" onClick={() => setManual(true)}>
|
||||||
|
Type a path instead
|
||||||
|
</button>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useState, type FormEvent } from 'react'
|
import { useState, type FormEvent } from 'react'
|
||||||
import { BaoClient, BaoError, type BaoHealth } from '../../api/bao'
|
import { BaoClient, BaoError, type BaoHealth } from '../../api/bao'
|
||||||
import { useSession } from '../../api/useSession'
|
import { useSession } from '../../api/useSession'
|
||||||
|
import { ConnectionSummary } from './ConnectionSummary'
|
||||||
|
|
||||||
type Mode = 'token' | 'userpass'
|
type Mode = 'token' | 'userpass'
|
||||||
|
|
||||||
@@ -43,17 +44,19 @@ export function ConnectPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (client && tokenInfo) {
|
||||||
|
return (
|
||||||
|
<section>
|
||||||
|
<h1>Connection</h1>
|
||||||
|
<ConnectionSummary client={client} tokenInfo={tokenInfo} onDisconnect={disconnect} />
|
||||||
|
</section>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
<h1>Connect</h1>
|
<h1>Connect</h1>
|
||||||
{client && tokenInfo && (
|
<p className="hint">Connect to an OpenBao server to manage its identities and who can reach which secrets.</p>
|
||||||
<p role="status">
|
|
||||||
Connected to {client.baseUrl} as {tokenInfo.display_name || 'token'} (policies: {tokenInfo.policies.join(', ')}){' '}
|
|
||||||
<button type="button" onClick={disconnect}>
|
|
||||||
Disconnect
|
|
||||||
</button>
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
<form onSubmit={submit}>
|
<form onSubmit={submit}>
|
||||||
<label>
|
<label>
|
||||||
OpenBao URL
|
OpenBao URL
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
import { useQuery } from '@tanstack/react-query'
|
||||||
|
import type { BaoClient, TokenInfo } from '../../api/bao'
|
||||||
|
|
||||||
|
function formatRemaining(ms: number): string {
|
||||||
|
const minutes = Math.max(0, Math.round(ms / 60_000))
|
||||||
|
if (minutes < 1) return 'less than a minute'
|
||||||
|
const days = Math.floor(minutes / 1440)
|
||||||
|
const hours = Math.floor((minutes % 1440) / 60)
|
||||||
|
const mins = minutes % 60
|
||||||
|
if (days) return `${days}d ${hours}h`
|
||||||
|
if (hours) return `${hours}h ${mins}m`
|
||||||
|
return `${mins}m`
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
client: BaoClient
|
||||||
|
tokenInfo: TokenInfo
|
||||||
|
onDisconnect: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
/** What you're connected to and as whom. Shown instead of the connect form while a session is active. */
|
||||||
|
export function ConnectionSummary({ client, tokenInfo, onDisconnect }: Props) {
|
||||||
|
const health = useQuery({ queryKey: ['health', client.baseUrl], queryFn: () => client.health() })
|
||||||
|
// The session's tokenInfo is a snapshot from sign-in, so look the token up again for a current TTL.
|
||||||
|
const self = useQuery({ queryKey: ['token-self', client.baseUrl], queryFn: () => client.lookupSelf(), staleTime: 0 })
|
||||||
|
|
||||||
|
const info = self.data ?? tokenInfo
|
||||||
|
const remaining = `in ${formatRemaining(info.ttl * 1000)}`
|
||||||
|
const expires = info.ttl <= 0 ? 'Never' : self.data ? `${remaining} (${new Date(self.dataUpdatedAt + info.ttl * 1000).toLocaleString()})` : remaining
|
||||||
|
const h = health.data
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="connection">
|
||||||
|
<div className="connection-head" role="status">
|
||||||
|
<p className="connection-state">
|
||||||
|
<span className="dot" aria-hidden="true" />
|
||||||
|
Connected to <code>{client.baseUrl}</code> as <strong>{info.display_name || 'token'}</strong>
|
||||||
|
</p>
|
||||||
|
<button type="button" onClick={onDisconnect}>
|
||||||
|
Disconnect
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="connection-grid">
|
||||||
|
<section aria-labelledby="conn-server">
|
||||||
|
<h2 id="conn-server">Server</h2>
|
||||||
|
{health.isPending && <p className="hint">Checking server…</p>}
|
||||||
|
{health.error && <p role="alert">{health.error.message}</p>}
|
||||||
|
{h && (
|
||||||
|
<dl>
|
||||||
|
<dt>Version</dt>
|
||||||
|
<dd>OpenBao {h.version}</dd>
|
||||||
|
<dt>Status</dt>
|
||||||
|
<dd>{!h.initialized ? 'Not initialised' : h.sealed ? 'Sealed' : 'Unsealed'}</dd>
|
||||||
|
<dt>Role</dt>
|
||||||
|
<dd>{h.standby ? 'Standby node' : 'Active node'}</dd>
|
||||||
|
{h.cluster_name && (
|
||||||
|
<>
|
||||||
|
<dt>Cluster</dt>
|
||||||
|
<dd>{h.cluster_name}</dd>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{h.server_time_utc != null && (
|
||||||
|
<>
|
||||||
|
<dt>Server time</dt>
|
||||||
|
<dd>{new Date(h.server_time_utc * 1000).toLocaleString(undefined, { timeZone: 'UTC', dateStyle: 'medium', timeStyle: 'medium' })} UTC</dd>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</dl>
|
||||||
|
)}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section aria-labelledby="conn-session">
|
||||||
|
<h2 id="conn-session">Your session</h2>
|
||||||
|
<dl>
|
||||||
|
<dt>Signed in as</dt>
|
||||||
|
<dd>{info.display_name || 'token'}</dd>
|
||||||
|
<dt>Policies</dt>
|
||||||
|
<dd>
|
||||||
|
{info.policies.length ? (
|
||||||
|
<ul className="chips">
|
||||||
|
{info.policies.map((p) => (
|
||||||
|
<li key={p}>{p}</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
) : (
|
||||||
|
'None'
|
||||||
|
)}
|
||||||
|
</dd>
|
||||||
|
<dt>Token expires</dt>
|
||||||
|
<dd>{expires}</dd>
|
||||||
|
<dt>Renewable</dt>
|
||||||
|
<dd>{info.renewable ? 'Yes' : 'No'}</dd>
|
||||||
|
</dl>
|
||||||
|
<p className="hint">The token is held in memory only. Reloading the page signs you out.</p>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
+737
-83
@@ -1,151 +1,656 @@
|
|||||||
|
/* ---------- Tokens ---------- */
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
color-scheme: light dark;
|
color-scheme: light dark;
|
||||||
font-family: system-ui, sans-serif;
|
|
||||||
|
/* Surfaces: page < raised < sunken. Ink is a cool slate, not pure black/white. */
|
||||||
|
--bg: light-dark(#f6f7f9, #0f1216);
|
||||||
|
--surface: light-dark(#ffffff, #171b21);
|
||||||
|
--surface-sunken: light-dark(#eef0f3, #0b0e11);
|
||||||
|
--line: light-dark(#dde1e7, #262c35);
|
||||||
|
--line-strong: light-dark(#c3c9d2, #384150);
|
||||||
|
|
||||||
|
--ink: light-dark(#161a20, #e8ebf0);
|
||||||
|
--ink-soft: light-dark(#4a5361, #a2abb9);
|
||||||
|
--ink-faint: light-dark(#6b7482, #7c8594);
|
||||||
|
|
||||||
|
/* One accent (verdigris) plus two semantic colours. */
|
||||||
|
--accent: light-dark(#0b7a6e, #3cc2af);
|
||||||
|
--accent-ink: light-dark(#ffffff, #07211d);
|
||||||
|
--accent-soft: light-dark(#e2f3f0, #12302c);
|
||||||
|
--danger: light-dark(#b42318, #ff8a7a);
|
||||||
|
--danger-soft: light-dark(#fdecea, #3a1815);
|
||||||
|
--warn: light-dark(#8a5a00, #f2c14e);
|
||||||
|
--warn-soft: light-dark(#fff4d6, #3a2d0c);
|
||||||
|
|
||||||
|
--font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
|
||||||
|
--mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
|
||||||
|
|
||||||
|
/* Type scale: 1.2 ratio from 15px. */
|
||||||
|
--text-sm: 0.8125rem;
|
||||||
|
--text: 0.9375rem;
|
||||||
|
--text-lg: 1.125rem;
|
||||||
|
--text-xl: 1.5rem;
|
||||||
|
|
||||||
|
/* Spacing scale. */
|
||||||
|
--s1: 0.25rem;
|
||||||
|
--s2: 0.5rem;
|
||||||
|
--s3: 0.75rem;
|
||||||
|
--s4: 1rem;
|
||||||
|
--s5: 1.5rem;
|
||||||
|
--s6: 2.5rem;
|
||||||
|
|
||||||
|
--radius: 6px;
|
||||||
|
--measure: 72rem;
|
||||||
|
--focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
|
||||||
|
|
||||||
|
font-family: var(--font);
|
||||||
|
font-size: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Base ---------- */
|
||||||
|
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--ink);
|
||||||
|
font-size: var(--text);
|
||||||
|
line-height: 1.5;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shell nav {
|
h1 {
|
||||||
display: flex;
|
font-size: var(--text-xl);
|
||||||
gap: 1rem;
|
line-height: 1.2;
|
||||||
align-items: center;
|
font-weight: 650;
|
||||||
padding: 0.75rem 1rem;
|
letter-spacing: -0.015em;
|
||||||
border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent);
|
margin: 0 0 var(--s5);
|
||||||
}
|
}
|
||||||
|
|
||||||
.shell nav a {
|
h2,
|
||||||
color: inherit;
|
h3 {
|
||||||
text-decoration: none;
|
font-size: var(--text-lg);
|
||||||
opacity: 0.7;
|
line-height: 1.3;
|
||||||
}
|
|
||||||
|
|
||||||
.shell nav a.active {
|
|
||||||
opacity: 1;
|
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
margin: var(--s5) 0 var(--s3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.shell nav .connect {
|
p {
|
||||||
|
margin: 0 0 var(--s3);
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: var(--accent);
|
||||||
|
text-underline-offset: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
code,
|
||||||
|
pre {
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: 0.875em;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
background: var(--surface-sunken);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: var(--s3) var(--s4);
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
:focus-visible {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: var(--focus);
|
||||||
|
}
|
||||||
|
|
||||||
|
main:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hint {
|
||||||
|
color: var(--ink-faint);
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- App shell ---------- */
|
||||||
|
|
||||||
|
.shell > nav {
|
||||||
|
display: flex;
|
||||||
|
gap: var(--s1);
|
||||||
|
align-items: stretch;
|
||||||
|
padding: 0 max(var(--s5), calc((100% - var(--measure)) / 2 + var(--s5)));
|
||||||
|
background: var(--surface);
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shell > nav strong {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-right: var(--s4);
|
||||||
|
font-weight: 700;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shell > nav a {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: var(--s3) var(--s3);
|
||||||
|
color: var(--ink-soft);
|
||||||
|
text-decoration: none;
|
||||||
|
border-bottom: 2px solid transparent;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shell > nav a:hover {
|
||||||
|
color: var(--ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shell > nav a.active {
|
||||||
|
color: var(--ink);
|
||||||
|
border-bottom-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shell > nav a:focus-visible {
|
||||||
|
box-shadow: inset 0 0 0 2px var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shell > nav .whoami {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-left: auto;
|
||||||
|
padding: 0 var(--s3);
|
||||||
|
color: var(--ink-faint);
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shell > nav .connect {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shell main {
|
.shell > nav .whoami + .connect {
|
||||||
padding: 1rem;
|
margin-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.shell main {
|
||||||
|
max-width: var(--measure);
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: var(--s6) var(--s5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The graph needs the full width to be readable; the nav follows it. */
|
||||||
|
.shell:has(.graph-layout) main {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.shell:has(.graph-layout) > nav {
|
||||||
|
padding-inline: var(--s5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice {
|
||||||
|
padding: var(--s3) var(--s5);
|
||||||
|
background: var(--warn-soft);
|
||||||
|
color: var(--warn);
|
||||||
|
border-bottom: 1px solid var(--warn);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notice a {
|
||||||
|
color: inherit;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skip-link {
|
||||||
|
position: absolute;
|
||||||
|
left: -9999px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.skip-link:focus {
|
||||||
|
left: var(--s2);
|
||||||
|
top: var(--s2);
|
||||||
|
z-index: 10;
|
||||||
|
background: var(--surface);
|
||||||
|
padding: var(--s2) var(--s3);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Buttons ---------- */
|
||||||
|
|
||||||
|
button {
|
||||||
|
font: inherit;
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.25;
|
||||||
|
padding: 0.4rem var(--s3);
|
||||||
|
color: var(--ink);
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.12s, border-color 0.12s;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover:not(:disabled) {
|
||||||
|
background: var(--surface-sunken);
|
||||||
|
border-color: var(--ink-faint);
|
||||||
|
}
|
||||||
|
|
||||||
|
button:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Submit buttons are the primary action of their form. */
|
||||||
|
button[type='submit'] {
|
||||||
|
background: var(--accent);
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent-ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
button[type='submit']:hover:not(:disabled) {
|
||||||
|
background: var(--accent);
|
||||||
|
border-color: var(--accent);
|
||||||
|
filter: brightness(1.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Destructive actions. */
|
||||||
|
button[aria-label^='Delete'],
|
||||||
|
button[aria-label^='Revoke'],
|
||||||
|
button[aria-label^='Remove'] {
|
||||||
|
color: var(--danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
button[aria-label^='Delete']:hover:not(:disabled),
|
||||||
|
button[aria-label^='Revoke']:hover:not(:disabled),
|
||||||
|
button[aria-label^='Remove']:hover:not(:disabled) {
|
||||||
|
background: var(--danger-soft);
|
||||||
|
border-color: var(--danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Forms ---------- */
|
||||||
|
|
||||||
form {
|
form {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.75rem;
|
gap: var(--s4);
|
||||||
max-width: 24rem;
|
max-width: 26rem;
|
||||||
|
margin: var(--s4) 0;
|
||||||
|
padding: var(--s5);
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
form label {
|
form label {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.25rem;
|
gap: var(--s1);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:not([type='radio'], [type='checkbox']),
|
||||||
|
select {
|
||||||
|
font: inherit;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.45rem var(--s3);
|
||||||
|
color: var(--ink);
|
||||||
|
background: var(--surface-sunken);
|
||||||
|
border: 1px solid var(--line-strong);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
select {
|
||||||
|
width: auto;
|
||||||
|
min-width: 10rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
input::placeholder {
|
||||||
|
color: var(--ink-faint);
|
||||||
|
}
|
||||||
|
|
||||||
|
input:disabled {
|
||||||
|
opacity: 0.6;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:focus-visible,
|
||||||
|
select:focus-visible {
|
||||||
|
box-shadow: none;
|
||||||
|
outline: 2px solid var(--accent);
|
||||||
|
outline-offset: 0;
|
||||||
|
border-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type='radio'],
|
||||||
|
input[type='checkbox'] {
|
||||||
|
margin: 0;
|
||||||
|
accent-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Radios and checkboxes sit beside their text, not stacked. */
|
||||||
|
fieldset {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--s2);
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
padding: 0;
|
||||||
|
margin-bottom: var(--s2);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset label,
|
||||||
|
label.check {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--s2);
|
||||||
|
font-weight: 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
[role='alert'] {
|
[role='alert'] {
|
||||||
color: #c0392b;
|
color: var(--danger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p[role='alert'] {
|
||||||
|
padding: var(--s2) var(--s3);
|
||||||
|
background: var(--danger-soft);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
[role='status'] {
|
||||||
|
color: var(--ink-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Tables ---------- */
|
||||||
|
|
||||||
table {
|
table {
|
||||||
border-collapse: collapse;
|
width: 100%;
|
||||||
margin-bottom: 1rem;
|
border-collapse: separate;
|
||||||
|
border-spacing: 0;
|
||||||
|
margin-bottom: var(--s4);
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
th,
|
th,
|
||||||
td {
|
td {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 0.35rem 0.75rem;
|
padding: var(--s3) var(--s4);
|
||||||
border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent);
|
border-bottom: 1px solid var(--line);
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
background: var(--surface-sunken);
|
||||||
|
color: var(--ink-soft);
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:last-child td {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
tbody tr:hover {
|
||||||
|
background: color-mix(in srgb, var(--accent) 5%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Action cells: keep buttons on one line, right aligned. */
|
||||||
|
td:last-child:has(button) {
|
||||||
|
white-space: nowrap;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
td:last-child button + button {
|
||||||
|
margin-left: var(--s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Tabs ---------- */
|
||||||
|
|
||||||
.tabs {
|
.tabs {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0.5rem;
|
gap: var(--s1);
|
||||||
margin-bottom: 1rem;
|
margin-bottom: var(--s5);
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs button {
|
||||||
|
padding: var(--s2) var(--s4);
|
||||||
|
background: none;
|
||||||
|
border: 0;
|
||||||
|
border-bottom: 2px solid transparent;
|
||||||
|
border-radius: 0;
|
||||||
|
margin-bottom: -1px;
|
||||||
|
color: var(--ink-soft);
|
||||||
|
font-size: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tabs button:hover:not(:disabled) {
|
||||||
|
background: none;
|
||||||
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs [aria-selected='true'] {
|
.tabs [aria-selected='true'] {
|
||||||
|
color: var(--ink);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-decoration: underline;
|
border-bottom-color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
label.check {
|
/* ---------- Secrets ---------- */
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.secret-once {
|
|
||||||
border: 2px solid #d4a017;
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
overflow-wrap: anywhere;
|
|
||||||
}
|
|
||||||
|
|
||||||
.crumbs {
|
.crumbs {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 0.25rem;
|
align-items: center;
|
||||||
margin: 0.75rem 0;
|
gap: var(--s1);
|
||||||
|
margin: var(--s4) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.crumbs button {
|
||||||
|
font-family: var(--mono);
|
||||||
|
background: var(--surface-sunken);
|
||||||
}
|
}
|
||||||
|
|
||||||
.entries {
|
.entries {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
|
margin: 0 0 var(--s4);
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entries li + li {
|
||||||
|
border-top: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.entries button {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
padding: var(--s2) var(--s4);
|
||||||
|
text-align: left;
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: var(--text);
|
||||||
|
background: none;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.entries [aria-pressed='true'] {
|
.entries [aria-pressed='true'] {
|
||||||
|
background: var(--accent-soft);
|
||||||
|
color: var(--accent);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hint {
|
/* A token is shown once; make that unmissable. */
|
||||||
opacity: 0.7;
|
.secret-once {
|
||||||
font-size: 0.9em;
|
padding: var(--s4);
|
||||||
|
margin-bottom: var(--s4);
|
||||||
|
background: var(--warn-soft);
|
||||||
|
border: 1px solid var(--warn);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
color: var(--ink);
|
||||||
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The Access panel: a card with a header, current access on the left, the grant form on the right. */
|
||||||
.access-editor {
|
.access-editor {
|
||||||
border-top: 2px solid color-mix(in srgb, currentColor 30%, transparent);
|
margin-top: var(--s6);
|
||||||
margin-top: 1.5rem;
|
background: var(--surface);
|
||||||
padding-top: 1rem;
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
.access-head {
|
||||||
background: color-mix(in srgb, currentColor 8%, transparent);
|
display: flex;
|
||||||
padding: 0.75rem;
|
align-items: center;
|
||||||
overflow-x: auto;
|
justify-content: space-between;
|
||||||
|
gap: var(--s3);
|
||||||
|
padding: var(--s3) var(--s5);
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.access-head h2 {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: var(--s2);
|
||||||
|
margin: 0;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.access-head .kind {
|
||||||
|
padding: 0 var(--s2);
|
||||||
|
background: var(--surface-sunken);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 999px;
|
||||||
|
color: var(--ink-soft);
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.access-body {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(22rem, 28rem);
|
||||||
|
gap: var(--s5);
|
||||||
|
align-items: start;
|
||||||
|
padding: var(--s5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-head {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: var(--s2) var(--s4);
|
||||||
|
margin-bottom: var(--s3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-head h3,
|
||||||
|
.access-grant h3 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.access-current h3:not(.section-head h3) {
|
||||||
|
margin-top: var(--s6);
|
||||||
|
margin-bottom: var(--s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.access-current table {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.policy-list {
|
||||||
|
list-style: none;
|
||||||
|
margin: var(--s3) 0 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.policy-list > li {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--s2) var(--s3);
|
||||||
|
padding: var(--s2) 0;
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
font-family: var(--mono);
|
||||||
|
}
|
||||||
|
|
||||||
|
.policy-list pre {
|
||||||
|
flex-basis: 100%;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.access-grant {
|
||||||
|
max-width: none;
|
||||||
|
margin: 0;
|
||||||
|
background: var(--bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.access-grant .caps {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.access-grant .caps legend {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 60rem) {
|
||||||
|
.access-body {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Graph ---------- */
|
||||||
|
|
||||||
.graph-toolbar {
|
.graph-toolbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 1rem;
|
gap: var(--s4);
|
||||||
align-items: end;
|
align-items: flex-end;
|
||||||
margin-bottom: 0.75rem;
|
margin-bottom: var(--s3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.graph-toolbar label {
|
.graph-toolbar label:not(.check) {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.25rem;
|
gap: var(--s1);
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-toolbar .check {
|
||||||
|
min-height: 2.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.graph-legend {
|
.graph-legend {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1.5rem;
|
gap: var(--s5);
|
||||||
font-size: 0.85em;
|
margin-bottom: var(--s2);
|
||||||
opacity: 0.7;
|
color: var(--ink-faint);
|
||||||
margin-bottom: 0.5rem;
|
font-size: var(--text-sm);
|
||||||
}
|
}
|
||||||
|
|
||||||
.graph-layout {
|
.graph-layout {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr 22rem;
|
grid-template-columns: 1fr 22rem;
|
||||||
gap: 1rem;
|
gap: var(--s4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.graph-canvas {
|
.graph-canvas {
|
||||||
height: 70vh;
|
height: 70vh;
|
||||||
border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
|
background: var(--surface-sunken);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.graph-details {
|
.graph-details {
|
||||||
@@ -182,37 +687,186 @@ pre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.gnode-selected {
|
.gnode-selected {
|
||||||
box-shadow: 0 0 0 3px #d4a017;
|
box-shadow: 0 0 0 3px var(--warn);
|
||||||
}
|
}
|
||||||
|
|
||||||
.skip-link {
|
@media (max-width: 48rem) {
|
||||||
position: absolute;
|
.shell nav {
|
||||||
left: -9999px;
|
flex-wrap: wrap;
|
||||||
|
padding: 0 var(--s4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.shell main {
|
||||||
|
padding: var(--s5) var(--s4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.graph-layout {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.skip-link:focus {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
left: 0.5rem;
|
* {
|
||||||
top: 0.5rem;
|
transition: none !important;
|
||||||
z-index: 10;
|
}
|
||||||
background: Canvas;
|
|
||||||
padding: 0.5rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.notice {
|
/* Standalone field labels (e.g. the Secrets mount picker) sit inline with their control. */
|
||||||
padding: 0.6rem 1rem;
|
main section > label {
|
||||||
background: color-mix(in srgb, #d4a017 25%, transparent);
|
display: flex;
|
||||||
border-bottom: 1px solid #d4a017;
|
align-items: center;
|
||||||
|
gap: var(--s2);
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.whoami {
|
/* ---------- Connection summary ---------- */
|
||||||
opacity: 0.7;
|
|
||||||
margin-left: auto;
|
.connection-head {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: var(--s3);
|
||||||
|
padding: var(--s4) var(--s5);
|
||||||
|
margin-bottom: var(--s5);
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
color: var(--ink);
|
||||||
}
|
}
|
||||||
|
|
||||||
.whoami + .connect {
|
.connection-state {
|
||||||
margin-left: 0;
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
gap: var(--s2);
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
main:focus {
|
.dot {
|
||||||
outline: none;
|
width: 0.6rem;
|
||||||
|
height: 0.6rem;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--accent);
|
||||||
|
box-shadow: 0 0 0 3px var(--accent-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
|
||||||
|
gap: var(--s5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-grid section {
|
||||||
|
padding: var(--s4) var(--s5) var(--s2);
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
}
|
||||||
|
|
||||||
|
.connection-grid h2 {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dl {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: max-content 1fr;
|
||||||
|
gap: var(--s3) var(--s5);
|
||||||
|
margin: 0 0 var(--s4);
|
||||||
|
}
|
||||||
|
|
||||||
|
dt {
|
||||||
|
color: var(--ink-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
dd {
|
||||||
|
margin: 0;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chips {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: var(--s1);
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chips li {
|
||||||
|
padding: 0 var(--s2);
|
||||||
|
background: var(--accent-soft);
|
||||||
|
color: var(--accent);
|
||||||
|
border-radius: 999px;
|
||||||
|
font-family: var(--mono);
|
||||||
|
font-size: var(--text-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---------- Access: secret picker ---------- */
|
||||||
|
|
||||||
|
.path-picker {
|
||||||
|
display: grid;
|
||||||
|
gap: var(--s3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-picker .crumbs {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-picker .entries {
|
||||||
|
margin: 0;
|
||||||
|
max-height: 14rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.path-picker .hint {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entry-folder {
|
||||||
|
display: flex !important;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entry-folder span {
|
||||||
|
color: var(--ink-faint);
|
||||||
|
}
|
||||||
|
|
||||||
|
.entries .entry-secret {
|
||||||
|
padding: var(--s2) var(--s4);
|
||||||
|
font-family: var(--mono);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entries .entry-secret:hover {
|
||||||
|
background: var(--surface-sunken);
|
||||||
|
}
|
||||||
|
|
||||||
|
.entries .entry-secret:has(input:checked) {
|
||||||
|
background: var(--accent-soft);
|
||||||
|
color: var(--accent);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.entries .entry-secret:has(input:disabled) {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* A button that reads as an inline link. */
|
||||||
|
button.link {
|
||||||
|
padding: 0;
|
||||||
|
font-size: inherit;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--accent);
|
||||||
|
background: none;
|
||||||
|
border: 0;
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.link:hover:not(:disabled) {
|
||||||
|
background: none;
|
||||||
|
filter: brightness(1.15);
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user