feat: Enhance dashboard layout and widget configuration
- 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:
1 parent
9bc0cf70da
commit
e4e2f23d7f
12 files changed
+592
-417
No files matched your search
@@ -9,7 +9,12 @@ from fastapi import APIRouter, Depends, Header, HTTPException
|
||||
from psycopg2.extras import Json
|
||||
|
||||
from auth import require_auth
|
||||
from dashboard_layout_schema import DashboardLayoutPayload, coalesce_effective_layout, default_layout_dict
|
||||
from dashboard_layout_schema import (
|
||||
DashboardLayoutPayload,
|
||||
coalesce_effective_layout,
|
||||
lab_default_layout_dict,
|
||||
product_default_layout_dict,
|
||||
)
|
||||
from dashboard_widget_entitlements import apply_entitlements_to_layout_dict, widgets_catalog_payload
|
||||
from db import get_cursor, get_db
|
||||
from routers.profiles import get_pid
|
||||
@@ -47,11 +52,13 @@ def get_dashboard_layout(
|
||||
custom, effective = coalesce_effective_layout(raw)
|
||||
with get_db() as conn:
|
||||
effective = apply_entitlements_to_layout_dict(effective, pid, conn)
|
||||
default_adj = apply_entitlements_to_layout_dict(default_layout_dict(), pid, conn)
|
||||
product_adj = apply_entitlements_to_layout_dict(product_default_layout_dict(), pid, conn)
|
||||
lab_adj = apply_entitlements_to_layout_dict(lab_default_layout_dict(), pid, conn)
|
||||
return {
|
||||
"custom": custom,
|
||||
"layout": effective,
|
||||
"default_layout": default_adj,
|
||||
"product_default_layout": product_adj,
|
||||
"lab_default_layout": lab_adj,
|
||||
}
|
||||
|
||||
|
||||
@@ -100,4 +107,5 @@ def reset_dashboard_layout(
|
||||
)
|
||||
if cur.rowcount == 0:
|
||||
raise HTTPException(404, "Profil nicht gefunden")
|
||||
return {"ok": True, "layout": default_layout_dict()}
|
||||
cleared = apply_entitlements_to_layout_dict(product_default_layout_dict(), pid, conn)
|
||||
return {"ok": True, "layout": cleared}
|
||||
Reference in new issue
Block a user