[31188f42] einfügen
einfügen
This commit is contained in:
@@ -1252,7 +1252,6 @@ def run_batch_classification_task():
|
||||
# --- Serve Frontend ---
|
||||
static_path = "/frontend_static"
|
||||
if not os.path.exists(static_path):
|
||||
# Local dev fallback
|
||||
static_path = os.path.join(os.path.dirname(__file__), "../../frontend/dist")
|
||||
if not os.path.exists(static_path):
|
||||
static_path = os.path.join(os.path.dirname(__file__), "../static")
|
||||
@@ -1260,11 +1259,34 @@ if not os.path.exists(static_path):
|
||||
logger.info(f"Static files path: {static_path} (Exists: {os.path.exists(static_path)})")
|
||||
|
||||
if os.path.exists(static_path):
|
||||
from fastapi.responses import FileResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
index_file = os.path.join(static_path, "index.html")
|
||||
|
||||
# Mount assets specifically first
|
||||
assets_path = os.path.join(static_path, "assets")
|
||||
if os.path.exists(assets_path):
|
||||
app.mount("/assets", StaticFiles(directory=assets_path), name="assets")
|
||||
|
||||
@app.get("/")
|
||||
async def serve_index():
|
||||
return FileResponse(os.path.join(static_path, "index.html"))
|
||||
return FileResponse(index_file)
|
||||
|
||||
app.mount("/", StaticFiles(directory=static_path, html=True), name="static")
|
||||
# Catch-all for SPA routing (any path not matched by API or assets)
|
||||
@app.get("/{full_path:path}")
|
||||
async def spa_fallback(full_path: str):
|
||||
# Allow API calls to fail naturally with 404
|
||||
if full_path.startswith("api/"):
|
||||
raise HTTPException(status_code=404)
|
||||
|
||||
# If it's a file that exists, serve it (e.g. favicon, robots.txt)
|
||||
file_path = os.path.join(static_path, full_path)
|
||||
if os.path.isfile(file_path):
|
||||
return FileResponse(file_path)
|
||||
|
||||
# Otherwise, serve index.html for SPA routing
|
||||
return FileResponse(index_file)
|
||||
else:
|
||||
@app.get("/")
|
||||
def root_no_frontend():
|
||||
|
||||
@@ -4,7 +4,7 @@ import { ContactsTable } from './components/ContactsTable' // NEW
|
||||
import { ImportWizard } from './components/ImportWizard'
|
||||
import { Inspector } from './components/Inspector'
|
||||
import { RoboticsSettings } from './components/RoboticsSettings'
|
||||
import { LayoutDashboard, UploadCloud, RefreshCw, Settings, Users, Building, Sun, Moon } from 'lucide-react'
|
||||
import { LayoutDashboard, UploadCloud, RefreshCw, Settings, Users, Building, Sun, Moon, Activity } from 'lucide-react'
|
||||
import clsx from 'clsx'
|
||||
|
||||
// Base URL detection (Production vs Dev)
|
||||
@@ -119,6 +119,16 @@ function App() {
|
||||
{theme === 'dark' ? <Sun className="h-5 w-5" /> : <Moon className="h-5 w-5" />}
|
||||
</button>
|
||||
|
||||
<a
|
||||
href="/connector/dashboard"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="p-2 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full transition-colors text-slate-500 dark:text-slate-400"
|
||||
title="Connector Status Dashboard"
|
||||
>
|
||||
<Activity className="h-5 w-5" />
|
||||
</a>
|
||||
|
||||
<button
|
||||
onClick={() => setIsSettingsOpen(true)}
|
||||
className="p-2 hover:bg-slate-100 dark:hover:bg-slate-800 rounded-full transition-colors text-slate-500 dark:text-slate-400"
|
||||
|
||||
Reference in New Issue
Block a user