View Source Luminous.Dashboard behaviour (luminous v2.6.1)

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

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

Returns the dashboard's URL parameters as a keyword list based on the supplied params and the dashboard's current state

Link to this section Types

@type t() :: map()
@type url_params() :: keyword()

Link to this section Callbacks

Link to this callback

dashboard_path(t, url_params)

View Source
@callback dashboard_path(Phoenix.LiveView.Socket.t(), url_params()) :: binary()

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.

  • :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

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

Link to this function

url_params(dashboard, params \\ [])

View Source
@spec url_params(t(), Keyword.t()) :: url_params()

Returns the dashboard's URL parameters as a keyword list based on the supplied params and the dashboard's current state