Repository navigation
fix(dashboard): make the LiveView dashboard start and render - #2
Merged
Merged
Conversation
The dashboard returned 500 on every page and could not actually start: ELIXIR_CLAW_START_DASHBOARD was documented but never read, and the endpoint had no port, secret key base, PubSub, session plug, error views or LiveView client script. The layout also read @inner_block instead of @inner_content. Add ElixirClaw.Dashboard (runtime config, localhost by default), compile-time endpoint config, error views, a root layout that serves the LiveView JS from the deps, and tests (lazy_html as a test dependency).
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #1 (base is
chore/repo-hygiene); retarget tomainafter #1 merges.Problem
Every dashboard page returned 500, and the dashboard could not actually start:
ELIXIR_CLAW_START_DASHBOARDis documented in the README but nothing read it.secret_key_base,pubsub_server, session plug (needed by:fetch_session/ CSRF), or error views. The missingErrorViewis what turned every failure into an opaque 500.Layouts.live/1read@inner_block, but a layout receives@inner_content.Changes
ElixirClaw.Dashboard:enabled?/0and runtime config from env (ELIXIR_CLAW_START_DASHBOARD,_DASHBOARD_HOST,_DASHBOARD_PORT,_SECRET_KEY_BASE). Binds to127.0.0.1by default because the dashboard has no authentication; a random secret key is generated when none is set.config/config.exs: compile-time endpoint settings (pubsub_server,render_errors). NewErrorHTML/ErrorJSONmodules.Plug.Session, andphoenix.min.js/phoenix_live_view.min.jsserved straight from the deps (no asset pipeline). Router sets a root layout;Layouts.live/1becomesLayouts.root/1with CSRF meta and the LiveSocket bootstrap.lazy_htmladded as a test-only dependency (required by LiveView 1.x tests).Verification
mix test: 96 tests, 0 failures (16:hardwareexcluded), on macOS and in anelixir:1.19Linux container; format and--warnings-as-errorscleanELIXIR_CLAW_START_DASHBOARD=true:/,/nodes,/approvals,/telemetry,/config,/api/*and both JS assets return 200, unknown paths return 404phx-connected) and the Approve button round-trips without errorsKnown limitations (not addressed here)
ElixirClaw.DashboardStub; Approve/Reject don't change it.mix runor a release, not the standalone escript (the JS is served from the deps'priv).ElixirClaw.Registryiskeys: :unique, soEvents.subscribe/1only works for one process per key; a second open dashboard tab won't receive events.