- Add `tags: List[str]` field to all 13 entity types (devices, output targets, CSS sources, picture sources, audio sources, value sources, sync clocks, automations, scene presets, capture/audio/PP/pattern templates) - Update all stores, schemas, and route handlers for tag CRUD - Add GET /api/v1/tags endpoint aggregating unique tags across all stores - Create TagInput component with chip display, autocomplete dropdown, keyboard navigation, and API-backed suggestions - Display tag chips on all entity cards (searchable via existing text filter) - Add tag input to all 14 editor modals with dirty check support - Add CSS styles and i18n keys (en/ru/zh) for tag UI - Also includes code review fixes: thread safety, perf, store dedup Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
80 lines
3.4 KiB
Python
80 lines
3.4 KiB
Python
"""Capture template and engine schemas."""
|
|
|
|
from datetime import datetime
|
|
from typing import Dict, List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class TemplateCreate(BaseModel):
|
|
"""Request to create a capture template."""
|
|
|
|
name: str = Field(description="Template name", min_length=1, max_length=100)
|
|
engine_type: str = Field(description="Engine type (e.g., 'mss', 'dxcam', 'wgc')", min_length=1)
|
|
engine_config: Dict = Field(default_factory=dict, description="Engine-specific configuration")
|
|
description: Optional[str] = Field(None, description="Template description", max_length=500)
|
|
tags: List[str] = Field(default_factory=list, description="User-defined tags")
|
|
|
|
|
|
class TemplateUpdate(BaseModel):
|
|
"""Request to update a template."""
|
|
|
|
name: Optional[str] = Field(None, description="Template name", min_length=1, max_length=100)
|
|
engine_type: Optional[str] = Field(None, description="Capture engine type (mss, dxcam, wgc)")
|
|
engine_config: Optional[Dict] = Field(None, description="Engine-specific configuration")
|
|
description: Optional[str] = Field(None, description="Template description", max_length=500)
|
|
tags: Optional[List[str]] = None
|
|
|
|
|
|
class TemplateResponse(BaseModel):
|
|
"""Template information response."""
|
|
|
|
id: str = Field(description="Template ID")
|
|
name: str = Field(description="Template name")
|
|
engine_type: str = Field(description="Engine type identifier")
|
|
engine_config: Dict = Field(description="Engine-specific configuration")
|
|
tags: List[str] = Field(default_factory=list, description="User-defined tags")
|
|
created_at: datetime = Field(description="Creation timestamp")
|
|
updated_at: datetime = Field(description="Last update timestamp")
|
|
description: Optional[str] = Field(None, description="Template description")
|
|
|
|
|
|
class TemplateListResponse(BaseModel):
|
|
"""List of templates response."""
|
|
|
|
templates: List[TemplateResponse] = Field(description="List of templates")
|
|
count: int = Field(description="Number of templates")
|
|
|
|
|
|
class EngineInfo(BaseModel):
|
|
"""Capture engine information."""
|
|
|
|
type: str = Field(description="Engine type identifier (e.g., 'mss', 'dxcam')")
|
|
name: str = Field(description="Human-readable engine name")
|
|
default_config: Dict = Field(description="Default configuration for this engine")
|
|
available: bool = Field(description="Whether engine is available on this system")
|
|
has_own_displays: bool = Field(default=False, description="Engine has its own device list (not desktop monitors)")
|
|
|
|
|
|
class EngineListResponse(BaseModel):
|
|
"""List of available engines response."""
|
|
|
|
engines: List[EngineInfo] = Field(description="Available capture engines")
|
|
count: int = Field(description="Number of engines")
|
|
|
|
|
|
class TemplateAssignment(BaseModel):
|
|
"""Request to assign template to device."""
|
|
|
|
template_id: str = Field(description="Template ID to assign")
|
|
|
|
|
|
class TemplateTestRequest(BaseModel):
|
|
"""Request to test a capture template."""
|
|
|
|
engine_type: str = Field(description="Capture engine type to test")
|
|
engine_config: Dict = Field(default={}, description="Engine configuration")
|
|
display_index: int = Field(description="Display index to capture")
|
|
border_width: int = Field(default=10, ge=1, le=100, description="Border width in pixels")
|
|
capture_duration: float = Field(default=5.0, ge=1.0, le=30.0, description="Duration to capture in seconds")
|