feat: add Group device type for combining multiple devices
Lint & Test / test (push) Successful in 2m19s

Introduces a new "group" device type that aggregates multiple physical
(or nested group) devices into one virtual device. Supports two modes:
- Sequence: LEDs concatenated end-to-end (led_count = sum of children)
- Independent: full pixel array resampled to each child independently

Includes cycle detection (DFS) to prevent circular group references,
delete protection for devices referenced by groups, recursive LED count
resolution for nested groups, and reorder controls (move up/down) for
child devices in the UI.

Backend: Device model, API schemas, GroupLEDClient, GroupDeviceProvider,
route validation, processing pipeline integration.
Frontend: type picker, child device picker with reorder, mode selector,
i18n (en/ru/zh), layers icon, CSS for group child rows.
Tests: 20 unit tests for cycle detection, LED count resolution, and
GroupLEDClient (sequence slicing, independent resampling, cleanup).
This commit is contained in:
2026-04-11 02:26:56 +03:00
parent 92585e7c19
commit 4940007e54
25 changed files with 1595 additions and 125 deletions
+28
View File
@@ -0,0 +1,28 @@
# Group Device Type Implementation
## Phase 1: Storage Layer
- [x] Add `group_device_ids`, `group_mode` fields to Device model
- [x] Add cycle detection + led_count resolution + group reference helpers to DeviceStore
## Phase 2: API Schemas
- [x] Add group fields to DeviceCreate, DeviceUpdate, DeviceResponse
## Phase 3: GroupLEDClient + Provider
- [x] Create `group_client.py` — GroupLEDClient (sequence slice / independent resample)
- [x] Create `group_provider.py` — GroupDeviceProvider
- [x] Register group provider in `led_client.py`
## Phase 4: Routes + Processing Pipeline
- [x] Update device routes — group-specific create/update logic, delete protection, cycle validation
- [x] Add group fields to DeviceInfo + _DEVICE_FIELD_DEFAULTS
- [x] Pass group context (device_store, group fields) to create_led_client
## Phase 5: Tests
- [x] Unit tests for cycle detection, led_count resolution, GroupLEDClient (20 tests, all passing)
## Phase 6: Frontend
- [x] Group device UI (child picker, mode selector, hide URL for groups)
- [x] i18n keys (en, ru, zh)
- [x] TypeScript types + API helper
- [x] Icon (layers) for group device type
- [x] CSS for group child rows