Phases 5-7: Dashboard UI, Admin API, and Auth middleware

Phase 5 - Main Dashboard:
- Dashboard overview page with system health stats
- Jobs by status breakdown, success rates, top clients
- Dashboard API (/api/dashboard/overview, by-client, problems, by-version)

Phase 6 - Admin/Scraper Management:
- Scrapers management page with traffic allocation UI
- Admin API for scraper CRUD operations
- Traffic percentage updates for A/B testing
- Promote/deprecate scraper versions

Phase 7 - Authentication:
- API key authentication middleware
- SHA-256 key hashing (keys never stored in plain text)
- Scope-based authorization (jobs:read, jobs:write, admin)
- Rate limiting per API key

Also:
- Updated api_server_production.py to include new routers
- Extended core/database.py with dashboard query methods
- Added dashboard link to sidebar navigation
- Updated CONTEXT-KEEPER.md to mark all phases complete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Alejandro Gutiérrez
2026-01-24 15:43:00 +00:00
parent 788ef84756
commit 39c80fc8be
11 changed files with 3465 additions and 16 deletions

View File

@@ -40,7 +40,11 @@ from workers.chrome_pool import (
release_scraping_worker,
get_pool_stats
)
from api.routes import batches_router, set_batches_db
from api.routes import (
batches_router, set_batches_db,
dashboard_router, set_dashboard_db,
admin_router, set_admin_db,
)
# Configure logging
logging.basicConfig(
@@ -86,6 +90,8 @@ async def lifespan(app: FastAPI):
# Inject database into route modules
set_batches_db(db)
set_dashboard_db(db)
set_admin_db(db)
# Initialize health check system with canary monitoring
# DISABLED: Canary tests consume Google Maps requests and trigger rate limiting
@@ -145,6 +151,8 @@ app.add_middleware(
# Include routers from api/routes/
app.include_router(batches_router)
app.include_router(dashboard_router)
app.include_router(admin_router)
# ==================== Request/Response Models ====================