Add HTML5 object action links
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-17 00:57:44 +03:00
parent f830c4290f
commit 61cfc9d1cd
2 changed files with 32 additions and 0 deletions
@@ -473,6 +473,7 @@ def render_html5_object_context(
<strong>{escape(str(name))}</strong>
<span>{escape(str(getattr(obj, "kind", "object")))}</span>
</article>
{_object_action_links(project_id, str(name), getattr(obj, "lineage_id", ""), modules)}
<dl class="report-grid">
{_metric("Attrs", len(attributes))}
{_metric("Tables", len(sections))}
@@ -1512,6 +1513,34 @@ def _named_node_item(label: str, node: object) -> str:
"""
def _object_action_links(project_id: str, object_name: str, lineage_id: object, modules: Iterable[object]) -> str:
quoted_project = quote(project_id)
quoted_object = quote(object_name, safe="")
lineage = str(lineage_id or "")
first_module = next(iter(modules), None)
module_lineage = str(getattr(first_module, "lineage_id", "") or "")
source_link = (
f'<a class="button" href="/html5/projects/{quoted_project}/source/{quote(module_lineage, safe="")}">Source</a>'
if module_lineage
else ""
)
symbol_link = (
f'<a class="button" href="/html5/projects/{quoted_project}/symbols/{quote(lineage, safe="")}/detail">Symbol</a>'
if lineage
else ""
)
return f"""
<nav class="object-actions" data-html5-object-actions>
<a class="button" href="/projects/{quoted_project}/objects/schema/{quoted_object}">Schema</a>
<a class="button" href="/projects/{quoted_project}/objects/impact/{quoted_object}">Impact</a>
<a class="button" href="/projects/{quoted_project}/objects/privacy/{quoted_object}">Privacy</a>
<a class="button" href="/html5/projects/{quoted_project}/flowchart?focus={quoted_object}">Flowchart</a>
{source_link}
{symbol_link}
</nav>
"""
def _tabular_section_item(section: object) -> str:
tabular_section = getattr(section, "tabular_section", None)
columns = getattr(section, "columns", []) or []