Add manual AMS slot selection for prints (#76)

- ReprintModal: Dropdown to override auto-matched AMS slots
- AddToQueueModal: Collapsible filament mapping section
- Backend: Store ams_mapping in print queue, apply when print starts
- Color names in dropdowns (decoded from Bambu codes or derived from hex)
- Blue ring indicator for manually selected vs auto-matched slots
- Status indicators: green (match), yellow (type only), orange (not found)

Closes #76

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
maziggy
2026-01-12 08:37:47 +01:00
co-authored by Claude Opus 4.5
parent e2ace4f946
commit ad4e4fc3a2
15 changed files with 1065 additions and 454 deletions
+8
View File
@@ -1,5 +1,6 @@
"""API routes for print queue management."""
import json
import logging
from datetime import datetime
@@ -27,6 +28,12 @@ router = APIRouter(prefix="/queue", tags=["queue"])
def _enrich_response(item: PrintQueueItem) -> PrintQueueItemResponse:
"""Add nested archive/printer info to response."""
response = PrintQueueItemResponse.model_validate(item)
# Parse ams_mapping from JSON string
if item.ams_mapping:
try:
response.ams_mapping = json.loads(item.ams_mapping)
except json.JSONDecodeError:
response.ams_mapping = None
if item.archive:
response.archive_name = item.archive.print_name or item.archive.filename
response.archive_thumbnail = item.archive.thumbnail_path
@@ -90,6 +97,7 @@ async def add_to_queue(
require_previous_success=data.require_previous_success,
auto_off_after=data.auto_off_after,
manual_start=data.manual_start,
ams_mapping=json.dumps(data.ams_mapping) if data.ams_mapping else None,
position=max_pos + 1,
status="pending",
)