Add HTML5 object data flow context
This commit is contained in:
@@ -325,6 +325,7 @@ def render_html5_object_context(
|
||||
runtime: Iterable[object] | None = None,
|
||||
knowledge: Iterable[object] | None = None,
|
||||
privacy: object | None = None,
|
||||
integrations: Iterable[object] | None = None,
|
||||
) -> str:
|
||||
if schema is None or impact is None:
|
||||
return f"""
|
||||
@@ -340,13 +341,18 @@ def render_html5_object_context(
|
||||
modules = getattr(impact, "modules", []) or []
|
||||
routines = getattr(impact, "routines", []) or []
|
||||
forms = getattr(impact, "forms", []) or []
|
||||
commands = getattr(impact, "commands", []) or []
|
||||
roles = getattr(impact, "roles", []) or []
|
||||
jobs = getattr(impact, "jobs", []) or []
|
||||
callees = getattr(impact, "callees", []) or []
|
||||
query_tables = getattr(impact, "query_tables", []) or []
|
||||
writes = getattr(impact, "writes", []) or []
|
||||
grants = getattr(access, "grants", []) if access is not None else []
|
||||
ui_forms = getattr(ui, "forms", []) if ui is not None else []
|
||||
runtime_items = list(runtime or [])
|
||||
knowledge_items = list(knowledge or [])
|
||||
privacy_markers = getattr(privacy, "markers", []) if privacy is not None else []
|
||||
integration_items = list(integrations or [])
|
||||
return f"""
|
||||
<div class="object-context" data-html5-object-context data-html5-object-name="{escape(str(name))}">
|
||||
<div class="panel-title">Object context</div>
|
||||
@@ -360,7 +366,12 @@ def render_html5_object_context(
|
||||
{_metric("Modules", len(modules))}
|
||||
{_metric("Routines", len(routines))}
|
||||
{_metric("Forms", len(ui_forms) or len(forms))}
|
||||
{_metric("Commands", len(commands))}
|
||||
{_metric("Roles", len(grants) or len(roles))}
|
||||
{_metric("Reads", len(query_tables))}
|
||||
{_metric("Writes", len(writes))}
|
||||
{_metric("Calls", len(callees))}
|
||||
{_metric("Integrations", len(integration_items))}
|
||||
{_metric("Runtime", len(runtime_items))}
|
||||
{_metric("Knowledge", len(knowledge_items))}
|
||||
{_metric("Privacy", len(privacy_markers))}
|
||||
@@ -370,6 +381,11 @@ def render_html5_object_context(
|
||||
{''.join(_tabular_section_item(item) for item in sections[:4])}
|
||||
{''.join(_ui_form_item(item) for item in ui_forms[:4])}
|
||||
{''.join(_role_access_item(item) for item in grants[:6])}
|
||||
{''.join(_integration_endpoint_item(item) for item in integration_items[:4])}
|
||||
{''.join(_named_node_item("command", item) for item in commands[:6])}
|
||||
{''.join(_named_node_item("read", item) for item in query_tables[:4])}
|
||||
{''.join(_named_node_item("write", item) for item in writes[:4])}
|
||||
{''.join(_named_node_item("call", item) for item in callees[:6])}
|
||||
{''.join(_runtime_summary_item(item) for item in runtime_items[:6])}
|
||||
{''.join(_knowledge_record_item(item) for item in knowledge_items[:6])}
|
||||
{''.join(_privacy_marker_item(item) for item in privacy_markers[:6])}
|
||||
@@ -1475,6 +1491,19 @@ def _privacy_marker_item(marker: object) -> str:
|
||||
"""
|
||||
|
||||
|
||||
def _integration_endpoint_item(endpoint: object) -> str:
|
||||
name = str(getattr(endpoint, "name", "") or "integration")
|
||||
kind = _enum_text(getattr(endpoint, "kind", "UNKNOWN"))
|
||||
direction = str(getattr(endpoint, "direction", "UNKNOWN") or "UNKNOWN")
|
||||
owner = str(getattr(endpoint, "owner", "") or "owner unavailable")
|
||||
return f"""
|
||||
<article class="object-context-item" data-html5-object-context-item="integration">
|
||||
<strong>{escape(name)}</strong>
|
||||
<small>{escape(kind)} · {escape(direction)} · {escape(owner)}</small>
|
||||
</article>
|
||||
"""
|
||||
|
||||
|
||||
def _authoring_diff_item(line: object) -> str:
|
||||
kind = str(getattr(line, "kind", ""))
|
||||
text = str(getattr(line, "text", ""))
|
||||
|
||||
Reference in New Issue
Block a user