Link HTML5 object selection to flowchart
This commit is contained in:
@@ -247,15 +247,26 @@ def render_html5_editor(
|
||||
return _page(f"SFERA HTML5 - {project_id}", content)
|
||||
|
||||
|
||||
def render_html5_flowchart(project_id: str, flowchart: object | None) -> str:
|
||||
def render_html5_flowchart(
|
||||
project_id: str,
|
||||
flowchart: object | None,
|
||||
*,
|
||||
focus: str | None = None,
|
||||
oob: bool = False,
|
||||
) -> str:
|
||||
hx_url = f"/html5/projects/{quote(project_id)}/flowchart"
|
||||
if focus:
|
||||
hx_url = f"{hx_url}?focus={quote(focus, safe='')}"
|
||||
oob_attr = ' hx-swap-oob="outerHTML"' if oob else ""
|
||||
if flowchart is None:
|
||||
return f"""
|
||||
<div
|
||||
class="flowchart-panel"
|
||||
data-html5-flowchart
|
||||
hx-get="/html5/projects/{quote(project_id)}/flowchart"
|
||||
hx-get="{hx_url}"
|
||||
hx-trigger="load"
|
||||
hx-swap="outerHTML"
|
||||
{oob_attr}
|
||||
>
|
||||
<div class="panel-title">Карта связей</div>
|
||||
<p class="muted padded">Сервер собирает граф проекта.</p>
|
||||
@@ -273,9 +284,10 @@ def render_html5_flowchart(project_id: str, flowchart: object | None) -> str:
|
||||
<div
|
||||
class="flowchart-panel"
|
||||
data-html5-flowchart
|
||||
hx-get="/html5/projects/{quote(project_id)}/flowchart"
|
||||
hx-get="{hx_url}"
|
||||
hx-trigger="every 30s"
|
||||
hx-swap="outerHTML"
|
||||
{oob_attr}
|
||||
>
|
||||
<div class="panel-title">Карта связей · {escape(mode)}</div>
|
||||
<dl class="report-grid">
|
||||
|
||||
Reference in New Issue
Block a user