View Source Luminous.Dashboard (luminous v2.5.2)

A dashboard is the highest-level luminous component and contains all the necessary dashboard attributes such as the panels, variables and the time range selector. It also stores the state of the panels (query results). The dashboard is initialized in Luminous.Live and populated at runtime using populate/2.

Link to this section Summary

Functions

Parse the supplied parameters and return the dashboard map structure. The following options are supported

Get the dashboard's current time range

return the panel data for the specified panel

Returns the LV path for the specific dashboard based on its configuration. The second argument can be either the socket or the Phoenix.Endpoint

Populate the dashboard's dynamic properties (e.g. variable values, time range etc.) at runtime.

Update the dashboard's current time range

Update the dashboard's panel data

Update the dashboard's variables

Link to this section Types

Link to this section Functions

@spec define!(keyword()) :: t()

Parse the supplied parameters and return the dashboard map structure. The following options are supported:

  • :title (String.t/0) - Required.

  • :path (function of arity 3) - Required.

  • :action (atom/0) - Required.

  • :panels (list of map/0) - The default value is [].

  • :variables (list of map/0) - The default value is [].

  • :time_range_selector (struct of type Luminous.TimeRangeSelector) - The default value is %Luminous.TimeRangeSelector{id: nil, current_time_range: nil}.

  • :time_zone (String.t/0) - The default value is "Europe/Athens".

Link to this function

get_current_time_range(dashboard)

View Source
@spec get_current_time_range(t()) :: Luminous.TimeRange.t() | nil

Get the dashboard's current time range

Link to this function

get_data(dashboard, panel_id)

View Source
@spec get_data(t(), :atom) :: any()

return the panel data for the specified panel

Link to this function

path(dashboard, socket_or_endpoint, params \\ [])

View Source
@spec path(t(), Phoenix.LiveView.Socket.t() | module(), Keyword.t()) :: binary()

Returns the LV path for the specific dashboard based on its configuration. The second argument can be either the socket or the Phoenix.Endpoint

Link to this function

populate(dashboard, socket_assigns)

View Source
@spec populate(t(), map()) :: t()

Populate the dashboard's dynamic properties (e.g. variable values, time range etc.) at runtime.

Link to this function

update_current_time_range(dashboard, time_range)

View Source
@spec update_current_time_range(t(), Luminous.TimeRange.t()) :: t()

Update the dashboard's current time range

Link to this function

update_data(dashboard, panel_id, data)

View Source
@spec update_data(t(), :atom, any()) :: t()

Update the dashboard's panel data

Link to this function

update_variables(dashboard, new_variables)

View Source
@spec update_variables(t(), [Luminous.Variable.t()]) :: t()

Update the dashboard's variables