Add product-area presentation to Views
This commit is contained in:
@@ -111,6 +111,21 @@ def _catalogue(
|
||||
)
|
||||
|
||||
|
||||
def _product_area_ids(
|
||||
session: Session,
|
||||
principal: ApiPrincipal,
|
||||
) -> frozenset[str]:
|
||||
active_module_ids = {
|
||||
surface.module_id for surface in _catalogue(session, principal)
|
||||
}
|
||||
return frozenset(
|
||||
area.id
|
||||
for manifest in get_registry().manifests()
|
||||
if manifest.id in active_module_ids and manifest.frontend is not None
|
||||
for area in manifest.frontend.product_areas
|
||||
)
|
||||
|
||||
|
||||
def _view_governance_policy():
|
||||
return view_governance_policy(get_registry())
|
||||
|
||||
@@ -507,6 +522,7 @@ def _effective_response(state: EffectiveViewState) -> EffectiveViewResponse:
|
||||
active_revision_id=effective.revision_id,
|
||||
active_view_name=effective.name,
|
||||
visible_surface_ids=sorted(effective.visible_surface_ids),
|
||||
presentation=dict(effective.presentation),
|
||||
projection_active=effective.projection_active,
|
||||
locked=effective.locked,
|
||||
available_views=[
|
||||
@@ -753,6 +769,8 @@ def api_create_definition(
|
||||
visible_surface_ids=payload.visible_surface_ids,
|
||||
catalogue=_catalogue(session, principal),
|
||||
actor_id=_actor_id(principal),
|
||||
presentation=payload.presentation,
|
||||
available_product_area_ids=_product_area_ids(session, principal),
|
||||
)
|
||||
_audit(
|
||||
session,
|
||||
@@ -892,6 +910,8 @@ def api_create_revision(
|
||||
visible_surface_ids=payload.visible_surface_ids,
|
||||
catalogue=_catalogue(session, principal),
|
||||
actor_id=_actor_id(principal),
|
||||
presentation=payload.presentation,
|
||||
available_product_area_ids=_product_area_ids(session, principal),
|
||||
)
|
||||
_audit(
|
||||
session,
|
||||
|
||||
Reference in New Issue
Block a user