45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Start Dashboard Server for Protocol Mapping Testing
|
|
"""
|
|
|
|
import uvicorn
|
|
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
from fastapi.templating import Jinja2Templates
|
|
from fastapi.responses import HTMLResponse
|
|
from fastapi import Request
|
|
|
|
from src.dashboard.api import dashboard_router
|
|
from src.dashboard.templates import DASHBOARD_HTML
|
|
|
|
# Create FastAPI app
|
|
app = FastAPI(title="Calejo Control Adapter Dashboard", version="1.0.0")
|
|
|
|
# Include dashboard router
|
|
app.include_router(dashboard_router)
|
|
|
|
# Serve static files
|
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
|
|
|
@app.get("/", response_class=HTMLResponse)
|
|
async def serve_dashboard(request: Request):
|
|
"""Serve the main dashboard interface"""
|
|
return HTMLResponse(DASHBOARD_HTML)
|
|
|
|
@app.get("/dashboard", response_class=HTMLResponse)
|
|
async def serve_dashboard_alt(request: Request):
|
|
"""Alternative route for dashboard"""
|
|
return HTMLResponse(DASHBOARD_HTML)
|
|
|
|
if __name__ == "__main__":
|
|
print("🚀 Starting Calejo Control Adapter Dashboard...")
|
|
print("📊 Dashboard available at: http://localhost:8080")
|
|
print("📊 Protocol Mapping tab should be visible in the navigation")
|
|
|
|
uvicorn.run(
|
|
app,
|
|
host="0.0.0.0",
|
|
port=8080,
|
|
log_level="info"
|
|
) |