Ignite rocketboost.rs

Widgets

The dashboard, at /admin, shows two kinds of block for each resource: stat cards, and a table of the newest records. A resource adds them by implementing methods of the trait.

Stat cards

A card is a StatWidget: a label, such as Tags, and a whole-number value. The dashboard shows the cards of every resource, in the order the resources are passed to the panel builder, and each resource's cards in the order its widgets method returns them.

The widgets method has this signature: fn widgets(conn: &mut MysqlConnection) -> QueryResult<Vec<StatWidget>>. It runs on a connection from the pool, so it can use any Diesel query. The default returns no cards.

When no resource has cards, the dashboard says No stats yet. and tells the developer to implement widgets.

Latest records

A resource declares a table of its newest records. A derived resource does it with the latest_records(...) attribute, and a hand-written one with the latest_records method, which returns a LatestRecords or None. Both set the same three things:

  • title, the heading of the table, such as Latest tags.
  • columns, the keys of the resource's columns to show, in order.
  • limit, the most records to show. The panel shows at least one.

The rows come from the resource's latest method, which the panel calls with the declared limit. It must return the newest records first. A cell shows its value the way the list does, so a date reads as 1 Mar 2026 and a boolean as Yes or No. A column key that is not one of the resource's columns shows its name as the heading, with empty cells. A table with no records says No records yet..

The Article resource in Resources is derived, and declares its table with the attribute: the five newest articles, with their title and publication date. The derive writes latest for it, ordered by the primary key, newest first.

The Tag resource in the same place is hand-written, so it declares its table in the latest_records method and implements latest itself.

Not built yet

  • Charts. Charts are out of scope for v1.
  • Links and ordering. A card or a table does not link anywhere, and the order is fixed by the resources' order.