Add document preview, delete, and fix scroll in documents panel
Documents tab was limited to ~9 visible items due to fixed max-height without overflow-hidden. Now uses 70vh with proper overflow. Added click-to-preview (shows extracted text in dialog) and delete button with confirmation dialog + backend DELETE endpoint. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
25
web/app.py
25
web/app.py
@@ -2436,6 +2436,31 @@ async def api_reprocess_document(case_number: str, doc_id: str):
|
||||
return {"status": "reprocessing"}
|
||||
|
||||
|
||||
@app.delete("/api/cases/{case_number}/documents/{doc_id}")
|
||||
async def api_delete_document(case_number: str, doc_id: str):
|
||||
"""Delete a single document from a case (including its chunks and file)."""
|
||||
case = await db.get_case_by_number(case_number)
|
||||
if not case:
|
||||
raise HTTPException(404, f"תיק {case_number} לא נמצא")
|
||||
|
||||
case_id = UUID(case["id"])
|
||||
document_id = UUID(doc_id)
|
||||
doc = await db.get_document(document_id)
|
||||
if not doc or UUID(doc["case_id"]) != case_id:
|
||||
raise HTTPException(404, "מסמך לא נמצא בתיק")
|
||||
|
||||
# Try to remove the physical file
|
||||
file_path = doc.get("file_path")
|
||||
if file_path:
|
||||
import pathlib
|
||||
p = pathlib.Path(file_path)
|
||||
if p.exists():
|
||||
p.unlink(missing_ok=True)
|
||||
|
||||
await db.delete_document(document_id)
|
||||
return {"deleted": True, "doc_id": doc_id}
|
||||
|
||||
|
||||
# ── Chair feedback endpoints ──────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user