Skip to main content

Module render

Module render 

Source
Expand description

The human-readable renderings, and the only place colour is woven in.

These lived in crate::admin::render beside the JSON ones until colour arrived. The split is where the sharing actually is: every render_*_json is read by both front ends (src/webadmin/pages/, src/webadmin/handlers/) and must stay byte-identical for a script parsing --json, while every renderer here has exactly one consumer, the terminal. Keeping them together would have meant either a Palette argument threaded through src/admin/, which is the front-end-agnostic layer, or colouring whole lines from the print site, which is all a finished padded string allows.

Two conventions hold throughout:

  • Pad first, then colour — palette.status(&format!("{:<11}", status)). A format width counts bytes, so wrapping before padding counts the escape and collapses the column. See super::style.
  • Colour is semantic, never decorative. Statuses, refusals and standing warnings; not labels, not timestamps, not identifiers. A listing should read as data with a few things standing out, and Palette::plain() must stay the shape an operator’s awk was written against.

Functions§

print_rows
Prints a listing the way every --json-capable list command prints one: one JSON array, or one human-readable line per row.
render_account_detail_text
account show <id>, one field per line.
render_account_line
One line: id profile status last_seen_from contact created_at.
render_admin_session_line
One line: id user state created_at expires_at ip.
render_admin_totp_line
admin user totp status, in words.
render_admin_user_line
One line: username status totp created_at last_login.
render_audit_detail_text
audit show <id>, one field per line — the row carries thirteen possible fields and a single line of them would wrap on any terminal.
render_audit_line
One line: id created_at event profile actor client identifiers.
render_eab_created_text
eab create text output.
render_eab_line
One line: kid status label created_at (RFC3339).
render_order_detail_text
order show text output.
render_order_line
One line: id status identifiers (comma-joined) created_at.