Add HTML5 background import job status
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-16 21:43:25 +03:00
parent 52caf1b331
commit ecee447044
3 changed files with 89 additions and 1 deletions
@@ -41,6 +41,7 @@ from api_server.html5 import (
render_html5_project_setup,
render_html5_project_rows,
render_html5_import_check,
render_html5_import_job,
render_html5_setup_summary,
render_html5_source,
render_html5_status,
@@ -1717,6 +1718,28 @@ async def html5_project_setup_import(project_id: str, request: Request) -> Respo
)
@app.post("/html5/projects/{project_id}/setup/import-job")
async def html5_project_setup_import_job(project_id: str, request: Request) -> Response:
form = await _html5_form_data(request)
source = ImportSourceKind(_form_value(form, "source") or _current_import_source(project_id).value)
job = await start_project_import_job(project_id, source, ImportRequest(source=source))
return Response(
render_html5_import_job(project_id, job),
media_type="text/html; charset=utf-8",
)
@app.get("/html5/projects/{project_id}/setup/jobs/{job_id}")
async def html5_project_setup_job(project_id: str, job_id: str) -> Response:
job = _operations.jobs.get(job_id)
if job is None or job.payload.get("project_id") != project_id:
raise HTTPException(status_code=404, detail=f"Unknown import job: {job_id}")
return Response(
render_html5_import_job(project_id, job),
media_type="text/html; charset=utf-8",
)
@app.post("/html5/projects/{project_id}/setup/reindex")
async def html5_project_setup_reindex(project_id: str) -> Response:
await reindex_project(project_id)