- Integrated a new API endpoint for fetching the widget catalog in the Dashboard-Lab. - Updated the dashboard layout schema to utilize the widget catalog for dynamic widget management. - Refactored DashboardLabPage and PilotVizPage to leverage the new widget rendering system. - Removed deprecated widget metadata from the frontend, streamlining the widget management process. - Bumped app_dashboard version to 1.1.0 to reflect the new features and improvements.
56 lines
1.4 KiB
Python
56 lines
1.4 KiB
Python
"""
|
|
Öffentlicher Widget-Katalog (Dashboard-Lab / später Produkt-Dashboard).
|
|
|
|
Single Source für: erlaubte IDs, Standard-Reihenfolge, Anzeige-Metadaten für API/GUI.
|
|
Frontend-Komponenten registrieren dieselben IDs lokal (siehe widgetSystem/registerPilotLabWidgets).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, TypedDict
|
|
|
|
|
|
class WidgetCatalogEntry(TypedDict):
|
|
id: str
|
|
title: str
|
|
description: str
|
|
|
|
|
|
# Reihenfolge in der Liste = Standard-Layout (alle default_enabled: True im Default-Layout)
|
|
WIDGET_CATALOG: list[WidgetCatalogEntry] = [
|
|
{
|
|
"id": "welcome",
|
|
"title": "Willkommen",
|
|
"description": "Begrüßung und Kurzkontext",
|
|
},
|
|
{
|
|
"id": "quick_capture",
|
|
"title": "Schnelleingabe",
|
|
"description": "Gewicht und Vitalwerte erfassen",
|
|
},
|
|
{
|
|
"id": "kpi_board",
|
|
"title": "KPI-Kacheln",
|
|
"description": "Referenzwerte, KF%, Kalorien",
|
|
},
|
|
{
|
|
"id": "body_overview",
|
|
"title": "Körper (Chart)",
|
|
"description": "Gewicht & Kennzahlen",
|
|
},
|
|
{
|
|
"id": "activity_overview",
|
|
"title": "Aktivität",
|
|
"description": "Training & Konsistenz",
|
|
},
|
|
]
|
|
|
|
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),
|
|
}
|