Link HTML5 object selection to symbol detail
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-17 00:47:39 +03:00
parent 6f594395f8
commit 9c4d02616f
3 changed files with 10 additions and 3 deletions
+4 -2
View File
@@ -1085,10 +1085,11 @@ def render_html5_symbols(snapshot: SirSnapshot, q: str, project_id: str | None =
return "".join(_symbol_result(node, project_id) for node in results) return "".join(_symbol_result(node, project_id) for node in results)
def render_html5_symbol_detail(project_id: str, references: object | None) -> str: def render_html5_symbol_detail(project_id: str, references: object | None, *, oob: bool = False) -> str:
oob_attr = ' hx-swap-oob="outerHTML"' if oob else ""
if references is None: if references is None:
return f""" return f"""
<div class="symbol-detail" data-html5-symbol-detail> <div class="symbol-detail" data-html5-symbol-detail{oob_attr}>
<div class="panel-title">Символ</div> <div class="panel-title">Символ</div>
<p class="muted padded">Выберите результат поиска для server-side definition/references по проекту {escape(project_id)}.</p> <p class="muted padded">Выберите результат поиска для server-side definition/references по проекту {escape(project_id)}.</p>
</div> </div>
@@ -1109,6 +1110,7 @@ def render_html5_symbol_detail(project_id: str, references: object | None) -> st
class="symbol-detail" class="symbol-detail"
data-html5-symbol-detail data-html5-symbol-detail
data-html5-lineage-id="{escape(lineage_id)}" data-html5-lineage-id="{escape(lineage_id)}"
{oob_attr}
> >
<div class="panel-title">Символ · {escape(str(kind))}</div> <div class="panel-title">Символ · {escape(str(kind))}</div>
<article class="symbol-focus"> <article class="symbol-focus">
+3 -1
View File
@@ -1768,6 +1768,7 @@ async def html5_project_object_context(project_id: str, object_name: str) -> Res
runtime = _runtime_for_object_context(project_id, impact) runtime = _runtime_for_object_context(project_id, impact)
knowledge = _knowledge_for_object_context(schema, impact, ui) knowledge = _knowledge_for_object_context(schema, impact, ui)
source_node = _source_node_for_object_context(project_id, impact) source_node = _source_node_for_object_context(project_id, impact)
symbol_references = await project_symbol_references(project_id, schema.object.lineage_id, direction="both")
object_context = render_html5_object_context( object_context = render_html5_object_context(
project_id, project_id,
schema, schema,
@@ -1782,8 +1783,9 @@ async def html5_project_object_context(project_id: str, object_name: str) -> Res
) )
flowchart_context = render_html5_flowchart(project_id, flowchart, focus=object_name, oob=True) flowchart_context = render_html5_flowchart(project_id, flowchart, focus=object_name, oob=True)
source_context = render_html5_source(source_node, oob=True) if source_node is not None else "" source_context = render_html5_source(source_node, oob=True) if source_node is not None else ""
symbol_context = render_html5_symbol_detail(project_id, symbol_references, oob=True)
return Response( return Response(
object_context + flowchart_context + source_context, object_context + flowchart_context + source_context + symbol_context,
media_type="text/html; charset=utf-8", media_type="text/html; charset=utf-8",
) )
+3
View File
@@ -331,6 +331,9 @@ def test_html5_object_context_fragment(tmp_path: Path):
assert "data-html5-source" in context.text assert "data-html5-source" in context.text
assert "ObjectModule.bsl" in context.text assert "ObjectModule.bsl" in context.text
assert "Соединение = Новый HTTPСоединение" in context.text assert "Соединение = Новый HTTPСоединение" in context.text
assert "data-html5-symbol-detail" in context.text
assert "Символ · DOCUMENT" in context.text
assert "HAS_ATTRIBUTE" in context.text
assert "1 signals" in context.text assert "1 signals" in context.text
assert "1 errors" in context.text assert "1 errors" in context.text
assert "125.0 ms" in context.text assert "125.0 ms" in context.text