View Source Luminous.TimeRangeSelector behaviour (luminous v0.1.0)

a selector represents the widget in the dashboard that allows for selecting a time range/period

it is defined at compile time and populated at compile time (current value)

it can also be updated with a new value

Link to this section Summary

Callbacks

this behaviour needs to be implemented by the module that is passed to define/2

Link to this section Types

@type preset() :: binary()
@type t() :: %Luminous.TimeRangeSelector{
  current_time_range: nil | Luminous.TimeRange.t(),
  hook: binary(),
  id: binary(),
  mod: module()
}
@type time_zone() :: binary()

Link to this section Callbacks

Link to this callback

default_time_range(time_zone)

View Source
@callback default_time_range(time_zone()) :: Luminous.TimeRange.t()

this behaviour needs to be implemented by the module that is passed to define/2

Link to this section Functions

Link to this function

default_time_range(selector, time_zone)

View Source
@spec default_time_range(t(), time_zone()) :: Luminous.TimeRange.t()
@spec define(module(), Keyword.t()) :: t()
Link to this function

get_time_range_for(selector, preset, time_zone)

View Source
@spec get_time_range_for(t(), preset(), time_zone()) :: Luminous.TimeRange.t()

Calculates and returns the time range for the given preset in the given time zone.

Link to this function

populate(selector, time_zone)

View Source
@spec populate(t(), time_zone()) :: t()
@spec presets() :: [preset()]
Link to this function

update_current(selector, time_range)

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