PhoenixKitDashboards.Web.ProjectDashboardLive (PhoenixKitDashboards v0.4.0)

Copy Markdown View Source

The Dashboard tab for the phoenix_kit_projects hub — this module's phoenix_kit_project_extensions/0 contribution: a READ-ONLY, live view of one linked dashboard inside a project page.

Hub session contract

Off-router mount (live_render, no handle_params/3), per the projects embed-session contract: "project_uuid" / "config" / "current_user_uuid" / "locale". The extension's config carries the linkage — config["dashboard_uuid"], picked in the project's Modules panel.

Only SHARED dashboards render here

A project tab is a project-wide surface; personal and role dashboards carry per-user visibility that a shared pane must not blur. The picker offers only scope == "system" dashboards and the render path re-checks (a re-scoped dashboard downgrades to an explanatory card, live). Widget bodies still gate per-viewer: the embed identity is reconstructed from current_user_uuid and each widget re-checks Registry.visible_for_scope?/2, so a viewer without a module's permission sees that widget's placeholder, exactly like the builder.

What renders

The builder's fitted board (BuilderComponents.grid_mode/free_mode) in readonly mode — no drag/resize hooks, no card chrome, no catalog — with an id_prefix so the fit hooks' DOM ids stay unique inside the project page. Grid dashboards show their FIRST layout (v1: no layout switcher). Live widgets keep refreshing via a re-hosted copy of the builder's :refresh_tick loop, and edits made in the builder elsewhere appear live (Dashboards.subscribe/1).