feat: Introduce admin dashboard product standard management
- Added new API endpoints for managing the product dashboard standard, including retrieval, update, and deletion functionalities. - Enhanced the DashboardConfigurePage to support admin mode for configuring the product dashboard standard. - Updated the admin navigation to include a link for the product dashboard standard configuration. - Refactored the dashboard layout logic to utilize the new product standard management features. - Bumped app_dashboard version to 1.10.0 to reflect these enhancements and changes.
This commit is contained in:
1 parent
ff95ef63c7
commit
365ce49c6a
12 files changed
+299
-32
No files matched your search
@@ -0,0 +1,45 @@
|
||||
from dashboard_layout_schema import DashboardLayoutPayload, product_default_layout_dict
|
||||
from dashboard_widget_entitlements import widgets_catalog_admin_payload
|
||||
|
||||
|
||||
def test_widgets_catalog_admin_all_allowed():
|
||||
p = widgets_catalog_admin_payload()
|
||||
assert p["catalog_version"] == 1
|
||||
assert len(p["widgets"]) >= 1
|
||||
assert all(w["allowed"] is True for w in p["widgets"])
|
||||
|
||||
|
||||
def test_get_product_default_base_uses_code_when_no_row(monkeypatch):
|
||||
from system_dashboard_product_default import get_product_default_base_dict
|
||||
|
||||
class _Cur:
|
||||
def execute(self, *a, **k):
|
||||
pass
|
||||
|
||||
def fetchone(self):
|
||||
return None
|
||||
|
||||
monkeypatch.setattr("system_dashboard_product_default.get_cursor", lambda _c: _Cur())
|
||||
assert get_product_default_base_dict(object()) == product_default_layout_dict()
|
||||
|
||||
|
||||
def test_get_product_default_base_uses_db_when_valid(monkeypatch):
|
||||
from system_dashboard_product_default import get_product_default_base_dict
|
||||
|
||||
from widget_catalog import ALLOWED_WIDGET_IDS
|
||||
|
||||
small = {
|
||||
"version": 1,
|
||||
"widgets": [{"id": wid, "enabled": wid == "welcome"} for wid in sorted(ALLOWED_WIDGET_IDS)],
|
||||
}
|
||||
DashboardLayoutPayload.model_validate(small)
|
||||
|
||||
class _Cur:
|
||||
def execute(self, *a, **k):
|
||||
pass
|
||||
|
||||
def fetchone(self):
|
||||
return {"value": small}
|
||||
|
||||
monkeypatch.setattr("system_dashboard_product_default.get_cursor", lambda _c: _Cur())
|
||||
assert get_product_default_base_dict(object()) == small
|
||||
Reference in new issue
Block a user