feat: Integrate Dashboard-Lab layout and enhance settings navigation
- Added new routes and API endpoints for the Dashboard-Lab layout in the app. - Updated main.py to include the app_dashboard router for backend integration. - Enhanced App.jsx to include a route for the DashboardLabPage. - Modified SettingsPage to add a link to the new Dashboard-Lab layout, improving user access to dashboard features. - Updated version.py to reflect the new app_dashboard module version.
This commit is contained in:
1 parent
c0cb995a7b
commit
e5f6e6c10d
11 files changed
+522
-9
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import pytest
|
||||
|
||||
from dashboard_layout_schema import (
|
||||
ALLOWED_WIDGET_IDS,
|
||||
DashboardLayoutPayload,
|
||||
coalesce_effective_layout,
|
||||
default_layout_dict,
|
||||
)
|
||||
|
||||
|
||||
def test_default_has_all_allowed_ids():
|
||||
d = default_layout_dict()
|
||||
got = {w["id"] for w in d["widgets"]}
|
||||
assert got == ALLOWED_WIDGET_IDS
|
||||
|
||||
|
||||
def test_payload_rejects_duplicate_ids():
|
||||
with pytest.raises(Exception):
|
||||
DashboardLayoutPayload.model_validate(
|
||||
{
|
||||
"version": 1,
|
||||
"widgets": [
|
||||
{"id": "welcome", "enabled": True},
|
||||
{"id": "welcome", "enabled": False},
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_payload_requires_one_enabled():
|
||||
with pytest.raises(Exception):
|
||||
DashboardLayoutPayload.model_validate(
|
||||
{
|
||||
"version": 1,
|
||||
"widgets": [{"id": "welcome", "enabled": False}],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_coalesce_none():
|
||||
custom, eff = coalesce_effective_layout(None)
|
||||
assert custom is False
|
||||
assert eff == default_layout_dict()
|
||||
|
||||
|
||||
def test_coalesce_valid_raw():
|
||||
raw = {
|
||||
"version": 1,
|
||||
"widgets": [
|
||||
{"id": "welcome", "enabled": True},
|
||||
{"id": "kpi_board", "enabled": True},
|
||||
],
|
||||
}
|
||||
custom, eff = coalesce_effective_layout(raw)
|
||||
assert custom is True
|
||||
assert eff == raw
|
||||
Reference in new issue
Block a user