Add auto-start targets feature with dashboard section

- Add auto_start boolean field to PictureTarget model (persisted per-target)
- Wire auto_start through API schemas, routes, and store
- Auto-start targets on server boot in main.py lifespan
- Add star toggle button on target cards (next to delete button)
- Add auto-start section on dashboard between performance and profiles
- Remove auto-start section from profiles tab

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-25 15:08:01 +03:00
parent 701eac19e5
commit d05b4b78f4
14 changed files with 131 additions and 8 deletions

View File

@@ -101,6 +101,7 @@ def _target_to_response(target) -> PictureTargetResponse:
keepalive_interval=target.keepalive_interval,
state_check_interval=target.state_check_interval,
description=target.description,
auto_start=target.auto_start,
created_at=target.created_at,
updated_at=target.updated_at,
)
@@ -112,6 +113,7 @@ def _target_to_response(target) -> PictureTargetResponse:
picture_source_id=target.picture_source_id,
key_colors_settings=_kc_settings_to_schema(target.settings),
description=target.description,
auto_start=target.auto_start,
created_at=target.created_at,
updated_at=target.updated_at,
)
@@ -121,6 +123,7 @@ def _target_to_response(target) -> PictureTargetResponse:
name=target.name,
target_type=target.target_type,
description=target.description,
auto_start=target.auto_start,
created_at=target.created_at,
updated_at=target.updated_at,
)
@@ -159,6 +162,7 @@ async def create_target(
picture_source_id=data.picture_source_id,
key_colors_settings=kc_settings,
description=data.description,
auto_start=data.auto_start,
)
# Register in processor manager
@@ -274,6 +278,7 @@ async def update_target(
state_check_interval=data.state_check_interval,
key_colors_settings=kc_settings,
description=data.description,
auto_start=data.auto_start,
)
# Detect KC brightness VS change (inside key_colors_settings)

View File

@@ -62,6 +62,7 @@ class PictureTargetCreate(BaseModel):
picture_source_id: str = Field(default="", description="Picture source ID (for key_colors targets)")
key_colors_settings: Optional[KeyColorsSettingsSchema] = Field(None, description="Key colors settings (for key_colors targets)")
description: Optional[str] = Field(None, description="Optional description", max_length=500)
auto_start: bool = Field(default=False, description="Auto-start on server boot")
class PictureTargetUpdate(BaseModel):
@@ -79,6 +80,7 @@ class PictureTargetUpdate(BaseModel):
picture_source_id: Optional[str] = Field(None, description="Picture source ID (for key_colors targets)")
key_colors_settings: Optional[KeyColorsSettingsSchema] = Field(None, description="Key colors settings (for key_colors targets)")
description: Optional[str] = Field(None, description="Optional description", max_length=500)
auto_start: Optional[bool] = Field(None, description="Auto-start on server boot")
class PictureTargetResponse(BaseModel):
@@ -98,6 +100,7 @@ class PictureTargetResponse(BaseModel):
picture_source_id: str = Field(default="", description="Picture source ID (key_colors)")
key_colors_settings: Optional[KeyColorsSettingsSchema] = Field(None, description="Key colors settings")
description: Optional[str] = Field(None, description="Description")
auto_start: bool = Field(default=False, description="Auto-start on server boot")
created_at: datetime = Field(description="Creation timestamp")
updated_at: datetime = Field(description="Last update timestamp")