Persist device row moves

This commit is contained in:
2026-07-25 21:09:02 +02:00
parent 2eba4ea75e
commit 08a2775a88
25 changed files with 391 additions and 1678 deletions
+8 -45
View File
@@ -36,9 +36,9 @@ snapshots contain zero, one or multiple complete device rows. Move commands
contain each row's expected and target circuit plus its exact expected and
target sort order. This makes deletion and moves undoable without generating
replacement identities or renumbering circuits. Existing Circuit and
CircuitDeviceRow cell edits plus standalone insert/delete actions in the editor
consume these endpoints. Move, reorder and renumber UI paths are still being
migrated.
CircuitDeviceRow cell edits, standalone insert/delete actions and device-row
moves in the editor consume these endpoints. Reorder and renumber UI paths are
still being migrated.
`circuit-device-row.move` targets existing circuits in the same circuit list.
`circuit-device-row.move-with-new-circuit` atomically creates exactly one
@@ -169,48 +169,11 @@ Response sketch:
- `GET /circuit-sections/:sectionId/next-identifier`
- preview next identifier for section (`prefix + maxSuffix + 1`)
Circuit and device-row field updates, standalone insertions and standalone
deletions are available only as the corresponding versioned commands through
`POST /projects/:projectId/commands`. There are no direct field-update PATCH,
structure POST or CircuitDeviceRow DELETE routes. The direct
`DELETE /circuits/:circuitId` route remains temporarily for the inverse of the
not-yet-migrated placeholder move UI and must not be used by new features.
### Move Device Row
- `PATCH /circuit-device-rows/:rowId/move`
- Purpose: move one row to existing circuit or to newly created circuit in target section.
Request sketch:
```json
{
"targetCircuitId": "cir_target"
}
```
or
```json
{
"targetSectionId": "sec_target",
"createNewCircuit": true
}
```
### Bulk Move Device Rows
- `PATCH /circuit-device-rows/move-bulk`
- Purpose: move multiple rows in one command flow.
Request sketch:
```json
{
"rowIds": ["row_1", "row_2"],
"targetCircuitId": "cir_target"
}
```
Circuit and device-row field updates, standalone insertions/deletions and
single or bulk device-row moves are available only as the corresponding
versioned commands through `POST /projects/:projectId/commands`. There are no
direct field-update PATCH, structure POST, move, Circuit DELETE or
CircuitDeviceRow DELETE routes.
### Reorder Circuits
@@ -1,10 +1,10 @@
# Circuit List Editor Known Limitations
- Existing Circuit and CircuitDeviceRow cell edits plus standalone
insert/delete actions use persistent project commands and project-wide
toolbar undo/redo. The editor's visible stack is still session-local, is
empty after reload and still contains direct move/reorder/renumber operations
during the cutover.
insert/delete actions and CircuitDeviceRow moves use persistent project
commands and project-wide toolbar undo/redo. The editor's visible stack is
still session-local, is empty after reload and still contains direct
reorder/renumber operations during the cutover.
- Server-side project revisions and persistent undo/redo eligibility exist for
the command types documented in `circuit-list-editor-api.md`; complete editor
command coverage and history reconstruction are not complete.
+8 -4
View File
@@ -91,10 +91,11 @@ sowie eigenständiges Einfügen und Löschen verwendet das Grid bereits über di
öffentliche Command-Grenze. Neue Circuits und Gerätezeilen erhalten ihre stabile
UUID vor dem Command; Löschen und Undo bewahren diese Identität. Der Tree liefert
dazu `currentRevision`; Undo/Redo für diese Aktionen läuft über die projektweite
Serverhistorie. Direkte Feld-PATCH-, Struktur-POST- und Gerätezeilen-DELETE-
Endpunkte sind entfernt. Move-, Reorder- und Renumber-UI-Pfade verbleiben
vorerst im sichtbaren sitzungslokalen Stack; nach einem Reload wird dieser noch
nicht aus der Serverhistorie rekonstruiert.
Serverhistorie. Direkte Feld-PATCH-, Struktur-POST-, Move-, Circuit- und
Gerätezeilen-DELETE-Endpunkte sind entfernt. Gerätezeilen-Moves im Grid
verwenden die persistenten Kommandos bereits. Nur Reorder- und
Renumber-UI-Pfade verbleiben vorerst im sichtbaren sitzungslokalen Stack; nach
einem Reload wird dieser noch nicht aus der Serverhistorie rekonstruiert.
`circuit-device-row.move` verschiebt oder sortiert eine oder mehrere Zeilen
zwischen vorhandenen Stromkreisen derselben Liste. Erwartete und neue
Stromkreis-/Sortierpositionen machen Forward und Inverse deterministisch;
@@ -104,6 +105,9 @@ Verschieben auf einen freien Platz ab: Ein Zielstromkreis mit stabiler UUID und
BMK wird zusammen mit allen Zeilenbewegungen erzeugt. Undo stellt die exakten
Quellpositionen wieder her und löscht den erzeugten Stromkreis nur, wenn dessen
Felder und vollständiger Zeilenbestand unverändert sind.
Der Editor erzeugt die vollständigen Move-Zuweisungen aus dem geladenen Tree,
vergibt für neue Ziele vor dem Kommando eine stabile UUID und führt das
Toolbar-Undo/Redo über die projektweite Historie aus.
`circuit.reorder-section` speichert die erwartete und neue Sortierposition
jedes Stromkreises eines vollständigen Abschnitts. Forward, Undo und Redo
ändern ausschließlich `sortOrder`; Stromkreisblöcke, Gerätezeilen und BMKs
+4 -23
View File
@@ -130,27 +130,8 @@ Expected response shape:
If migrations were not applied, endpoint may return an empty fallback with a warning.
## Dev-only visual test helper (multi-device circuit)
## Visual verification
Add one extra manual device row to an existing circuit:
```bash
npm run dev:add-manual-circuit-row -- <circuitId>
```
Default inserted values:
- `name`: `Test sub device`
- `displayName`: `Beleuchtung WC`
- `phaseType`: `single_phase`
- `quantity`: `1`
- `powerPerUnit`: `0.05`
- `simultaneityFactor`: `1`
- `cosPhi`: `1`
The script prints the created row id.
Delete the test row again:
```bash
npm run dev:delete-circuit-row -- <rowId>
```
Manual device rows and multi-device circuits can be created directly in the
circuit-list editor. The former development scripts for direct database writes
were removed because they bypassed project revisions and persistent undo/redo.
@@ -194,6 +194,9 @@ Completed foundation:
empty target-circuit snapshot; forward creation and all row moves share one
transaction, while undo restores the source positions and deletes only an
unchanged generated target
- the circuit-list editor executes existing-target and generated-target row
moves through these commands; obsolete direct move and Circuit DELETE routes
plus their separate transaction adapter are removed
- `circuit.reorder-section` requires the complete section circuit set and
stores exact expected/target sort positions; its inverse changes no
equipment identifier and never splits a circuit block
@@ -211,9 +214,8 @@ Completed foundation:
Remaining constraints before completing persistent history:
- route the remaining move, reorder and renumber editor writes through their
existing typed persistent commands and remove the final direct mutation
routes
- route the remaining reorder and renumber editor writes through their existing
typed persistent commands and remove the final direct mutation routes
- reconstruct the visible frontend history state after reload; Circuit and
CircuitDeviceRow field/insert/delete actions plus ProjectDevice operations
already use persistent commands and project-wide undo