pub struct DashboardCard {
pub id: String,
pub title: String,
pub value: Value,
pub status: HealthStatus,
pub detail: String,
pub source: DashboardSource,
pub route: String,
pub action: Option<String>,
}Expand description
One fact on a dashboard: a value read out of one capability’s answer, the verdict the source gives it, where a reader drills in, and what acts on it.
use majordomus_cli::capability::builtin::dashboard::DashboardCard;
use serde_json::json;
let card: DashboardCard = serde_json::from_value(json!({
"id": "health-status",
"title": "Health",
"value": "ok",
"status": "ok",
"detail": "the worst of 8 check(s)",
"source": { "capability": "health.report", "input": {}, "pointer": "/status", "measure": "exact" },
"route": "/cockpit/health",
})).unwrap();
// the value is the source's: reading the pointer out of its answer gives it back
assert_eq!(card.source.measure.read(&json!({ "status": "ok" }), &card.source.pointer), card.value);
assert!(card.action.is_none());Fields§
§id: StringA stable id, [a-z][a-z0-9-]*, unique across the dashboard.
title: StringWhat the value is.
value: ValueThe value, read out of the source’s answer by the source’s measure: a number, a
string or a boolean, or null when the source holds none.
status: HealthStatusThe source’s verdict on it; unknown when the source could not answer.
detail: StringOne line: what the value means, or why the source could not answer.
source: DashboardSourceWhere the value came from.
route: StringThe Cockpit page a reader drills into for the evidence.
action: Option<String>The command that acts on it, when one does.
Trait Implementations§
Source§impl Clone for DashboardCard
impl Clone for DashboardCard
Source§fn clone(&self) -> DashboardCard
fn clone(&self) -> DashboardCard
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DashboardCard
impl Debug for DashboardCard
Source§impl<'de> Deserialize<'de> for DashboardCard
impl<'de> Deserialize<'de> for DashboardCard
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DashboardCard
Source§impl JsonSchema for DashboardCard
impl JsonSchema for DashboardCard
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for DashboardCard
impl PartialEq for DashboardCard
Source§fn eq(&self, other: &DashboardCard) -> bool
fn eq(&self, other: &DashboardCard) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DashboardCard
impl Serialize for DashboardCard
impl StructuralPartialEq for DashboardCard
Auto Trait Implementations§
impl Freeze for DashboardCard
impl RefUnwindSafe for DashboardCard
impl Send for DashboardCard
impl Sync for DashboardCard
impl Unpin for DashboardCard
impl UnsafeUnpin for DashboardCard
impl UnwindSafe for DashboardCard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.