Part-DB-server/tests/Services
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
..
AI Added tests for AIPlatformRegistry 2026-05-02 22:12:36 +02:00
Attachments Ran rector and made tests final 2026-02-14 23:32:43 +01:00
Cache Added more tests 2026-05-11 21:50:33 +02:00
EDA Enhance KiCad integration: API v2, batch EDA editing, field export control (#1241) 2026-03-01 22:10:13 +01:00
EntityMergers/Mergers Ran rector and made tests final 2026-02-14 23:32:43 +01:00
Formatters Added more tests 2026-05-11 21:50:33 +02:00
ImportExportSystem Prevent formula injection into XLSX export 2026-07-14 18:14:59 +02:00
InfoProviderSystem Fixed phpunit tests 2026-07-20 00:04:55 +02:00
LabelSystem Implement parsing of TME QR codes (#1324) 2026-03-29 14:53:31 +02:00
LogSystem Test some more edge cases in tests 2026-05-11 23:13:46 +02:00
Misc Ran rector and made tests final 2026-02-14 23:32:43 +01:00
Parameters Ran rector and made tests final 2026-02-14 23:32:43 +01:00
Parts Test some more edge cases in tests 2026-05-11 23:13:46 +02:00
ProjectSystem Test some more edge cases in tests 2026-05-11 23:13:46 +02:00
System Ensure that the Password reset link is generated on a trusted domain, and cannot be manipulated by an attacker by setting the host header 2026-07-19 23:05:02 +02:00
Tools Add a component value calculator & image generator 2026-07-30 17:49:18 +02:00
Trees Ran rector and made tests final 2026-02-14 23:32:43 +01:00
UserSystem Added additional tests 2026-05-11 20:28:40 +02:00
ElementTypeNameGeneratorTest.php Ran rector and made tests final 2026-02-14 23:32:43 +01:00
ElementTypesTest.php Ran rector and made tests final 2026-02-14 23:32:43 +01:00
EntityURLGeneratorTest.php Added more tests 2026-05-11 21:50:33 +02:00