Schema-driven admin for all Hero services — generic renderer + x-admin annotations #15
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_components#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Schema-driven admin for all Hero services
Goal: one generic admin that renders each service's OpenRPC spec, so a service gets a working admin with zero UI code and its bespoke
*_admincrate / module is deleted. Grounded against the working tree onrevamp/schema-driven-admin; full plan + provenance in the author's notes.The simplifying insight: the Playground tab is already a generic, spec-driven admin (
router/playground.rs). The project is "promote that engine to the default admin, give CRUD-shaped method groups a nicer layout, annotate the few things the spec can't express." Mostly deletion + extraction, not new construction.Architecture — one pipeline, no DSL
One renderer with three modes: Resources (list/detail/form layout over the extracted schema-form engine), Methods (the existing Playground — zero-config fallback), Builtins (irreducible bespoke panes mounted by name — the only escape hatch). No detection on the hot path; a "resource" is just a method group an annotation lays out.
What's reused / extracted / deleted
admin/schema.rs(Resolver— the spec→widget brain),admin/layout.rs,admin/components/*(shell),admin/transport.rs, dioxus-bootstrap-css.pubwidget; unify the 5 cell impls into oneCellenum; oneuse_poll(fetch,trigger); onestatus_color; one lookup resolver; promoteModalShell.proc/whiteboard/voice/aibroker≈ 6,471 LOC, most ofprocess.rsretained as<Builtin>); the string-markup config layer + roxmltree parser; scoped*_admincrates (~29,419 addressable LOC, excluding thehero_biz_adminAskama outlier).The
x-adminannotation modelAdmin metadata lives on each service's OpenRPC spec (
x-adminextension), deserialized by serde into typed structs — no central manifest store, no XML grammar, no parser. One source of truth, versioned with the service, served as runtime data. A service with nox-adminfalls back to the Playground (still a usable admin).envelope(param-wrapper key) is the one field that can't be inferred. Implemented + unit-tested incrates/hero_components_app/src/admin/hints.rs.Minimal resource is two fields —
{ "schema": "Job", "envelope": "data" }— method names default to{snake(schema)}_{verb}. Lenient/forward-compatible: unknown fields ignored, unknown cell kinds degrade, invalid entries dropped + reported.Context & auth — paired with writes
Genuinely absent today (
router.contextsexists butContextPickeris dead code; no auth machinery). Writes ship with a minimal context slice, not after — no destructive affordance is enabled until the selected context is forwarded on every call. Read-only generation can precede this; mutation cannot.Phases
AdminHints+ loader. (started —AdminHintslanded)<Builtin>/embed the hard tail (code/slides/office).x-admin).Success metric
Services served with zero bespoke per-service UI code — not a single LOC figure.