pub struct Placement {
pub analytics: Option<AnalyticsPlacement>,
pub dashboard: Option<DashboardPlacement>,
}Expand description
Where a widget surfaces in the SPA — an Analytics tab and/or a pinned
Dashboard card. Shared verbatim by both widget kinds: a job’s
AggregateWidget and a view’s SqlWidget are authored the same
way. (#1257 folded the aggregate side’s flat dashboard: +
pin_dashboard: pair into this block; expressing one idea in two
shapes meant a width had to be invented twice.)
Fields§
§analytics: Option<AnalyticsPlacement>The Analytics tab this widget groups under. Absent ⇒ not shown on the Analytics page.
Written either as a bare tab name or as a block, so the common case stays one line and a width is there when it’s wanted:
analytics: app-usage
# or
analytics: { tab: app-usage, width: half }dashboard: Option<DashboardPlacement>Promote to the main Dashboard (reuses #900’s pinned section). Absent ⇒ not pinned.
Implementations§
Source§impl Placement
impl Placement
Sourcepub fn tab(&self) -> &str
pub fn tab(&self) -> &str
The Analytics tab name, or a fallback so a dashboard-only widget still carries a group label for the shared widget list.
Sourcepub fn width_for(&self, pinned: bool) -> Option<WidgetWidth>
pub fn width_for(&self, pinned: bool) -> Option<WidgetWidth>
Width to render at on the surface being served. The two surfaces
are independent: the Dashboard’s pinned strip is a summary where
two full-width widgets push everything else below the fold, while
an Analytics tab gives the widget the room and usually wants the
per-render default.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Placement
impl<'de> Deserialize<'de> for Placement
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>,
Source§impl JsonSchema for Placement
impl JsonSchema for Placement
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more