Docs: user and administrator guides, screenshots; fix Generate and Leases layout
CI / integration (push) Successful in 1m25s
CI / check (push) Successful in 3m21s

Generate credentials no longer shows a raw JSON box for roles that take no input, and lease rows get proper button styling.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mattandClaude Sonnet 5.5 committed 2026-11-10 10:50:00 +00:00
1 parent 3fa32b5076
commit 4d0740dd97
21 files changed
+389 -5

No files matched your search

@@ -43,6 +43,12 @@ test('shows issued credentials once, and keeps them out of every cache', async (
expect(qc.getMutationCache().getAll()).toHaveLength(0)
})
test('a role that takes no input offers just Generate, with no raw JSON box', () => {
setup('database')
expect(screen.getByRole('form', { name: 'Generate credentials for ro' })).toBeInTheDocument()
expect(screen.queryByLabelText(/JSON/)).not.toBeInTheDocument()
})
test('revokes the lease on request', async () => {
vi.mocked(creds.generateCreds).mockResolvedValue(issued)
vi.mocked(leases.revokeLease).mockResolvedValue()
+2
View File
@@ -79,6 +79,8 @@ export function GenerateCreds({
key={kind.id}
kind={{ fields: kind.inputs }}
noun={`${kind.label.toLowerCase()} for ${role}`}
title={`${kind.label} for ${role}`}
rawJson={false}
showName={false}
submitLabel="Generate"
draft={draft}
+1 -1
View File
@@ -18,7 +18,7 @@ function LeaseRow({ client, id, name, onChanged }: { client: BaoClient; id: stri
const revoke = useMutation({ mutationFn: () => revokeLease(client, id), onSuccess: onChanged })
return (
<li>
<li className="lease-row">
<span>{name}</span>
<button type="button" aria-expanded={open} aria-label={`Details ${name}`} onClick={() => setOpen(!open)}>
Details
+12 -4
View File
@@ -99,6 +99,8 @@ export function RoleEditor({
noun = 'role',
showName = true,
nameLabel,
title: titleOverride,
rawJson = true,
submitLabel = 'Save',
draft,
pending,
@@ -114,6 +116,10 @@ export function RoleEditor({
showName?: boolean
/** Label for the name field; defaults to "<Noun> name". */
nameLabel?: string
/** Replaces the generated form title. */
title?: string
/** Show a raw JSON box when the schema has no fields (generic engines). False for forms that take no input. */
rawJson?: boolean
submitLabel?: string
draft: RoleDraft
pending: boolean
@@ -122,7 +128,7 @@ export function RoleEditor({
onSubmit: () => void
onCancel: () => void
}) {
const title = draft.isNew ? `New ${noun}` : showName ? `Edit ${draft.name}` : `Edit ${noun}`
const title = titleOverride ?? (draft.isNew ? `New ${noun}` : showName ? `Edit ${draft.name}` : `Edit ${noun}`)
function submit(e: FormEvent) {
e.preventDefault()
onSubmit()
@@ -137,10 +143,12 @@ export function RoleEditor({
</label>
)}
{kind.fields.length === 0 ? (
<label>
Role (JSON)
rawJson && (
<label>
Role (JSON)
<textarea value={draft.json} onChange={(e) => onChange({ ...draft, json: e.target.value })} rows={10} spellCheck={false} />
</label>
</label>
)
) : (
kind.fields.map((f) => (
<Field
+33
View File
@@ -491,6 +491,39 @@ td:last-child button + button {
border-radius: 0;
}
/* A lease is a row with its own actions, not a folder link: undo the full-width entry button style. */
.entries .lease-row {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: var(--s2);
padding: var(--s2) var(--s4);
}
.entries .lease-row > span {
flex: 1;
min-width: 0;
overflow-wrap: anywhere;
font-family: var(--mono);
}
.entries .lease-row button {
display: inline-block;
width: auto;
padding: 0.4rem var(--s3);
text-align: center;
font-family: inherit;
font-size: var(--text-sm);
background: var(--surface);
border: 1px solid var(--line-strong);
border-radius: var(--radius);
}
.entries .lease-row > :is(p, dl) {
flex-basis: 100%;
margin: 0;
}
.entries [aria-pressed='true'] {
background: var(--accent-soft);
color: var(--accent);