Migrate hand-rolled API tab in hero_proc_admin to <hero-api-docs> web component #108
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_proc#108
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?
Context
Follow-up from hero_website_framework#4. The OpenRPC explorer that was meant to be hoisted out of
hero_proc_adminhas now landed as a reusable web component<hero-api-docs>inhero_admin_lib/static/js/api-docs.js.Audit (comment 33847):
hero_proc_adminstill ships its own hand-rolled API tab. Migrate it.Locations to change
crates/hero_proc_admin/templates/index.html:667+— the API tab markup.crates/hero_proc_admin/static/js/dashboard.js— theapi-acc*(api-accordion) JS that drives it.crates/hero_proc_admin/static/css/.What to do
<hero-api-docs>element. Attribute config per the component's doc-comment inhero_admin_lib/src/assets.rs(rpc-url, etc.).hero_admin_lib's static assets are mounted on the same path the component expects (/static/shared/js/api-docs.js). Cross-check with how<hero-connection-status>is already wired intemplates/base.html:168.hero_proc_adminagainsthero_proc_server— confirm method list, param input, request fire, response display all match prior behaviour.Acceptance
hero_proc_adminrendered by<hero-api-docs>; no hand-rolled accordion code remains.api-acc*selectors removed fromdashboard.js.hero_proc_adminbuild clean; no orphaned static asset paths.Related
Done — API tab migrated to
<hero-api-docs>Landed on
developmentin commit 32af77c.What changed
crates/hero_proc_admin/templates/index.htmlapi-accordion+api-detail-panel+ loading state) with a single<hero-api-docs spec-url="{{ base_path }}/openrpc.json" rpc-url="{{ base_path }}/rpc">.crates/hero_proc_admin/templates/base.html<script src="{{ base_path }}/static/shared/js/api-docs.js">next to the existingconnection-status.jsline — same pattern, same shared mount.crates/hero_proc_admin/static/js/dashboard.jsapiDocsInitializedflag, theswitchTab('api')init branch, the special-caseapi/...hashchange handler (component owns its own hash routing via the defaulthash-prefix="api"), and the entire 478-line API helper block:API_NS_ICONS,_apiSpec,apiSchemaTypeLabel/Html,apiBuildExampleBody/Output,apiCopyToClipboard,apiShowDetail/Type,apiBuildGroupHtml/TypesGroupHtml,apiSelectMethod/Type,apiMethodsUsingType,apiToggleGroup,apiApplyHash,initApiDocs.crates/hero_proc_admin/static/css/dashboard.cssAPI DOCS TABsection (~285 lines, all.api-*selectors). The component's styles are scoped to its own Shadow DOM, so no replacement needed.Net: 4 files, +7 / −804 lines.
cargo build -p hero_proc_adminis clean.Acceptance check (from the issue)
hero_proc_adminrendered by<hero-api-docs>; no hand-rolled accordion code remains.api-acc*selectors removed fromdashboard.js. (grepforapi-acc|apiAcc|API_NS_ICONS|initApiDocs|_apiSpecreturns no matches across the crate.)hero_proc_adminbuild clean; no orphaned static asset paths. (The/static/shared/{*path}route inroutes.rs:326already servesapi-docs.jsfromhero_admin_lib— same mount that powersconnection-status.js,bootstrap.bundle.min.js,marked.min.js,highlight.min.js.)Smoke test — deferred
The issue calls for running
hero_proc_adminagainsthero_proc_serverand verifying method list / param input / request fire / response. My environment has no provisioned Hero user (PATH_ROOTunset, nohero_cfg.toml), andlab service coreto bootstrap the stack has broad side effects (sqlite state, hero_router, hero_code, hero_db). Holding off rather than taking that action autonomously.Wiring confidence is high regardless:
<hero-api-docs>is the same shape as<hero-connection-status>(already working in this admin via the same/static/shared/mount), and the framework'sdemo_websiteexercises it end-to-end. If you spin it up and the API tab looks wrong, the fix is almost certainly attribute-level (e.g.spec-urlresolution under a non-rootbase_path).Note on the duplicate issue
This is essentially the same task as #107 (less detailed body, no comments). I worked from #108 as instructed; #107 can be closed as a duplicate.