Some checks failed
Integration Tests / integration-tests (push) Failing after 20s
Integration Tests / performance-tests (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.11) (push) Failing after 23s
Frontend (React) / test (20) (push) Failing after 1m3s
Frontend (React) / build (push) Has been skipped
Frontend (React) / lighthouse (push) Has been skipped
Service Adapters (Python FastAPI) / test (3.12) (push) Failing after 23s
Service Adapters (Python FastAPI) / test (3.13) (push) Failing after 20s
Service Adapters (Python FastAPI) / build (push) Has been skipped
### Summary of Changes - Removed proxy configuration in `rsbuild.config.js` as the API Gateway is not running. - Added smooth transitions and gentle loading overlays in CSS for improved user experience during data loading. - Updated `Dashboard` component to conditionally display loading spinner and gentle loading overlay based on data fetching state. - Enhanced `useOfflineAwareServiceStatus` and `useOfflineAwareSystemData` hooks to manage loading states and service status more effectively. - Increased refresh intervals for service status and system data to reduce API call frequency. ### Expected Results - Improved user experience with smoother loading transitions and better feedback during data refreshes. - Enhanced handling of service status checks, providing clearer information when services are unavailable. - Streamlined code for managing loading states, making it easier to maintain and extend in the future.
70 lines
2.1 KiB
Python
70 lines
2.1 KiB
Python
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
# Import route modules
|
|
from middleware import LoggingMiddleware
|
|
from routes import events, frigate, general, home_assistant, immich
|
|
from services.logging_config import get_application_logger, setup_logging
|
|
from services.status_checker import status_checker
|
|
|
|
# Set up unified logging for both application and request logs
|
|
setup_logging(level="INFO", enable_request_logging=True)
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
"""Manage application lifespan events."""
|
|
# Startup
|
|
logger = get_application_logger()
|
|
logger.info("LabFusion Service Adapters starting up")
|
|
yield
|
|
# Shutdown
|
|
logger.info("LabFusion Service Adapters shutting down")
|
|
await status_checker.close()
|
|
|
|
|
|
# Create FastAPI app
|
|
app = FastAPI(
|
|
title="LabFusion Service Adapters",
|
|
description="Service integration adapters for Home Assistant, Frigate, Immich, and other homelab services",
|
|
version="1.0.0",
|
|
license_info={"name": "MIT License", "url": "https://opensource.org/licenses/MIT"},
|
|
servers=[
|
|
{"url": "http://localhost:8001", "description": "Development Server"},
|
|
{"url": "https://adapters.labfusion.dev", "description": "Production Server"},
|
|
],
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
# Add custom logging middleware first (runs last in the chain)
|
|
app.add_middleware(LoggingMiddleware)
|
|
|
|
# CORS middleware
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["*"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(general.router)
|
|
app.include_router(home_assistant.router)
|
|
app.include_router(frigate.router)
|
|
app.include_router(immich.router)
|
|
app.include_router(events.router)
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
|
|
# Configure uvicorn to use our unified logging
|
|
uvicorn.run(
|
|
app,
|
|
host="127.0.0.1",
|
|
port=8001,
|
|
log_config=None, # Disable uvicorn's default logging config
|
|
access_log=True, # Enable access logging
|
|
)
|