feat: Update widget catalog and enhance dashboard layout features
- Added new "Dashboard-Lab-Widgets" entry to the documentation for better guidance on widget configuration. - Updated the app_dashboard version to 1.8.0 to reflect the introduction of widget catalog features and layout entitlements. - Enhanced widget catalog entries to include optional feature requirements for better visibility and access control. - Improved the DashboardLabPage to manage widget visibility based on feature entitlements, ensuring a more tailored user experience.
This commit is contained in:
1 parent
bc91396885
commit
9bc0cf70da
8 files changed
+242
-32
No files matched your search
+26
-20
@@ -6,13 +6,16 @@ Frontend-Komponenten registrieren dieselben IDs lokal (siehe widgetSystem/regist
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, TypedDict
|
||||
from typing import Any, NotRequired, TypedDict
|
||||
|
||||
|
||||
class WidgetCatalogEntry(TypedDict):
|
||||
"""requires_feature: optional features.id; fehlt oder leer → Widget immer sichtbar (nur Auth)."""
|
||||
|
||||
id: str
|
||||
title: str
|
||||
description: str
|
||||
requires_feature: NotRequired[str]
|
||||
|
||||
|
||||
# Reihenfolge = Default-Layout-Reihenfolge. Aktiv-Flags: DEFAULT_LAB_WIDGET_IDS (Rest zunächst aus).
|
||||
@@ -25,7 +28,8 @@ WIDGET_CATALOG: list[WidgetCatalogEntry] = [
|
||||
{
|
||||
"id": "quick_capture",
|
||||
"title": "Schnelleingabe",
|
||||
"description": "Gewicht + Baseline-Vitals; optional show_weight / show_resting_hr / show_hrv / show_vo2_max (false = aus)",
|
||||
"description": "Gewicht + Baseline-Vitals; optional show_weight / show_resting_hr / show_hrv / show_vo2_max (false = aus); Feature weight_entries",
|
||||
"requires_feature": "weight_entries",
|
||||
},
|
||||
{
|
||||
"id": "kpi_board",
|
||||
@@ -35,12 +39,14 @@ WIDGET_CATALOG: list[WidgetCatalogEntry] = [
|
||||
{
|
||||
"id": "body_overview",
|
||||
"title": "Körper (Chart)",
|
||||
"description": "Gewicht & Kennzahlen (optional: config chart_days 7–90)",
|
||||
"description": "Gewicht & Kennzahlen (optional: config chart_days 7–90); Feature weight_entries",
|
||||
"requires_feature": "weight_entries",
|
||||
},
|
||||
{
|
||||
"id": "activity_overview",
|
||||
"title": "Aktivität",
|
||||
"description": "Trainingstyp-Verteilung (Kuchen) + Konsistenz — Zeitraum über config chart_days 7–90",
|
||||
"description": "Trainingstyp-Verteilung (Kuchen) + Konsistenz — Zeitraum über config chart_days 7–90; Feature activity_entries",
|
||||
"requires_feature": "activity_entries",
|
||||
},
|
||||
{
|
||||
"id": "dashboard_greeting",
|
||||
@@ -50,17 +56,20 @@ WIDGET_CATALOG: list[WidgetCatalogEntry] = [
|
||||
{
|
||||
"id": "quick_weight_today",
|
||||
"title": "Gewicht heute",
|
||||
"description": "Tagesgewicht erfassen (wie Produkt-Dashboard)",
|
||||
"description": "Tagesgewicht erfassen (wie Produkt-Dashboard); Feature weight_entries",
|
||||
"requires_feature": "weight_entries",
|
||||
},
|
||||
{
|
||||
"id": "body_stat_strip",
|
||||
"title": "Kennzahlen-Kacheln",
|
||||
"description": "Gewicht, KF, Magermasse, Ø-kcal — Oberreihe",
|
||||
"description": "Gewicht, KF, Magermasse, Ø-kcal — Oberreihe; u. a. nutrition_entries (Ø-kcal)",
|
||||
"requires_feature": "nutrition_entries",
|
||||
},
|
||||
{
|
||||
"id": "status_pills",
|
||||
"title": "Indikatoren (Pills)",
|
||||
"description": "WHR, WHtR, Protein, KF",
|
||||
"description": "WHR, WHtR, Protein, KF; Feature nutrition_entries",
|
||||
"requires_feature": "nutrition_entries",
|
||||
},
|
||||
{
|
||||
"id": "profile_goals_progress",
|
||||
@@ -70,17 +79,20 @@ WIDGET_CATALOG: list[WidgetCatalogEntry] = [
|
||||
{
|
||||
"id": "trend_kcal_weight",
|
||||
"title": "Trend Kalorien + Gewicht",
|
||||
"description": "Linienchart (optional config chart_days 7–90, Default 30)",
|
||||
"description": "Linienchart (optional config chart_days 7–90, Default 30); Feature nutrition_entries",
|
||||
"requires_feature": "nutrition_entries",
|
||||
},
|
||||
{
|
||||
"id": "nutrition_activity_summary",
|
||||
"title": "Ernährung & Aktivität Kurz",
|
||||
"description": "Ø 7T Kacheln",
|
||||
"description": "Ø 7T Kacheln; Feature nutrition_entries",
|
||||
"requires_feature": "nutrition_entries",
|
||||
},
|
||||
{
|
||||
"id": "nutrition_detail_charts",
|
||||
"title": "Ernährung — Detaillierte Charts",
|
||||
"description": "Phase-0c NutritionCharts (optional chart_days 7–90, Default 30)",
|
||||
"description": "Phase-0c NutritionCharts (optional chart_days 7–90, Default 30); Feature nutrition_entries",
|
||||
"requires_feature": "nutrition_entries",
|
||||
},
|
||||
{
|
||||
"id": "recovery_charts_panel",
|
||||
@@ -90,7 +102,8 @@ WIDGET_CATALOG: list[WidgetCatalogEntry] = [
|
||||
{
|
||||
"id": "progress_photos",
|
||||
"title": "Fortschrittsfotos",
|
||||
"description": "Galerie der hochgeladenen Fotos",
|
||||
"description": "Galerie der hochgeladenen Fotos; Feature photos",
|
||||
"requires_feature": "photos",
|
||||
},
|
||||
{
|
||||
"id": "recovery_sleep_rest",
|
||||
@@ -105,7 +118,8 @@ WIDGET_CATALOG: list[WidgetCatalogEntry] = [
|
||||
{
|
||||
"id": "ai_pipeline_insight",
|
||||
"title": "KI Pipeline & letzte Analyse",
|
||||
"description": "Pipeline starten + Gesamt-Insight",
|
||||
"description": "Pipeline starten + Gesamt-Insight; Feature ai_pipeline",
|
||||
"requires_feature": "ai_pipeline",
|
||||
},
|
||||
]
|
||||
|
||||
@@ -120,11 +134,3 @@ DEFAULT_LAB_WIDGET_IDS: frozenset[str] = frozenset(
|
||||
)
|
||||
|
||||
ALLOWED_WIDGET_IDS: frozenset[str] = frozenset(e["id"] for e in WIDGET_CATALOG)
|
||||
|
||||
|
||||
def catalog_response() -> dict[str, Any]:
|
||||
"""Payload für GET /api/app/widgets/catalog."""
|
||||
return {
|
||||
"catalog_version": 1,
|
||||
"widgets": list(WIDGET_CATALOG),
|
||||
}
|
||||
Reference in new issue
Block a user