Add multi-plate 3MF plate selection for reprinting (Issue #93)

When reprinting a multi-plate 3MF file exported with "All sliced file",
the system now asks which plate to print and only maps filaments for
that specific plate.

Backend changes:
- Add GET /archives/{id}/plates endpoint to list available plates
  with thumbnails, print times, and per-plate filament requirements
- Add GET /archives/{id}/plate-thumbnail/{index} for plate thumbnails
- Update GET /archives/{id}/filament-requirements to accept plate_id
  query parameter for filtering filaments by plate
- Add plate_id field to ReprintRequest schema
- Update POST /archives/{id}/reprint to use plate_id from request body
  instead of auto-detecting (maintains backward compatibility)

Frontend changes:
- Add getArchivePlates API method
- Update getArchiveFilamentRequirements to accept optional plateId
- Update reprintArchive to accept plate_id in options
- Add plate selection UI to ReprintModal when multi-plate 3MF detected
- Show plate thumbnails, names, and filament counts in selection grid
- Require plate selection before printing multi-plate files
- Filter filament requirements to show only selected plate's filaments

Tests:
- Add unit tests for multi-plate slice_info.config parsing
- Add unit tests for plate detection from gcode files
- Add integration tests for new plate endpoints
This commit is contained in:
maziggy
2026-01-19 13:29:37 +01:00
committed by MartinNYHC
parent 3a2ec8056c
commit af0dad11ec
8 changed files with 668 additions and 126 deletions
@@ -380,3 +380,35 @@ class TestArchiveF3DEndpoints:
assert with_f3d["f3d_path"] == "archives/test/design.f3d"
assert without_f3d is not None
assert without_f3d["f3d_path"] is None
# ========================================================================
# Multi-Plate 3MF endpoints (Issue #93)
# ========================================================================
@pytest.mark.asyncio
@pytest.mark.integration
async def test_get_archive_plates_not_found(self, async_client: AsyncClient):
"""Verify 404 when fetching plates for non-existent archive."""
response = await async_client.get("/api/v1/archives/999999/plates")
assert response.status_code == 404
@pytest.mark.asyncio
@pytest.mark.integration
async def test_get_plate_thumbnail_not_found(self, async_client: AsyncClient):
"""Verify 404 when fetching plate thumbnail for non-existent archive."""
response = await async_client.get("/api/v1/archives/999999/plate-thumbnail/1")
assert response.status_code == 404
@pytest.mark.asyncio
@pytest.mark.integration
async def test_filament_requirements_not_found(self, async_client: AsyncClient):
"""Verify filament-requirements returns 404 for non-existent archive."""
response = await async_client.get("/api/v1/archives/999999/filament-requirements")
assert response.status_code == 404
@pytest.mark.asyncio
@pytest.mark.integration
async def test_filament_requirements_with_plate_id_not_found(self, async_client: AsyncClient):
"""Verify filament-requirements with plate_id returns 404 for non-existent archive."""
response = await async_client.get("/api/v1/archives/999999/filament-requirements?plate_id=1")
assert response.status_code == 404