WardrikWeb. Page
(wardrik_web v0.1.0-rc.1)
Copy Markdown
A page that an extension adds to the dashboard.
The dashboard serves the LiveView live at <prefix>/x/<path>. The navigation links to it
with the text label.
%WardrikWeb.Page{path: "fleet", label: "Fleet", live: MyApp.FleetLive}Writing a page
use WardrikWeb.Page makes a LiveView with the dashboard's components imported and
WardrikWeb.Form aliased:
defmodule MyApp.FleetLive do
use WardrikWeb.Page
@impl true
def mount(_params, _session, socket), do: {:ok, assign(socket, page_title: "Fleet")}
@impl true
def render(assigns) do
~H"""
<.head title="Fleet" lead="Runs and cost for each agent." />
<div class="card">
<header>Teams</header>
<div class="body">...</div>
</div>
"""
end
endThe page gets @scope and @dashboard, like the dashboard's own pages. Run operations with
Wardrik.Scope.run(@scope, id, input).
These classes match the dashboard's look:
card, with aheaderand abody.liston a table. Addstackto stack the cells on narrow screens, and setdata-labelon each cell.btn,btn primary,btn smallandbtn dangeron buttons.flash errorandflash infoon messages, andemptyfor an empty list.