View Source Luminous.Panel behaviour (luminous v2.2.0)

A panel represents a single visual element (chart) in a dashboard that can contain many queries.

It also defines a behaviour that must be implemented by concrete Panels.

Link to this section Summary

Callbacks

A list of the available panel actions that will be transmitted as events using JS.dispatch using the format panel:${panel_id}:${event} The label will be shown in the dropdown. This is an optional callback -- if undefined (or if it returns []), then the dropdown is not rendered

Define the panel type's supported data attributes These will be used to parse, validate and populate the client's input

Define custom attributes according to the panel type These will be used to parse, validate and populate the client's input

aggregate all transformed results to a single structure that will be sent to the concrete panel

the phoenix function component that renders the panel see Luminous.Components.panel/1 for a description of the available assigns

transform a query result to view data acc. to the panel type

Functions

Define a panel Verifies all supplied options both generic (@attributes) and the concrete panel's attributes Will raise if the validation fails

Refresh all panel queries.

Link to this section Types

Link to this section Callbacks

@callback actions() :: [%{event: binary(), label: binary()}]

A list of the available panel actions that will be transmitted as events using JS.dispatch using the format panel:${panel_id}:${event} The label will be shown in the dropdown. This is an optional callback -- if undefined (or if it returns []), then the dropdown is not rendered

@callback data_attributes() :: Luminous.Attributes.Schema.t()

Define the panel type's supported data attributes These will be used to parse, validate and populate the client's input

@callback panel_attributes() :: Luminous.Attributes.Schema.t()

Define custom attributes according to the panel type These will be used to parse, validate and populate the client's input

@callback reduce(list(), t(), Luminous.Dashboard.t()) :: any()

aggregate all transformed results to a single structure that will be sent to the concrete panel

@callback render(map()) :: Phoenix.LiveView.Rendered.t()

the phoenix function component that renders the panel see Luminous.Components.panel/1 for a description of the available assigns

@callback transform(Luminous.Query.result(), t()) :: any()

transform a query result to view data acc. to the panel type

Link to this section Functions

@spec define!(Keyword.t()) :: t()

Define a panel Verifies all supplied options both generic (@attributes) and the concrete panel's attributes Will raise if the validation fails

Link to this function

refresh(panel, variables, time_range)

View Source
@spec refresh(t(), [Luminous.Variable.t()], Luminous.TimeRange.t()) :: [any()]

Refresh all panel queries.