Lotus.Storage.DashboardCardFilterMapping (Lotus v1.1.0)

Copy Markdown View Source

Maps a dashboard filter to a query variable within a card.

This schema establishes the connection between a dashboard-level filter and the query variable it controls within a specific card. When the filter value changes, it is passed to the query as the specified variable.

Transform

The optional transform field changes the filter value before the query variable gets it. Lotus has two transforms, for a date range value in the form "start,end":

  • "date_range_start" - keeps the part before the comma
  • "date_range_end" - keeps the part after the comma. A value with no comma does not change

Any other transform does not change the value.

The transform gets the value after Lotus.Dashboards.DateToken resolves a relative date token, so a :date_range filter with the value "last_7_days" can map its start and end dates to two variables.

Example transform config:

{
  "type": "date_range_start"
}

Summary

Types

t()

@type t() :: %Lotus.Storage.DashboardCardFilterMapping{
  __meta__: term(),
  card: Lotus.Storage.DashboardCard.t() | Ecto.Association.NotLoaded.t(),
  card_id: term(),
  filter: Lotus.Storage.DashboardFilter.t() | Ecto.Association.NotLoaded.t(),
  filter_id: term(),
  id: term(),
  inserted_at: DateTime.t(),
  transform: map() | nil,
  updated_at: DateTime.t(),
  variable_name: String.t()
}

Functions

changeset(mapping, attrs)

new(attrs)

update(mapping, attrs)