Add HTML5 project panel SSE updates
This commit is contained in:
@@ -284,6 +284,7 @@ def render_html5_flowchart(
|
||||
normalized_depth = min(max(depth, 1), 3)
|
||||
hx_url = _flowchart_url(project_id, focus, normalized_depth)
|
||||
oob_attr = ' hx-swap-oob="outerHTML"' if oob else ""
|
||||
live_attr = ' sse-swap="project-flowchart"' if focus is None else ""
|
||||
if flowchart is None:
|
||||
return f"""
|
||||
<div
|
||||
@@ -293,6 +294,7 @@ def render_html5_flowchart(
|
||||
hx-trigger="load"
|
||||
hx-swap="outerHTML"
|
||||
{oob_attr}
|
||||
{live_attr}
|
||||
>
|
||||
<div class="panel-title">Карта связей</div>
|
||||
<p class="muted padded">Сервер собирает граф проекта.</p>
|
||||
@@ -311,7 +313,7 @@ def render_html5_flowchart(
|
||||
class="flowchart-panel"
|
||||
data-html5-flowchart
|
||||
hx-get="{hx_url}"
|
||||
hx-trigger="every 30s"
|
||||
{live_attr}
|
||||
hx-swap="outerHTML"
|
||||
{oob_attr}
|
||||
>
|
||||
@@ -336,6 +338,7 @@ def render_html5_project_report(project_id: str, report: dict | None) -> str:
|
||||
data-html5-project-report
|
||||
hx-get="/html5/projects/{quote(project_id)}/report"
|
||||
hx-trigger="load"
|
||||
sse-swap="project-report"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
<div class="panel-title">Отчет проекта</div>
|
||||
@@ -357,7 +360,7 @@ def render_html5_project_report(project_id: str, report: dict | None) -> str:
|
||||
class="report-panel"
|
||||
data-html5-project-report
|
||||
hx-get="/html5/projects/{quote(project_id)}/report"
|
||||
hx-trigger="every 15s"
|
||||
sse-swap="project-report"
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
<div class="panel-title">Отчет проекта</div>
|
||||
@@ -424,9 +427,6 @@ def render_html5_object_report(
|
||||
<div
|
||||
class="report-panel"
|
||||
data-html5-project-report
|
||||
hx-get="/html5/projects/{quote(project_id)}/report"
|
||||
hx-trigger="every 15s"
|
||||
hx-swap="outerHTML"
|
||||
{oob_attr}
|
||||
>
|
||||
<div class="panel-title">Отчет объекта</div>
|
||||
@@ -487,6 +487,7 @@ def render_html5_review(
|
||||
oob: bool = False,
|
||||
) -> str:
|
||||
oob_attr = ' hx-swap-oob="outerHTML"' if oob else ""
|
||||
live_attr = ' sse-swap="project-review"' if title == "Review" and not oob else ""
|
||||
if findings is None:
|
||||
return f"""
|
||||
<div
|
||||
@@ -494,6 +495,7 @@ def render_html5_review(
|
||||
data-html5-review
|
||||
hx-get="/html5/projects/{quote(project_id)}/review"
|
||||
hx-trigger="load"
|
||||
{live_attr}
|
||||
hx-swap="outerHTML"
|
||||
{oob_attr}
|
||||
>
|
||||
@@ -510,7 +512,7 @@ def render_html5_review(
|
||||
class="review-panel"
|
||||
data-html5-review
|
||||
hx-get="/html5/projects/{quote(project_id)}/review"
|
||||
hx-trigger="every 20s"
|
||||
{live_attr}
|
||||
hx-swap="outerHTML"
|
||||
{oob_attr}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user