Parcourir la source

fix(inventory): "Print labels..." works in Spoolman mode (#1390 follow-up)

  The LabelTemplatePickerModal correctly branches on a spoolmanMode prop
  and the /spoolman/labels backend endpoint exists, but InventoryPage was
  instantiating the modal with spoolmanMode={false} hard-coded. Every
  click in Spoolman mode resolved to /inventory/labels with Spoolman spool
  IDs and returned 404 "Spool(s) not found".

  The hard-coded value came with a stale comment from the original label
  printing PR that said "Spoolman path hands users an iframe to Spoolman
  so the per-spool button never shows in that context" -- that assumption
  stopped being true when the unified inventory UI shipped.

  Pass the actual spoolmanMode value through, drop the stale comment.

  The existing LabelTemplatePickerModal.test.tsx already covers both
  branches at the component level (line 209: "routes to the Spoolman
  endpoint when spoolmanMode is true"). The gap was that no test exercised
  the InventoryPage wiring.
maziggy il y a 1 semaine
Parent
commit
b07122e395
4 fichiers modifiés avec 5 ajouts et 6 suppressions
  1. 3 0
      CHANGELOG.md
  2. 1 5
      frontend/src/pages/InventoryPage.tsx
  3. 0 0
      static/assets/index-5ID0OvMM.js
  4. 1 1
      static/index.html

Fichier diff supprimé car celui-ci est trop grand
+ 3 - 0
CHANGELOG.md


+ 1 - 5
frontend/src/pages/InventoryPage.tsx

@@ -1890,16 +1890,12 @@ function InventoryPage({ spoolmanMode = false, spoolmanModeReady = true }: { spo
         onSave={handleColumnConfigSave}
         onSave={handleColumnConfigSave}
       />
       />
 
 
-      {/* Label printing (#809) — local-mode only on dev. The Spoolman path
-          on this branch hands users an iframe straight to Spoolman, so the
-          per-spool button never shows in that context. The Spoolman label
-          endpoint is wired and tested for when the inventory UI lands. */}
       <LabelTemplatePickerModal
       <LabelTemplatePickerModal
         isOpen={labelPickerSpoolIds !== null}
         isOpen={labelPickerSpoolIds !== null}
         onClose={() => setLabelPickerSpoolIds(null)}
         onClose={() => setLabelPickerSpoolIds(null)}
         availableSpools={filteredSpools}
         availableSpools={filteredSpools}
         initialSelectedIds={labelPickerSpoolIds ?? []}
         initialSelectedIds={labelPickerSpoolIds ?? []}
-        spoolmanMode={false}
+        spoolmanMode={spoolmanMode}
       />
       />
     </div>
     </div>
   );
   );

Fichier diff supprimé car celui-ci est trop grand
+ 0 - 0
static/assets/index-5ID0OvMM.js


+ 1 - 1
static/index.html

@@ -26,7 +26,7 @@
 
 
     <!-- Splash screens for iOS -->
     <!-- Splash screens for iOS -->
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
-    <script type="module" crossorigin src="/assets/index-BI09b1Nz.js"></script>
+    <script type="module" crossorigin src="/assets/index-5ID0OvMM.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-KYwGxnG9.css">
     <link rel="stylesheet" crossorigin href="/assets/index-KYwGxnG9.css">
   </head>
   </head>
   <body>
   <body>

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff