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.
85 lines
3.3 KiB
Python
85 lines
3.3 KiB
Python
from typing import Any, Dict, List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ServiceStatus(BaseModel):
|
|
enabled: bool = Field(..., description="Whether the service is enabled")
|
|
url: str = Field(..., description="Service URL")
|
|
status: str = Field(..., description="Service status (healthy, unhealthy, disabled, error, timeout, unauthorized, forbidden)")
|
|
response_time: Optional[float] = Field(None, description="Response time in seconds")
|
|
error: Optional[str] = Field(None, description="Error message if status is not healthy")
|
|
uptime: Optional[str] = Field(None, description="Service uptime information (for sensor-based checks)")
|
|
metadata: Optional[Dict[str, Any]] = Field(default_factory=dict, description="Additional metadata from health check")
|
|
|
|
|
|
class HAAttributes(BaseModel):
|
|
unit_of_measurement: Optional[str] = Field(None, description="Unit of measurement")
|
|
friendly_name: Optional[str] = Field(None, description="Friendly name")
|
|
|
|
|
|
class HAEntity(BaseModel):
|
|
entity_id: str = Field(..., description="Entity ID")
|
|
state: str = Field(..., description="Current state")
|
|
attributes: HAAttributes = Field(..., description="Entity attributes")
|
|
|
|
|
|
class HAEntitiesResponse(BaseModel):
|
|
entities: List[HAEntity] = Field(..., description="List of Home Assistant entities")
|
|
|
|
|
|
class FrigateEvent(BaseModel):
|
|
id: str = Field(..., description="Event ID")
|
|
timestamp: str = Field(..., description="Event timestamp")
|
|
camera: str = Field(..., description="Camera name")
|
|
label: str = Field(..., description="Detection label")
|
|
confidence: float = Field(..., ge=0, le=1, description="Detection confidence")
|
|
|
|
|
|
class FrigateEventsResponse(BaseModel):
|
|
events: List[FrigateEvent] = Field(..., description="List of Frigate events")
|
|
|
|
|
|
class ImmichAsset(BaseModel):
|
|
id: str = Field(..., description="Asset ID")
|
|
filename: str = Field(..., description="Filename")
|
|
created_at: str = Field(..., description="Creation timestamp")
|
|
tags: List[str] = Field(..., description="Asset tags")
|
|
faces: List[str] = Field(..., description="Detected faces")
|
|
|
|
|
|
class ImmichAssetsResponse(BaseModel):
|
|
assets: List[ImmichAsset] = Field(..., description="List of Immich assets")
|
|
|
|
|
|
class EventData(BaseModel):
|
|
service: str = Field(..., description="Service name")
|
|
event_type: str = Field(..., description="Event type")
|
|
metadata: Dict[str, Any] = Field(default_factory=dict, description="Event metadata")
|
|
|
|
|
|
class EventResponse(BaseModel):
|
|
status: str = Field(..., description="Publication status")
|
|
event: Dict[str, Any] = Field(..., description="Published event")
|
|
|
|
|
|
class Event(BaseModel):
|
|
timestamp: str = Field(..., description="Event timestamp")
|
|
service: str = Field(..., description="Service name")
|
|
event_type: str = Field(..., description="Event type")
|
|
metadata: str = Field(..., description="Event metadata as JSON string")
|
|
|
|
|
|
class EventsResponse(BaseModel):
|
|
events: List[Event] = Field(..., description="List of events")
|
|
|
|
|
|
class HealthResponse(BaseModel):
|
|
status: str = Field(..., description="Service health status")
|
|
timestamp: str = Field(..., description="Health check timestamp")
|
|
|
|
|
|
class RootResponse(BaseModel):
|
|
message: str = Field(..., description="API message")
|
|
version: str = Field(..., description="API version")
|