Add HTML5 object data flow context
This commit is contained in:
@@ -1748,10 +1748,21 @@ async def html5_project_object_context(project_id: str, object_name: str) -> Res
|
||||
access = await get_object_access(project_id, object_name)
|
||||
ui = await get_object_ui(project_id, object_name)
|
||||
privacy = await object_privacy(project_id, object_name)
|
||||
integrations = _integrations_for_object_context(project_id, impact)
|
||||
runtime = _runtime_for_object_context(project_id, impact)
|
||||
knowledge = _knowledge_for_object_context(schema, impact, ui)
|
||||
return Response(
|
||||
render_html5_object_context(project_id, schema, impact, access, ui, runtime, knowledge, privacy),
|
||||
render_html5_object_context(
|
||||
project_id,
|
||||
schema,
|
||||
impact,
|
||||
access,
|
||||
ui,
|
||||
runtime,
|
||||
knowledge,
|
||||
privacy,
|
||||
integrations,
|
||||
),
|
||||
media_type="text/html; charset=utf-8",
|
||||
)
|
||||
|
||||
@@ -8178,6 +8189,34 @@ def _knowledge_for_object_context(
|
||||
return sorted(records, key=lambda item: item.title.lower())[:12]
|
||||
|
||||
|
||||
def _integrations_for_object_context(
|
||||
project_id: str,
|
||||
impact: ObjectImpactResponse,
|
||||
) -> list[IntegrationEndpointResponse]:
|
||||
owner_names = {
|
||||
name
|
||||
for group in [impact.modules, impact.routines]
|
||||
for item in group
|
||||
for name in [item.qualified_name, item.name]
|
||||
if name
|
||||
}
|
||||
if not owner_names:
|
||||
return []
|
||||
snapshot = _project_snapshot_or_404(project_id)
|
||||
return [
|
||||
IntegrationEndpointResponse(
|
||||
endpoint_id=endpoint.endpoint_id,
|
||||
name=endpoint.name,
|
||||
kind=endpoint.kind.value,
|
||||
direction=endpoint.direction,
|
||||
owner=endpoint.owner,
|
||||
attributes=endpoint.attributes,
|
||||
)
|
||||
for endpoint in build_integration_topology(snapshot).endpoints
|
||||
if endpoint.owner in owner_names
|
||||
]
|
||||
|
||||
|
||||
def _current_import_source(project_id: str) -> ImportSourceKind:
|
||||
setup = _project_setup_response(project_id)
|
||||
if setup.current_source is not None:
|
||||
|
||||
Reference in New Issue
Block a user