feat: Enhance dashboard layout and widget configuration
Deploy Development / deploy (push) Successful in 48s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 17s

- Updated dashboard layout schema to introduce separate default layouts for product and lab dashboards.
- Added new functions for managing product and lab default layouts, improving user customization options.
- Updated app_dashboard version to 1.9.0 to reflect the introduction of product vs lab layout defaults and new API fields for dashboard configuration.
- Enhanced tests to validate new layout functionalities and ensure proper widget visibility based on user settings.
This commit is contained in:
Lars committed 2026-04-08 07:41:16 +02:00
1 parent 9bc0cf70da
commit e4e2f23d7f
12 files changed
+592 -417

No files matched your search

+26 -4
View File
@@ -1,7 +1,7 @@
"""
Dashboard-Layout v1 (Nutzer-Lab): Validierung und Standard-Layout.
Dashboard-Layout v1: Validierung, Produkt-Standard (Übersicht) und Lab-Standard.
Erlaubte Widget-IDs und Standard-Reihenfolge: widget_catalog.WIDGET_CATALOG
Erlaubte Widget-IDs und Reihenfolge: widget_catalog.WIDGET_CATALOG.
"""
from __future__ import annotations
@@ -10,7 +10,12 @@ from typing import Any, Literal
from pydantic import BaseModel, Field, field_validator, model_validator
from dashboard_widget_config import validate_widget_entry_config
from widget_catalog import ALLOWED_WIDGET_IDS, DEFAULT_LAB_WIDGET_IDS, WIDGET_CATALOG
from widget_catalog import (
ALLOWED_WIDGET_IDS,
DEFAULT_LAB_WIDGET_IDS,
DEFAULT_PRODUCT_DASHBOARD_WIDGET_IDS,
WIDGET_CATALOG,
)
# Abwärtskompatibel (Tests importieren weiterhin aus diesem Modul)
__all__ = [
@@ -19,10 +24,13 @@ __all__ = [
"DashboardWidgetEntry",
"coalesce_effective_layout",
"default_layout_dict",
"lab_default_layout_dict",
"product_default_layout_dict",
]
def default_layout_dict() -> dict[str, Any]:
def lab_default_layout_dict() -> dict[str, Any]:
"""Standard für Dashboard-Lab (Experimentier-Widgets)."""
on = DEFAULT_LAB_WIDGET_IDS
return {
"version": 1,
@@ -30,6 +38,20 @@ def default_layout_dict() -> dict[str, Any]:
}
def product_default_layout_dict() -> dict[str, Any]:
"""System-Standard für die Produkt-Übersicht (kein DB-Override)."""
on = DEFAULT_PRODUCT_DASHBOARD_WIDGET_IDS
return {
"version": 1,
"widgets": [{"id": e["id"], "enabled": e["id"] in on} for e in WIDGET_CATALOG],
}
def default_layout_dict() -> dict[str, Any]:
"""Alias: Produkt-Standard (coalesce, Reset). Lab nutzt lab_default_layout_dict()."""
return product_default_layout_dict()
class DashboardWidgetEntry(BaseModel):
id: str = Field(min_length=1, max_length=64)
enabled: bool = True