WardrikWeb.Router (wardrik_web v0.1.0-rc.1)

Copy Markdown

Adds the dashboard to a Phoenix router.

import WardrikWeb.Router

scope "/" do
  pipe_through :browser
  wardrik_dashboard "/wardrik", resolver: {MyAppWeb.WardrikResolver, []}
end
  • The pipeline must fetch the session and check CSRF tokens. Phoenix's :browser pipeline does both.
  • The endpoint must serve the LiveView socket with the session: socket "/live", Phoenix.LiveView.Socket, websocket: [connect_info: [session: @session_options]].

Summary

Functions

Mounts the dashboard at path.

Functions

wardrik_dashboard(path, opts)

(macro)

Mounts the dashboard at path.

Options

  • :resolver (tuple of atom/0, term/0 values) - Required. The WardrikWeb.Resolver to use, as {module, opts}.

  • :on_mount (list of term/0) - Your on_mount hooks, for example the one that loads the signed-in user. They run before the resolver. The default value is [].

  • :extensions (list of atom/0) - The WardrikWeb.Extension modules to add. The default value is [].

  • :settings (keyword/0) - The settings pages to turn on, as {module, opts} for each page. :servers, :secrets, :notify_targets and :oauth_apps take a WardrikWeb.Settings. :connections takes a WardrikWeb.Connections. The default value is [].

    • :servers

    • :secrets

    • :notify_targets

    • :oauth_apps

    • :connections

  • :socket_path (String.t/0) - The path of the endpoint's LiveView socket. The default value is "/live".

  • :sign_in (String.t/0) - The path to redirect to when the resolver refuses access. The default value is "/".

  • :live_session (atom/0) - The name of the live session. Set a different name for each dashboard if you mount more than one. The default value is :wardrik_web.