Link HTML5 object selection to symbol detail
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
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:
|
||||
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>
|
||||
<p class="muted padded">Выберите результат поиска для server-side definition/references по проекту {escape(project_id)}.</p>
|
||||
</div>
|
||||
@@ -1109,6 +1110,7 @@ def render_html5_symbol_detail(project_id: str, references: object | None) -> st
|
||||
class="symbol-detail"
|
||||
data-html5-symbol-detail
|
||||
data-html5-lineage-id="{escape(lineage_id)}"
|
||||
{oob_attr}
|
||||
>
|
||||
<div class="panel-title">Символ · {escape(str(kind))}</div>
|
||||
<article class="symbol-focus">
|
||||
|
||||
@@ -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)
|
||||
knowledge = _knowledge_for_object_context(schema, impact, ui)
|
||||
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(
|
||||
project_id,
|
||||
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)
|
||||
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(
|
||||
object_context + flowchart_context + source_context,
|
||||
object_context + flowchart_context + source_context + symbol_context,
|
||||
media_type="text/html; charset=utf-8",
|
||||
)
|
||||
|
||||
|
||||
@@ -331,6 +331,9 @@ def test_html5_object_context_fragment(tmp_path: Path):
|
||||
assert "data-html5-source" in context.text
|
||||
assert "ObjectModule.bsl" 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 errors" in context.text
|
||||
assert "125.0 ms" in context.text
|
||||
|
||||
Reference in New Issue
Block a user