fix(ui): Plan-Navigation nicht mehr durch leere data_slices blockieren
Test Suite / lint-backend (push) Waiting to run
Test Suite / compose-smoke (push) Waiting to run
Test Suite / k6 /api/health Baseline (push) Blocked by required conditions
Test Suite / playwright-smoke (push) Blocked by required conditions
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Has been cancelled
Test Suite / lint-backend (push) Waiting to run
Test Suite / compose-smoke (push) Waiting to run
Test Suite / k6 /api/health Baseline (push) Blocked by required conditions
Test Suite / playwright-smoke (push) Blocked by required conditions
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Has been cancelled
Archetyp-UI-Profil und Methoden-Schnittmenge werden korrekt gemerged; Frontend faellt bei leerem data_slices auf ui_profile.dataSlices zurueck, damit Eingang/Sprint/Gates erreichbar bleiben.
This commit is contained in:
1 parent
fe1edb84f8
commit
11b7128204
5 files changed
+77
-8
No files matched your search
@@ -47,16 +47,29 @@ def _load_ui_profile_from_db(archetype_key: str) -> Optional[dict[str, Any]]:
|
||||
conn.close()
|
||||
|
||||
|
||||
def _resolve_ui_profile(archetype_key: str) -> dict[str, Any]:
|
||||
db_profile = _load_ui_profile_from_db(archetype_key)
|
||||
if db_profile:
|
||||
return db_profile
|
||||
def _seed_ui_profile(archetype_key: str) -> dict[str, Any]:
|
||||
seed_profile = get_ui_profile_json(archetype_key)
|
||||
if seed_profile:
|
||||
return seed_profile
|
||||
return resolve_ui_profile(archetype_key)
|
||||
|
||||
|
||||
def _resolve_ui_profile(archetype_key: str) -> dict[str, Any]:
|
||||
seed_profile = _seed_ui_profile(archetype_key)
|
||||
db_profile = _load_ui_profile_from_db(archetype_key)
|
||||
if not db_profile:
|
||||
return seed_profile
|
||||
|
||||
merged = {**seed_profile, **db_profile}
|
||||
if not (merged.get("omCapabilities") or merged.get("dataSlices")):
|
||||
seed_slices = seed_profile.get("dataSlices") or []
|
||||
merged["dataSlices"] = list(seed_slices)
|
||||
merged["omCapabilities"] = list(
|
||||
seed_profile.get("omCapabilities") or seed_slices
|
||||
)
|
||||
return merged
|
||||
|
||||
|
||||
def _resolve_om_capabilities(ui_profile: dict[str, Any]) -> frozenset[str]:
|
||||
caps = ui_profile.get("omCapabilities") or ui_profile.get("dataSlices") or []
|
||||
return frozenset(caps)
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from auth import AUTH_HEADER
|
||||
from services import operating_context as operating_context_service
|
||||
from tests.factories import provision_user_in_tenant
|
||||
from tests.test_initiatives_actions import _auth, _create_initiative, _login
|
||||
|
||||
@@ -182,3 +183,19 @@ def test_operating_context_not_found(client):
|
||||
headers=_auth(token),
|
||||
)
|
||||
assert res.status_code == 404
|
||||
|
||||
|
||||
def test_resolve_ui_profile_merges_seed_slices_when_db_partial(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
operating_context_service,
|
||||
"_load_ui_profile_from_db",
|
||||
lambda _key: {
|
||||
"planOutlineKeys": ["profile", "inbox", "sprint", "gates"],
|
||||
"planDefaultRoute": "/plan/inbox",
|
||||
},
|
||||
)
|
||||
profile = operating_context_service._resolve_ui_profile("initiative.product")
|
||||
assert profile["planOutlineKeys"] == ["profile", "inbox", "sprint", "gates"]
|
||||
assert "backlog" in profile["dataSlices"]
|
||||
assert "work_cycles" in profile["dataSlices"]
|
||||
assert profile["omCapabilities"]
|
||||
Reference in new issue
Block a user