- Show CPU and GPU model names as overlays on performance chart cards - Add cpu_name field to performance API with cross-platform detection - Extract reusable color-picker popover module (9 presets + custom picker) - Per-chart color customization for CPU/RAM/GPU performance charts - Redesign header: compact toolbar container with icon-only buttons - Compact language dropdown (EN/RU/ZH), icon-only login/logout - Use accent color for FPS charts, range slider accent, dashboard icons Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
118 lines
4.3 KiB
Python
118 lines
4.3 KiB
Python
"""System-related schemas (health, version, displays)."""
|
|
|
|
from datetime import datetime
|
|
from typing import List, Literal
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class HealthResponse(BaseModel):
|
|
"""Health check response."""
|
|
|
|
status: Literal["healthy", "unhealthy"] = Field(description="Service health status")
|
|
timestamp: datetime = Field(description="Current server time")
|
|
version: str = Field(description="Application version")
|
|
|
|
|
|
class VersionResponse(BaseModel):
|
|
"""Version information response."""
|
|
|
|
version: str = Field(description="Application version")
|
|
python_version: str = Field(description="Python version")
|
|
api_version: str = Field(description="API version")
|
|
|
|
|
|
class DisplayInfo(BaseModel):
|
|
"""Display/monitor information."""
|
|
|
|
index: int = Field(description="Display index")
|
|
name: str = Field(description="Display name")
|
|
width: int = Field(description="Display width in pixels")
|
|
height: int = Field(description="Display height in pixels")
|
|
x: int = Field(description="Display X position")
|
|
y: int = Field(description="Display Y position")
|
|
is_primary: bool = Field(default=False, description="Whether this is the primary display")
|
|
refresh_rate: int = Field(description="Display refresh rate in Hz")
|
|
|
|
|
|
class DisplayListResponse(BaseModel):
|
|
"""List of available displays."""
|
|
|
|
displays: List[DisplayInfo] = Field(description="Available displays")
|
|
count: int = Field(description="Number of displays")
|
|
|
|
|
|
class ProcessListResponse(BaseModel):
|
|
"""List of running processes."""
|
|
|
|
processes: List[str] = Field(description="Sorted list of unique process names")
|
|
count: int = Field(description="Number of unique processes")
|
|
|
|
|
|
class GpuInfo(BaseModel):
|
|
"""GPU performance information."""
|
|
|
|
name: str | None = Field(default=None, description="GPU device name")
|
|
utilization: float | None = Field(default=None, description="GPU core usage percent")
|
|
memory_used_mb: float | None = Field(default=None, description="GPU memory used in MB")
|
|
memory_total_mb: float | None = Field(default=None, description="GPU total memory in MB")
|
|
temperature_c: float | None = Field(default=None, description="GPU temperature in Celsius")
|
|
|
|
|
|
class PerformanceResponse(BaseModel):
|
|
"""System performance metrics."""
|
|
|
|
cpu_name: str | None = Field(default=None, description="CPU model name")
|
|
cpu_percent: float = Field(description="System-wide CPU usage percent")
|
|
ram_used_mb: float = Field(description="RAM used in MB")
|
|
ram_total_mb: float = Field(description="RAM total in MB")
|
|
ram_percent: float = Field(description="RAM usage percent")
|
|
gpu: GpuInfo | None = Field(default=None, description="GPU info (null if unavailable)")
|
|
timestamp: datetime = Field(description="Measurement timestamp")
|
|
|
|
|
|
class RestoreResponse(BaseModel):
|
|
"""Response after restoring configuration backup."""
|
|
|
|
status: str = Field(description="Status of restore operation")
|
|
stores_written: int = Field(description="Number of stores successfully written")
|
|
stores_total: int = Field(description="Total number of known stores")
|
|
missing_stores: List[str] = Field(default_factory=list, description="Store keys not found in backup")
|
|
restart_scheduled: bool = Field(description="Whether server restart was scheduled")
|
|
message: str = Field(description="Human-readable status message")
|
|
|
|
|
|
# ─── Auto-backup schemas ──────────────────────────────────────
|
|
|
|
class AutoBackupSettings(BaseModel):
|
|
"""Settings for automatic backup."""
|
|
|
|
enabled: bool = Field(description="Whether auto-backup is enabled")
|
|
interval_hours: float = Field(ge=0.5, le=168, description="Backup interval in hours")
|
|
max_backups: int = Field(ge=1, le=100, description="Maximum number of backup files to keep")
|
|
|
|
|
|
class AutoBackupStatusResponse(BaseModel):
|
|
"""Auto-backup settings plus runtime status."""
|
|
|
|
enabled: bool
|
|
interval_hours: float
|
|
max_backups: int
|
|
last_backup_time: str | None = None
|
|
next_backup_time: str | None = None
|
|
|
|
|
|
class BackupFileInfo(BaseModel):
|
|
"""Information about a saved backup file."""
|
|
|
|
filename: str
|
|
size_bytes: int
|
|
created_at: str
|
|
|
|
|
|
class BackupListResponse(BaseModel):
|
|
"""List of saved backup files."""
|
|
|
|
backups: List[BackupFileInfo]
|
|
count: int
|