Add HTML5 operations monitor
This commit is contained in:
@@ -42,6 +42,8 @@ from api_server.html5 import (
|
||||
render_html5_project_rows,
|
||||
render_html5_import_check,
|
||||
render_html5_import_job,
|
||||
render_html5_operation_rows,
|
||||
render_html5_operations,
|
||||
render_html5_settings_panel,
|
||||
render_html5_setup_summary,
|
||||
render_html5_source,
|
||||
@@ -1612,6 +1614,22 @@ async def html5_delete_project(project_id: str, request: Request) -> Response:
|
||||
)
|
||||
|
||||
|
||||
@app.get("/html5/operations")
|
||||
async def html5_operations() -> Response:
|
||||
return Response(
|
||||
render_html5_operations(_html5_operation_jobs()),
|
||||
media_type="text/html; charset=utf-8",
|
||||
)
|
||||
|
||||
|
||||
@app.get("/html5/operations/jobs")
|
||||
async def html5_operation_jobs() -> Response:
|
||||
return Response(
|
||||
render_html5_operation_rows(_html5_operation_jobs()),
|
||||
media_type="text/html; charset=utf-8",
|
||||
)
|
||||
|
||||
|
||||
@app.get("/html5/projects/{project_id}/editor")
|
||||
async def html5_project_editor(project_id: str, q: str = "") -> Response:
|
||||
try:
|
||||
@@ -7837,6 +7855,10 @@ def _current_import_source(project_id: str) -> ImportSourceKind:
|
||||
return ImportSourceKind.XML_DUMP
|
||||
|
||||
|
||||
def _html5_operation_jobs() -> list[OperationJob]:
|
||||
return sorted(_operations.jobs.values(), key=lambda job: job.updated_at, reverse=True)[:50]
|
||||
|
||||
|
||||
def _project_summaries() -> list[ProjectSummaryResponse]:
|
||||
project_ids = set(_project_setup.keys())
|
||||
stored_snapshots = _storage.list_snapshot_refs()
|
||||
|
||||
Reference in New Issue
Block a user