Quellcode durchsuchen

fix: auto-select first plate for multi-plate files in print modal (#394)

When scheduling a multi-plate file from the file manager, the modal
allowed submission without selecting a plate. Now auto-selects the
first plate by default and enforces plate selection for both archive
and library files.
maziggy vor 6 Monaten
Ursprung
Commit
cf0287d5c8

+ 1 - 0
CHANGELOG.md

@@ -42,6 +42,7 @@ All notable changes to Bambuddy will be documented in this file.
 - **Phantom Prints on Power Cycle** ([#374](https://github.com/maziggy/bambuddy/issues/374)) — The print queue uploaded `.3mf` files to the printer's SD card root (`/`) but never deleted them after the print finished. Some printers (e.g. P1S) auto-start files found in the root directory on power cycle, causing ghost prints on every reboot. Now deletes the uploaded file from the SD card after print completion (best-effort, non-blocking).
 - **Spool Form Scrollbar Flicker in Edge** ([#364](https://github.com/maziggy/bambuddy/issues/364)) — The Add/Edit Spool modal's scrollable area used `overflow-y: auto`, which on Windows Edge (where scrollbars take layout space) caused the scrollbar to appear and disappear on hover — making the color picker unusable at certain zoom levels. Added `scrollbar-gutter: stable` to reserve scrollbar space and prevent layout thrashing.
 - **Archive Duplicate Badge Misses Name-Based Duplicates** ([#315](https://github.com/maziggy/bambuddy/issues/315)) — The duplicate badge on archive cards only matched by file content hash, so re-sliced prints of the same model (different GCODE, same print name) were not flagged as duplicates. Now also matches by print name (case-insensitive), consistent with the detail view's duplicate detection.
+- **Schedule Print Allows No Plate Selected for Multi-Plate Files** ([#394](https://github.com/maziggy/bambuddy/issues/394)) — When scheduling a multi-plate file from the file manager, the modal showed a "Selection required" warning but still allowed submission without selecting a plate. The job defaulted to plate 1, but the queue item didn't indicate which plate, and editing showed no plate selected. Now auto-selects the first plate by default when plates load, and the submit button validation applies to both archive and library files.
 
 ### Improved
 - **Phantom Print Investigation — Logging & Hardening** ([#374](https://github.com/maziggy/bambuddy/issues/374)) — Added targeted logging and hardening to help diagnose reports of prints starting automatically without user input. Debug log volume reduced ~90% by suppressing `sqlalchemy.engine` (changed from INFO to WARNING) and `aiosqlite` (new WARNING suppression) noise that previously filled 2.5MB in 16 minutes. Every `start_print()` call now logs a `PRINT COMMAND` trace with the caller's file, line, and function name. The print scheduler logs pending queue items when found. `on_print_complete` warns when multiple queue items are in "printing" status for the same printer, which signals a state inconsistency.

+ 5 - 5
frontend/src/components/PrintModal/index.tsx

@@ -251,9 +251,9 @@ export function PrintModal({
     setPerPrinterConfigs
   );
 
-  // Auto-select first plate for single-plate files
+  // Auto-select first plate when plates load (single or multi-plate)
   useEffect(() => {
-    if (platesData?.plates?.length === 1 && !selectedPlate) {
+    if (platesData?.plates && platesData.plates.length >= 1 && !selectedPlate) {
       setSelectedPlate(platesData.plates[0].index);
     }
   }, [platesData, selectedPlate]);
@@ -528,11 +528,11 @@ export function PrintModal({
     // Model-based assignment only works in queue modes (not immediate reprint)
     if (assignmentMode === 'model' && mode === 'reprint') return false;
 
-    // For multi-plate archive files, need a selected plate (library files skip this)
-    if (!isLibraryFile && isMultiPlate && !selectedPlate) return false;
+    // For multi-plate files, need a selected plate
+    if (isMultiPlate && !selectedPlate) return false;
 
     return true;
-  }, [selectedPrinters.length, assignmentMode, targetModel, mode, isMultiPlate, selectedPlate, isPending, isLibraryFile]);
+  }, [selectedPrinters.length, assignmentMode, targetModel, mode, isMultiPlate, selectedPlate, isPending]);
 
   // Modal title and action button text based on mode
   const getModalConfig = () => {

Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
static/assets/index-D0i6ZWxF.css


Datei-Diff unterdrückt, da er zu groß ist
+ 0 - 0
static/assets/index-FDhjTp9p.js


+ 2 - 2
static/index.html

@@ -23,8 +23,8 @@
 
     <!-- Splash screens for iOS -->
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
-    <script type="module" crossorigin src="/assets/index-B6_GHLIb.js"></script>
-    <link rel="stylesheet" crossorigin href="/assets/index-VlqasY_r.css">
+    <script type="module" crossorigin src="/assets/index-FDhjTp9p.js"></script>
+    <link rel="stylesheet" crossorigin href="/assets/index-D0i6ZWxF.css">
   </head>
   <body>
     <div id="root"></div>

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.