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:
@@ -147,6 +147,19 @@ async def lifespan(app: FastAPI):
|
||||
# Start profile engine (evaluates conditions and auto-starts/stops targets)
|
||||
await profile_engine.start()
|
||||
|
||||
# Auto-start targets with auto_start=True
|
||||
auto_started = 0
|
||||
for target in targets:
|
||||
if getattr(target, "auto_start", False):
|
||||
try:
|
||||
await processor_manager.start_processing(target.id)
|
||||
auto_started += 1
|
||||
logger.info(f"Auto-started target: {target.name} ({target.id})")
|
||||
except Exception as e:
|
||||
logger.warning(f"Failed to auto-start target {target.id}: {e}")
|
||||
if auto_started:
|
||||
logger.info(f"Auto-started {auto_started} target(s)")
|
||||
|
||||
yield
|
||||
|
||||
# Shutdown
|
||||
|
||||
Reference in New Issue
Block a user