This commit is contained in:
Mateusz Gruszczyński committed 2026-11-09 11:22:09 +01:00
1 parent 0cbe0566f5
commit 992a1795af
34 files changed
+1409 -604

No files matched your search

+7
View File
@@ -6,6 +6,8 @@ struct DashboardPresetLayout {
dashboard_widgets: Vec<String>,
dashboard_hidden_widgets: Vec<String>,
dashboard_widget_sizes: Option<BTreeMap<String, u8>>,
#[serde(default)]
dashboard_widget_heights: Option<BTreeMap<String, u8>>,
dashboard_density: String,
overview_samples: u16,
}
@@ -43,6 +45,8 @@ fn validate_dashboard_preset_layout(layout: &DashboardPresetLayout) -> Result<()
.clone_from(&layout.dashboard_hidden_widgets);
pref.dashboard_widget_sizes
.clone_from(&layout.dashboard_widget_sizes);
pref.dashboard_widget_heights
.clone_from(&layout.dashboard_widget_heights);
pref.dashboard_density.clone_from(&layout.dashboard_density);
validate_admin_preferences(&pref)
}
@@ -66,12 +70,14 @@ async fn dashboard_presets(
dashboard_widgets: layout.dashboard_widgets,
dashboard_hidden_widgets: layout.dashboard_hidden_widgets,
dashboard_widget_sizes: layout.dashboard_widget_sizes,
dashboard_widget_heights: layout.dashboard_widget_heights,
..Default::default()
};
reconcile_dashboard_widgets(&mut prefs);
layout.dashboard_widgets = prefs.dashboard_widgets;
layout.dashboard_hidden_widgets = prefs.dashboard_hidden_widgets;
layout.dashboard_widget_sizes = prefs.dashboard_widget_sizes;
layout.dashboard_widget_heights = prefs.dashboard_widget_heights;
if validate_dashboard_preset_layout(&layout).is_ok() {
presets.push(NamedDashboardPreset { name, layout });
}
@@ -170,6 +176,7 @@ mod dashboard_preset_validation_tests {
dashboard_widgets: default_admin_dashboard_widgets_for_tests(),
dashboard_hidden_widgets: default_hidden_dashboard_widgets(),
dashboard_widget_sizes: None,
dashboard_widget_heights: None,
dashboard_density: default_admin_dashboard_density(),
overview_samples: 600,
};