Docs: user and administrator guides, screenshots; fix Generate and Leases layout
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:
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()
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user