View Source Backpex.Metric behaviour (Backpex v0.8.2)

Behaviour implemented by all metrics.

Metrics are info boxes for your resources displaying key indicators prominently on the index view in your application. An example could be to show the current total of all orders received today. You may create your own metrics by implementing this behaviour.

Summary

Callbacks

Used to render the metric as a heex template on the index views.

Functions

Builds string of css classes for basic metric box

Determine if metrics are visible for given live_resource.

Callbacks

@callback format(data :: any(), format :: any()) :: term()
Link to this callback

query(query, select, repo)

View Source
@callback query(query :: Ecto.Queryable.t(), select :: any(), repo :: Ecto.Repo.t()) ::
  Ecto.Schema.t() | term() | nil
@callback render(assigns :: map()) :: %Phoenix.LiveView.Rendered{
  caller: term(),
  dynamic: term(),
  fingerprint: term(),
  root: term(),
  static: term()
}

Used to render the metric as a heex template on the index views.

Functions

Link to this function

metric_box_class(metric)

View Source

Builds string of css classes for basic metric box

Link to this function

metrics_visible?(visibility, resource)

View Source

Determine if metrics are visible for given live_resource.