feat: Revamp KPI board configuration and validation
- Enhanced the KPI board widget to support tile configuration, allowing users to select and order tiles. - Updated validation logic to ensure proper handling of tile IDs and configuration fields. - Removed legacy chart_days support, transitioning to a fixed analysis window for KPI metrics. - Improved the DashboardLabPage to integrate the new KpiBoardConfigEditor for managing tile selections. - Bumped app_dashboard version to 1.5.0 to reflect these significant changes.
This commit is contained in:
1 parent
096d896166
commit
c0c512e942
10 files changed
+390
-91
No files matched your search
@@ -30,11 +30,25 @@ def test_activity_chart_days():
|
||||
validate_widget_entry_config("activity_overview", {"chart_days": 5})
|
||||
|
||||
|
||||
def test_kpi_board_chart_days():
|
||||
def test_kpi_board_tiles():
|
||||
assert validate_widget_entry_config("kpi_board", {}) == {}
|
||||
assert validate_widget_entry_config("kpi_board", {"chart_days": 14}) == {"chart_days": 14}
|
||||
assert validate_widget_entry_config("kpi_board", {"tiles": []}) == {"tiles": []}
|
||||
assert validate_widget_entry_config(
|
||||
"kpi_board",
|
||||
{"tiles": [{"id": "body_fat"}, {"id": "avg_kcal"}, {"id": "ref:hr_max"}]},
|
||||
) == {"tiles": [{"id": "body_fat"}, {"id": "avg_kcal"}, {"id": "ref:hr_max"}]}
|
||||
with pytest.raises(ValueError):
|
||||
validate_widget_entry_config("kpi_board", {"chart_days": 5})
|
||||
validate_widget_entry_config("kpi_board", {"tiles": [{"id": "unknown"}]})
|
||||
with pytest.raises(ValueError):
|
||||
validate_widget_entry_config("kpi_board", {"tiles": [{"id": "body_fat"}, {"id": "body_fat"}]})
|
||||
with pytest.raises(ValueError):
|
||||
validate_widget_entry_config("kpi_board", {"extra": 1})
|
||||
|
||||
|
||||
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}) == {}
|
||||
assert validate_widget_entry_config("kpi_board", {"chart_days": 5}) == {}
|
||||
|
||||
|
||||
def test_welcome_still_rejects_config():
|
||||
|
||||
Reference in new issue
Block a user