[feature] Add label-paper sheet printing#95
Draft
akira69 wants to merge 17 commits into
Draft
Conversation
… designer - Add filaments/[id]/print.astro: single-filament label print page mirroring spools/[id]/print.astro with filament-specific defaults (height=25mm, qrSize=15mm), storage keys, and API mapping - Add filaments/print.astro: batch filament label print page mirroring spools/print.astro with filament API + filament extra fields - Add Print Label button to filaments/[id]/index.astro (builds URL params from filament API data + stores extra fields in sessionStorage) - Add Print Labels bulk action to filaments/index.astro (bulk-action-bar) - Add i18n keys: filaments.backToFilament, filaments.showFilamentId, filaments.printLabel, filaments.bulkLabel (en + de)
Add optional qrUrl field to StandardLabelData so filament print pages can specify the correct entity URL for QR codes.
… fields on print pages - Detail page writes standard fields (extruder_temp, bed_temp, diameter, density, weight, finish, price) plus system custom fields to filaman-filament-label-extra-fields sessionStorage before navigating to the print page, so no extra API fetch is needed - Single print page fallback (direct navigation): now also shows standard filament fields as selectable checkboxes alongside system custom fields; parallelizes the two API fetches; no longer early-returns when there are no system custom fields - Batch print page: always shows standard filament fields as selectable extra fields (Extruder Temp, Bed Temp, Diameter, Density, Weight, Finish, Price) in addition to system-defined custom fields
…designer Add optional presetsKey to LabelDesignerEditorOptions so each entity type can use its own preset store. Filament print pages now use 'filaman-filament-label-presets-v1'; spool pages continue using the default 'filaman-label-presets-v1'. Presets named 'Default' are seeded separately in each store.
…erEditor Remove the optional default. Every caller must now explicitly declare which preset namespace it owns: spools/[id]/print → filaman-spool-label-presets-v1 spools/print → filaman-spool-label-presets-v1 filaments/[id]/print → filaman-filament-label-presets-v1 filaments/print → filaman-filament-label-presets-v1 This makes future entity types impossible to accidentally share presets.
On first use of a spool print page after upgrade, presets stored under 'filaman-label-presets-v1' (the old shared key) are moved to 'filaman-spool-label-presets-v1' and the old key is deleted. Migration only runs when the effective key is the spool key and the destination is empty, so it is idempotent and only fires once.
- Entity-locked QR URLs in designer: spool pages encode /spools/{id},
filament pages encode /filaments/{id}
- Cross-type preset sharing with <optgroup> divider; filament pages show
spool presets section and vice versa; cross-type presets are read-only
- Entity-specific labels throughout the designer UI: token group header,
empty extra-fields state, QR pill label, section titles
- Non-system filament custom fields now included in print page sessionStorage
- Filament label defaults match spool defaults (height 40mm, QR 18mm)
- Token area Extra Fields group label uses entity-specific i18n key
- LabelDesignerSettings.info gains marginMm field (default 0) - Margin is applied as marginTop on the main info/QR row, providing vertical spacing between the title blocks and the info area - Range+number input added to LabelDesignerEditor.astro below the text-size row, matching the existing title gap control style - Editor wired in FIELD_IDS, SLIDER_PAIRS, read/apply/reset/localize - Preset save/load and reset-section button all handle the new field
Old localStorage (v<2) had height=25mm and QR=15mm from early development. Adds SETTINGS_VERSION=2; on load, any saved settings without _v>=2 are discarded so the correct defaults (60x40mm, QR=18mm) take effect.
…overage - Split DESIGNER_TOKENS into FILAMENT_TOKENS (all pages) + SPOOL_TOKENS (spool pages only), adding 5 new filament fields and 13 spool model fields - Add entityType option to LabelDesignerEditorOptions; spool pages show a dedicated 'Spool' token group (lot_number, external_id, rfid_uid, location, status, purchase_date, purchase_price, remaining/initial/empty weights, stocked_in_at, last_used_at); filament pages omit it - Extend SpoolData interface and DesignerFlatLabelData with all new fields - Wire spool model fields through buildSpoolDataFromFlatLabel and buildSpoolDataFromApiSpool so tokens resolve correctly at render time - spool/[id]/index.astro: include all spool model fields in printUrl params and efForPrint (so they appear as standard-label checkboxes too) - spool/[id]/print.astro, filament/[id]/print.astro: read new URL params - filament pages: add subtype, manufacturer_color_name, default_spool_weight_g, spool_outer_diameter_mm, spool_width_mm, spool_material to URL params - spools/print.astro (batch): add Spool Fields checkbox section for model-level fields in the standard label sidebar - Fix pre-existing TS error: info preset default was missing marginMm
1432c48 to
278012e
Compare
278012e to
561d5e5
Compare
561d5e5 to
c4160ce
Compare
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
Adds label-paper sheet printing for users who do not have a dedicated label printer or who want to use partially consumed label sheets.
Why:
What changed:
Output modecontrol to all four print flows:LabelSheetOutputSettingsUI so the four print pages share one sheet-settings block.Label papersettings for paper size, custom dimensions, rows/columns, margins, gaps, skipped cells, copies, grid visibility, and fit-to-cell.label-sheet.ts.Stack / Merge Order
#93 and #94 are now merged into
devel.This PR is stacked after #91. Its diff may include #91 changes until #91 lands, then this branch should be rebased onto the updated
devel.The branch has been restacked on the simplified #91 tip and reuses #91's shared standard settings and batch print style components instead of carrying duplicate print-page markup.
Expected remaining merge order:
Validation
npm run lintpasses with existing warnings.npm run checkpasses with existing project hints.npm run buildpasses.127.0.0.1:4325:Note:
npm run buildstill logs the existing localversion.txtwarning in this worktree; generatedsrc/version.jswas not committed.Test Checklist