Browse 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 1 week ago
parent
commit
b07122e395
4 changed files with 5 additions and 6 deletions
  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

File diff suppressed because it is too large
+ 3 - 0
CHANGELOG.md


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

@@ -1890,16 +1890,12 @@ function InventoryPage({ spoolmanMode = false, spoolmanModeReady = true }: { spo
         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
         isOpen={labelPickerSpoolIds !== null}
         onClose={() => setLabelPickerSpoolIds(null)}
         availableSpools={filteredSpools}
         initialSelectedIds={labelPickerSpoolIds ?? []}
-        spoolmanMode={false}
+        spoolmanMode={spoolmanMode}
       />
     </div>
   );

File diff suppressed because it is too large
+ 0 - 0
static/assets/index-5ID0OvMM.js


+ 1 - 1
static/index.html

@@ -26,7 +26,7 @@
 
     <!-- Splash screens for iOS -->
     <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">
   </head>
   <body>

Some files were not shown because too many files changed in this diff