Part-DB-server/assets/controllers
Sebastian Almberg d73bc42362 Add a component value calculator & image generator
Adds a "Value calculator" tool (Tools menu) that decodes/encodes the value of
common components and generates a clean SVG picture you can attach to a part —
handy for assortments imported with blank thumbnails and sparse data.

Calculator tabs (bidirectional decode <-> encode), each drawing the part to the
selected package with a collapsible appearance panel and an "attach to part"
action (optionally as the master picture):
- Resistor: 4/5/6-band colour code
- Capacitor: value <-> 3-digit code <-> tolerance
- SMD resistor: value <-> 3-digit / 4-digit / EIA-96 code
- Inductor: colour-band code
- SMD inductor: value <-> uH code

Bulk "Generate component images" parts-table action:
- Classifies each selected part (resistor / capacitor / inductor / diode / LED,
  THT or SMD) with ComponentValueGuesser and detects value, voltage, tolerance,
  power, ppm, pitch, diameter, colour, SMD package and marking from the name,
  description and parameters.
- Renders a preview per part, lets you tweak appearance, and attaches the images
  in one go; can also write matching KiCad symbol/footprint/reference-prefix EDA
  fields.

Backend: ComponentValueGuesser (classification + detection + EDA suggestion),
GeneratedImageAttachmentHelper (stores the SVG through the existing attachment
pipeline, so it is sanitised on save), two POST endpoints on PartController
(generate_image, set_eda) guarded by `edit` + CSRF, a new `@tools.value_calculator`
permission, a Tools-tree entry and docs. All drawing is client-side in a Stimulus
controller; the un-sanitised live preview escapes part-derived text and validates
colours as defence-in-depth.

Tests: unit tests for ComponentValueGuesser and functional tests for the
endpoints, including permission and CSRF enforcement and the persisted side
effects.
2026-07-30 17:49:18 +02:00
..
common Moved alerts and dialogs from unsupported bootbox to Sweetalert2 library 2026-06-21 14:21:01 +02:00
elements Use upstream version of dataTables.select as the fix was merged 2026-06-21 14:41:56 +02:00
filters Added copyright/license info to files 2022-11-29 21:21:26 +01:00
helpers Allow to scan labels anywhere on the page 2026-03-01 16:48:29 +01:00
pages Add a component value calculator & image generator 2026-07-30 17:49:18 +02:00
backup_restore_controller.js Add backup restore feature 2026-01-30 23:24:48 +01:00
bulk_import_controller.js Add Quick Apply and batch update to bulk info provider import (#1316) 2026-05-04 21:56:18 +02:00
bulk_job_manage_controller.js Refactor bulk import functionality to make controller smaller (use services) add DTOs and use stimulus controllers on frontend 2025-09-09 20:30:27 +02:00
csrf_protection_controller.js Updated stimulus recipe 2025-11-30 15:07:59 +01:00
docker_update_progress_controller.js Add Docker update support via Watchtower integration (#1330) 2026-05-03 23:00:31 +02:00
field_mapping_controller.js Add Quick Apply and batch update to bulk info provider import (#1316) 2026-05-04 21:56:18 +02:00
toggle_password_controller.js Removed the deprecated symfony/ux-toggle-password package by replacing it by our own local versions 2025-08-30 21:57:57 +02:00
update_confirm_controller.js Fix update confirmation dialog not blocking form submission 2026-01-30 23:24:48 +01:00