ignite_core/widget.rs
1//! Dashboard widgets: the stat cards and the latest-records tables a resource
2//! can show on the dashboard.
3
4/// One stat card on the dashboard: a label and a whole-number value.
5#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
6pub struct StatWidget {
7 /// The card's heading, such as "Users".
8 pub label: &'static str,
9 /// The number the card shows.
10 pub value: i64,
11}
12
13/// A dashboard table of the newest records of a resource (added in v1).
14#[derive(Debug, Clone, PartialEq, Eq)]
15pub struct LatestRecords {
16 /// The table's heading, such as "Latest users".
17 pub title: &'static str,
18 /// The keys of the resource's columns to show, in order. Each key must be a column key.
19 pub columns: &'static [&'static str],
20 /// The most records the table shows, newest first.
21 pub limit: i64,
22}