feat(dashboard): add logs page, pagination, quick mapping modal, price pre-validation
- Add /logs page with per-order sync run details, filters (Toate/Importate/Fara Mapare/Erori) - Add price pre-validation (validate_prices + ensure_prices) to prevent ORA-20000 on direct articles - Add find_new_orders() to detect orders not yet in Oracle COMENZI - Extend missing_skus table with order context (order_count, order_numbers, customers) - Add server-side pagination on /api/validate/missing-skus and /missing-skus page - Replace confusing "Skip"/"Err" with "Fara Mapare"/"Erori" terminology - Add inline mapping modal on dashboard (replaces navigation to /mappings) - Add 2-row stat cards: orders (Comenzi Noi/Ready/Importate/Fara Mapare/Erori) + articles - Add ID_POL/ID_GESTIUNE/ID_SECTIE to config.py and .env - Update .gitignore (venv, *.db, api/api/, logs/) - 33/33 unit tests pass, E2E verified with Playwright Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,11 @@ async def sync_history(page: int = 1, per_page: int = 20):
|
||||
return await sqlite_service.get_sync_runs(page, per_page)
|
||||
|
||||
|
||||
@router.get("/logs", response_class=HTMLResponse)
|
||||
async def logs_page(request: Request):
|
||||
return templates.TemplateResponse("logs.html", {"request": request})
|
||||
|
||||
|
||||
@router.get("/api/sync/run/{run_id}")
|
||||
async def sync_run_detail(run_id: str):
|
||||
"""Get details for a specific sync run."""
|
||||
@@ -69,6 +74,30 @@ async def sync_run_detail(run_id: str):
|
||||
return detail
|
||||
|
||||
|
||||
@router.get("/api/sync/run/{run_id}/log")
|
||||
async def sync_run_log(run_id: str):
|
||||
"""Get detailed log per order for a sync run."""
|
||||
detail = await sqlite_service.get_sync_run_detail(run_id)
|
||||
if not detail:
|
||||
return {"error": "Run not found", "status_code": 404}
|
||||
orders = detail.get("orders", [])
|
||||
return {
|
||||
"run_id": run_id,
|
||||
"run": detail.get("run", {}),
|
||||
"orders": [
|
||||
{
|
||||
"order_number": o.get("order_number"),
|
||||
"customer_name": o.get("customer_name"),
|
||||
"items_count": o.get("items_count"),
|
||||
"status": o.get("status"),
|
||||
"error_message": o.get("error_message"),
|
||||
"missing_skus": o.get("missing_skus"),
|
||||
}
|
||||
for o in orders
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@router.put("/api/sync/schedule")
|
||||
async def update_schedule(config: ScheduleConfig):
|
||||
"""Update scheduler configuration."""
|
||||
|
||||
Reference in New Issue
Block a user