|
|
|
@@ -227,10 +227,13 @@ def render_html5_editor(
|
|
|
|
|
<ul class="compact">{''.join(f'<li><span>{escape(kind)}</span><b>{count}</b></li>' for kind, count in counts.most_common(10))}</ul>
|
|
|
|
|
<div class="panel-title">Результаты</div>
|
|
|
|
|
<div data-html5-symbol-results>
|
|
|
|
|
{render_html5_symbols(snapshot, q)}
|
|
|
|
|
{render_html5_symbols(snapshot, q, project_id)}
|
|
|
|
|
</div>
|
|
|
|
|
{render_html5_symbol_detail(project_id, None)}
|
|
|
|
|
{render_html5_project_report(project_id, None)}
|
|
|
|
|
{render_html5_review(project_id, None)}
|
|
|
|
|
{render_html5_authoring_preview(project_id, None)}
|
|
|
|
|
{render_html5_authoring_changes(project_id, None)}
|
|
|
|
|
</aside>
|
|
|
|
|
</section>
|
|
|
|
|
<footer class="status" data-html5-status hx-ext="sse" sse-connect="/html5/projects/{quote(project_id)}/events" sse-swap="status">
|
|
|
|
@@ -311,6 +314,174 @@ def render_html5_review(project_id: str, findings: list[dict] | None) -> str:
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def render_html5_authoring_changes(project_id: str, changes: Iterable[object] | None) -> str:
|
|
|
|
|
if changes is None:
|
|
|
|
|
return f"""
|
|
|
|
|
<div
|
|
|
|
|
class="authoring-panel"
|
|
|
|
|
data-html5-authoring-changes
|
|
|
|
|
hx-get="/html5/projects/{quote(project_id)}/authoring/changes"
|
|
|
|
|
hx-trigger="load"
|
|
|
|
|
hx-swap="outerHTML"
|
|
|
|
|
>
|
|
|
|
|
<div class="panel-title">Authoring</div>
|
|
|
|
|
<p class="muted padded">Сервер загружает историю рабочих изменений.</p>
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
change_list = list(changes)
|
|
|
|
|
if not change_list:
|
|
|
|
|
body = '<p class="muted padded">Изменений пока нет</p>'
|
|
|
|
|
else:
|
|
|
|
|
body = "".join(_authoring_change_item(change) for change in change_list[:12])
|
|
|
|
|
return f"""
|
|
|
|
|
<div
|
|
|
|
|
class="authoring-panel"
|
|
|
|
|
data-html5-authoring-changes
|
|
|
|
|
hx-get="/html5/projects/{quote(project_id)}/authoring/changes"
|
|
|
|
|
hx-trigger="every 15s"
|
|
|
|
|
hx-swap="outerHTML"
|
|
|
|
|
>
|
|
|
|
|
<div class="panel-title">Authoring · {len(change_list)}</div>
|
|
|
|
|
<div class="review-list">{body}</div>
|
|
|
|
|
{render_html5_authoring_change_detail(project_id, None)}
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def render_html5_authoring_preview(project_id: str, preview: object | None, error: str | None = None) -> str:
|
|
|
|
|
if preview is None and error is None:
|
|
|
|
|
return f"""
|
|
|
|
|
<div class="authoring-preview" data-html5-authoring-preview>
|
|
|
|
|
<div class="panel-title">Authoring preview</div>
|
|
|
|
|
<form
|
|
|
|
|
class="authoring-preview-form"
|
|
|
|
|
data-html5-authoring-preview-form
|
|
|
|
|
method="post"
|
|
|
|
|
action="/html5/projects/{quote(project_id)}/authoring/completion-preview"
|
|
|
|
|
hx-post="/html5/projects/{quote(project_id)}/authoring/completion-preview"
|
|
|
|
|
hx-target="[data-html5-authoring-preview-result]"
|
|
|
|
|
hx-swap="outerHTML"
|
|
|
|
|
>
|
|
|
|
|
<input name="object_name" placeholder="object_name" />
|
|
|
|
|
<input name="routine_name" placeholder="routine_name" />
|
|
|
|
|
<input name="cursor_line" placeholder="line" />
|
|
|
|
|
<input name="intent" value="fill-check" />
|
|
|
|
|
<input name="user_id" placeholder="user_id" />
|
|
|
|
|
<textarea name="source_text" placeholder="BSL source"></textarea>
|
|
|
|
|
<button type="submit">Preview</button>
|
|
|
|
|
</form>
|
|
|
|
|
{render_html5_authoring_preview_result(project_id)}
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
return render_html5_authoring_preview_result(project_id, preview, error)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def render_html5_authoring_preview_result(project_id: str, preview: object | None = None, error: str | None = None) -> str:
|
|
|
|
|
if preview is None and error is None:
|
|
|
|
|
return '<div class="authoring-preview-result" data-html5-authoring-preview-result></div>'
|
|
|
|
|
if error:
|
|
|
|
|
return f"""
|
|
|
|
|
<div class="authoring-preview-result" data-html5-authoring-preview-result>
|
|
|
|
|
<div class="panel-title">Preview result</div>
|
|
|
|
|
<p class="muted padded">{escape(error)}</p>
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
allowed = bool(getattr(preview, "allowed", False))
|
|
|
|
|
insert_text = str(getattr(preview, "insert_text", ""))
|
|
|
|
|
checks = getattr(preview, "checks", []) or []
|
|
|
|
|
diff = getattr(preview, "semantic_diff", []) or []
|
|
|
|
|
context = getattr(preview, "context", None)
|
|
|
|
|
object_node = getattr(context, "object", None)
|
|
|
|
|
routine_node = getattr(context, "routine", None)
|
|
|
|
|
object_name = getattr(object_node, "qualified_name", None) or getattr(object_node, "name", None) or "object unavailable"
|
|
|
|
|
routine_name = getattr(routine_node, "name", None) or "routine unavailable"
|
|
|
|
|
check_rows = "".join(_authoring_check_item(check) for check in checks[:8])
|
|
|
|
|
diff_rows = "".join(_authoring_diff_item(line) for line in diff[:8]) or '<p class="muted padded">Diff пустой</p>'
|
|
|
|
|
return f"""
|
|
|
|
|
<div class="authoring-preview-result" data-html5-authoring-preview-result data-html5-project-id="{escape(project_id)}">
|
|
|
|
|
<div class="panel-title">Preview result · {'allowed' if allowed else 'blocked'}</div>
|
|
|
|
|
<article class="authoring-change">
|
|
|
|
|
<strong>{escape(str(object_name))}</strong>
|
|
|
|
|
<span>{escape(str(routine_name))}</span>
|
|
|
|
|
<small>{escape(insert_text[:180] or "insert text unavailable")}</small>
|
|
|
|
|
</article>
|
|
|
|
|
<div class="check-list">{check_rows}</div>
|
|
|
|
|
<div class="diff-list">{diff_rows}</div>
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def render_html5_authoring_change_detail(project_id: str, preview: object | None) -> str:
|
|
|
|
|
if preview is None:
|
|
|
|
|
return f"""
|
|
|
|
|
<div class="authoring-detail" data-html5-authoring-detail>
|
|
|
|
|
<div class="panel-title">Rollback preview</div>
|
|
|
|
|
<p class="muted padded">Выберите изменение, чтобы сервер рассчитал rollback diff для проекта {escape(project_id)}.</p>
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
change_id = str(getattr(preview, "change_id", ""))
|
|
|
|
|
original_version_id = str(getattr(preview, "original_version_id", ""))
|
|
|
|
|
rollback_version_id = str(getattr(preview, "rollback_version_id", ""))
|
|
|
|
|
target = getattr(preview, "target", None)
|
|
|
|
|
target_name = getattr(target, "qualified_name", None) or getattr(target, "name", None) or "target unavailable"
|
|
|
|
|
diff = getattr(preview, "semantic_diff", []) or []
|
|
|
|
|
checks = getattr(preview, "checks", []) or []
|
|
|
|
|
apply_available = bool(getattr(preview, "apply_available", False))
|
|
|
|
|
diff_rows = "".join(_authoring_diff_item(line) for line in diff[:12]) or '<p class="muted padded">Diff пустой</p>'
|
|
|
|
|
check_rows = "".join(_authoring_check_item(check) for check in checks[:8])
|
|
|
|
|
apply_form = _authoring_rollback_form(project_id, change_id, rollback_version_id) if apply_available else ""
|
|
|
|
|
return f"""
|
|
|
|
|
<div
|
|
|
|
|
class="authoring-detail"
|
|
|
|
|
data-html5-authoring-detail
|
|
|
|
|
data-html5-authoring-change="{escape(change_id)}"
|
|
|
|
|
>
|
|
|
|
|
<div class="panel-title">Rollback preview · {'ready' if apply_available else 'blocked'}</div>
|
|
|
|
|
<article class="authoring-change">
|
|
|
|
|
<strong>{escape(str(target_name))}</strong>
|
|
|
|
|
<span>{escape(original_version_id)} -> {escape(rollback_version_id)}</span>
|
|
|
|
|
<small>{escape(change_id)}</small>
|
|
|
|
|
</article>
|
|
|
|
|
<div class="check-list">{check_rows}</div>
|
|
|
|
|
<div class="diff-list">{diff_rows}</div>
|
|
|
|
|
{apply_form}
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def render_html5_authoring_rollback_result(project_id: str, result: object | None = None, error: str | None = None) -> str:
|
|
|
|
|
if result is None and error is None:
|
|
|
|
|
return '<div class="authoring-result" data-html5-authoring-result></div>'
|
|
|
|
|
if error:
|
|
|
|
|
return f"""
|
|
|
|
|
<div class="authoring-result" data-html5-authoring-result>
|
|
|
|
|
<div class="panel-title">Rollback apply</div>
|
|
|
|
|
<p class="muted padded">{escape(error)}</p>
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
status = str(getattr(result, "status", "UNKNOWN"))
|
|
|
|
|
change_id = str(getattr(result, "change_id", ""))
|
|
|
|
|
rollback_change_id = str(getattr(result, "rollback_change_id", ""))
|
|
|
|
|
version = getattr(result, "version", None)
|
|
|
|
|
version_id = str(getattr(version, "version_id", ""))
|
|
|
|
|
return f"""
|
|
|
|
|
<div
|
|
|
|
|
class="authoring-result"
|
|
|
|
|
data-html5-authoring-result
|
|
|
|
|
data-html5-authoring-change="{escape(change_id)}"
|
|
|
|
|
data-html5-version-id="{escape(version_id)}"
|
|
|
|
|
>
|
|
|
|
|
<div class="panel-title">Rollback apply</div>
|
|
|
|
|
<article class="authoring-change">
|
|
|
|
|
<strong>{escape(status)}</strong>
|
|
|
|
|
<span>{escape(rollback_change_id)}</span>
|
|
|
|
|
<small>{escape(version_id)}</small>
|
|
|
|
|
</article>
|
|
|
|
|
<p class="muted padded">Rollback применен в workspace для проекта {escape(project_id)}.</p>
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def render_html5_project_setup(*, project_id: str, projects: Iterable[object], setup: object) -> str:
|
|
|
|
|
project_nav = "\n".join(_project_link(project, project_id) for project in projects)
|
|
|
|
|
name = _setup_name(setup)
|
|
|
|
@@ -560,16 +731,81 @@ def html5_symbol_results(snapshot: SirSnapshot, q: str) -> list[object]:
|
|
|
|
|
][:30]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def render_html5_symbols(snapshot: SirSnapshot, q: str) -> str:
|
|
|
|
|
def render_html5_symbols(snapshot: SirSnapshot, q: str, project_id: str | None = None) -> str:
|
|
|
|
|
results = html5_symbol_results(snapshot, q)
|
|
|
|
|
if not results:
|
|
|
|
|
return '<p class="muted">Нет результатов</p>'
|
|
|
|
|
return "".join(_symbol_result(node) 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:
|
|
|
|
|
if references is None:
|
|
|
|
|
return f"""
|
|
|
|
|
<div class="symbol-detail" data-html5-symbol-detail>
|
|
|
|
|
<div class="panel-title">Символ</div>
|
|
|
|
|
<p class="muted padded">Выберите результат поиска для server-side definition/references по проекту {escape(project_id)}.</p>
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
symbol = getattr(references, "symbol", None)
|
|
|
|
|
node = getattr(symbol, "node", None)
|
|
|
|
|
source = getattr(symbol, "source", None)
|
|
|
|
|
name = getattr(node, "qualified_name", None) or getattr(node, "name", "symbol")
|
|
|
|
|
kind = getattr(node, "kind", "")
|
|
|
|
|
source_path = getattr(source, "source_path", None) or ""
|
|
|
|
|
line = getattr(source, "line_start", None)
|
|
|
|
|
location = f"{source_path}:{line}" if source_path and line else source_path or "source unavailable"
|
|
|
|
|
refs = getattr(references, "references", []) or []
|
|
|
|
|
ref_items = "".join(_symbol_reference_item(ref) for ref in refs[:10]) or '<p class="muted padded">References не найдены</p>'
|
|
|
|
|
lineage_id = str(getattr(node, "lineage_id", ""))
|
|
|
|
|
return f"""
|
|
|
|
|
<div
|
|
|
|
|
class="symbol-detail"
|
|
|
|
|
data-html5-symbol-detail
|
|
|
|
|
data-html5-lineage-id="{escape(lineage_id)}"
|
|
|
|
|
>
|
|
|
|
|
<div class="panel-title">Символ · {escape(str(kind))}</div>
|
|
|
|
|
<article class="symbol-focus">
|
|
|
|
|
<strong>{escape(str(name))}</strong>
|
|
|
|
|
<small>{escape(str(location))}</small>
|
|
|
|
|
</article>
|
|
|
|
|
<div class="review-list">{ref_items}</div>
|
|
|
|
|
</div>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def render_html5_source(node: object | None) -> str:
|
|
|
|
|
name = "source" if node is None else getattr(node, "qualified_name", None) or getattr(node, "name", "source")
|
|
|
|
|
return f'<pre class="code" data-html5-source data-html5-source-name="{escape(str(name))}">{escape(_node_source_text(node))}</pre>'
|
|
|
|
|
kind = "" if node is None else _enum_text(getattr(node, "kind", ""))
|
|
|
|
|
lineage_id = "" if node is None else str(getattr(node, "lineage_id", ""))
|
|
|
|
|
source_path = "" if node is None else str(
|
|
|
|
|
getattr(node, "source_path", None) or getattr(getattr(node, "source_ref", None), "source_path", None) or ""
|
|
|
|
|
)
|
|
|
|
|
line = "" if node is None else str(
|
|
|
|
|
getattr(node, "line_start", None) or getattr(getattr(node, "source_ref", None), "line_start", None) or ""
|
|
|
|
|
)
|
|
|
|
|
location = f"{source_path}:{line}" if source_path and line else source_path or "source unavailable"
|
|
|
|
|
source_text = _node_source_text(node)
|
|
|
|
|
line_count = len(source_text.splitlines()) or 1
|
|
|
|
|
return f"""
|
|
|
|
|
<article
|
|
|
|
|
class="source-panel"
|
|
|
|
|
data-html5-source
|
|
|
|
|
data-html5-source-name="{escape(str(name))}"
|
|
|
|
|
data-html5-lineage-id="{escape(lineage_id)}"
|
|
|
|
|
>
|
|
|
|
|
<header class="source-head">
|
|
|
|
|
<div>
|
|
|
|
|
<strong>{escape(str(name))}</strong>
|
|
|
|
|
<small>{escape(kind or "source")}</small>
|
|
|
|
|
</div>
|
|
|
|
|
<dl>
|
|
|
|
|
{_metric("Lines", line_count)}
|
|
|
|
|
{_metric("Location", location)}
|
|
|
|
|
</dl>
|
|
|
|
|
</header>
|
|
|
|
|
<pre class="code">{escape(source_text)}</pre>
|
|
|
|
|
</article>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _page(title: str, body: str) -> str:
|
|
|
|
@@ -773,21 +1009,121 @@ def _tree_item(project_id: str, node: object) -> str:
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _symbol_result(node: object) -> str:
|
|
|
|
|
def _symbol_result(node: object, project_id: str | None = None) -> str:
|
|
|
|
|
name = getattr(node, "qualified_name", None) or getattr(node, "name", "")
|
|
|
|
|
kind = getattr(node, "kind", "")
|
|
|
|
|
kind_value = str(kind.value if hasattr(kind, "value") else kind)
|
|
|
|
|
lineage_id = str(getattr(node, "lineage_id", ""))
|
|
|
|
|
source_path = getattr(node, "source_path", None) or getattr(getattr(node, "source_ref", None), "source_path", None) or ""
|
|
|
|
|
line = getattr(node, "line_start", None) or getattr(getattr(node, "source_ref", None), "line_start", None)
|
|
|
|
|
location = f"{source_path}:{line}" if source_path and line else source_path or "source unavailable"
|
|
|
|
|
htmx_attrs = (
|
|
|
|
|
f'hx-get="/html5/projects/{quote(project_id)}/symbols/{quote(lineage_id, safe="")}/detail" '
|
|
|
|
|
'hx-target="[data-html5-symbol-detail]" hx-swap="outerHTML"'
|
|
|
|
|
if project_id and lineage_id
|
|
|
|
|
else ""
|
|
|
|
|
)
|
|
|
|
|
return f"""
|
|
|
|
|
<article class="symbol" data-html5-symbol>
|
|
|
|
|
<article class="symbol" data-html5-symbol data-html5-lineage-id="{escape(lineage_id)}" {htmx_attrs}>
|
|
|
|
|
<strong>{escape(str(name))}</strong>
|
|
|
|
|
<span>{escape(kind_value)}</span>
|
|
|
|
|
<small>{escape(str(location))}</small>
|
|
|
|
|
</article>"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _symbol_reference_item(reference: object) -> str:
|
|
|
|
|
kind = str(getattr(reference, "kind", ""))
|
|
|
|
|
direction = str(getattr(reference, "direction", ""))
|
|
|
|
|
source = getattr(reference, "source", None)
|
|
|
|
|
target = getattr(reference, "target", None)
|
|
|
|
|
location = getattr(reference, "location", None)
|
|
|
|
|
source_name = getattr(source, "qualified_name", None) or getattr(source, "name", "")
|
|
|
|
|
target_name = getattr(target, "qualified_name", None) or getattr(target, "name", "")
|
|
|
|
|
source_path = getattr(location, "source_path", None) or ""
|
|
|
|
|
line = getattr(location, "line_start", None)
|
|
|
|
|
place = f"{source_path}:{line}" if source_path and line else source_path
|
|
|
|
|
label = f"{source_name} -> {target_name}".strip(" ->")
|
|
|
|
|
return f"""
|
|
|
|
|
<article class="symbol-reference" data-html5-symbol-reference>
|
|
|
|
|
<strong>{escape(label or kind)}</strong>
|
|
|
|
|
<span>{escape(direction)} · {escape(kind)}</span>
|
|
|
|
|
<small>{escape(place or "source unavailable")}</small>
|
|
|
|
|
</article>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _authoring_change_item(change: object) -> str:
|
|
|
|
|
change_id = str(getattr(change, "change_id", ""))
|
|
|
|
|
status = str(getattr(change, "status", ""))
|
|
|
|
|
target = getattr(change, "target", None)
|
|
|
|
|
target_name = getattr(target, "qualified_name", None) or getattr(target, "name", None) or "target unavailable"
|
|
|
|
|
approved_by = str(getattr(change, "approved_by", "") or "not approved")
|
|
|
|
|
task_id = str(getattr(change, "task_id", "") or "no task")
|
|
|
|
|
added = getattr(change, "added_lines", 0)
|
|
|
|
|
removed = getattr(change, "removed_lines", 0)
|
|
|
|
|
production = "production" if bool(getattr(change, "production_applied", False)) else "workspace"
|
|
|
|
|
project_id = str(getattr(change, "project_id", ""))
|
|
|
|
|
detail_attrs = (
|
|
|
|
|
f'hx-get="/html5/projects/{quote(project_id)}/authoring/changes/{quote(change_id, safe="")}" '
|
|
|
|
|
'hx-target="[data-html5-authoring-detail]" hx-swap="outerHTML"'
|
|
|
|
|
if change_id and project_id
|
|
|
|
|
else ""
|
|
|
|
|
)
|
|
|
|
|
return f"""
|
|
|
|
|
<article class="authoring-change" data-html5-authoring-change="{escape(change_id)}" {detail_attrs}>
|
|
|
|
|
<strong>{escape(str(target_name))}</strong>
|
|
|
|
|
<span>{escape(status)} · +{escape(str(added))} / -{escape(str(removed))} · {escape(production)}</span>
|
|
|
|
|
<small>{escape(task_id)} · {escape(approved_by)} · {escape(change_id)}</small>
|
|
|
|
|
</article>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _authoring_diff_item(line: object) -> str:
|
|
|
|
|
kind = str(getattr(line, "kind", ""))
|
|
|
|
|
text = str(getattr(line, "text", ""))
|
|
|
|
|
return f"""
|
|
|
|
|
<article class="diff-item" data-html5-authoring-diff="{escape(kind)}">
|
|
|
|
|
<span>{escape(kind)}</span>
|
|
|
|
|
<code>{escape(text)}</code>
|
|
|
|
|
</article>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _authoring_check_item(check: object) -> str:
|
|
|
|
|
name = str(getattr(check, "name", "check"))
|
|
|
|
|
status = str(getattr(check, "status", "UNKNOWN"))
|
|
|
|
|
message = str(getattr(check, "message", ""))
|
|
|
|
|
return f"""
|
|
|
|
|
<article class="check-item" data-html5-authoring-check="{escape(status)}">
|
|
|
|
|
<strong>{escape(name)}</strong>
|
|
|
|
|
<span>{escape(status)}</span>
|
|
|
|
|
<small>{escape(message)}</small>
|
|
|
|
|
</article>
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _authoring_rollback_form(project_id: str, change_id: str, rollback_version_id: str) -> str:
|
|
|
|
|
return f"""
|
|
|
|
|
<form
|
|
|
|
|
class="rollback-form"
|
|
|
|
|
data-html5-authoring-rollback-form
|
|
|
|
|
method="post"
|
|
|
|
|
action="/html5/projects/{quote(project_id)}/authoring/changes/{quote(change_id, safe="")}/apply-rollback"
|
|
|
|
|
hx-post="/html5/projects/{quote(project_id)}/authoring/changes/{quote(change_id, safe="")}/apply-rollback"
|
|
|
|
|
hx-target="[data-html5-authoring-result]"
|
|
|
|
|
hx-swap="outerHTML"
|
|
|
|
|
>
|
|
|
|
|
<input type="hidden" name="expected_rollback_version_id" value="{escape(rollback_version_id)}" />
|
|
|
|
|
<input name="approved_by" placeholder="approved_by" required />
|
|
|
|
|
<input name="task_id" placeholder="task_id" />
|
|
|
|
|
<input name="session_id" placeholder="session_id" />
|
|
|
|
|
<input name="approval_note" placeholder="Комментарий" />
|
|
|
|
|
<button type="submit">Apply rollback</button>
|
|
|
|
|
</form>
|
|
|
|
|
{render_html5_authoring_rollback_result(project_id)}
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _node_source_text(node: object | None) -> str:
|
|
|
|
|
if node is None:
|
|
|
|
|
return "// Модуль не найден в snapshot.\n// HTML5 IDE показывает серверный fallback без клиентского JS."
|
|
|
|
@@ -807,9 +1143,9 @@ def _css() -> str:
|
|
|
|
|
.band,.panel,.editor{border:1px solid var(--line);background:var(--card)}.band{max-width:1180px;margin:auto;padding:18px}.section-title,.topbar,.editor-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.button,button{display:inline-flex;align-items:center;justify-content:center;height:32px;border:1px solid var(--line);background:#fff;padding:0 12px;text-decoration:none;font-weight:700;cursor:pointer}table{width:100%;border-collapse:collapse}th,td{border-top:1px solid var(--line);padding:12px;text-align:left}td small{display:block;color:var(--muted)}td .button,td form{margin-right:6px}.delete-project{display:inline-flex;gap:4px;vertical-align:middle}.delete-project input{height:32px;width:120px;border:1px solid var(--line);padding:0 6px}
|
|
|
|
|
.workspace{min-height:100vh;padding-bottom:34px}.topbar{position:sticky;top:0;z-index:2;height:54px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.94);padding:0 14px}.brand{font-weight:900;text-decoration:none;color:var(--brand)}.project-nav{display:flex;gap:6px;overflow:auto;flex:1}.project-link{white-space:nowrap;text-decoration:none;border:1px solid var(--line);padding:6px 10px;background:#fff}.project-link.active{background:var(--brand);border-color:var(--brand);color:#fff}
|
|
|
|
|
.layout{display:grid;grid-template-columns:280px minmax(0,1fr)320px;height:calc(100vh - 88px)}.panel{overflow:auto}.panel-title{padding:12px;border-bottom:1px solid var(--line);font-size:12px;font-weight:900;text-transform:uppercase;color:var(--muted)}.tree-item{display:block;padding:10px 12px;border-bottom:1px solid var(--line);text-decoration:none}.tree-item span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tree-item small{color:var(--muted)}
|
|
|
|
|
.editor{min-width:0;overflow:hidden;border-top:0;border-bottom:0}.editor-head{height:72px;border-bottom:1px solid var(--line);padding:0 14px}.editor-head h1{margin:0;font-size:18px}.search{display:flex;gap:6px}.search input{height:32px;width:260px;border:1px solid var(--line);padding:0 10px}.code{height:calc(100% - 72px);margin:0;overflow:auto;padding:16px;background:#fbfaf7;font:13px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre-wrap}
|
|
|
|
|
.metrics{display:grid;grid-template-columns:1fr 1fr;margin:0}.metrics div{padding:12px;border-bottom:1px solid var(--line)}.metrics dt{color:var(--muted);font-size:12px}.metrics dd{margin:2px 0 0;font-size:22px;font-weight:800}.compact{list-style:none;margin:0;padding:0}.compact li{display:flex;justify-content:space-between;padding:8px 12px;border-bottom:1px solid var(--line)}.symbol{display:grid;gap:3px;padding:10px 12px;border-bottom:1px solid var(--line)}.symbol span,.symbol small{color:var(--muted)}.report-grid{display:grid;grid-template-columns:1fr 1fr;margin:0}.report-grid div{padding:10px 12px;border-bottom:1px solid var(--line)}.report-grid dt{color:var(--muted);font-size:12px}.report-grid dd{margin:2px 0 0;font-size:20px;font-weight:900}.review-item{display:grid;gap:3px;padding:10px 12px;border-bottom:1px solid var(--line)}.review-item span,.review-item small{color:var(--muted)}.status{position:fixed;bottom:0;left:0;right:0;display:flex;gap:18px;overflow:auto;height:34px;align-items:center;border-top:1px solid var(--line);background:#fff;padding:0 12px;color:var(--muted);font-size:12px}.empty-state{max-width:720px;margin:80px auto;background:#fff;border:1px solid var(--line);padding:28px}
|
|
|
|
|
.setup-layout{display:grid;grid-template-columns:340px minmax(0,1fr);gap:16px;max-width:1180px;margin:18px auto;padding:0 16px}.setup-workspace{background:#f3f6fb}.setup-card{padding:16px;border-bottom:1px solid var(--line)}.setup-card h1{margin:0;font-size:24px}.setup-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}.setup-main{min-height:620px}.settings-form{display:grid;grid-template-columns:2fr 1fr 1fr auto;gap:8px;align-items:end;padding:12px 16px;border-bottom:1px solid var(--line);background:#fff}.settings-form label{display:grid;gap:4px;font-size:12px;font-weight:800;color:var(--muted);text-transform:uppercase}.settings-form input{height:32px;border:1px solid var(--line);padding:0 8px}.saved{float:right;color:var(--ok);font-weight:900}.setup-actions-panel{display:flex;gap:8px;flex-wrap:wrap;align-items:end;padding:12px 16px;border-bottom:1px solid var(--line);background:#fbfcfe}.inline-form{display:flex;gap:8px;align-items:end}.inline-form label{display:grid;gap:4px;font-size:12px;font-weight:800;color:var(--muted);text-transform:uppercase}.inline-form select{height:32px;min-width:240px;border:1px solid var(--line);background:#fff;padding:0 8px}.setup-summary{display:grid;gap:0}.compact-lead{margin:0;padding:0 16px 16px}.setup-metrics,.ops-summary{display:grid;grid-template-columns:repeat(4,1fr);margin:0;border-top:1px solid var(--line)}.ops-summary{grid-template-columns:repeat(5,1fr);margin:12px 0}.setup-metrics div,.ops-summary div{padding:16px;border-right:1px solid var(--line);border-bottom:1px solid var(--line);background:#fff}.setup-metrics div:last-child,.ops-summary div:last-child{border-right:0}.setup-metrics dt,.ops-summary dt{font-size:12px;color:var(--muted)}.setup-metrics dd,.ops-summary dd{margin:4px 0 0;font-size:28px;font-weight:900}.status-pill{border:1px solid var(--line);padding:6px 10px;background:#eef6f1;color:var(--ok);font-weight:800}.flush{border-top:1px solid var(--line)}.padded{padding:12px 16px;margin:0}.setup-detail,.history-item,.source-card,.check-item{display:grid;gap:3px;padding:12px 16px;border-bottom:1px solid var(--line)}.setup-detail span,.setup-detail small,.history-item span,.history-item small,.source-card span,.source-card small,.check-item span,.check-item small,.check-head span,.check-head small{color:var(--muted)}.source-list,.history-list,.check-list{display:grid}.check-head{display:flex;gap:10px;align-items:center;padding:12px 16px;border-bottom:1px solid var(--line);background:#fff}.job-log{margin:0;padding:0;list-style:none}.job-log li{padding:8px 16px;border-bottom:1px solid var(--line);color:var(--muted);font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px}
|
|
|
|
|
.editor{min-width:0;overflow:hidden;border-top:0;border-bottom:0}.editor-head{height:72px;border-bottom:1px solid var(--line);padding:0 14px}.editor-head h1{margin:0;font-size:18px}.search{display:flex;gap:6px}.search input{height:32px;width:260px;border:1px solid var(--line);padding:0 10px}.source-panel{height:calc(100% - 72px);display:grid;grid-template-rows:auto minmax(0,1fr);overflow:hidden}.source-head{display:flex;justify-content:space-between;gap:12px;align-items:center;min-height:54px;padding:10px 14px;border-bottom:1px solid var(--line);background:#fff}.source-head strong,.source-head small{display:block}.source-head small{color:var(--muted)}.source-head dl{display:flex;gap:12px;margin:0}.source-head div div{padding:0}.source-head dt{font-size:11px;color:var(--muted)}.source-head dd{margin:0;font-weight:800}.code{height:100%;margin:0;overflow:auto;padding:16px;background:#fbfaf7;font:13px/1.55 ui-monospace,SFMono-Regular,Consolas,monospace;white-space:pre-wrap}
|
|
|
|
|
.metrics{display:grid;grid-template-columns:1fr 1fr;margin:0}.metrics div{padding:12px;border-bottom:1px solid var(--line)}.metrics dt{color:var(--muted);font-size:12px}.metrics dd{margin:2px 0 0;font-size:22px;font-weight:800}.compact{list-style:none;margin:0;padding:0}.compact li{display:flex;justify-content:space-between;padding:8px 12px;border-bottom:1px solid var(--line)}.symbol{display:grid;gap:3px;padding:10px 12px;border-bottom:1px solid var(--line);cursor:pointer}.symbol:hover{background:#f8fbff}.symbol span,.symbol small{color:var(--muted)}.symbol-focus,.symbol-reference{display:grid;gap:3px;padding:10px 12px;border-bottom:1px solid var(--line)}.symbol-focus small,.symbol-reference span,.symbol-reference small{color:var(--muted)}.report-grid{display:grid;grid-template-columns:1fr 1fr;margin:0}.report-grid div{padding:10px 12px;border-bottom:1px solid var(--line)}.report-grid dt{color:var(--muted);font-size:12px}.report-grid dd{margin:2px 0 0;font-size:20px;font-weight:900}.review-item,.authoring-change{display:grid;gap:3px;padding:10px 12px;border-bottom:1px solid var(--line)}.authoring-change[hx-get]{cursor:pointer}.authoring-change[hx-get]:hover{background:#f8fbff}.review-item span,.review-item small,.authoring-change span,.authoring-change small{color:var(--muted)}.diff-item{display:grid;grid-template-columns:72px minmax(0,1fr);gap:8px;padding:8px 12px;border-bottom:1px solid var(--line)}.diff-item span{color:var(--muted);font-weight:800}.diff-item code{white-space:pre-wrap;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px}.status{position:fixed;bottom:0;left:0;right:0;display:flex;gap:18px;overflow:auto;height:34px;align-items:center;border-top:1px solid var(--line);background:#fff;padding:0 12px;color:var(--muted);font-size:12px}.empty-state{max-width:720px;margin:80px auto;background:#fff;border:1px solid var(--line);padding:28px}
|
|
|
|
|
.setup-layout{display:grid;grid-template-columns:340px minmax(0,1fr);gap:16px;max-width:1180px;margin:18px auto;padding:0 16px}.setup-workspace{background:#f3f6fb}.setup-card{padding:16px;border-bottom:1px solid var(--line)}.setup-card h1{margin:0;font-size:24px}.setup-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}.setup-main{min-height:620px}.settings-form{display:grid;grid-template-columns:2fr 1fr 1fr auto;gap:8px;align-items:end;padding:12px 16px;border-bottom:1px solid var(--line);background:#fff}.settings-form label{display:grid;gap:4px;font-size:12px;font-weight:800;color:var(--muted);text-transform:uppercase}.settings-form input{height:32px;border:1px solid var(--line);padding:0 8px}.saved{float:right;color:var(--ok);font-weight:900}.setup-actions-panel{display:flex;gap:8px;flex-wrap:wrap;align-items:end;padding:12px 16px;border-bottom:1px solid var(--line);background:#fbfcfe}.inline-form{display:flex;gap:8px;align-items:end}.inline-form label{display:grid;gap:4px;font-size:12px;font-weight:800;color:var(--muted);text-transform:uppercase}.inline-form select{height:32px;min-width:240px;border:1px solid var(--line);background:#fff;padding:0 8px}.rollback-form,.authoring-preview-form{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:12px;border-bottom:1px solid var(--line);background:#fbfcfe}.rollback-form input,.authoring-preview-form input,.authoring-preview-form textarea{min-width:0;border:1px solid var(--line);padding:0 8px}.rollback-form input,.authoring-preview-form input{height:32px}.authoring-preview-form textarea{grid-column:1/-1;min-height:88px;padding:8px;resize:vertical;font:12px/1.45 ui-monospace,SFMono-Regular,Consolas,monospace}.rollback-form button,.authoring-preview-form button{grid-column:1/-1}.setup-summary{display:grid;gap:0}.compact-lead{margin:0;padding:0 16px 16px}.setup-metrics,.ops-summary{display:grid;grid-template-columns:repeat(4,1fr);margin:0;border-top:1px solid var(--line)}.ops-summary{grid-template-columns:repeat(5,1fr);margin:12px 0}.setup-metrics div,.ops-summary div{padding:16px;border-right:1px solid var(--line);border-bottom:1px solid var(--line);background:#fff}.setup-metrics div:last-child,.ops-summary div:last-child{border-right:0}.setup-metrics dt,.ops-summary dt{font-size:12px;color:var(--muted)}.setup-metrics dd,.ops-summary dd{margin:4px 0 0;font-size:28px;font-weight:900}.status-pill{border:1px solid var(--line);padding:6px 10px;background:#eef6f1;color:var(--ok);font-weight:800}.flush{border-top:1px solid var(--line)}.padded{padding:12px 16px;margin:0}.setup-detail,.history-item,.source-card,.check-item{display:grid;gap:3px;padding:12px 16px;border-bottom:1px solid var(--line)}.setup-detail span,.setup-detail small,.history-item span,.history-item small,.source-card span,.source-card small,.check-item span,.check-item small,.check-head span,.check-head small{color:var(--muted)}.source-list,.history-list,.check-list{display:grid}.check-head{display:flex;gap:10px;align-items:center;padding:12px 16px;border-bottom:1px solid var(--line);background:#fff}.job-log{margin:0;padding:0;list-style:none}.job-log li{padding:8px 16px;border-bottom:1px solid var(--line);color:var(--muted);font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px}
|
|
|
|
|
@media(max-width:980px){.layout{grid-template-columns:1fr;height:auto}.tree,.inspector{max-height:320px}.editor{min-height:520px}.hero{display:block}.shell{padding:16px}}
|
|
|
|
|
@media(max-width:980px){.setup-layout{grid-template-columns:1fr}.setup-metrics{grid-template-columns:1fr 1fr}.settings-form{grid-template-columns:1fr}}
|
|
|
|
|
"""
|
|
|
|
|