feat(printing): filament label printing foundation#846
feat(printing): filament label printing foundation#846akira69 wants to merge 11 commits intoDonkie:masterfrom
Conversation
|
@Donkie , at all interested in implementing these features? do you have the time to consider it? Or did you find any other maintainers to consider it? Thanks for any feedback. |
|
Thanks for the contribution! I will take a look within a couple of days hopefully. |
|
This feature would be great as many has requested the filament QR code generation. +1 from me |
From upstream Donkie/Spoolman PR Donkie#846
- Remove unused sqlalchemy imports from migrations - Move AsyncSession to TYPE_CHECKING block - Use removeprefix() instead of ternary - Rename loop variable to avoid overwrite warning - Fix extra blank lines in env.py
f2e6da9 to
e1ab3be
Compare
e1ab3be to
2c8a20f
Compare
2c8a20f to
9e4cf60
Compare
|
OK! after much wrangling, is now cleanly separated from other PRs and implementing features in ways that work with other later PRs. Ready to go! ---> after some futher optimization/improvements (including better commented code) March 13, ready again for review and merge! |
0e67ff2 to
750a946
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
16ca9a4 to
8420604
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
- Add ?search= query param to filament API endpoint (mirrors spool API) - Simplify filamentSelectModal from 4-field parallel fetch loop to single debounced ?search= call – consistent with spoolSelectModal pattern - Remove getAPIURL import, allSearchResults state, isSearching state, localSearchTerm, and multi-field fetch loop (~50 LOC removed)
e2388ac to
85fd256
Compare
- onPrint made optional (was required) - Added optional onExport callback + Export Labels button (conditional) - Added optional initialSelectedIds for URL-parameter pre-selection - Initialize selectedItems state from initialSelectedIds ?? [] - Added printing.qrcode.exportButton locale key
…n checks - qrCodePrintingDialog: 5 sites (nested printSettings + 4 scalar fields) - filamentQrCodePrintingDialog: 3 sites (labelSettings, name triple-spread, template) - spoolQrCodePrintingDialog: 3 sites (same pattern as filament dialog) - spoolSelectModal: add useMemo Set for O(1) isAllFilteredSelected checks
|
@akira69 Is this just waiting on Donkie to approve? |
Pretty much, I've just recently did some more testing and tweaked accordingly, but confirmation/review/test from anyone else is appreciated |
|
Would you mind creating a release on your repo so we can test/use it until it gets merged into Spoolman? |
@AIT-OLPE : done: |
|
Thanks, I built the docker image and started it which works, however I can't seem to find the button to print filament labels at all. Do I need to enable it somewhere? Ive tried both with my production database and a new test database same issue. |
I must have made a mistake in what I selected to release. |
Summary
filament label printing foundation
Provides a means to print labels for Filaments, not just spools. This is useful for labeling test coupons/filament color swatches that are not spool connected.
Note, further, earlier additional functionality that used to be inside this PR is moved to other PRs to limit scope and simplify review.
Code Quality Compliance ✅
Per https://github.com/Donkie/Spoolman/wiki/Contribute#style
Included
print_presets_filament)print_presetsin this PR?search=param across the full filament dataset (vendor name, name, material, article number, ID)Latest Fixes
?search=API call for full-dataset search, consistent with the spool selector pattern in feat(printing/ui): Spool Print selection page UX Improvement #869. Searching for a vendor or material is no longer limited to the currently visible page.searchquery parameter (matching the spool API), backed by the existing_build_search_filters()helper.base_urlsettings without crashing when that value was stored as a plain string.Code Quality Improvements 🔧
Performance Optimizations Applied:
useCallbackmemoization toselectUnselectFiltered,handleSelectItem,handlePageChange, andhandlePageSizeChangecallbacks infilamentSelectModal.tsxBackend Refactoring:
filament.find()to dedicated_build_search_filters()helper function?search=query parameter to the filament list API endpointReact Immutability Fixes Applied:
qrCodePrintingDialog.tsx(×5 sites),filamentQrCodePrintingDialog.tsx(×3 sites),spoolQrCodePrintingDialog.tsx(×3 sites)curPreset.field = value; updateCurrentPreset(curPreset)→updateCurrentPreset({ ...curPreset, field: value }){ ...curPreset, subObj: { ...curPreset.subObj, key: value } }Selection Performance Fix (spoolSelectModal):
selectedItems.includes(id)calls (once per row per render) with O(1)selectedSet.has(id)viauseMemo(() => new Set(selectedItems), [selectedItems])Related
Scope Boundary
#869#860#861,#862Database Impact
Relationship / Merge Notes
#860is stacked on top of#846.#857is stacked on top of#860.#872is stacked on top of#857.#869remains intentionally independent and improves the spool-side pre-print selection UX.#846and#869now use parallel selection-step UX patterns, both using a single debounced?search=API call for full-dataset search.#869does not replace this PR; it brings spool selection UX up to the same general level as the filament-side selection flow here.#846does not depend on#862.Compatibility pre-patch (
d65860a) for combined-branch merges:onPrintmade optional (was required) — allows feat(export): add separate AML/PNG label export flows and improvements #860 callers to conditionally render only an Export buttononExport?callback + conditional Export Labels button added — mirrorsSpoolSelectModalpattern from feat(export): add separate AML/PNG label export flows and improvements #860initialSelectedIds?added — enables URL-parameter pre-selection used by feat(export): add separate AML/PNG label export flows and improvements #860's routingprinting.qrcode.exportButtonlocale key addedTest Checklist
Verified locally on March 27, 2026 via Playwright against the PR app at
http://localhost:9846.?search=API call)