feat(export): add separate AML/PNG label export flows and improvements#860
Open
akira69 wants to merge 19 commits into
Open
feat(export): add separate AML/PNG label export flows and improvements#860akira69 wants to merge 19 commits into
akira69 wants to merge 19 commits into
Conversation
This was referenced Feb 24, 2026
8663e53 to
c6e4217
Compare
This was referenced Mar 5, 2026
Open
0f24dbe to
32d1e50
Compare
4e38030 to
6e733a8
Compare
- Extract _build_search_filters() helper to reduce McCabe complexity - Reduces find() complexity from 13 → ~8 (under 10 limit) - Reduces branch count from 13 → acceptable levels - Resolves Ruff linting errors C901 + PLR0912 - Pure refactoring: behavior unchanged - Also fixes Prettier formatting on filamentSelectModal and qrCodePrintingDialog
1e0164d to
e699666
Compare
- Wrap selectUnselectFiltered, handleSelectItem callbacks in useCallback - Wrap handlePageChange, handlePageSizeChange, applySearchFilter in useCallback - Reduces unnecessary re-renders of child components (pagination, checkboxes, buttons) - Stable function references now persist across renders
…ack PR773) - Fetch extra field definitions once at endpoint entry instead of per-request - Eliminates redundant database calls for extra field validation - Applies feedback from PR 773: 'get_extra_fields only needs to be run max at once per call' - Affected endpoints: create/update for filament, spool, and vendor resources - Reduces API layer complexity and improves performance
(cherry picked from commit dc11b7bdae1777a70a68bedfe503f988e96acd13)
…ase URL handling Harden QR export base URL parsing to prevent template injection attacks Per https://github.com/Donkie/Spoolman/wiki/Contribute#style - ESLint (frontend) ✓ Fixed: control character regex - Prettier (frontend) ✓ Fixed: 7 files formatting - Ruff (backend) ✓ - Pre-commit hooks validated ✓
- Wrap selectUnselectFiltered, handleSelectItem callbacks in useCallback - Reduces unnecessary re-renders of table and checkboxes - Consistent with filament selector optimization pattern - Stable function references improve React.memo effectiveness
e699666 to
e81b670
Compare
- Use single debounced ?search= call (mirrors spool API / PR846 approach) - Remove 4-field parallel fetch loop, getAPIURL import, allSearchResults state - API ?search= param was already present via 'Carry filament search foundation'
cff78ed to
6df5e78
Compare
- useSetPrintSettings returns mutation object directly (fixes combined-branch .mutate() calls) - All four dialog callers updated to use setRemotePresets.mutate() - QRCodePrintingDialog/QRCodeExportDialog: add extraTitleSettings, extraInfoSettings, extraExportSettings props - FilamentSelectModal: add optional onExport, initialSelectedIds props + Export button (matches SpoolSelectModal pattern) - otherModels: add useSimpleSortedArrayQuery factory, refactor 4 verbose hooks to 1-liners (matches PR862 approach)
…to module scope - qrCodeExportDialog: 5 mutation sites replaced with spreads - exportDialog: move pngSignature, readUint32BE, writeUint32BE, isPng, getChunkType, CRC32_TABLE (was getCrc32Table IIFE), crc32, createPngChunk, setPngDpiMetadata to module scope — helpers are now allocated once per page load, not per render
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR delivers dedicated label export flows for spool and filament labels, including AML/PNG export options and export-specific UX.
Why This Matters
Code Quality Compliance ✅
Per https://github.com/Donkie/Spoolman/wiki/Contribute#style
Code Quality Improvements 🔧
Performance Optimizations Applied:
useCallbackmemoization to filament selector callbacks (filamentSelectModal.tsx):selectUnselectFiltered,handleSelectItem,handlePageChange,handlePageSizeChangeuseCallbackmemoization to spool selector callbacks (spoolSelectModal.tsx):selectUnselectFiltered,handleSelectItemAlignment with PR 846:
?search=API call introduced in feat(printing): filament label printing foundation #846, so full-dataset search works in both print and export flows.React Immutability Fixes Applied:
qrCodeExportDialog.tsx(×5 sites)curPreset.field = value; updateCurrentPreset(curPreset)→updateCurrentPreset({ ...curPreset, field: value })Module-Scope Extraction (exportDialog):
pngSignature,readUint32BE,writeUint32BE,isPng,getChunkType,getCrc32Table,crc32,createPngChunk,setPngDpiMetadata) from inside theExportDialogcomponent body to module scopegetCrc32Tablelazy-init IIFE renamed toCRC32_TABLEimmediate IIFE — table computed once unconditionally at module loadWhat Changed
Export flow and routing
Export capabilities
01,02,03, ...)UI wording consistency
Export Filament LabelsExport Spool LabelsScreenshots
The selection window with separate export labels button
The new export Label page with AML export added and DPI selection for PNG
"Export as .zip" for both PNG and AML exports (one file per label inside the archive).
ZIP name to be exported shown :
Configurable individual label filename template
Latest Fixes
base_urlsettings without crashing when the value was stored as a plain string."undefined"in saved local storage instead of crashing the export page.?search=API call (from feat(printing): filament label printing foundation #846), so full-dataset vendor and material searches work in the export flow too.Manual Verification Completed
http://127.0.0.1:9860.base_urlvalue and confirmed both export and settings pages still load without crashing."undefined"and confirmed the export page recovers instead of failing during initialization.?search=flow returned full-dataset matches.01,02, ...) and custom filename templates persist and reload correctly.Testing Performed
http://127.0.0.1:9860: ✓Test Checklist
Merge Notes (Combined-Branch Integration) 🔀
Commit
fba5e5dpre-patches four conflict hotspots discovered during combined-branch integration:useSetPrintSettings— returns the rawuseSetSetting<>()mutation object directly; fixes.mutate()call patterns expected by callers in combined branchesQRCodePrintingDialog,QRCodeExportDialog) —extraTitleSettings?,extraInfoSettings?,extraExportSettings?props added with render sites; allows filament-specific settings rows to be injected from callers in other PRs without conflictFilamentSelectModal—onPrintmade optional,onExport?+initialSelectedIds?added, conditional Export Labels button added; aligns withSpoolSelectModalpattern already in this PRotherModels.tsx—useSimpleSortedArrayQueryfactory added, 4 verbose hooks refactored to 1-liners; identical to feat(ui/filters): searchable filter dropdown + bulk selection + query responsiveness #862's approach, so the two PRs auto-merge on this file instead of conflictingMerge order: after #846, before #862.
Database Impact
Scope Mapping
PR Chain / Dependencies
#846(required).#857(logo core) is stacked on top of this PR.#872(logo GitHub sync) is stacked on top of#857.