feat: Enhance dashboard widget configuration and introduce new widgets
- Updated the dashboard layout schema to include new widgets: DashboardGreeting, QuickWeightToday, BodyStatStrip, StatusPills, ProfileGoalsProgress, TrendKcalWeight, NutritionActivitySummary, RecoverySleepRest, and TrainingTypeDistribution. - Improved widget configuration validation to support new features, including chart days for trend and distribution widgets. - Refactored the default lab layout to align with the updated widget catalog and ensure proper default activation. - Bumped app_dashboard version to 1.6.0 to reflect the addition of new widgets and configuration enhancements.
This commit is contained in:
1 parent
c0c512e942
commit
3d498d03c1
28 files changed
+1487
-243
No files matched your search
@@ -45,6 +45,24 @@ def test_kpi_board_tiles():
|
||||
validate_widget_entry_config("kpi_board", {"extra": 1})
|
||||
|
||||
|
||||
def test_trend_kcal_weight_chart_days():
|
||||
assert validate_widget_entry_config("trend_kcal_weight", {}) == {}
|
||||
assert validate_widget_entry_config("trend_kcal_weight", {"chart_days": 30}) == {"chart_days": 30}
|
||||
with pytest.raises(ValueError):
|
||||
validate_widget_entry_config("trend_kcal_weight", {"chart_days": 6})
|
||||
|
||||
|
||||
def test_training_type_distribution_days():
|
||||
assert validate_widget_entry_config("training_type_distribution", {}) == {}
|
||||
assert validate_widget_entry_config(
|
||||
"training_type_distribution", {"distribution_days": 28}
|
||||
) == {"distribution_days": 28}
|
||||
with pytest.raises(ValueError):
|
||||
validate_widget_entry_config("training_type_distribution", {"distribution_days": 5})
|
||||
with pytest.raises(ValueError):
|
||||
validate_widget_entry_config("training_type_distribution", {"distribution_days": 200})
|
||||
|
||||
|
||||
def test_kpi_board_legacy_chart_days_dropped():
|
||||
"""Nur chart_days (Alt-Layouts) → automatische Kachelwahl, kein Ø-Kal-Fenster mehr."""
|
||||
assert validate_widget_entry_config("kpi_board", {"chart_days": 14}) == {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Widget-Katalog: Konsistenz (IDs, Default-Layout, Katalog-Response)."""
|
||||
|
||||
from dashboard_layout_schema import default_layout_dict
|
||||
from widget_catalog import ALLOWED_WIDGET_IDS, WIDGET_CATALOG, catalog_response
|
||||
from widget_catalog import ALLOWED_WIDGET_IDS, DEFAULT_LAB_WIDGET_IDS, WIDGET_CATALOG, catalog_response
|
||||
|
||||
|
||||
def test_catalog_ids_unique_and_match_allowed():
|
||||
@@ -15,7 +15,9 @@ def test_default_layout_follows_catalog_order():
|
||||
assert d["version"] == 1
|
||||
got = [w["id"] for w in d["widgets"]]
|
||||
assert got == [e["id"] for e in WIDGET_CATALOG]
|
||||
assert all(w["enabled"] is True for w in d["widgets"])
|
||||
enabled_ids = {w["id"] for w in d["widgets"] if w["enabled"]}
|
||||
assert enabled_ids == DEFAULT_LAB_WIDGET_IDS
|
||||
assert any(w["enabled"] for w in d["widgets"])
|
||||
|
||||
|
||||
def test_catalog_response_shape():
|
||||
|
||||
Reference in new issue
Block a user