Compare commits

...
2 Commits
Author SHA1 Message Date
marco 5bb4e063da umstellung auf claud 2026-12-04 10:14:49 +01:00
marco 79c5f0c5cd Stand_2026_12_02 2026-12-02 14:47:39 +01:00
199 changed files with 7221 additions and 1317 deletions

No files matched your search

+4 -1
View File
@@ -1,2 +1,5 @@
{ {
} "editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.detectIndentation": false
}
View File
Whitespace-only changes.
+354
View File
@@ -0,0 +1,354 @@
▲ Next.js 16.1.6 (webpack)
- Local: http://localhost:3002
- Network: http://10.8.1.11:3002
- Experiments (use with caution):
· serverActions
✓ Starting...
✓ Ready in 1890ms
GET /units 200 in 2.4s (compile: 1964ms, render: 433ms)
GET /units 200 in 146ms (compile: 7ms, render: 139ms)
GET /units 200 in 139ms (compile: 75ms, render: 64ms)
GET /units 200 in 217ms (compile: 4ms, render: 213ms)
GET /units 200 in 133ms (compile: 74ms, render: 59ms)
GET /groups 200 in 1030ms (compile: 772ms, render: 258ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 1686ms (compile: 1551ms, render: 135ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 60ms (compile: 11ms, render: 49ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 51ms (compile: 11ms, render: 40ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 57ms (compile: 6ms, render: 50ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 183ms (compile: 109ms, render: 74ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 124ms (compile: 65ms, render: 59ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 106ms (compile: 44ms, render: 62ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 1153ms (compile: 1094ms, render: 59ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 1158ms (compile: 1096ms, render: 62ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 1175ms (compile: 1095ms, render: 80ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 1177ms (compile: 1094ms, render: 84ms)
GET /api/pdf-assets/pdf.worker.min.mjs 200 in 804ms (compile: 789ms, render: 15ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 200 in 58ms (compile: 13ms, render: 45ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 32ms (compile: 5ms, render: 27ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 42ms (compile: 4ms, render: 38ms)
GET /api/pdf-assets/wasm/qcms_bg.wasm 200 in 25ms (compile: 8ms, render: 17ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 120ms (compile: 56ms, render: 64ms)
GET /units 200 in 313ms (compile: 13ms, render: 299ms)
GET /projekte 200 in 2.3s (compile: 1910ms, render: 348ms)
GET /anzeigewerte/bearbeiten 200 in 2.3s (compile: 1911ms, render: 351ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 54ms (compile: 16ms, render: 38ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 55ms (compile: 14ms, render: 41ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 70ms (compile: 14ms, render: 56ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 71ms (compile: 13ms, render: 58ms)
GET /api/pdf-assets/pdf.worker.min.mjs 200 in 30ms (compile: 9ms, render: 21ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 200 in 45ms (compile: 2ms, render: 42ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 17ms (compile: 3ms, render: 13ms)
GET /api/pdf-assets/wasm/qcms_bg.wasm 200 in 14ms (compile: 2ms, render: 12ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 190ms (compile: 114ms, render: 76ms)
GET /units 200 in 71ms (compile: 13ms, render: 58ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 635ms (compile: 495ms, render: 140ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 645ms (compile: 496ms, render: 149ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 646ms (compile: 495ms, render: 151ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 650ms (compile: 494ms, render: 156ms)
GET /units 200 in 113ms (compile: 39ms, render: 74ms)
GET /api/pdf-assets/pdf.worker.min.mjs 200 in 266ms (compile: 248ms, render: 18ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 200 in 54ms (compile: 5ms, render: 49ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 39ms (compile: 9ms, render: 30ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 50ms (compile: 10ms, render: 40ms)
GET /api/pdf-assets/wasm/qcms_bg.wasm 200 in 15ms (compile: 3ms, render: 12ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 55ms (compile: 13ms, render: 42ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 53ms (compile: 8ms, render: 45ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 57ms (compile: 10ms, render: 47ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 34ms (compile: 6ms, render: 27ms)
GET /api/pdf-assets/pdf.worker.min.mjs 200 in 27ms (compile: 7ms, render: 20ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 200 in 50ms (compile: 1963µs, render: 48ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 23ms (compile: 3ms, render: 20ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 25ms (compile: 3ms, render: 23ms)
GET /api/pdf-assets/wasm/qcms_bg.wasm 200 in 21ms (compile: 3ms, render: 17ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 120ms (compile: 43ms, render: 77ms)
GET /sensoren-digital 200 in 925ms (compile: 844ms, render: 81ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 104ms (compile: 27ms, render: 77ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 50ms (compile: 9ms, render: 41ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 77ms (compile: 23ms, render: 54ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 132ms (compile: 71ms, render: 61ms)
GET /anlagen/einstellungen 200 in 389ms (compile: 341ms, render: 47ms)
GET /anlagen/einstellungen 200 in 288ms (compile: 54ms, render: 233ms)
GET /units 200 in 291ms (compile: 10ms, render: 280ms)
GET /verbindungen 200 in 737ms (compile: 668ms, render: 69ms)
GET /anlagen/einstellungen 200 in 42ms (compile: 8ms, render: 34ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 495ms (compile: 442ms, render: 52ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 501ms (compile: 444ms, render: 57ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 510ms (compile: 442ms, render: 68ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 512ms (compile: 442ms, render: 71ms)
GET /api/pdf-assets/pdf.worker.min.mjs 200 in 355ms (compile: 331ms, render: 23ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 200 in 51ms (compile: 6ms, render: 45ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 42ms (compile: 10ms, render: 33ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 44ms (compile: 9ms, render: 35ms)
GET /api/pdf-assets/wasm/qcms_bg.wasm 200 in 16ms (compile: 2ms, render: 14ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 57ms (compile: 13ms, render: 44ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 56ms (compile: 9ms, render: 47ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 68ms (compile: 10ms, render: 58ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 72ms (compile: 9ms, render: 63ms)
GET /api/pdf-assets/pdf.worker.min.mjs 200 in 22ms (compile: 6ms, render: 16ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 200 in 41ms (compile: 1978µs, render: 39ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 38ms (compile: 4ms, render: 34ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 42ms (compile: 4ms, render: 38ms)
GET /api/pdf-assets/wasm/qcms_bg.wasm 200 in 20ms (compile: 3ms, render: 17ms)
GET /anlagen/einstellungen 200 in 108ms (compile: 45ms, render: 63ms)
GET /anlagen/einstellungen 200 in 67ms (compile: 7ms, render: 60ms)
GET /anlagen/einstellungen 200 in 160ms (compile: 70ms, render: 90ms)
GET /anlagen/einstellungen 200 in 217ms (compile: 112ms, render: 105ms)
GET /anlagen/einstellungen 200 in 38ms (compile: 4ms, render: 34ms)
GET /anlagen/einstellungen 200 in 140ms (compile: 65ms, render: 75ms)
GET /anlagen/einstellungen 200 in 118ms (compile: 47ms, render: 70ms)
GET /anlagen/einstellungen 200 in 35ms (compile: 3ms, render: 32ms)
GET /anlagen/einstellungen 200 in 140ms (compile: 60ms, render: 80ms)
GET /anlagen/einstellungen 200 in 84ms (compile: 35ms, render: 48ms)
GET /anlagen/einstellungen 200 in 933ms (compile: 837ms, render: 97ms)
GET /anlagen/einstellungen 200 in 42ms (compile: 6ms, render: 36ms)
GET /anlagen/einstellungen/pdf 200 in 965ms (compile: 893ms, render: 72ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 755ms (compile: 607ms, render: 148ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 759ms (compile: 607ms, render: 152ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf 200 in 761ms (compile: 608ms, render: 153ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/units 200 in 761ms (compile: 606ms, render: 155ms)
GET /anlagen/einstellungen/pdf 200 in 107ms (compile: 37ms, render: 70ms)
GET /api/pdf-assets/pdf.worker.min.mjs 200 in 349ms (compile: 324ms, render: 25ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 200 in 58ms (compile: 12ms, render: 46ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 35ms (compile: 3ms, render: 31ms)
GET /api/anlagen/6995c490bb286cf2c27da0da/pdf/file?version=50bc04da-a60b-4fe7-a734-d43229144d6e 206 in 37ms (compile: 3ms, render: 34ms)
GET /api/pdf-assets/wasm/qcms_bg.wasm 200 in 17ms (compile: 2ms, render: 14ms)
GET /anlagen/einstellungen 200 in 84ms (compile: 33ms, render: 52ms)
GET /anlagen/einstellungen/procon 200 in 834ms (compile: 760ms, render: 73ms)
GET /anlagen/einstellungen 200 in 73ms (compile: 10ms, render: 63ms)
GET /anlagen/einstellungen 200 in 382ms (compile: 59ms, render: 323ms)
GET /anlagen/einstellungen/pdf 200 in 516ms (compile: 68ms, render: 448ms)
GET /anlagen/einstellungen 200 in 519ms (compile: 38ms, render: 481ms)
GET /anlagen/einstellungen/procon 200 in 529ms (compile: 126ms, render: 403ms)
GET /anlagen/einstellungen 200 in 167ms (compile: 119ms, render: 48ms)
GET /anlagen/einstellungen/opcua 200 in 1682ms (compile: 1409ms, render: 273ms)
GET /verbindungen 307 in 112ms (compile: 9ms, render: 103ms)
GET /sps/opcua 307 in 574ms (compile: 434ms, render: 140ms)
GET /anlagen/pdf?unit=test 307 in 570ms (compile: 457ms, render: 113ms)
GET /anlagen/einstellungen/opcua 200 in 46ms (compile: 9ms, render: 37ms)
GET /anlagen/einstellungen 200 in 36ms (compile: 6ms, render: 31ms)
GET /signals/import 200 in 1539ms (compile: 1462ms, render: 78ms)
GET /anlagen/einstellungen 200 in 58ms (compile: 11ms, render: 47ms)
GET /sps 200 in 801ms (compile: 753ms, render: 49ms)
GET /sps 200 in 35ms (compile: 3ms, render: 32ms)
GET /anlagen/einstellungen 200 in 179ms (compile: 44ms, render: 135ms)
GET /anlagen/einstellungen 200 in 171ms (compile: 94ms, render: 77ms)
GET /anlagen/einstellungen 200 in 181ms (compile: 114ms, render: 67ms)
GET /anlagen/einstellungen 200 in 141ms (compile: 72ms, render: 69ms)
GET /anlagen/einstellungen 200 in 42ms (compile: 6ms, render: 35ms)
GET /anlagen/einstellungen 200 in 162ms (compile: 93ms, render: 69ms)
GET /anlagen/einstellungen 200 in 132ms (compile: 41ms, render: 90ms)
GET /anlagen/einstellungen 200 in 155ms (compile: 90ms, render: 65ms)
GET /anlagen/einstellungen 200 in 122ms (compile: 35ms, render: 86ms)
GET /projekte 200 in 822ms (compile: 613ms, render: 210ms)
GET /projekte/system 200 in 1493ms (compile: 1220ms, render: 273ms)
GET /projekte/system/datensicherung 200 in 1495ms (compile: 1222ms, render: 274ms)
http://localhost:3000/anlage/selected/6995c490bb286cf2c27da0da
200 OK
POST /projekte 200 in 98ms (compile: 9ms, render: 89ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 785ms (compile: 683ms, render: 102ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 70ms (compile: 5ms, render: 66ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 146ms (compile: 13ms, render: 133ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 193ms (compile: 85ms, render: 108ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 145ms (compile: 40ms, render: 105ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 266ms (compile: 3ms, render: 263ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 1137ms (compile: 957ms, render: 180ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 89ms (compile: 5ms, render: 84ms)
GET /units/edit/6ae49e65706ab3f558d37066 200 in 2.1s (compile: 1873ms, render: 266ms)
POST /units/edit/6ae49e65706ab3f558d37066 200 in 86ms (compile: 10ms, render: 76ms)
POST /units/edit/6ae49e65706ab3f558d37066 200 in 37ms (compile: 4ms, render: 34ms)
GET /units/edit/6ae49e65706ab3f558d37066 200 in 75ms (compile: 12ms, render: 63ms)
POST /units/edit/6ae49e65706ab3f558d37066 200 in 39ms (compile: 6ms, render: 33ms)
POST /units/edit/6ae49e65706ab3f558d37066 200 in 35ms (compile: 3ms, render: 32ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 195ms (compile: 83ms, render: 113ms)
GET /units/edit/6ae9da372a95c343cbd959bb 200 in 83ms (compile: 23ms, render: 60ms)
POST /units/edit/6ae9da372a95c343cbd959bb 200 in 65ms (compile: 4ms, render: 61ms)
POST /units/edit/6ae9da372a95c343cbd959bb 200 in 52ms (compile: 4ms, render: 47ms)
Update unit
{
name: 'ET',
type: 'Allgemein',
groupId: '6a8bf9e853f346de0c74c3d2',
bmk: '',
prefix: 'BA1',
postfix: '',
info: '',
components: [
{
id: '6ae9da392a95c343cbd959bf',
name: 'SC',
index: 0,
prefix: '',
postfix: '',
type: 'Allgemein'
}
],
anlageId: '6995c490bb286cf2c27da0da'
}
POST /units/edit/6ae9da372a95c343cbd959bb 200 in 98ms (compile: 11ms, render: 87ms)
GET /units 200 in 896ms (compile: 799ms, render: 97ms)
GET /units 200 in 55ms (compile: 4ms, render: 51ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 111ms (compile: 13ms, render: 98ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 137ms (compile: 42ms, render: 95ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 122ms (compile: 42ms, render: 80ms)
GET /units 200 in 499ms (compile: 408ms, render: 92ms)
GET /groups 200 in 145ms (compile: 13ms, render: 132ms)
GET /groups 200 in 1217ms (compile: 878ms, render: 338ms)
GET /groups 200 in 114ms (compile: 9ms, render: 105ms)
GET /groups 200 in 76ms (compile: 4ms, render: 71ms)
GET /groups/edit/6a990c63841b680fc48955b9 200 in 1737ms (compile: 1667ms, render: 70ms)
GET /groups/edit/6a990c63841b680fc48955b9 200 in 85ms (compile: 39ms, render: 45ms)
POST /groups/edit/6a990c63841b680fc48955b9 200 in 91ms (compile: 8ms, render: 83ms)
GET /groups 200 in 376ms (compile: 12ms, render: 364ms)
GET /groups 200 in 288ms (compile: 12ms, render: 276ms)
GET /anlagen/6995c490bb286cf2c27da0da 200 in 122ms (compile: 15ms, render: 107ms)
GET /signals 200 in 1135ms (compile: 1002ms, render: 133ms)
GET /ios 200 in 865ms (compile: 693ms, render: 172ms)
GET /signals/import 200 in 731ms (compile: 669ms, render: 62ms)
GET /ios 200 in 94ms (compile: 9ms, render: 85ms)
GET /signals 200 in 64ms (compile: 11ms, render: 54ms)
GET /signals/assignments 200 in 1037ms (compile: 866ms, render: 171ms)
GET /signals 200 in 83ms (compile: 12ms, render: 71ms)
GET /signals/assignments 200 in 104ms (compile: 3ms, render: 101ms)
GET /signals 200 in 341ms (compile: 158ms, render: 183ms)
GET /signals/assignments 200 in 97ms (compile: 5ms, render: 92ms)
GET /signals 200 in 55ms (compile: 4ms, render: 51ms)
GET /signals 200 in 208ms (compile: 138ms, render: 70ms)
GET /signals/assignment 200 in 931ms (compile: 759ms, render: 172ms)
GET /signals 200 in 70ms (compile: 8ms, render: 62ms)
GET /signals/import 200 in 739ms (compile: 551ms, render: 189ms)
POST /signals/import 200 in 157ms (compile: 5ms, render: 153ms)
POST /signals/import 200 in 52ms (compile: 8ms, render: 45ms)
POST /signals/import 200 in 48ms (compile: 4ms, render: 44ms)
POST /signals/import 200 in 82ms (compile: 5ms, render: 77ms)
GET /ios 200 in 117ms (compile: 11ms, render: 105ms)
GET /signals 200 in 66ms (compile: 6ms, render: 60ms)
GET /signals/import 200 in 95ms (compile: 4ms, render: 91ms)
GET /signals/import 200 in 57ms (compile: 4ms, render: 52ms)
GET /ios 200 in 82ms (compile: 4ms, render: 78ms)
GET /signals/import 200 in 53ms (compile: 4ms, render: 49ms)
GET /ios 200 in 94ms (compile: 4ms, render: 90ms)
GET /signals 200 in 53ms (compile: 5ms, render: 48ms)
GET /signals/assignments 200 in 123ms (compile: 10ms, render: 113ms)
GET /signals/assignment 200 in 138ms (compile: 13ms, render: 125ms)
GET /signals 200 in 63ms (compile: 5ms, render: 59ms)
GET /signals/assignment 200 in 90ms (compile: 4ms, render: 86ms)
GET /signals 200 in 57ms (compile: 5ms, render: 52ms)
GET /signals 200 in 50ms (compile: 5ms, render: 44ms)
GET /signals 200 in 198ms (compile: 106ms, render: 93ms)
GET /signals 200 in 1127ms (compile: 1000ms, render: 126ms)
GET /signals 200 in 100ms (compile: 4ms, render: 96ms)
GET /signals 200 in 107ms (compile: 34ms, render: 72ms)
GET /signals 200 in 743ms (compile: 597ms, render: 145ms)
GET /signals 200 in 103ms (compile: 14ms, render: 89ms)
GET /signals 200 in 51ms (compile: 5ms, render: 45ms)
GET /signals 200 in 149ms (compile: 67ms, render: 83ms)
GET /signals 200 in 920ms (compile: 789ms, render: 131ms)
GET /signals 200 in 158ms (compile: 16ms, render: 142ms)
GET /signals 200 in 40ms (compile: 4ms, render: 36ms)
GET /signals 200 in 37ms (compile: 4ms, render: 34ms)
GET /signals 200 in 47ms (compile: 5ms, render: 42ms)
GET /signals 200 in 45ms (compile: 5ms, render: 40ms)
GET /signals 200 in 47ms (compile: 4ms, render: 43ms)
GET /signals 200 in 43ms (compile: 4ms, render: 39ms)
GET /signals 200 in 41ms (compile: 4ms, render: 37ms)
GET /signals 200 in 44ms (compile: 4ms, render: 40ms)
GET /signals 200 in 48ms (compile: 7ms, render: 41ms)
GET /signals 200 in 45ms (compile: 4ms, render: 40ms)
GET /signals 200 in 46ms (compile: 8ms, render: 38ms)
GET /signals 200 in 41ms (compile: 4ms, render: 37ms)
GET /signals 200 in 793ms (compile: 576ms, render: 217ms)
GET /signals 200 in 795ms (compile: 576ms, render: 219ms)
GET /signals 200 in 795ms (compile: 575ms, render: 219ms)
GET /signals 200 in 1629ms (compile: 1409ms, render: 220ms)
GET /signals 200 in 94ms (compile: 17ms, render: 77ms)
GET /signals 200 in 103ms (compile: 49ms, render: 54ms)
GET /signals 200 in 38ms (compile: 4ms, render: 35ms)
GET /hardware 200 in 3.3s (compile: 1988ms, render: 1308ms)
GET /hardware/io-import 200 in 3.3s (compile: 1990ms, render: 1310ms)
GET /hardware/io-zuordnung 200 in 3.3s (compile: 1988ms, render: 1323ms)
GET /hardware/zuordnung-uebersicht 200 in 3.3s (compile: 1989ms, render: 1324ms)
GET /signals 200 in 144ms (compile: 85ms, render: 59ms)
GET /signals/import 307 in 1569ms (compile: 1340ms, render: 230ms)
GET /signals 200 in 119ms (compile: 68ms, render: 51ms)
GET /signals/assignments 307 in 888ms (compile: 691ms, render: 196ms)
GET /signals 200 in 98ms (compile: 62ms, render: 36ms)
GET /signals/assignment?unitId=test 307 in 831ms (compile: 659ms, render: 172ms)
GET /signals 200 in 132ms (compile: 5ms, render: 127ms)
GET /hardware/io-zuordnung 200 in 132ms (compile: 13ms, render: 119ms)
GET /hardware/zuordnung-uebersicht 200 in 108ms (compile: 11ms, render: 96ms)
GET /hardware/io-import 200 in 49ms (compile: 11ms, render: 38ms)
GET /hardware 200 in 42ms (compile: 12ms, render: 31ms)
GET /hardware/io-import 200 in 39ms (compile: 4ms, render: 35ms)
GET /hardware/zuordnung-uebersicht 200 in 103ms (compile: 9ms, render: 94ms)
GET /hardware/io-zuordnung 200 in 90ms (compile: 4ms, render: 87ms)
GET /hardware 200 in 28ms (compile: 4ms, render: 24ms)
GET /ios 200 in 109ms (compile: 10ms, render: 99ms)
GET /signals 200 in 59ms (compile: 4ms, render: 55ms)
GET /ios 200 in 91ms (compile: 3ms, render: 88ms)
GET /signals 200 in 57ms (compile: 7ms, render: 50ms)
GET /hardware/io-zuordnung 200 in 99ms (compile: 3ms, render: 96ms)
GET /signals 200 in 47ms (compile: 4ms, render: 43ms)
GET /ios 200 in 85ms (compile: 3ms, render: 82ms)
GET /hardware/zuordnung-uebersicht 200 in 108ms (compile: 7ms, render: 101ms)
GET /hardware/io-zuordnung 200 in 101ms (compile: 4ms, render: 97ms)
GET /hardware/io-zuordnung 200 in 426ms (compile: 195ms, render: 232ms)
GET /hardware/io-zuordnung 200 in 1003ms (compile: 806ms, render: 197ms)
GET /hardware/io-zuordnung 200 in 1006ms (compile: 807ms, render: 199ms)
GET /hardware/io-zuordnung 200 in 105ms (compile: 8ms, render: 97ms)
GET /hardware/io-zuordnung 200 in 233ms (compile: 32ms, render: 202ms)
GET /hardware/io-zuordnung 200 in 150ms (compile: 19ms, render: 131ms)
GET /hardware/io-zuordnung 200 in 209ms (compile: 61ms, render: 148ms)
GET /hardware 200 in 916ms (compile: 89ms, render: 827ms)
GET /hardware/io-zuordnung 200 in 927ms (compile: 9ms, render: 918ms)
GET /hardware/zuordnung-uebersicht 200 in 928ms (compile: 49ms, render: 879ms)
GET /hardware/io-uebersicht 200 in 1994ms (compile: 1585ms, render: 409ms)
GET /hardware/zuordnung-uebersicht 200 in 149ms (compile: 12ms, render: 137ms)
GET /hardware/io-zuordnung 200 in 107ms (compile: 12ms, render: 95ms)
GET /hardware 200 in 36ms (compile: 8ms, render: 28ms)
GET /sps/io-diagnose 200 in 1046ms (compile: 969ms, render: 78ms)
POST /sps/io-diagnose 200 in 544ms (compile: 4ms, render: 541ms)
GET /sps/io-diagnose 200 in 276ms (compile: 81ms, render: 195ms)
GET /sps/io-diagnose 200 in 36ms (compile: 4ms, render: 31ms)
GET /sps/simulation 200 in 1254ms (compile: 1154ms, render: 101ms)
GET /sps/simulation 200 in 40ms (compile: 5ms, render: 35ms)
GET /sps/io-diagnose/events?anlageId=6995c490bb286cf2c27da0da&connectionId=a8539908-5b41-4f25-9aec-a2303f589776&unitId=6a8c116adbe08c3d75e3aefd&token=918c0cda145272adb570f94b75560c800bd9466062647b77be488419d9331536 200 in 23.5s (compile: 888ms, render: 22.6s)
GET /sps/opcua-strukturen 200 in 1346ms (compile: 1223ms, render: 123ms)
GET /sps/opcua-strukturen 200 in 62ms (compile: 7ms, render: 56ms)
GET /motor-opc 200 in 1371ms (compile: 1226ms, render: 144ms)
GET /motor-opc 200 in 100ms (compile: 6ms, render: 94ms)
GET /sensoren-digital/live 200 in 1523ms (compile: 1454ms, render: 69ms)
GET /sensoren-digital/live 200 in 46ms (compile: 4ms, render: 42ms)
GET /sps/sensoren-digital 200 in 2.3s (compile: 1620ms, render: 686ms)
GET /sps/sensoren-digital 200 in 77ms (compile: 16ms, render: 61ms)
GET /procon/aggregate 200 in 1600ms (compile: 1426ms, render: 174ms)
GET /procon/aggregate 200 in 100ms (compile: 6ms, render: 94ms)
GET /procon 200 in 1272ms (compile: 1207ms, render: 65ms)
GET /procon 200 in 51ms (compile: 5ms, render: 47ms)
GET /parameter 200 in 1857ms (compile: 1755ms, render: 102ms)
GET /parameter 200 in 46ms (compile: 6ms, render: 40ms)
POST /parameter 200 in 58ms (compile: 6ms, render: 52ms)
POST /parameter 200 in 43ms (compile: 4ms, render: 38ms)
GET /parameter 200 in 186ms (compile: 10ms, render: 177ms)
GET /parameter 200 in 43ms (compile: 4ms, render: 39ms)
GET /parameter 200 in 179ms (compile: 121ms, render: 58ms)
GET /parameter 200 in 135ms (compile: 11ms, render: 125ms)
GET /parameter 200 in 39ms (compile: 3ms, render: 35ms)
GET /parameter 200 in 113ms (compile: 44ms, render: 69ms)
GET /parameter 200 in 41ms (compile: 3ms, render: 38ms)
GET /parameter 200 in 116ms (compile: 47ms, render: 70ms)
GET /parameter 200 in 124ms (compile: 14ms, render: 110ms)
GET /parameter 200 in 126ms (compile: 4ms, render: 122ms)
GET /parameter 200 in 67ms (compile: 4ms, render: 63ms)
GET /parameter 200 in 141ms (compile: 7ms, render: 134ms)
GET /parameter 200 in 43ms (compile: 4ms, render: 39ms)
GET /parameter 200 in 109ms (compile: 41ms, render: 69ms)
GET /parameter 200 in 44ms (compile: 4ms, render: 41ms)
GET /parameter 200 in 37ms (compile: 4ms, render: 34ms)
GET /parameter 200 in 172ms (compile: 9ms, render: 163ms)
GET /parameter 200 in 184ms (compile: 37ms, render: 147ms)
GET /parameter 200 in 85ms (compile: 4ms, render: 82ms)
GET /parameter 200 in 49ms (compile: 6ms, render: 43ms)
GET /parameter 200 in 142ms (compile: 16ms, render: 126ms)
GET /parameter 200 in 38ms (compile: 5ms, render: 34ms)
GET /parameter 200 in 55ms (compile: 6ms, render: 49ms)
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "rk-frontend", "name": "rk-frontend",
"version": "0.1.0", "version": "0.3.6",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "rk-frontend", "name": "rk-frontend",
"version": "0.1.0", "version": "0.3.6",
"dependencies": { "dependencies": {
"@dnd-kit/core": "^6.3.1", "@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0", "@dnd-kit/sortable": "^10.0.0",
+2 -1
View File
@@ -1,6 +1,7 @@
{ {
"name": "rk-frontend", "name": "rk-frontend",
"version": "0.1.0", "version": "0.3.6",
"buildVersion": "2026.12.03.7",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev --webpack", "dev": "next dev --webpack",
+343
View File
@@ -54,3 +54,346 @@
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) { at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429' digest: '283840429'
} }
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Daten geändert. Arbeitsfläche neu laden.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_dd4fa6c7._.js:1:2075)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '734857798'
}
⨯ Error: Daten geändert. Arbeitsfläche neu laden.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_dd4fa6c7._.js:1:2075)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '734857798'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Daten geändert. Arbeitsfläche neu laden.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_dd4fa6c7._.js:1:2075)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '734857798'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Taster-Nr. fehlt in ProCon oder ist mehrfach vorhanden. Zuerst die Excel-Datei in ProCon importieren bzw. die Zuordnung korrigieren.
at h (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:4552)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '283840429'
}
⨯ Error: Daten-Nr. fehlt bei ProCon-Digitalsensoren oder ist mehrfach vorhanden. Zuerst Excel importieren.
at d (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_402782b9._.js:1:7422)
at async m (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:1:7659)
at async p (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:2713)
at async Module.L (D:\mon\rk\rk-frontend\.next\server\chunks\ssr\_9c7af7ff._.js:2:7928) {
digest: '1474552932'
}
View File
Whitespace-only changes.
+6
View File
@@ -0,0 +1,6 @@
▲ Next.js 16.1.6
- Local: http://localhost:3001
- Network: http://10.8.1.11:3001
✓ Starting...
✓ Ready in 699ms
+183
View File
@@ -0,0 +1,183 @@
const { test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const ts = require('typescript');
function load(file, mocks) {
const source = fs.readFileSync(path.join(__dirname, '..', file), 'utf8');
const code = ts.transpileModule(source, { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 } }).outputText;
const result = { exports: {} };
new Function('require', 'module', 'exports', code)(name => {
if (name === 'next/cache') return { revalidatePath() {} };
if (!mocks[name]) throw new Error('Missing mock: ' + name);
return mocks[name];
}, result, result.exports);
return result.exports;
}
const context = { anlageId: 'a', verbindungId: 'v', verbindungName: 'Test' };
function parameterFixture() {
const calls = [];
const comparisons = { ...context, version: 'hash', rows: [
{ key: 'local', local: { id: 'local', parameterNr: 1 }, remote: { Nummer: 1 }, selectable: true, issue: '' },
{ key: 'remote-2', local: null, remote: { Nummer: 2 }, selectable: false, issue: '', status: 'Nur ProCon' },
] };
const elementTable = { ...context, kind: 'aggregate', version: 1, rows: [{ id: 'e1', targetNr: 1, kategorie: 1, parameterName: 2 }] };
const mocks = {
'./api-zuordnung': {}, './api-position-table': {},
'@/actions/anzeigen/api-anzeigewerte': {}, '@/actions/sensoren/api-analog': {}, '@/actions/sensoren/api-digital': {},
'@/actions/texte/api-texte': {}, '@/actions/steuerbuttons/api-steuerbuttons': {},
'@/actions/fehlerliste/api-fehlerliste': {},
'@/actions/parameter/api-parameter': {
api_compareAllParameters: async () => ({ success: true, data: comparisons }),
api_syncAllParameters: async dto => { calls.push(dto); return { success: true, data: {} }; },
},
'@/actions/parameter/api-element-parameter': {
api_elementParameters: async () => elementTable,
api_importElementParameters: async table => { calls.push('import'); return table; },
api_compareElementParameter: async () => ({ ...context, version: 'element-hash' }),
api_syncElementParameter: async (kind, id, dto) => { calls.push({ kind, id, ...dto }); },
},
};
return { calls, comparisons, elementTable, mocks, api: () => load('src/actions/procon/api-bulk-sync.ts', mocks) };
}
test('general parameter read includes remote-only IDs; writing uses existing local IDs', async () => {
const f = parameterFixture();
let result = await f.api().api_bulkParameterArea(context, 'allgemein', 'toLocal');
assert.equal(result.completed, 2); assert.deepEqual(f.calls[0].ids, ['local', 'remote-2']);
f.calls.length = 0;
result = await f.api().api_bulkParameterArea(context, 'allgemein', 'toProcon');
assert.equal(result.completed, 1); assert.deepEqual(f.calls[0].ids, ['local']); assert.equal(result.errors.length, 1);
});
test('each element parameter area uses the requested direction and imports missing local rows only when reading', async () => {
for (const kind of ['aggregate', 'analog', 'digital', 'beschriftungen']) {
const f = parameterFixture();
let result = await f.api().api_bulkParameterArea(context, kind, 'toLocal');
assert.equal(result.completed, 1); assert.equal(f.calls[0], 'import'); assert.equal(f.calls[1].direction, 'toLocal');
f.calls.length = 0;
result = await f.api().api_bulkParameterArea(context, kind, 'toProcon');
assert.equal(result.completed, 1); assert.equal(f.calls.length, 1); assert.equal(f.calls[0].direction, 'toProcon');
}
});
test('context changes and invalid directions cause no parameter writes', async () => {
const f = parameterFixture(); f.comparisons.verbindungId = 'other';
const result = await f.api().api_bulkParameterArea(context, 'allgemein', 'toProcon');
assert.equal(result.completed, 0); assert.match(result.errors[0], /Verbindung/); assert.equal(f.calls.length, 0);
await f.api().api_bulkParameterArea(context, 'analog', 'invalid'); assert.equal(f.calls.length, 0);
});
test('parameter errors are reported with their target while successful rows remain counted', async () => {
const f = parameterFixture(); f.elementTable.rows.push({ id: 'e2', targetNr: 2, kategorie: 1, parameterName: 2 });
f.mocks['@/actions/parameter/api-element-parameter'].api_syncElementParameter = async (kind, id) => { if (id === 'e2') throw new Error('Conflict'); };
const result = await f.api().api_bulkParameterArea(context, 'aggregate', 'toProcon');
assert.equal(result.completed, 1); assert.match(result.errors[0], /2.*Conflict/);
});
test('mapping checks are read-only and applying mappings uses the reviewed version', async () => {
const f = parameterFixture(); const applied = [];
f.mocks['./api-zuordnung'] = {
api_mappingPreview: async () => ({ ...context, version: 'mapping-hash', rows: [{ status: 'gespeichert', spsAntriebId: 1 }] }),
api_mappingAccept: async dto => { applied.push(dto); return { success: true, count: 1, conflicts: 0 }; },
};
f.mocks['./api-position-table'] = { api_positionOverview: async () => ({ aggregates: context, displays: { rows: [] }, analog: { rows: [] }, digital: { rows: [] }, texts: { rows: [] }, buttons: { rows: [] } }) };
let result = await f.api().api_bulkMappings(context, false);
assert.equal(applied.length, 0); assert.equal(result.completed, 0); assert.ok(result.unchanged >= 5);
result = await f.api().api_bulkMappings(context, true);
assert.equal(result.completed, 1); assert.equal(applied[0].version, 'mapping-hash');
assert.equal(f.calls.length, 0);
await f.api().api_bulkMappings({ ...context, verbindungId: 'other' }, true);
assert.equal(applied.length, 1);
});
function layoutFixture() {
const calls = [];
const p = { id: 'main', x: 0, y: 0, width: 100, height: 40, z: 0, show: true };
const remote = { Id: 1, PositionX: 100, PositionY: 0, Width: 100, Height: 40, PositionZ: 0, Show: true };
const group = { ...context, version: 'group', masterId: 'master', mainId: 'master', elements: [{ id: 'master', local: p, procon: { ...p, x: 100 } }] };
const overview = { ...context, warnings: [], aggregates: [{ id: 1, spsAntriebId: 1, data: group }],
displays: { rows: [{ id: 'd', datenNr: 1, typ: 'Text', placements: [p] }] },
analog: { rows: [{ id: 'a', datenNr: 1, placements: [p] }] }, digital: { rows: [{ id: 's', datenNr: 1, placements: [p] }] },
buttons: { rows: [{ id: 'b', tasterNr: 1, typ: 'ButtonView', beschreibung: 'Button', placements: [p] }] },
texts: { rows: [{ id: 't', datenNr: 1, text: '', placements: [p] }] } };
const compared = { ...context, version: 'hash', local: { placements: [p], graphics: [], valuePlacementId: 'main', typ: 'ButtonView' },
remote, visuals: [{ ...remote, SensorVisualisierung_State: 2, SensorVisualisierung_ViewId: null }] };
const save = kind => async (id, dto) => { calls.push({ kind, ...dto }); return { success: true }; };
const mocks = {
'./api-overview': { api_visualizationOverview: async () => overview },
'@/actions/procon/api-group-sync': { api_groupCompare: async () => group, api_groupApply: save('aggregate') },
'@/lib/visualisierung/layout': { getMaster: aggregate => aggregate.data.elements[0] },
'@/types/sensoren/analog': { knownAnalogStates: {} }, '@/types/sensoren/digital': { knownDigitalStates: { ein: 1 } },
'@/actions/anzeigen/api-anzeigewerte': { api_compareDisplay: async () => ({ success: true, data: { ...compared, visuals: [{ ...remote, Discriminator: 'Text' }] } }), api_syncDisplay: save('display') },
'@/actions/sensoren/api-analog': { api_compareAnalog: async () => compared, api_syncAnalog: save('analog') },
'@/actions/sensoren/api-digital': { api_compareDigital: async () => ({ ...compared, local: { ...compared.local, graphics: [{ slot: 'ein', placementId: 'main' }] }, visuals: [{ ...remote, SensorVisualisierung_State: 1 }] }), api_syncDigital: save('digital') },
'@/actions/texte/api-texte': { api_compareText: async () => compared, api_syncText: save('text') },
'@/actions/steuerbuttons/api-steuerbuttons': { api_compareSteuerbutton: async () => ({ ...compared, remote: { ...remote, Typ: 2 } }), api_syncSteuerbutton: save('button') },
};
return { calls, overview, compared, mocks, api: () => load('src/actions/visualisierung/api-layout-sync.ts', mocks) };
}
test('layout reading covers all six kinds including locally empty text and only transfers layouts', async () => {
const f = layoutFixture();
const result = await f.api().api_syncAllVisualizationLayouts('a', 'v', 'toLocal');
assert.deepEqual(result.errors, []); assert.equal(result.completed, 6);
for (const call of f.calls) {
assert.equal(call.direction, 'toLocal');
if (call.kind !== 'aggregate') { assert.equal(call.fields, false); assert.equal(call.layout, true); assert.equal(call.graphics, false); }
}
});
test('layout writing retains default direction and skips empty text; context errors prevent writes', async () => {
const f = layoutFixture();
const result = await f.api().api_syncAllVisualizationLayouts('a', 'v');
assert.equal(result.completed, 5); assert.ok(f.calls.every(call => call.direction === 'toProcon'));
f.calls.length = 0; f.overview.verbindungId = 'other';
const failed = await f.api().api_syncAllVisualizationLayouts('a', 'v', 'toLocal');
assert.match(failed.errors[0], /Verbindung/); assert.equal(f.calls.length, 0);
});
test('ambiguous layout targets are reported and never chosen automatically', async () => {
const f = layoutFixture(); f.compared.visuals.push({ ...f.compared.visuals[0], Id: 2 });
const result = await f.api().api_syncAllVisualizationLayouts('a', 'v', 'toLocal');
assert.ok(result.errors.some(error => error.includes('mehrdeutig')));
assert.equal(f.calls.filter(call => call.kind === 'analog' || call.kind === 'button').length, 0);
});
function listFixture(area) {
const f = parameterFixture(), compared = [], written = [];
let revision = 0, failId = '', wrongContext = false;
const rows = [0, 1].map(n => ({ id: 'r' + n, datenNr: n, tasterNr: n, fehlerNr: n,
beschreibung: n ? 'Beschreibung' : '', text: n ? 'Text' : '', meldung: 'Fehler', placements: [{ x: n }] }));
const get = async () => ({ anlageId: 'a', version: revision, rows });
const compare = async id => {
compared.push(id);
if (id === failId) throw new Error('Missing mapping');
return { ...context, verbindungId: wrongContext ? 'other' : 'v', version: String(revision), local: rows.find(r => r.id === id) };
};
const sync = async (id, dto) => { assert.equal(dto.version, String(revision)); written.push({ id, dto }); revision++; };
const config = {
analog: ['@/actions/sensoren/api-analog', 'api_analog', 'api_compareAnalog', 'api_syncAnalog'],
digital: ['@/actions/sensoren/api-digital', 'api_digital', 'api_compareDigital', 'api_syncDigital'],
buttons: ['@/actions/steuerbuttons/api-steuerbuttons', 'api_steuerbuttons', 'api_compareSteuerbutton', 'api_syncSteuerbutton'],
texte: ['@/actions/texte/api-texte', 'api_texte', 'api_compareText', 'api_syncText'],
fehlerliste: ['@/actions/fehlerliste/api-fehlerliste', 'api_fehlerliste', 'api_compareFehler', 'api_syncFehler'],
}[area];
f.mocks[config[0]] = { [config[1]]: get, [config[2]]: compare, [config[3]]: sync };
return { ...f, rows, compared, written, fail(id) { failId = id; }, changeContext() { wrongContext = true; } };
}
test('all five list kinds transfer in both directions with fresh revisions and layout/graphics disabled', async () => {
for (const area of ['analog', 'digital', 'buttons', 'texte', 'fehlerliste']) for (const direction of ['toProcon', 'toLocal']) {
const f = listFixture(area);
const result = await f.api().api_bulkListArea(context, area, direction);
assert.deepEqual(result.errors, []);
const skipped = direction === 'toProcon' && ['buttons', 'texte'].includes(area) ? 1 : 0;
assert.equal(result.completed, 2 - skipped); assert.equal(result.unchanged, skipped);
for (const { dto } of f.written) {
assert.equal(dto.direction, direction);
if (area !== 'fehlerliste') { assert.equal(dto.fields, true); assert.equal(dto.layout, false); }
if (['analog', 'digital'].includes(area)) assert.equal(dto.graphics, false);
}
assert.deepEqual(f.rows[0].placements, [{ x: 0 }]);
}
});
test('list preflight and connection mismatches prevent all writes in the area', async () => {
const f = listFixture('digital'); f.fail('r1');
const result = await f.api().api_bulkListArea(context, 'digital', 'toProcon');
assert.equal(result.completed, 0); assert.match(result.errors[0], /Daten-Nr. 1.*Missing mapping/); assert.equal(f.written.length, 0);
const other = listFixture('fehlerliste'); other.changeContext();
await other.api().api_bulkListArea(context, 'fehlerliste', 'toLocal'); assert.equal(other.written.length, 0);
});
+15
View File
@@ -0,0 +1,15 @@
// Basis-URL des NestJS-Backends.
// Sie wird über die Umgebungsvariable BACKEND_URL gesetzt (z. B. in .env.local),
// damit ein Umzug des Backends keine Änderungen im Code erfordert.
// Ohne Variable gilt der bisherige lokale Standard.
const DEFAULT_BACKEND_URL = 'http://localhost:3000';
const TRAILING_SLASHES = /\/+$/;
const configuredBackendUrl = process.env.BACKEND_URL ?? DEFAULT_BACKEND_URL;
// Abschließende Schrägstriche entfernen, da alle Pfade mit "/" beginnen.
export const BACKEND_URL = configuredBackendUrl.replace(
TRAILING_SLASHES,
'',
);
+1 -1
View File
@@ -1,4 +1,5 @@
export const proconNavigation: { label: string; href?: string }[] = [ export const proconNavigation: { label: string; href?: string }[] = [
{ label: 'Gesamtabgleich', href: '/procon/gesamtabgleich' },
{ label: 'Aggregate', href: '/procon/aggregate' }, { label: 'Aggregate', href: '/procon/aggregate' },
{ label: 'Sensoren Analog', href: '/sensoren-analog' }, { label: 'Sensoren Analog', href: '/sensoren-analog' },
{ label: 'Sensoren Digital', href: '/sensoren-digital' }, { label: 'Sensoren Digital', href: '/sensoren-digital' },
@@ -10,5 +11,4 @@ export const proconNavigation: { label: string; href?: string }[] = [
{ label: 'Texte', href: '/texte' }, { label: 'Texte', href: '/texte' },
{ label: 'Fehlerliste', href: '/fehlerliste' }, { label: 'Fehlerliste', href: '/fehlerliste' },
{ label: 'Aggregatmeldungen', href: '/aggregat-meldungen' }, { label: 'Aggregatmeldungen', href: '/aggregat-meldungen' },
{ label: 'Verbindungen', href: '/verbindungen' },
]; ];
+3 -3
View File
@@ -3,7 +3,7 @@ import { difference } from "next/dist/build/utils"
const rkPrefix = '/alt/rk' const rkPrefix = '/alt/rk'
export const Sites = { export const Sites = {
main: { url: '/', name: 'Home' }, main: { url: '/anlagen', name: 'Übersicht' },
alt: { url: '/alt', name: 'Alt' }, alt: { url: '/alt', name: 'Alt' },
anlagen: { anlagen: {
url: `${rkPrefix}/anlagen`, url: `${rkPrefix}/anlagen`,
@@ -68,11 +68,11 @@ export const Sites = {
signals: { signals: {
url: `/signals`, name:"EA's" , url: `/signals`, name:"EA's" ,
import:{ import:{
url:`/signals/import`, name:"Import" , url:`/hardware/io-import`, name:"Import" ,
} }
}, },
ios: { url: `/ios`, name:"IO " }, ios: { url: `/hardware/io-uebersicht`, name:"IO " },
} }
+3 -1
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { DisplayTable, DisplayComparison, DisplaySlot } from '@/types/anzeigen/anzeigewerte'; import type { DisplayTable, DisplayComparison, DisplaySlot } from '@/types/anzeigen/anzeigewerte';
const url = 'http://localhost:3000/rk2/anzeigewerte'; const url = BACKEND_URL + '/rk2/anzeigewerte';
type DisplayResult<T> = { success: true; data: T } | { success: false; error: string }; type DisplayResult<T> = { success: true; data: T } | { success: false; error: string };
// Erwartete API-Fehler als Daten zurückgeben: Next.js verbirgt geworfene Server-Action-Fehler im Produktionsbetrieb. // Erwartete API-Fehler als Daten zurückgeben: Next.js verbirgt geworfene Server-Action-Fehler im Produktionsbetrieb.
@@ -25,6 +26,7 @@ export async function api_saveDisplays(table: DisplayTable) {
revalidatePath('/visualisierung'); revalidatePath('/visualisierung');
return saved; return saved;
} }
export async function api_saveDisplaysResult(table: DisplayTable) { return displayResult(() => api_saveDisplays(table)); }
export async function api_compareDisplay(id: string) { export async function api_compareDisplay(id: string) {
return displayResult(() => request<DisplayComparison>('/' + encodeURIComponent(id) + '/sync')); return displayResult(() => request<DisplayComparison>('/' + encodeURIComponent(id) + '/sync'));
} }
+2 -1
View File
@@ -1,6 +1,7 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import type {BackupData,BackupManifest} from '@/types/backup'; import type {BackupData,BackupManifest} from '@/types/backup';
const url='http://localhost:3000/rk2/backups'; const url = BACKEND_URL + '/rk2/backups';
async function request<T>(init?:RequestInit):Promise<T>{const response=await fetch(url,{cache:'no-store',...init});const data=await response.json();if(!response.ok)throw new Error(data.message??'Datensicherung fehlgeschlagen');return data;} async function request<T>(init?:RequestInit):Promise<T>{const response=await fetch(url,{cache:'no-store',...init});const data=await response.json();if(!response.ok)throw new Error(data.message??'Datensicherung fehlgeschlagen');return data;}
export async function api_backups(){return request<BackupData>();} export async function api_backups(){return request<BackupData>();}
export async function api_createBackup(native:boolean){return request<BackupManifest>({method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({native})});} export async function api_createBackup(native:boolean){return request<BackupManifest>({method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({native})});}
+2 -1
View File
@@ -1,10 +1,11 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import type { DrawRenderData, DrawRenderRequests } from '@/types/draw/draw.types'; import type { DrawRenderData, DrawRenderRequests } from '@/types/draw/draw.types';
const url = "http://localhost:3000/draw"; const url = BACKEND_URL + "/draw";
export async function api_drawRender<T extends keyof DrawRenderRequests>(grafikTyp: T, parameter: DrawRenderRequests[T],): Promise<DrawRenderData> { export async function api_drawRender<T extends keyof DrawRenderRequests>(grafikTyp: T, parameter: DrawRenderRequests[T],): Promise<DrawRenderData> {
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import {revalidatePath} from 'next/cache'; import {revalidatePath} from 'next/cache';
import type {AggregatMeldungen,AggregatMeldungComparison} from '@/types/aggregat-meldungen'; import type {AggregatMeldungen,AggregatMeldungComparison} from '@/types/aggregat-meldungen';
const url='http://localhost:3000/rk2/aggregat-meldungen'; const url = BACKEND_URL + '/rk2/aggregat-meldungen';
async function request<T>(path='',method='GET',body?:unknown):Promise<T>{const r=await fetch(url+path,{method,cache:'no-store',...(body?{headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}:{})});const data=await r.json();if(!r.ok)throw new Error(Array.isArray(data.message)?data.message.join(', '):data.message??'Anfrage fehlgeschlagen');return data;} async function request<T>(path='',method='GET',body?:unknown):Promise<T>{const r=await fetch(url+path,{method,cache:'no-store',...(body?{headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}:{})});const data=await r.json();if(!r.ok)throw new Error(Array.isArray(data.message)?data.message.join(', '):data.message??'Anfrage fehlgeschlagen');return data;}
export async function api_aggregatMeldungen(){return request<AggregatMeldungen>();} export async function api_aggregatMeldungen(){return request<AggregatMeldungen>();}
export async function api_saveAggregatMeldungen(table:AggregatMeldungen){const result=await request<AggregatMeldungen>('','PUT',table);revalidatePath('/aggregat-meldungen');return result;} export async function api_saveAggregatMeldungen(table:AggregatMeldungen){const result=await request<AggregatMeldungen>('','PUT',table);revalidatePath('/aggregat-meldungen');return result;}
+2 -1
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { FehlerTable } from '@/types/fehlerliste'; import type { FehlerTable } from '@/types/fehlerliste';
const url = 'http://localhost:3000/rk2/fehlerliste'; const url = BACKEND_URL + '/rk2/fehlerliste';
async function request(init?: RequestInit): Promise<FehlerTable> { async function request(init?: RequestInit): Promise<FehlerTable> {
const response = await fetch(url, { cache: 'no-store', ...init }); const response = await fetch(url, { cache: 'no-store', ...init });
const data = await response.json(); const data = await response.json();
+2 -1
View File
@@ -1,6 +1,7 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import type {IoDiagnosticConfig,DiagnosticReport} from '@/types/io-diagnostics'; import type {IoDiagnosticConfig,DiagnosticReport} from '@/types/io-diagnostics';
const url='http://localhost:3000/rk2/io-diagnostics'; const url = BACKEND_URL + '/rk2/io-diagnostics';
async function request<T>(path='',init?:RequestInit):Promise<T>{const r=await fetch(url+path,{cache:'no-store',...init});const data=await r.json();if(!r.ok)throw new Error(data.message??'E/A-Prüfung fehlgeschlagen');return data;} async function request<T>(path='',init?:RequestInit):Promise<T>{const r=await fetch(url+path,{cache:'no-store',...init});const data=await r.json();if(!r.ok)throw new Error(data.message??'E/A-Prüfung fehlgeschlagen');return data;}
export async function api_ioDiagnosticConfig(){return request<IoDiagnosticConfig>();} export async function api_ioDiagnosticConfig(){return request<IoDiagnosticConfig>();}
export async function api_checkIos(anlageId:string,connectionId:string){return request<DiagnosticReport>('/check',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({anlageId,connectionId})});} export async function api_checkIos(anlageId:string,connectionId:string){return request<DiagnosticReport>('/check',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({anlageId,connectionId})});}
+2 -1
View File
@@ -1,6 +1,7 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import type {SimulationData,SimulationPlan,SimulationProposal,SimulationRuntime,SimulationSelection} from '@/types/io-simulation'; import type {SimulationData,SimulationPlan,SimulationProposal,SimulationRuntime,SimulationSelection} from '@/types/io-simulation';
const url='http://localhost:3000/rk2/io-simulation'; const url = BACKEND_URL + '/rk2/io-simulation';
async function request<T>(path='',method='GET',body?:unknown):Promise<T>{const r=await fetch(url+path,{method,cache:'no-store',...(body?{headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}:{})});const data=await r.json();if(!r.ok)throw new Error(Array.isArray(data.message)?data.message.join(', '):data.message??'Simulationsanfrage fehlgeschlagen');return data;} async function request<T>(path='',method='GET',body?:unknown):Promise<T>{const r=await fetch(url+path,{method,cache:'no-store',...(body?{headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}:{})});const data=await r.json();if(!r.ok)throw new Error(Array.isArray(data.message)?data.message.join(', '):data.message??'Simulationsanfrage fehlgeschlagen');return data;}
export async function api_simulation(id?:string){return request<SimulationData>(id?'?connectionId='+encodeURIComponent(id):'');} export async function api_simulation(id?:string){return request<SimulationData>(id?'?connectionId='+encodeURIComponent(id):'');}
export async function api_saveSimulation(plan:SimulationPlan){return request<SimulationPlan>('','PUT',plan);} export async function api_saveSimulation(plan:SimulationPlan){return request<SimulationPlan>('','PUT',plan);}
+3 -2
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { OpcConfiguration, OpcEndpoint, OpcNode, OpcValue } from '@/types/opcua'; import type { OpcConfiguration, OpcEndpoint, OpcNode, OpcValue } from '@/types/opcua';
const url = 'http://localhost:3000/rk2/opcua'; const url = BACKEND_URL + '/rk2/opcua';
async function request<T>(path = '', init?: RequestInit): Promise<T> { async function request<T>(path = '', init?: RequestInit): Promise<T> {
const response = await fetch(url + path, { cache: 'no-store', ...init }); const response = await fetch(url + path, { cache: 'no-store', ...init });
const data = await response.json(); const data = await response.json();
@@ -11,7 +12,7 @@ async function request<T>(path = '', init?: RequestInit): Promise<T> {
export async function api_opcConfiguration() { return request<OpcConfiguration>(); } export async function api_opcConfiguration() { return request<OpcConfiguration>(); }
export async function api_saveOpcConfiguration(data: OpcConfiguration) { export async function api_saveOpcConfiguration(data: OpcConfiguration) {
const saved = await request<OpcConfiguration>('', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }); const saved = await request<OpcConfiguration>('', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) });
revalidatePath('/sps/opcua'); return saved; revalidatePath('/anlagen/einstellungen/opcua'); return saved;
} }
async function operation<T>(id: string, action: string, data: object) { async function operation<T>(id: string, action: string, data: object) {
return request<T>('/' + encodeURIComponent(id) + '/' + action, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) }); return request<T>('/' + encodeURIComponent(id) + '/' + action, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(data) });
+2 -1
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { OpcStructure, StructuresData, StructureWriteResult } from '@/types/opcua-structures'; import type { OpcStructure, StructuresData, StructureWriteResult } from '@/types/opcua-structures';
const url = 'http://localhost:3000/rk2/opcua-structures'; const url = BACKEND_URL + '/rk2/opcua-structures';
async function request<T>(path = '', method = 'GET', body?: unknown): Promise<T> { async function request<T>(path = '', method = 'GET', body?: unknown): Promise<T> {
const response = await fetch(url + path, { method, cache: 'no-store', ...(body ? { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) } : {}) }); const response = await fetch(url + path, { method, cache: 'no-store', ...(body ? { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) } : {}) });
const result = await response.json(); const result = await response.json();
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import {revalidatePath} from 'next/cache'; import {revalidatePath} from 'next/cache';
import type {ElementParameterTable,ElementParameterComparison,ParameterKind} from '@/types/element-parameter'; import type {ElementParameterTable,ElementParameterComparison,ParameterKind} from '@/types/element-parameter';
const url='http://localhost:3000/rk2/element-parameter/'; const url = BACKEND_URL + '/rk2/element-parameter/';
async function request<T>(kind:ParameterKind,path='',method='GET',body?:unknown):Promise<T>{const r=await fetch(url+kind+path,{method,cache:'no-store',...(body?{headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}:{})});const data=await r.json();if(!r.ok)throw new Error(Array.isArray(data.message)?data.message.join(', '):data.message??'Parameteranfrage fehlgeschlagen');return data;} async function request<T>(kind:ParameterKind,path='',method='GET',body?:unknown):Promise<T>{const r=await fetch(url+kind+path,{method,cache:'no-store',...(body?{headers:{'Content-Type':'application/json'},body:JSON.stringify(body)}:{})});const data=await r.json();if(!r.ok)throw new Error(Array.isArray(data.message)?data.message.join(', '):data.message??'Parameteranfrage fehlgeschlagen');return data;}
function revalidate(kind:ParameterKind){revalidatePath(kind==='beschriftungen'?'/parameter-beschriftungen':'/parameter/'+kind);} function revalidate(kind:ParameterKind){revalidatePath(kind==='beschriftungen'?'/parameter-beschriftungen':'/parameter/'+kind);}
export async function api_elementParameters(kind:ParameterKind){return request<ElementParameterTable>(kind);} export async function api_elementParameters(kind:ParameterKind){return request<ElementParameterTable>(kind);}
+2 -1
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { ParameterTable, ParameterComparison, ParameterBulkComparison, ProconParameterValues } from '@/types/parameter'; import type { ParameterTable, ParameterComparison, ParameterBulkComparison, ProconParameterValues } from '@/types/parameter';
const url = 'http://localhost:3000/rk2/parameter'; const url = BACKEND_URL + '/rk2/parameter';
type ParameterResult<T> = { success: true; data: T } | { success: false; error: string }; type ParameterResult<T> = { success: true; data: T } | { success: false; error: string };
async function syncRequest<T>(path: string, init?: RequestInit): Promise<ParameterResult<T>> { async function syncRequest<T>(path: string, init?: RequestInit): Promise<ParameterResult<T>> {
+160
View File
@@ -0,0 +1,160 @@
'use server';
import { revalidatePath } from 'next/cache';
import { api_mappingPreview, api_mappingAccept } from './api-zuordnung';
import { api_compareAllParameters, api_syncAllParameters } from '@/actions/parameter/api-parameter';
import { api_elementParameters, api_importElementParameters, api_compareElementParameter, api_syncElementParameter } from '@/actions/parameter/api-element-parameter';
import { api_positionOverview } from './api-position-table';
import { api_compareDisplay } from '@/actions/anzeigen/api-anzeigewerte';
import { api_analog, api_compareAnalog, api_syncAnalog } from '@/actions/sensoren/api-analog';
import { api_digital, api_compareDigital, api_syncDigital } from '@/actions/sensoren/api-digital';
import { api_texte, api_compareText, api_syncText } from '@/actions/texte/api-texte';
import { api_steuerbuttons, api_compareSteuerbutton, api_syncSteuerbutton } from '@/actions/steuerbuttons/api-steuerbuttons';
import { api_fehlerliste, api_compareFehler, api_syncFehler } from '@/actions/fehlerliste/api-fehlerliste';
import type { BulkReport, ListArea, ParameterArea, SyncContext, SyncDirection } from '@/types/procon/bulk-sync';
function scope(expected: Pick<SyncContext, 'anlageId' | 'verbindungId'>, actual: { anlageId: string; verbindungId: string }) {
if (!expected.verbindungId || expected.anlageId !== actual.anlageId || expected.verbindungId !== actual.verbindungId)
throw new Error('Anlage oder ProCon-Verbindung geändert. Bitte Seite neu laden.');
}
function errorText(cause: unknown) { return cause instanceof Error ? cause.message : 'Abgleich fehlgeschlagen.'; }
export async function api_bulkListArea(context: SyncContext, area: ListArea, direction: SyncDirection): Promise<BulkReport> {
const report: BulkReport = { completed: 0, unchanged: 0, errors: [] };
try {
if (!['toLocal', 'toProcon'].includes(direction)) throw new Error('Ungültige Richtung.');
type Comparison = { anlageId: string; verbindungId: string; version: string; local: unknown };
const fields = { direction, fields: true, layout: false, graphics: false, targets: {} };
async function transfer<T extends { id: string }>(table: { anlageId: string; rows: T[] }, compare: (id: string) => Promise<Comparison>,
apply: (id: string, dto: SyncContext & { version: string; direction: SyncDirection }) => Promise<unknown>,
label: (row: T) => string, skip: (row: T) => boolean = () => false) {
if (table.anlageId !== context.anlageId) throw new Error('Anlage geändert. Bitte neu laden.');
const rows = table.rows.filter(row => !skip(row));
report.unchanged = table.rows.length - rows.length;
// Fehlende Zuordnungen vor dem ersten Schreiben des Bereichs melden.
for (const row of rows) {
try {
const c = await compare(row.id); scope(context, c);
if (JSON.stringify(c.local) !== JSON.stringify(row)) throw new Error('Lokale Liste geändert. Bitte neu laden.');
} catch (cause) { throw new Error(`${label(row)}: ${errorText(cause)} Keine Zeile dieses Bereichs übertragen.`); }
}
for (const row of rows) {
try {
// Auch beim Senden speichern manche Einzelabgleiche die lokale Tabelle und erhöhen deren Revision.
const c = await compare(row.id); scope(context, c);
if (JSON.stringify(c.local) !== JSON.stringify(row)) throw new Error('Lokale Zeile inzwischen geändert. Bitte neu laden.');
await apply(row.id, { ...context, version: c.version, direction });
report.completed++;
} catch (cause) {
report.errors.push(`${label(row)}: ${errorText(cause)} Abbruch nach ${report.completed} von ${rows.length} Zeilen. Erfolgreiche Übernahmen bleiben erhalten; bei Verbindungsabbruch die letzte Zeile vergleichen.`);
return;
}
}
}
switch (area) {
case 'analog': await transfer(await api_analog(), api_compareAnalog, (id, dto) => api_syncAnalog(id, { ...dto, ...fields }), row => `Daten-Nr. ${row.datenNr}`); break;
case 'digital': await transfer(await api_digital(), api_compareDigital, (id, dto) => api_syncDigital(id, { ...dto, ...fields }), row => `Daten-Nr. ${row.datenNr}`); break;
case 'buttons': await transfer(await api_steuerbuttons(), api_compareSteuerbutton, (id, dto) => api_syncSteuerbutton(id, { ...dto, fields: true, layout: false }), row => `Taster-Nr. ${row.tasterNr}`, row => direction === 'toProcon' && !row.beschreibung.trim()); break;
case 'texte': await transfer(await api_texte(), api_compareText, (id, dto) => api_syncText(id, { ...dto, fields: true, layout: false }), row => `Daten-Nr. ${row.datenNr}`, row => direction === 'toProcon' && !row.text.trim()); break;
case 'fehlerliste': await transfer(await api_fehlerliste(), api_compareFehler, api_syncFehler, row => `Fehler-Nr. ${row.fehlerNr}`); break;
default: throw new Error('Ungültiger Listenbereich.');
}
revalidatePath('/procon/gesamtabgleich'); revalidatePath('/visualisierung');
const path = area === 'analog' || area === 'digital' ? `/sensoren-${area}` : area === 'buttons' ? '/steuerbuttons' : `/${area}`;
revalidatePath(path); revalidatePath(path + '/bearbeiten');
} catch (cause) { report.errors.push(errorText(cause)); }
return report;
}
export async function api_bulkSyncContext(): Promise<{ ok: true; data: SyncContext } | { ok: false; error: string }> {
try {
const data = await api_mappingPreview();
return { ok: true, data: { anlageId: data.anlageId, verbindungId: data.verbindungId, verbindungName: data.verbindungName } };
} catch (cause) { return { ok: false, error: errorText(cause) }; }
}
export async function api_bulkParameterArea(context: SyncContext, area: ParameterArea, direction: SyncDirection): Promise<BulkReport> {
const report: BulkReport = { completed: 0, unchanged: 0, errors: [] };
try {
if (!['toLocal', 'toProcon'].includes(direction)) throw new Error('Ungültige Richtung.');
if (area === 'allgemein') {
const compared = await api_compareAllParameters();
if (!compared.success) throw new Error(compared.error);
const c = compared.data; scope(context, c);
const readable = (row: typeof c.rows[number]) => direction === 'toLocal' && !row.local && row.remote && !row.issue;
for (const row of c.rows.filter(row => !row.selectable && !readable(row)))
report.errors.push(`${row.local?.parameterNr ?? row.remote?.Nummer}: ${row.issue || row.status}`);
const ids = c.rows.filter(row => row.selectable || readable(row)).map(row => row.local?.id ?? row.key);
if (ids.length) {
const saved = await api_syncAllParameters({ ...context, version: c.version, direction, ids });
if (!saved.success) throw new Error(saved.error);
report.completed = ids.length;
}
} else {
if (!['aggregate', 'analog', 'digital', 'beschriftungen'].includes(area)) throw new Error('Ungültiger Parameterbereich.');
let table = await api_elementParameters(area); scope(context, table);
// Beim Einlesen auch bisher fehlende lokale Parameter aus vorhandenen ProCon-Datensätzen übernehmen.
if (direction === 'toLocal') table = await api_importElementParameters(table);
for (const row of table.rows) {
try {
const c = await api_compareElementParameter(area, row.id); scope(context, c);
await api_syncElementParameter(area, row.id, { ...context, version: c.version, direction });
report.completed++;
} catch (cause) {
report.errors.push(`${row.targetNr ?? 'Beschriftung'} / ${row.kategorie}:${row.parameterName}: ${errorText(cause)}`);
// Kontextwechsel nicht mit weiteren Schreibzugriffen fortsetzen.
const current = await api_elementParameters(area); scope(context, current);
}
}
}
revalidatePath('/procon/gesamtabgleich');
} catch (cause) { report.errors.push(errorText(cause)); }
return report;
}
export async function api_bulkMappings(context: SyncContext, apply: boolean): Promise<BulkReport> {
const report: BulkReport = { completed: 0, unchanged: 0, errors: [] };
try {
const mapping = await api_mappingPreview(); scope(context, mapping);
if (apply) {
const result = await api_mappingAccept({ ...context, version: mapping.version });
if (!result.success) throw new Error(result.error);
report.completed += result.count;
if (result.conflicts) report.errors.push(`${result.conflicts} Aggregat-Zuordnungskonflikte: unter Zuordnung Aggregate prüfen.`);
} else {
report.unchanged += mapping.rows.filter(row => row.status === 'gespeichert' || row.status === 'eindeutig').length;
for (const row of mapping.rows.filter(row => !['gespeichert', 'eindeutig'].includes(row.status)))
report.errors.push(`Aggregat ${row.spsAntriebId}: ${row.status}`);
}
const data = await api_positionOverview(); scope(context, data.aggregates);
const groups = [
{ label: 'Anzeige', rows: data.displays.rows, compare: async (id: string) => { const r = await api_compareDisplay(id); if (!r.success) throw new Error(r.error); return r.data; } },
{ label: 'Analog', rows: data.analog.rows, compare: api_compareAnalog },
{ label: 'Digital', rows: data.digital.rows, compare: api_compareDigital },
{ label: 'Text', rows: data.texts.rows.filter(row => row.text.trim()), compare: api_compareText },
];
for (const group of groups) for (const row of group.rows) {
try { scope(context, await group.compare(row.id)); report.unchanged++; }
catch (cause) { report.errors.push(`${group.label} ${row.datenNr}: ${errorText(cause)}`); }
}
for (const row of data.buttons.rows.filter(row => row.beschreibung.trim())) {
try { scope(context, await api_compareSteuerbutton(row.id)); report.unchanged++; }
catch (cause) { report.errors.push(`Steuertaster ${row.tasterNr}: ${errorText(cause)}`); }
}
const general = await api_compareAllParameters();
if (!general.success) throw new Error(general.error);
scope(context, general.data);
for (const row of general.data.rows) {
if (row.selectable) report.unchanged++;
else report.errors.push(`Allgemeiner Parameter ${row.local?.parameterNr ?? row.remote?.Nummer}: ${row.issue || row.status}`);
}
for (const kind of ['aggregate', 'analog', 'digital', 'beschriftungen'] as const) {
const table = await api_elementParameters(kind); scope(context, table);
for (const row of table.rows) {
try { scope(context, await api_compareElementParameter(kind, row.id)); report.unchanged++; }
catch (cause) { report.errors.push(`Parameter ${kind} ${row.targetNr ?? ''} / ${row.kategorie}:${row.parameterName}: ${errorText(cause)}`); }
}
}
revalidatePath('/procon/zuordnung'); revalidatePath('/visualisierung');
} catch (cause) { report.errors.push(errorText(cause)); }
return report;
}
+2 -1
View File
@@ -1,8 +1,9 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import type { GroupSyncData } from '@/types/procon/group-sync'; import type { GroupSyncData } from '@/types/procon/group-sync';
import type { GroupSyncValues } from '@/types/procon/group-sync'; import type { GroupSyncValues } from '@/types/procon/group-sync';
import type { GrafikGeneratorDaten } from '@/types/anlagen/procon-view-aggregate'; import type { GrafikGeneratorDaten } from '@/types/anlagen/procon-view-aggregate';
const url = (id: number) => 'http://localhost:3000/procon/aggregate/' + id + '/arbeitsflaeche'; const url = (id: number) => BACKEND_URL + '/procon/aggregate/' + id + '/arbeitsflaeche';
export async function api_groupCompare(id: number): Promise<GroupSyncData> { export async function api_groupCompare(id: number): Promise<GroupSyncData> {
const response = await fetch(url(id), { cache: 'no-store' }); const response = await fetch(url(id), { cache: 'no-store' });
if (!response.ok) { const error = await response.json(); throw new Error(error.message ?? 'Arbeitsfläche konnte nicht geladen werden'); } if (!response.ok) { const error = await response.json(); throw new Error(error.message ?? 'Arbeitsfläche konnte nicht geladen werden'); }
+2 -1
View File
@@ -1,11 +1,12 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { ProConAggregate, ProConAggVisu } from "@/types/procon"; import { ProConAggregate, ProConAggVisu } from "@/types/procon";
const url = "http://localhost:3000/procon/"; const url = BACKEND_URL + "/procon/";
const url_aggrgate = url + "aggregate" const url_aggrgate = url + "aggregate"
export async function api_ProconAggregate_Visualisierungen(id: number): Promise<{ export async function api_ProconAggregate_Visualisierungen(id: number): Promise<{
+2 -1
View File
@@ -1,9 +1,10 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { ProConAnzeige, ProConAnzeigeVisuElement } from "@/types/procon/anzeigen"; import { ProConAnzeige, ProConAnzeigeVisuElement } from "@/types/procon/anzeigen";
const url = "http://localhost:3000/procon/"; const url = BACKEND_URL + "/procon/";
const url_anzeigen = url + "anzeigen" const url_anzeigen = url + "anzeigen"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+2 -1
View File
@@ -1,10 +1,11 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { ProConMeldung } from "@/types/procon/meldungen"; import { ProConMeldung } from "@/types/procon/meldungen";
const url = "http://localhost:3000/procon/"; const url = BACKEND_URL + "/procon/";
const url_meldungen = url + "meldungen" const url_meldungen = url + "meldungen"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
+2 -1
View File
@@ -1,9 +1,10 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { ProConSensor, ProConSensorVisuElement } from "@/types/procon/sensoren"; import { ProConSensor, ProConSensorVisuElement } from "@/types/procon/sensoren";
const url = "http://localhost:3000/procon/"; const url = BACKEND_URL + "/procon/";
const url_sensoren = url + "sensoren" const url_sensoren = url + "sensoren"
const digital ="digital"; const digital ="digital";
const analog = "analog"; const analog = "analog";
+2 -1
View File
@@ -1,9 +1,10 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { ProConText } from "@/types/procon/texte"; import { ProConText } from "@/types/procon/texte";
const url = "http://localhost:3000/procon/"; const url = BACKEND_URL + "/procon/";
const url_texte = url + "texte" const url_texte = url + "texte"
export async function api_ProconTexte_getTexte(): Promise<ProConText[]> { export async function api_ProconTexte_getTexte(): Promise<ProConText[]> {
+2 -1
View File
@@ -1,10 +1,11 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
const url = "http://localhost:3000/procon/"; const url = BACKEND_URL + "/procon/";
const url_views = url + "views" const url_views = url + "views"
export async function api_ProconViews_UpdateXAML(id: string, xamlBase64: string): Promise<ActionResult<unknown>> { export async function api_ProconViews_UpdateXAML(id: string, xamlBase64: string): Promise<ActionResult<unknown>> {
@@ -1,11 +1,12 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { ProConAggregate, ProConView } from "@/types/procon"; import { ProConAggregate, ProConView } from "@/types/procon";
const url = "http://localhost:3000/procon/"; const url = BACKEND_URL + "/procon/";
const url_visualisierungen = url + "visu" const url_visualisierungen = url + "visu"
export async function api_ProconVisualisierungen_Update(id: number, data: Partial<ProConView>): Promise<ActionResult<unknown>> { export async function api_ProconVisualisierungen_Update(id: number, data: Partial<ProConView>): Promise<ActionResult<unknown>> {
+21
View File
@@ -0,0 +1,21 @@
'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache';
import type { ProjectImportContext, ProjectImportPreview, ProjectImportResult } from '@/types/procon/project-import';
const url = BACKEND_URL + '/procon/project-import';
async function request<T>(action: string, input: unknown): Promise<T> {
const response = await fetch(`${url}/${action}`, { method: 'POST', cache: 'no-store', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(input) });
const data = await response.json();
if (!response.ok) throw new Error(Array.isArray(data.message) ? data.message.join('; ') : data.message ?? 'Projektimport fehlgeschlagen.');
return data;
}
export async function api_previewProjectImport(context: ProjectImportContext, choices: Record<string, string>): Promise<ProjectImportPreview> {
return request('preview', { ...context, choices });
}
export async function api_applyProjectImport(preview: ProjectImportPreview, choices: Record<string, string>): Promise<ProjectImportResult> {
const result = await request<ProjectImportResult>('apply', { anlageId: preview.anlageId, verbindungId: preview.verbindungId, version: preview.version, choices });
// Also refresh after partially completed imports.
revalidatePath('/', 'layout');
return result;
}
+76 -1
View File
@@ -1,6 +1,30 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import type { SyncData, SyncRequest } from '@/types/procon/sync'; import type { SyncData, SyncRequest } from '@/types/procon/sync';
const url = (id: number, visuId: number) => 'http://localhost:3000/procon/aggregate/' + id + '/visualisierungen/' + visuId + '/sync'; import { api_groupCompare } from './api-group-sync';
import { api_savedAggregateLinks } from './api-zuordnung';
import { api_viewAggregate_exportXaml } from '@/actions/rk2/api-procon-view-aggregate';
function url(id: number, visuId: number): string {
return `${BACKEND_URL}/procon/aggregate/${id}/visualisierungen/${visuId}/sync`;
}
export async function api_exportAggregateXaml(id: number, version: string) {
try {
const group = await api_groupCompare(id);
if (group.version !== version) throw new Error('Daten geändert. Bitte die Arbeitsfläche neu laden.');
const mappings = await api_savedAggregateLinks();
if (mappings.anlageId !== group.anlageId || mappings.verbindungId !== group.verbindungId)
throw new Error('Anlage oder Verbindung geändert. Bitte neu laden.');
const links = mappings.links.filter(link => link.proConAggregateId === id);
if (links.length !== 1) throw new Error('Aggregat ist nicht eindeutig zugeordnet.');
const elementKeys = group.elements.filter(element => element.hasXaml).map(element => element.key);
if (!elementKeys.length) throw new Error('Keine gespeicherten XAML-Grafiken vorhanden.');
return await api_viewAggregate_exportXaml(group.anlageId, [{ componentId: links[0].componentId, elementKeys }]);
} catch (cause) {
return { success: false as const, error: cause instanceof Error ? cause.message : 'XAML-Dateien konnten nicht abgelegt werden.' };
}
}
export async function api_syncCompare(id: number, visuId: number): Promise<SyncData> { export async function api_syncCompare(id: number, visuId: number): Promise<SyncData> {
const response = await fetch(url(id, visuId), { cache: 'no-store' }); const response = await fetch(url(id, visuId), { cache: 'no-store' });
if (!response.ok) { const error = await response.json(); throw new Error(error.message ?? 'Vergleich fehlgeschlagen'); } if (!response.ok) { const error = await response.json(); throw new Error(error.message ?? 'Vergleich fehlgeschlagen'); }
@@ -14,3 +38,54 @@ export async function api_syncApply(id: number, visuId: number, dto: SyncRequest
} catch { return { success: false, error: 'Keine Verbindung zum Backend. Vor erneutem Übernehmen Daten neu laden.' }; } } catch { return { success: false, error: 'Keine Verbindung zum Backend. Vor erneutem Übernehmen Daten neu laden.' }; }
} }
export async function api_syncAllAggregateXaml(id: number, version: string) {
const result = { completed: 0, unchanged: 0, errors: [] as string[] };
try {
const group = await api_groupCompare(id);
if (group.version !== version) throw new Error('Daten geändert. Bitte die Arbeitsfläche neu laden.');
const tasks: { visualizationId: number; viewId: string; state: string; xaml: string; compared: SyncData }[] = [];
const normalize = (name: string) => name.replace(/\.xaml$/i, '').toLowerCase();
for (const element of group.elements.filter(e => e.hasXaml)) {
try {
if (element.visualizationId === null) throw new Error('Keine ProCon-Visualisierung zugeordnet.');
const compared = await api_syncCompare(id, element.visualizationId);
if (compared.anlageId !== group.anlageId || compared.verbindungId !== group.verbindungId)
throw new Error('Anlage oder Verbindung geändert.');
if (!compared.variants.length) throw new Error('Keine gespeicherten XAML-Varianten vorhanden.');
for (const variant of compared.variants) {
const matches = compared.views.filter(view => {
const name = normalize(view.id);
return variant.libraryName ? name === normalize(variant.libraryName)
: name.endsWith(`_${compared.key}_${variant.state}`.toLowerCase());
});
// Die Views gehören bereits genau dieser Visualisierung; Zustandsnamen sind daher eindeutig prüfbar.
const candidates = matches.length || variant.libraryName ? matches : compared.views.filter(view => normalize(view.id).endsWith(`_${variant.state}`.toLowerCase()));
const targets = candidates.length || variant.libraryName ? candidates : compared.variants.length === 1 && compared.views.length === 1 ? compared.views : [];
if (targets.length !== 1 || !variant.xaml.trim()) {
result.errors.push(`${element.key} / ${variant.state}: ${!variant.xaml.trim() ? 'XAML ist leer.' : 'ProCon-Datei fehlt oder ist mehrdeutig. Bitte einzeln abgleichen.'}`);
continue;
}
tasks.push({ visualizationId: element.visualizationId, viewId: targets[0].id, state: variant.state, xaml: variant.xaml, compared });
}
} catch (cause) { result.errors.push(`${element.key}: ${cause instanceof Error ? cause.message : 'Vergleich fehlgeschlagen'}`); }
}
const seen = new Set<string>();
const current = new Map<number, SyncData>();
for (const task of tasks) {
if (seen.has(task.viewId)) continue;
seen.add(task.viewId);
if (tasks.some(other => other.viewId === task.viewId && other.xaml !== task.xaml)) {
result.errors.push(`${task.viewId}: Unterschiedliche lokale XAML-Daten für dieselbe ProCon-Datei. Bitte einzeln abgleichen.`);
continue;
}
const compared = current.get(task.visualizationId) ?? task.compared;
if (compared.views.find(v => v.id === task.viewId)?.xaml === task.xaml) { result.unchanged++; continue; }
const saved = await api_syncApply(id, task.visualizationId, { version: compared.version, direction: 'toProcon',
values: compared.procon, xamlOnly: true, viewId: task.viewId, state: task.state, xaml: task.xaml });
if (saved.success) { current.set(task.visualizationId, saved.data); result.completed++; }
else result.errors.push(`${compared.key} / ${task.state}: ${saved.error}`);
}
} catch (cause) { result.errors.push(cause instanceof Error ? cause.message : 'XAML-Übertragung fehlgeschlagen'); }
return result;
}
+2 -1
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import type { MappingPreview } from '@/types/procon/zuordnung'; import type { MappingPreview } from '@/types/procon/zuordnung';
import type { SavedAggregateLinks } from '@/types/procon/zuordnung'; import type { SavedAggregateLinks } from '@/types/procon/zuordnung';
const url = 'http://localhost:3000/procon/aggregate/zuordnung'; const url = BACKEND_URL + '/procon/aggregate/zuordnung';
export async function api_savedAggregateLinks(): Promise<SavedAggregateLinks> { export async function api_savedAggregateLinks(): Promise<SavedAggregateLinks> {
const response = await fetch(url + '/gespeichert', { cache: 'no-store' }); const response = await fetch(url + '/gespeichert', { cache: 'no-store' });
if (!response.ok) throw new Error('Gespeicherte Zuordnung konnte nicht geladen werden.'); if (!response.ok) throw new Error('Gespeicherte Zuordnung konnte nicht geladen werden.');
+59 -27
View File
@@ -1,53 +1,85 @@
'use server' 'use server'
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { Anlage } from "@/types/rk"; import { Anlage } from "@/types/rk";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
function toAnlageSummary(anlage: Anlage): Anlage {
return {
id: anlage.id,
name: anlage.name,
anlageNr: anlage.anlageNr,
selected: anlage.selected,
};
}
export async function api_anlage_create(input: { name: string; anlageNr: number }): Promise<Anlage> {
const response = await fetch(`${BACKEND_URL}/anlage`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(input),
});
const data = await response.json();
if (!response.ok) {
throw new Error(data.message ?? 'Anlage konnte nicht angelegt werden.');
}
revalidatePath(Sites.anlagen.url);
revalidatePath('/projekte');
return toAnlageSummary(data);
}
export async function api_anlagen_getAll(): Promise<Anlage[]> { export async function api_anlagen_getAll(): Promise<Anlage[]> {
const result = await fetch(`${BACKEND_URL}/anlage`, {
cache: 'no-store',
method: 'GET',
headers: { 'Content-Type': 'application/json' },
});
const result = await fetch(`http://localhost:3000/anlage`, { const data = await result.json();
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json(); if (!result.ok || !Array.isArray(data)) {
throw new Error('Die Anlagenliste konnte nicht geladen werden.');
}
return data; return data.map(toAnlageSummary);
} }
export async function api_anlage_getSelected(): Promise<Anlage> { export async function api_anlage_getSelected(): Promise<Anlage> {
const result = await fetch(`${BACKEND_URL}/anlage/selected`, {
cache: 'no-store',
method: 'GET',
headers: { 'Content-Type': 'application/json' },
});
const result = await fetch(`http://localhost:3000/anlage/selected`, { const data = await result.json();
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json(); return data;
return data;
} }
export async function api_anlage_setSelected(id: string): Promise<Anlage> { export async function api_anlage_setSelected(id: string): Promise<Anlage> {
console.log(`http://localhost:3000/anlage/selected/${id}`); const requestUrl = `${BACKEND_URL}/anlage/selected/${id}`;
const result = await fetch(`http://localhost:3000/anlage/selected/${id}`, { console.log(requestUrl);
method: 'PATCH',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json(); const result = await fetch(requestUrl, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
});
const data = await result.json();
console.log(result.status, result.statusText); console.log(result.status, result.statusText);
if (!result.ok) { if (!result.ok) {
const error = await result.text(); throw new Error(data.message ?? `Anlage konnte nicht ausgewählt werden (${result.status}).`);
throw new Error(`API Fehler ${result.status}: ${error}`); }
}
revalidatePath(Sites.anlagen.url); revalidatePath('/', 'layout');
return data;
return toAnlageSummary(data);
} }
+29 -28
View File
@@ -1,28 +1,29 @@
import { DrawShapeData, DrawShapeOptionen } from "@/types/draw/draw.types"; import { BACKEND_URL } from '@/_config/backend';
import { Anlage } from "@/types/rk"; import { DrawShapeData, DrawShapeOptionen } from "@/types/draw/draw.types";
import { Anlage } from "@/types/rk";
export async function drawGetSvg(name: string, optionen?: DrawShapeOptionen): Promise<DrawShapeData> {
export async function drawGetSvg(name: string, optionen?: DrawShapeOptionen): Promise<DrawShapeData> {
let optionenStr = ''; let optionenStr = '';
if (optionen) {
optionenStr = '?' if (optionen) {
optionenStr = '?';
let separator = ''
for (const [key, value] of Object.entries(optionen)) { let separator = '';
optionenStr += separator + key + "=" + value; for (const [key, value] of Object.entries(optionen)) {
separator = '&' optionenStr += separator + key + "=" + value;
} separator = '&';
console.log(optionenStr) }
} console.log(optionenStr);
}
const result = await fetch(`http://localhost:3000/draw/gurtfoerderer${optionenStr}`, {
method: 'GET', const result = await fetch(`${BACKEND_URL}/draw/gurtfoerderer${optionenStr}`, {
headers: { 'Content-Type': 'application/json' } method: 'GET',
}); headers: { 'Content-Type': 'application/json' },
});
const data = await result.json() as DrawShapeData;
const data = await result.json() as DrawShapeData;
return data;
} return data;
}␍
+67 -62
View File
@@ -1,96 +1,101 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { Element, ElementCreate, ElementFilterOptionen, ElementUpdate } from "@/types/rk"; import { Element, ElementCreate, ElementFilterOptionen, ElementUpdate } from "@/types/rk";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
export async function api_ElementsGet(filter?: ElementFilterOptionen): Promise<Element[]> { export async function api_ElementsGet(filter?: ElementFilterOptionen): Promise<Element[]> {
let filterStr = '';
let filterStr = ''; if (filter) {
filterStr = '?';
if (filter) { let separator = '';
filterStr = '?'
let separator = '' for (const [key, value] of Object.entries(filter)) {
for (const [key, value] of Object.entries(filter)) { filterStr += separator + key + "=" + value;
separator = '&';
}
}
filterStr += separator + key + "=" + value; const result = await fetch(`${BACKEND_URL}/element${filterStr}`, {
separator = '&' method: 'GET',
} headers: { 'Content-Type': 'application/json' },
} });
const data = await result.json();
const result = await fetch(`http://localhost:3000/element${filterStr}`, { return data;
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json();
return data;
} }
export async function elementCreate(data: ElementCreate): Promise<ActionResult<Element>> { export async function elementCreate(data: ElementCreate): Promise<ActionResult<Element>> {
const result = await fetch(`${BACKEND_URL}/element`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const result = await fetch('http://localhost:3000/element', { const resultData = await result.json();
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.elements.url + "/");
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.elements.url+"/") return {
return { success: true, data: resultData }; success: true,
data: resultData,
};
} }
export async function elementUpdate(id: string, data: ElementUpdate): Promise<ActionResult<Element>> { export async function elementUpdate(id: string, data: ElementUpdate): Promise<ActionResult<Element>> {
const result = await fetch(`${BACKEND_URL}/element/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const result = await fetch(`http://localhost:3000/element/${id}`, { const resultData = await result.json();
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.elements.url);
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.elements.url);
return { success: true, data: resultData };
return {
success: true,
data: resultData,
};
} }
export async function api_elementDelete(id: string): Promise<ActionResult<Element>> { export async function api_elementDelete(id: string): Promise<ActionResult<Element>> {
const result = await fetch(`${BACKEND_URL}/element/${id}`, {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
});
const result = await fetch(`http://localhost:3000/element/${id}`, { const resultData = await result.json();
method: 'DELETE',
headers: { 'Content-Type': 'application/json' }
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.elements.url);
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.elements.url); return {
return { success: true, data: resultData }; success: true,
data: resultData,
} };
}
+17 -15
View File
@@ -1,24 +1,26 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
export async function uploadFile(formData: FormData) { export async function uploadFile(formData: FormData) {
const file = formData.get('file') as File; const file = formData.get('file') as File;
if (!file) { if (!file) {
throw new Error('Keine Datei'); throw new Error('Keine Datei');
} }
// Neues FormData für NestJS // Neues FormData für NestJS
const backendForm = new FormData(); const backendForm = new FormData();
backendForm.append('file', file); backendForm.append('file', file);
const res = await fetch('http://localhost:3000/draw/upload', { const res = await fetch(`${BACKEND_URL}/draw/upload`, {
method: 'POST', method: 'POST',
body: backendForm, body: backendForm,
}); });
if (!res.ok) { if (!res.ok) {
throw new Error('Upload fehlgeschlagen'); throw new Error('Upload fehlgeschlagen');
} }
return await res.json(); return await res.json();
} }
+73 -64
View File
@@ -1,97 +1,106 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { Group, GroupCreate, GroupFilterOptionen, GroupUpdate } from "@/types/rk"; import { Group, GroupCreate, GroupFilterOptionen, GroupUpdate } from "@/types/rk";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
export async function api_GroupAll(filter?: GroupFilterOptionen): Promise<Group[]> { export async function api_GroupAll(filter?: GroupFilterOptionen): Promise<Group[]> {
let filterStr = '';
let filterStr = '';
if (filter) {
filterStr = '?'
let separator = '' if (filter) {
for (const [key, value] of Object.entries(filter)) { filterStr = '?';
filterStr += separator + key + "=" + value; let separator = '';
separator = '&'
}
console.log(filterStr)
console.log(`http://localhost:3000/group${filter}`);
}
for (const [key, value] of Object.entries(filter)) {
const result = await fetch(`http://localhost:3000/group${filterStr}`, { filterStr += separator + key + "=" + value;
method: 'GET', separator = '&';
headers: { 'Content-Type': 'application/json' } }
});
const data = await result.json(); console.log(filterStr);
console.log(`${BACKEND_URL}/group${filter}`);
}
return data; const result = await fetch(`${BACKEND_URL}/group${filterStr}`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
});
const data = await result.json();
return data;
} }
export async function groupCreate(data: GroupCreate): Promise<ActionResult<Group>> { export async function groupCreate(data: GroupCreate): Promise<ActionResult<Group>> {
const result = await fetch(`${BACKEND_URL}/group`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const result = await fetch('http://localhost:3000/group', { const resultData = await result.json();
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.groups.url);
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.groups.url) return {
return { success: true,data:resultData }; success: true,
data: resultData,
};
} }
export async function groupUpdate(id: string, data: GroupUpdate): Promise<ActionResult<Group>> { export async function groupUpdate(id: string, data: GroupUpdate): Promise<ActionResult<Group>> {
const result = await fetch(`${BACKEND_URL}/group/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const result = await fetch(`http://localhost:3000/group/${id}`, { const resultData = await result.json();
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.groups.url);
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.groups.url);
return { success: true,data:resultData };
return {
success: true,
data: resultData,
};
} }
export async function api_groupDelete(id: string): Promise<ActionResult<Group>> { export async function api_groupDelete(id: string): Promise<ActionResult<Group>> {
console.log('delete Group') console.log('delete Group');
const result = await fetch(`http://localhost:3000/group/${id}`, {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' }
})
const resultData = await result.json(); const result = await fetch(`${BACKEND_URL}/group/${id}`, {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
});
if (!result.ok) { const resultData = await result.json();
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.groups.url); if (!result.ok) {
return { success: true,data:resultData }; return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
} revalidatePath(Sites.groups.url);
return {
success: true,
data: resultData,
};
}
+69 -63
View File
@@ -1,97 +1,103 @@
"use server" "use server"
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { LogNote, LogNoteCreate, LogNoteFilterOptionen, LogNoteUpdate } from "@/types/rk"; import { LogNote, LogNoteCreate, LogNoteFilterOptionen, LogNoteUpdate } from "@/types/rk";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
const path ="log-note" const path = "log-note";
export async function api_LogNoteGet(filter?: LogNoteFilterOptionen): Promise<LogNote[]> { export async function api_LogNoteGet(filter?: LogNoteFilterOptionen): Promise<LogNote[]> {
let filterStr = '';
let filterStr = ''; if (filter) {
filterStr = '?';
if (filter) { let separator = '';
filterStr = '?'
let separator = '' for (const [key, value] of Object.entries(filter)) {
for (const [key, value] of Object.entries(filter)) { filterStr += separator + key + "=" + value;
separator = '&';
}
}
filterStr += separator + key + "=" + value; const result = await fetch(`${BACKEND_URL}/${path}${filterStr}`, {
separator = '&' method: 'GET',
} headers: { 'Content-Type': 'application/json' },
} });
const data = await result.json();
const result = await fetch(`http://localhost:3000/${path}${filterStr}`, { return data;
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json();
return data;
} }
export async function api_logNoteCreate(data: LogNoteCreate): Promise<ActionResult<LogNote>> { export async function api_logNoteCreate(data: LogNoteCreate): Promise<ActionResult<LogNote>> {
const result = await fetch(`${BACKEND_URL}/${path}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const result = await fetch(`http://localhost:3000/${path}`, { const resultData = await result.json();
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { // revalidatePath(Sites.elements.url)
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
// revalidatePath(Sites.elements.url) return {
return { success: true, data: resultData }; success: true,
data: resultData,
};
} }
export async function api_logNoteUpdate(id: string, data: LogNoteUpdate): Promise<ActionResult<LogNote>> { export async function api_logNoteUpdate(id: string, data: LogNoteUpdate): Promise<ActionResult<LogNote>> {
const result = await fetch(`${BACKEND_URL}/${path}/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const result = await fetch(`http://localhost:3000/${path}/${id}`, { const resultData = await result.json();
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.logNote.url);
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.logNote.url);
return { success: true, data: resultData };
return {
success: true,
data: resultData,
};
} }
export async function api_logNoteDelete(id: string): Promise<ActionResult<LogNote>> { export async function api_logNoteDelete(id: string): Promise<ActionResult<LogNote>> {
const result = await fetch(`${BACKEND_URL}/${path}/${id}`, {
method: 'DELETE',
headers: { 'Content-Type': 'application/json' },
});
const result = await fetch(`http://localhost:3000/${path}/${id}`, { const resultData = await result.json();
method: 'DELETE',
headers: { 'Content-Type': 'application/json' }
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.logNote.url);
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.logNote.url); return {
return { success: true, data: resultData }; success: true,
data: resultData,
} };
}
+53 -39
View File
@@ -1,60 +1,74 @@
"use server"; "use server";
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { Group, Peripherie, PeripherieFilterOptionen, PeripherieUpdate } from "@/types/rk"; import { Group, Peripherie, PeripherieFilterOptionen, PeripherieUpdate } from "@/types/rk";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
export async function PeripherieFindApi(filter?: PeripherieFilterOptionen): Promise<Peripherie[]> { export async function PeripherieFindApi(filter?: PeripherieFilterOptionen): Promise<Peripherie[]> {
let filterStr = ''; // URLSearchParams setzt die "&"-Trenner und kodiert die Werte.
if (filter && (filter.adrByte || filter.elementId || filter.groupId)) { const query = new URLSearchParams();
filterStr = '?'
if (filter.adrByte) filterStr += 'adrByte=' + filter.adrByte;
if (filter.groupId) filterStr += 'groupId=' + filter.groupId;
if (filter.elementId) filterStr += 'elementId=' + filter.elementId;
}
console.log(`http://localhost:3000/peripherie` + filterStr)
const result = await fetch(`http://localhost:3000/peripherie` + filterStr, {
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json(); if (filter?.adrByte) {
query.set('adrByte', String(filter.adrByte));
}
return data; if (filter?.groupId) {
query.set('groupId', filter.groupId);
}
if (filter?.elementId) {
query.set('elementId', filter.elementId);
}
const queryString = query.toString();
const filterStr = queryString ? '?' + queryString : '';
const requestUrl = `${BACKEND_URL}/peripherie${filterStr}`;
console.log(requestUrl);
const result = await fetch(requestUrl, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
});
const data = await result.json();
return data;
} }
export async function GetEA_Differences(): Promise<Peripherie[]> { export async function GetEA_Differences(): Promise<Peripherie[]> {
const result = await fetch(`${BACKEND_URL}/peripherie/differences`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
});
const result = await fetch(`http://localhost:3000/peripherie/differences`, { const data = await result.json();
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json(); return data;
return data;
} }
export async function api_peripherieUpdate(id: string, data: PeripherieUpdate): Promise<ActionResult<Peripherie>> { export async function api_peripherieUpdate(id: string, data: PeripherieUpdate): Promise<ActionResult<Peripherie>> {
const result = await fetch(`${BACKEND_URL}/peripherie/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const result = await fetch(`http://localhost:3000/peripherie/${id}`, { const resultData = await result.json();
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.peripheries.url);
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.peripheries.url); return {
return { success: true, data: resultData }; success: true,
data: resultData,
} };
}
+2 -1
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import type { ProConConnections } from '@/types/rk/procon-verbindungen'; import type { ProConConnections } from '@/types/rk/procon-verbindungen';
const url = (id: string) => 'http://localhost:3000/anlage/' + encodeURIComponent(id) + '/procon-verbindungen'; const url = (id: string) => BACKEND_URL + '/anlage/' + encodeURIComponent(id) + '/procon-verbindungen';
export async function api_connections(id: string): Promise<ProConConnections> { export async function api_connections(id: string): Promise<ProConConnections> {
const response = await fetch(url(id), { cache: 'no-store' }); const response = await fetch(url(id), { cache: 'no-store' });
if (!response.ok) throw new Error('Verbindungen konnten nicht geladen werden.'); if (!response.ok) throw new Error('Verbindungen konnten nicht geladen werden.');
+42 -41
View File
@@ -1,64 +1,65 @@
'use server' 'use server'
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { VisuElement, VisuElementCreate, VisuElementUpdate } from "@/types/visu/visuElements.types"; import { VisuElement, VisuElementCreate, VisuElementUpdate } from "@/types/visu/visuElements.types";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
export async function api_VisuElementsAll(): Promise<VisuElement[]> { export async function api_VisuElementsAll(): Promise<VisuElement[]> {
const result = await fetch(`${BACKEND_URL}/visu-elements`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
});
const data = await result.json() as VisuElement[];
return data;
const result = await fetch(`http://localhost:3000/visu-elements`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json() as VisuElement[];
return data;
} }
export async function api_VisuElementCreate(data: VisuElementCreate): Promise<ActionResult<VisuElement>> { export async function api_VisuElementCreate(data: VisuElementCreate): Promise<ActionResult<VisuElement>> {
const result = await fetch(`${BACKEND_URL}/visu-elements/`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const resultData = await result.json();
const result = await fetch(`http://localhost:3000/visu-elements/`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.visu.url);
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.visu.url); return {
return { success: true, data: resultData }; success: true,
data: resultData,
};
} }
export async function api_VisuElementUpdate(id: string, data: VisuElementUpdate): Promise<ActionResult<VisuElement>> { export async function api_VisuElementUpdate(id: string, data: VisuElementUpdate): Promise<ActionResult<VisuElement>> {
const result = await fetch(`${BACKEND_URL}/visu-elements/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
});
const resultData = await result.json();
const result = await fetch(`http://localhost:3000/visu-elements/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json(); if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
if (!result.ok) { revalidatePath(Sites.visu.url);
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.visu.url); return {
return { success: true, data: resultData }; success: true,
data: resultData,
};
} }
+24
View File
@@ -0,0 +1,24 @@
'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache';
import type { AblaufData, AblaufTable, AblaufSource, AblaufCheck } from '@/types/anlagen/ablaeufe';
import type { PlanCatalog, BoxSimulation, GraphProposal, BoxPreview } from '@/types/anlagen/materialfluss';
const url = BACKEND_URL + '/rk2/ablaeufe';
async function request<T>(path = '', method = 'GET', table?: AblaufTable): Promise<T> {
const response = await fetch(url + path, { method, cache: 'no-store', headers: { 'Content-Type': 'application/json' },
...(table ? { body: JSON.stringify({ anlageId: table.anlageId, version: table.version, workflows: table.workflows }) } : {}) });
const data = await response.json();
if (!response.ok) throw new Error(Array.isArray(data.message) ? data.message.join('; ') : data.message ?? 'Abläufe konnten nicht geladen werden.');
return data;
}
export async function api_ablaeufe(): Promise<AblaufData> { return request(); }
export async function api_checkAblaeufe(table: AblaufTable): Promise<{ sources: AblaufSource[]; excludedSources: AblaufSource[]; checks: AblaufCheck[]; catalog: PlanCatalog }> { return request('/check', 'POST', table); }
export async function api_previewMaterialPlan(table: AblaufTable, workflowId: string, boxState?: BoxSimulation): Promise<{ graph?: GraphProposal; box?: BoxPreview }> {
const response = await fetch(url + '/preview-plan', { method: 'POST', cache: 'no-store', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ table: { anlageId: table.anlageId, version: table.version, workflows: table.workflows }, workflowId, boxState }) });
const result = await response.json();
if (!response.ok) throw new Error(Array.isArray(result.message) ? result.message.join('; ') : result.message ?? 'Vorschau fehlgeschlagen.');
return result;
}
export async function api_saveAblaeufe(table: AblaufTable): Promise<Omit<AblaufData, 'anlageName'>> {
const result = await request<Omit<AblaufData, 'anlageName'>>('', 'PUT', table); revalidatePath('/ablaeufe'); return result;
}
+2 -1
View File
@@ -1,11 +1,12 @@
'use server' 'use server'
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { ComponentCreate, ComponentOfUnit, ComponentResponse, ComponentUpdate } from "@/types/anlagen/components"; import { ComponentCreate, ComponentOfUnit, ComponentResponse, ComponentUpdate } from "@/types/anlagen/components";
import { UnitResponse } from "@/types/anlagen/units"; import { UnitResponse } from "@/types/anlagen/units";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
const url = "http://localhost:3000/rk2/"; const url = BACKEND_URL + "/rk2/";
const url_component = url + "components" const url_component = url + "components"
+81
View File
@@ -0,0 +1,81 @@
'use server';
import { api_units } from './api-units';
import { api_signals } from './api-signals';
import { api_visuAggregate } from './api-visu-aggregate';
import { api_analog } from '@/actions/sensoren/api-analog';
import { api_digital } from '@/actions/sensoren/api-digital';
import { api_displays } from '@/actions/anzeigen/api-anzeigewerte';
import { api_texte } from '@/actions/texte/api-texte';
import { api_fehlerliste } from '@/actions/fehlerliste/api-fehlerliste';
import { api_aggregatMeldungen } from '@/actions/fehlerliste/api-aggregat-meldungen';
import { api_parameters } from '@/actions/parameter/api-parameter';
import { api_elementParameters } from '@/actions/parameter/api-element-parameter';
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
import { createGroupContent } from '@/lib/groups/content';
import type { GroupResponse } from '@/types/anlagen/groups';
export async function api_groupOverview(groups: GroupResponse[], anlageId: string) {
const warnings: string[] = [];
async function optional<T>(label: string, task: Promise<T>, fallback: T): Promise<T> {
try {
return await task;
} catch {
warnings.push(`${label} konnten nicht geladen werden.`);
return fallback;
}
}
async function rows<T>(task: Promise<{ anlageId: string; rows: T[] }>): Promise<T[]> {
const table = await task;
if (table.anlageId !== anlageId) {
throw new Error('Die aktive Anlage wurde geändert.');
}
return table.rows;
}
const [units, signals, analog, digital, aggregates, displays, texts, messages, aggregateMessages, parameters, aggregateParameters, analogParameters, digitalParameters, labels] = await Promise.all([
api_units(),
optional('Signale', api_signals(), []),
optional('Analogsensoren', rows(api_analog()), []),
optional('Digitalsensoren', rows(api_digital()), []),
optional('VisuAggregate', api_visuAggregate(), []),
optional('Anzeigen', rows(api_displays()), []),
optional('Texte', rows(api_texte()), []),
optional('Allgemeine Meldungen', rows(api_fehlerliste()), []),
optional('Aggregatmeldungen', rows(api_aggregatMeldungen()), []),
optional('Allgemeine Parameter', rows(api_parameters()), []),
optional('Aggregatparameter', rows(api_elementParameters('aggregate')), []),
optional('Analogsensorparameter', rows(api_elementParameters('analog')), []),
optional('Digitalsensorparameter', rows(api_elementParameters('digital')), []),
optional('Parameterbeschriftungen', rows(api_elementParameters('beschriftungen')), []),
]);
const selected = await api_anlage_getSelected();
const plantChanged = selected.id !== anlageId || units.some(unit => unit.anlageId && unit.anlageId !== anlageId);
if (plantChanged) {
throw new Error('Die aktive Anlage wurde geändert. Bitte die Gruppenansicht neu laden.');
}
const sections = createGroupContent(groups, {
units,
signals,
analog,
digital,
aggregates,
displays,
texts,
messages,
aggregateMessages,
parameters,
elementParameters: {
aggregate: aggregateParameters,
analog: analogParameters,
digital: digitalParameters,
beschriftungen: labels,
},
});
return { sections, warnings: warnings.sort() };
}
+29 -17
View File
@@ -1,10 +1,12 @@
'use server' 'use server'
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { GroupCreate, GroupResponse } from "@/types/anlagen/groups"; import { GroupCreate, GroupResponse } from "@/types/anlagen/groups";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
import { api_units } from './api-units';
const url = "http://localhost:3000/rk2/"; const url = BACKEND_URL + "/rk2/";
const url_groups = url + "groups" const url_groups = url + "groups"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -98,22 +100,32 @@ export async function api_groups_update(id:string,data: GroupCreate): Promise<Ac
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//--- Groups DELETE //--- Groups DELETE
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
export async function api_groups_delete(id:string): Promise<ActionResult<GroupResponse>> { export async function api_groups_delete(id: string): Promise<ActionResult<GroupResponse>> {
console.log('Update group' + id); try {
const result = await fetch(`${url_groups}/${id}`, { // Auch vor dem nächsten Backend-Deployment keine belegten Gruppen löschen.
method: 'DELETE', const [groups, units] = await Promise.all([api_groups(), api_units()]);
headers: { 'Content-Type': 'application/json' }, if (!groups.some(group => group.id === id)) {
}) return { success: false, errors: ['Gruppe in der aktiven Anlage nicht gefunden.'] };
}
if (groups.some(group => group.parentId === id) || units.some(unit => unit.groupId === id)) {
return {
success: false,
errors: ['Die Gruppe enthält noch Units oder Untergruppen. Bitte zuerst verschieben oder entfernen.'],
};
}
const resultData = await result.json(); const response = await fetch(`${url_groups}/${encodeURIComponent(id)}`, { method: 'DELETE' });
const data = await response.json();
if (!response.ok) {
const errors = Array.isArray(data.message) ? data.message : [data.message ?? 'Löschen fehlgeschlagen.'];
return { success: false, errors };
}
if (!result.ok) { revalidatePath('/groups');
return { revalidatePath('/units');
success: false, revalidatePath('/anlagen/[id]', 'page');
errors: resultData.message, // kommt aus NestJS return { success: true, data };
}; } catch {
} return { success: false, errors: ['Keine Verbindung zum Backend. Bitte die Gruppenliste prüfen.'] };
}
revalidatePath(Sites.rk2.groups.url)
return { success: true, data:resultData };
} }
+2 -1
View File
@@ -1,10 +1,11 @@
'use server' 'use server'
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import type { IoBulkUpdateResult, IoCreate, IoResponse, IoUpdate } from "@/types/anlagen/ios"; import type { IoBulkUpdateResult, IoCreate, IoResponse, IoUpdate } from "@/types/anlagen/ios";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
const url_ios = "http://localhost:3000/rk2/ios"; const url_ios = BACKEND_URL + "/rk2/ios";
function getErrors(data: unknown, status: number): string[] { function getErrors(data: unknown, status: number): string[] {
if (typeof data === 'object' && data !== null && 'message' in data) { if (typeof data === 'object' && data !== null && 'message' in data) {
+2 -1
View File
@@ -1,6 +1,7 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { ProConViewAggregateData, ViewElement, ViewAggregateOverview } from '@/types/anlagen/procon-view-aggregate'; import { ProConViewAggregateData, ViewElement, ViewAggregateOverview } from '@/types/anlagen/procon-view-aggregate';
const url = 'http://localhost:3000/rk2/procon-view-aggregate/'; const url = BACKEND_URL + '/rk2/procon-view-aggregate/';
export async function api_viewAggregate_exportXaml(anlageId: string, auswahl: { componentId: string; elementKeys: string[] }[]) { export async function api_viewAggregate_exportXaml(anlageId: string, auswahl: { componentId: string; elementKeys: string[] }[]) {
try { try {
+12 -11
View File
@@ -1,10 +1,11 @@
'use server' 'use server'
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { SignalCreate, IoExcelData, SignalResponse } from "@/types/anlagen/signals"; import { SignalCreate, IoExcelData, SignalResponse } from "@/types/anlagen/signals";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
const url = "http://localhost:3000/rk2/"; const url = BACKEND_URL + "/rk2/";
const url_signals = url + "signals" const url_signals = url + "signals"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -21,14 +22,14 @@ export async function api_signal_assignIo(id: string, ioId: string | null): Prom
if (!response.ok) { if (!response.ok) {
const data: unknown = await response.json().catch(() => null); const data: unknown = await response.json().catch(() => null);
const message = typeof data === 'object' && data !== null && 'message' in data ? data.message : undefined; const message = typeof data === 'object' && data !== null && 'message' in data ? data.message : undefined;
return { success: false, errors: [typeof message === 'string' ? message : 'IO-Zuordnung fehlgeschlagen.'] }; return { success: false, errors: [typeof message === 'string' ? message : 'Zuordnung IOs fehlgeschlagen.'] };
} }
const data: SignalResponse = await response.json(); const data: SignalResponse = await response.json();
revalidatePath('/signals/assignment'); revalidatePath('/hardware/io-zuordnung');
revalidatePath('/signals/assignments'); revalidatePath('/hardware/zuordnung-uebersicht');
return { success: true, data }; return { success: true, data };
} catch { } catch {
return { success: false, errors: ['IO-Zuordnung konnte nicht gespeichert werden.'] }; return { success: false, errors: ['Zuordnung IOs konnte nicht gespeichert werden.'] };
} }
} }
@@ -43,8 +44,8 @@ export async function api_signals_assignIos(assignments: { signalId: string; ioI
return { success: false, errors: [typeof message === 'string' ? message : 'Zuordnungen konnten nicht gespeichert werden.'] }; return { success: false, errors: [typeof message === 'string' ? message : 'Zuordnungen konnten nicht gespeichert werden.'] };
} }
const data: SignalResponse[] = await response.json(); const data: SignalResponse[] = await response.json();
revalidatePath('/signals/assignment'); revalidatePath('/hardware/io-zuordnung');
revalidatePath('/signals/assignments'); revalidatePath('/hardware/zuordnung-uebersicht');
return { success: true, data }; return { success: true, data };
} catch { return { success: false, errors: ['Zuordnungen konnten nicht gespeichert werden.'] }; } } catch { return { success: false, errors: ['Zuordnungen konnten nicht gespeichert werden.'] }; }
} }
@@ -147,8 +148,8 @@ export async function api_signals_update(id:string,data: SignalCreate): Promise<
revalidatePath(Sites.rk2.signals.url) revalidatePath(Sites.rk2.signals.url)
if (data.componentId) revalidatePath(`${Sites.rk2.signals.url}/${data.componentId}`); if (data.componentId) revalidatePath(`${Sites.rk2.signals.url}/${data.componentId}`);
revalidatePath('/signals/assignment'); revalidatePath('/hardware/io-zuordnung');
revalidatePath('/signals/assignments'); revalidatePath('/hardware/zuordnung-uebersicht');
return { success: true, data:resultData }; return { success: true, data:resultData };
} }
@@ -162,8 +163,8 @@ export async function api_signals_delete(id: string): Promise<ActionResult<Signa
} }
const data: SignalResponse = await response.json(); const data: SignalResponse = await response.json();
if (data.componentId) revalidatePath(`${Sites.rk2.signals.url}/${data.componentId}`); if (data.componentId) revalidatePath(`${Sites.rk2.signals.url}/${data.componentId}`);
revalidatePath('/signals/assignment'); revalidatePath('/hardware/io-zuordnung');
revalidatePath('/signals/assignments'); revalidatePath('/hardware/zuordnung-uebersicht');
return { success: true, data }; return { success: true, data };
} catch { return { success: false, errors: ['Signal konnte nicht gelöscht werden.'] }; } } catch { return { success: false, errors: ['Signal konnte nicht gelöscht werden.'] }; }
} }
+53
View File
@@ -0,0 +1,53 @@
'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache';
import type { UnitMaterialSettings, MaterialSensor } from '@/types/anlagen/materialfluss';
export interface UnitMaterialData {
anlageId: string;
version: number;
settings: UnitMaterialSettings;
sensors: MaterialSensor[];
}
// Ohne Daten wird gelesen (GET), mit Daten gespeichert (PUT).
async function request(id: string, data?: UnitMaterialData): Promise<UnitMaterialData> {
const requestUrl = `${BACKEND_URL}/rk2/units/${encodeURIComponent(id)}/materialfluss`;
const method = data ? 'PUT' : 'GET';
const body = data
? JSON.stringify({
anlageId: data.anlageId,
version: data.version,
settings: data.settings,
})
: undefined;
const response = await fetch(requestUrl, {
method,
cache: 'no-store',
headers: { 'Content-Type': 'application/json' },
body,
});
const result = await response.json();
if (!response.ok) {
throw new Error(result.message ?? 'Unit-Materialfluss konnte nicht gespeichert werden.');
}
return result;
}
export async function api_unitMaterial(id: string) {
return request(id);
}
export async function api_saveUnitMaterial(id: string, data: UnitMaterialData) {
const result = await request(id, data);
revalidatePath('/ablaeufe');
return result;
}
+4 -3
View File
@@ -1,10 +1,11 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import { UnitTemplate, UnitTemplateData } from '@/types/anlagen/unit-templates'; import { UnitTemplate, UnitTemplateData } from '@/types/anlagen/unit-templates';
import { UnitCopy, UnitResponse } from '@/types/anlagen/units'; import { UnitCopy, UnitResponse } from '@/types/anlagen/units';
const url = 'http://localhost:3000/rk2/unit-templates'; const url = BACKEND_URL + '/rk2/unit-templates';
async function request<T>(path: string, method: string, data?: unknown): Promise<ActionResult<T>> { async function request<T>(path: string, method: string, data?: unknown): Promise<ActionResult<T>> {
try { try {
const response = await fetch(url + path, { const response = await fetch(url + path, {
@@ -32,8 +33,8 @@ export async function api_templates_insert(id: string, data: UnitCopy) {
if (result.success) { if (result.success) {
revalidatePath('/units'); revalidatePath('/units');
revalidatePath('/signals'); revalidatePath('/signals');
revalidatePath('/signals/assignment'); revalidatePath('/hardware/io-zuordnung');
revalidatePath('/signals/assignments'); revalidatePath('/hardware/zuordnung-uebersicht');
} }
return result; return result;
} }
+4 -3
View File
@@ -1,11 +1,12 @@
'use server' 'use server'
import { BACKEND_URL } from '@/_config/backend';
import { Sites } from "@/_config/sites"; import { Sites } from "@/_config/sites";
import { ComponentCreate, ComponentUpdate } from "@/types/anlagen/components"; import { ComponentCreate, ComponentUpdate } from "@/types/anlagen/components";
import { UnitCopy, UnitCreate, UnitResponse } from "@/types/anlagen/units"; import { UnitCopy, UnitCreate, UnitResponse } from "@/types/anlagen/units";
import { revalidatePath } from "next/cache"; import { revalidatePath } from "next/cache";
const url = "http://localhost:3000/rk2/"; const url = BACKEND_URL + "/rk2/";
const url_units = url + "units" const url_units = url + "units"
const comp_update = "component" const comp_update = "component"
const comp_add = "addComponent" const comp_add = "addComponent"
@@ -17,8 +18,8 @@ export async function api_units_delete(id: string): Promise<ActionResult<UnitRes
if (!response.ok) return { success: false, errors: Array.isArray(result.message) ? result.message : [result.message ?? 'Löschen fehlgeschlagen'] }; if (!response.ok) return { success: false, errors: Array.isArray(result.message) ? result.message : [result.message ?? 'Löschen fehlgeschlagen'] };
revalidatePath('/units'); revalidatePath('/units');
revalidatePath('/signals'); revalidatePath('/signals');
revalidatePath('/signals/assignment'); revalidatePath('/hardware/io-zuordnung');
revalidatePath('/signals/assignments'); revalidatePath('/hardware/zuordnung-uebersicht');
return { success: true, data: result }; return { success: true, data: result };
} catch { } catch {
return { success: false, errors: ['Löschen fehlgeschlagen. Bitte die Unit-Liste prüfen und gegebenenfalls erneut versuchen.'] }; return { success: false, errors: ['Löschen fehlgeschlagen. Bitte die Unit-Liste prüfen und gegebenenfalls erneut versuchen.'] };
+19 -1
View File
@@ -1,8 +1,26 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { VisuAggregateInput, VisuAggregateRow } from '@/types/anlagen/visu-aggregate'; import { VisuAggregateInput, VisuAggregateRow } from '@/types/anlagen/visu-aggregate';
import { revalidatePath } from 'next/cache';
import type { AggregateTableComparison, AggregateSyncField } from '@/types/anlagen/visu-aggregate-sync';
const url = 'http://localhost:3000/rk2/visu-aggregate'; const url = BACKEND_URL + '/rk2/visu-aggregate';
async function syncRequest<T>(action: string, input: unknown): Promise<T> {
const response = await fetch(`${url}/sync/${action}`, { method: 'POST', cache: 'no-store', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(input) });
const data = await response.json();
if (!response.ok) throw new Error(Array.isArray(data.message) ? data.message.join('; ') : data.message ?? 'Tabellenabgleich fehlgeschlagen.');
return data;
}
export async function api_visuAggregate_compare(anlageId: string, componentIds: string[]): Promise<AggregateTableComparison> {
return syncRequest('preview', { anlageId, componentIds });
}
export async function api_visuAggregate_toProcon(data: AggregateTableComparison, fields: AggregateSyncField[]): Promise<{ completed: number; unchanged: number }> {
const result = await syncRequest<{ completed: number; unchanged: number }>('apply', { anlageId: data.anlageId, verbindungId: data.verbindungId, componentIds: data.componentIds, version: data.version, fields });
revalidatePath('/procon'); revalidatePath('/visu-aggregate');
return result;
}
export async function api_visuAggregate(): Promise<VisuAggregateRow[]> { export async function api_visuAggregate(): Promise<VisuAggregateRow[]> {
const response = await fetch(url, { cache: 'no-store' }); const response = await fetch(url, { cache: 'no-store' });
+58 -1
View File
@@ -1,6 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache';
import type { AnalogTable, AnalogSource, AnalogComparison, AnalogSlot } from '@/types/sensoren/analog'; import type { AnalogTable, AnalogSource, AnalogComparison, AnalogSlot } from '@/types/sensoren/analog';
const url = 'http://localhost:3000/rk2/sensoren-analog'; const url = BACKEND_URL + '/rk2/sensoren-analog';
async function request<T>(path = '', init?: RequestInit): Promise<T> { async function request<T>(path = '', init?: RequestInit): Promise<T> {
const response = await fetch(url + path, { cache: 'no-store', ...init }); const result = await response.json(); const response = await fetch(url + path, { cache: 'no-store', ...init }); const result = await response.json();
if (!response.ok) throw new Error(Array.isArray(result.message) ? result.message.join(', ') : result.message ?? 'Sensoren konnten nicht verarbeitet werden'); if (!response.ok) throw new Error(Array.isArray(result.message) ? result.message.join(', ') : result.message ?? 'Sensoren konnten nicht verarbeitet werden');
@@ -13,8 +15,63 @@ export async function api_saveAnalog(table: AnalogTable) {
if (new TextEncoder().encode(body).length > 9 * 1024 * 1024) throw new Error('Sensortabelle ist zu groß (maximal 9 MB).'); if (new TextEncoder().encode(body).length > 9 * 1024 * 1024) throw new Error('Sensortabelle ist zu groß (maximal 9 MB).');
return request<AnalogTable>('', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body }); return request<AnalogTable>('', { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body });
} }
export async function api_saveAnalogResult(table: AnalogTable): Promise<{ ok: true; data: AnalogTable } | { ok: false; error: string }> {
try { return { ok: true, data: await api_saveAnalog(table) }; }
catch (cause) { return { ok: false, error: cause instanceof Error ? cause.message : 'Sensoren konnten nicht gespeichert werden.' }; }
}
export async function api_compareAnalog(id: string) { return request<AnalogComparison>('/' + encodeURIComponent(id) + '/sync'); } export async function api_compareAnalog(id: string) { return request<AnalogComparison>('/' + encodeURIComponent(id) + '/sync'); }
export async function api_syncAnalog(id: string, input: Pick<AnalogComparison, 'anlageId' | 'verbindungId' | 'version'> & { export async function api_syncAnalog(id: string, input: Pick<AnalogComparison, 'anlageId' | 'verbindungId' | 'version'> & {
direction: 'toLocal' | 'toProcon'; fields: boolean; layout: boolean; graphics: boolean; targets: Partial<Record<AnalogSlot, number>>; valueTargetId?: number; direction: 'toLocal' | 'toProcon'; fields: boolean; layout: boolean; graphics: boolean; targets: Partial<Record<AnalogSlot, number>>; valueTargetId?: number;
placementIds?: string[]; placementIds?: string[];
}) { return request<AnalogTable>('/' + encodeURIComponent(id) + '/sync', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(input) }); } }) { return request<AnalogTable>('/' + encodeURIComponent(id) + '/sync', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(input) }); }
type AnalogBulkInput = { anlageId: string; version: number; direction: 'toLocal' | 'toProcon' };
export async function api_syncAllAnalog(input: AnalogBulkInput): Promise<{ ok: true; data: AnalogTable; transferred: number } | { ok: false; error: string }> {
try {
const data = await syncAllAnalog(input);
revalidatePath('/sensoren-analog'); revalidatePath('/sensoren-analog/bearbeiten'); revalidatePath('/visualisierung');
return { ok: true, data, transferred: data.rows.length };
} catch (cause) {
return { ok: false, error: cause instanceof Error ? cause.message : 'Sensorübertragung fehlgeschlagen.' };
}
}
async function syncAllAnalog(input: AnalogBulkInput): Promise<AnalogTable> {
if (!['toLocal', 'toProcon'].includes(input.direction)) throw new Error('Ungültige Übertragungsrichtung.');
const table = await api_analog();
if (table.anlageId !== input.anlageId || table.version !== input.version) throw new Error('Anlage oder Sensoren geändert. Bitte neu laden.');
if (!table.rows.length) throw new Error('Keine lokalen Analogsensoren vorhanden.');
const comparisons: AnalogComparison[] = [];
for (const row of table.rows) {
try {
if (input.direction === 'toProcon' && row.statistikTyp && row.statistikProconId === null)
throw new Error('Numerische ProCon-ID für StatistikTyp eintragen.');
const comparison = await api_compareAnalog(row.id);
if (comparison.anlageId !== table.anlageId || JSON.stringify(comparison.local) !== JSON.stringify(row) ||
comparisons.length > 0 && comparison.verbindungId !== comparisons[0].verbindungId)
throw new Error('Anlage, Verbindung oder Sensoren geändert. Bitte neu laden.');
comparisons.push(comparison);
} catch (cause) {
throw new Error(`Daten-Nr. ${row.datenNr}: ${cause instanceof Error ? cause.message : 'Vergleich fehlgeschlagen'} Es wurden keine Sensoren übertragen.`);
}
}
if (input.direction === 'toLocal') {
const rows = comparisons.map(({ local, remote }) => ({ ...local, beschreibung: remote.Text ?? '',
einheit: remote.Einheit ?? '', statistikProconId: remote.StatistikTyp ?? null }));
const latest = await api_compareAnalog(table.rows[0].id);
if (latest.anlageId !== table.anlageId || latest.verbindungId !== comparisons[0].verbindungId)
throw new Error('Anlage oder Verbindung geändert. Es wurden keine lokalen Sensoren übernommen.');
return api_saveAnalog({ ...table, rows });
}
let result = table, completed = 0;
for (const comparison of comparisons) {
try {
result = await api_syncAnalog(comparison.local.id, { anlageId: comparison.anlageId, verbindungId: comparison.verbindungId,
version: comparison.version, direction: 'toProcon', fields: true, layout: false, graphics: false, targets: {} });
completed++;
} catch (cause) {
throw new Error(`${completed} von ${table.rows.length} Sensoren nach ProCon übertragen. Abbruch bei Daten-Nr. ${comparison.local.datenNr}: ${cause instanceof Error ? cause.message : 'Übertragung fehlgeschlagen'} Bereits übertragene Sensoren bleiben übernommen; bei einem Verbindungsabbruch den letzten Sensor über den Vergleich prüfen.`);
}
}
return result;
}
+2 -1
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { DigitalOpcData, DigitalOpcBinding, DigitalSensorLive, StructureReference } from '@/types/digital-opc'; import type { DigitalOpcData, DigitalOpcBinding, DigitalSensorLive, StructureReference } from '@/types/digital-opc';
const url = 'http://localhost:3000/rk2/digital-opc'; const url = BACKEND_URL + '/rk2/digital-opc';
async function request<T>(path = '', init?: RequestInit): Promise<T> { async function request<T>(path = '', init?: RequestInit): Promise<T> {
const response = await fetch(url + path, { cache: 'no-store', ...init }); const data = await response.json(); const response = await fetch(url + path, { cache: 'no-store', ...init }); const data = await response.json();
if (!response.ok) throw new Error(Array.isArray(data.message) ? data.message.join(', ') : data.message ?? 'OPC-Zuordnung fehlgeschlagen'); return data; if (!response.ok) throw new Error(Array.isArray(data.message) ? data.message.join(', ') : data.message ?? 'OPC-Zuordnung fehlgeschlagen'); return data;
+2 -1
View File
@@ -1,8 +1,9 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { DigitalTable, DigitalComparison, DigitalSlot } from '@/types/sensoren/digital'; import type { DigitalTable, DigitalComparison, DigitalSlot } from '@/types/sensoren/digital';
import type { AnalogSource } from '@/types/sensoren/analog'; import type { AnalogSource } from '@/types/sensoren/analog';
const url = 'http://localhost:3000/rk2/sensoren-digital'; const url = BACKEND_URL + '/rk2/sensoren-digital';
async function request<T>(path = '', init?: RequestInit): Promise<T> { async function request<T>(path = '', init?: RequestInit): Promise<T> {
const response = await fetch(url + path, { cache: 'no-store', ...init }); const response = await fetch(url + path, { cache: 'no-store', ...init });
const data = await response.json(); const data = await response.json();
+2 -1
View File
@@ -1,6 +1,7 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import type {MotorOpcData,MotorBinding} from '@/types/motor-opc'; import type {MotorOpcData,MotorBinding} from '@/types/motor-opc';
const url='http://localhost:3000/rk2/motor-opc'; const url = BACKEND_URL + '/rk2/motor-opc';
async function request<T>(path='',init?:RequestInit):Promise<T>{const r=await fetch(url+path,{cache:'no-store',...init});const d=await r.json();if(!r.ok)throw new Error(d.message??'Motorzuordnung fehlgeschlagen');return d;} async function request<T>(path='',init?:RequestInit):Promise<T>{const r=await fetch(url+path,{cache:'no-store',...init});const d=await r.json();if(!r.ok)throw new Error(d.message??'Motorzuordnung fehlgeschlagen');return d;}
export async function api_motorOpc(){return request<MotorOpcData>();} export async function api_motorOpc(){return request<MotorOpcData>();}
export async function api_motorCommand(componentId:string,input:{anlageId:string;revision:number;controlId:string;command:string}){return request<{results:{field:string;good:boolean;status:string}[]}>('/'+encodeURIComponent(componentId)+'/command',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(input)});} export async function api_motorCommand(componentId:string,input:{anlageId:string;revision:number;controlId:string;command:string}){return request<{results:{field:string;good:boolean;status:string}[]}>('/'+encodeURIComponent(componentId)+'/command',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(input)});}
+57 -1
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { SteuerbuttonTable, SteuerbuttonComparison } from '@/types/steuerbuttons'; import type { SteuerbuttonTable, SteuerbuttonComparison } from '@/types/steuerbuttons';
const url = 'http://localhost:3000/rk2/steuerbuttons'; const url = BACKEND_URL + '/rk2/steuerbuttons';
async function request(init?: RequestInit): Promise<SteuerbuttonTable> { async function request(init?: RequestInit): Promise<SteuerbuttonTable> {
const response = await fetch(url, { cache: 'no-store', ...init }); const response = await fetch(url, { cache: 'no-store', ...init });
const data = await response.json(); const data = await response.json();
@@ -29,3 +30,58 @@ export async function api_saveSteuerbuttons(table: SteuerbuttonTable) {
const saved = await request({ method: 'PUT', headers: { 'Content-Type': 'application/json' }, body }); const saved = await request({ method: 'PUT', headers: { 'Content-Type': 'application/json' }, body });
revalidatePath('/steuerbuttons'); return saved; revalidatePath('/steuerbuttons'); return saved;
} }
type BulkInput = { anlageId: string; version: number; direction: 'toLocal' | 'toProcon' };
export async function api_syncAllSteuerbuttons(input: BulkInput): Promise<
{ ok: true; data: SteuerbuttonTable; transferred: number; skipped: number } | { ok: false; error: string }
> {
try {
const result = await syncAllSteuerbuttons(input);
revalidatePath('/steuerbuttons'); revalidatePath('/steuerbuttons/bearbeiten'); revalidatePath('/visualisierung');
return { ok: true, ...result };
} catch (cause) {
return { ok: false, error: cause instanceof Error ? cause.message : 'Tasterübertragung fehlgeschlagen.' };
}
}
async function syncAllSteuerbuttons(input: BulkInput) {
if (!['toLocal', 'toProcon'].includes(input.direction)) throw new Error('Ungültige Übertragungsrichtung.');
const table = await api_steuerbuttons();
if (table.anlageId !== input.anlageId || table.version !== input.version) throw new Error('Anlage oder Steuertaster geändert. Bitte neu laden.');
if (!table.rows.length) throw new Error('Keine lokalen Steuertaster vorhanden.');
const rows = input.direction === 'toProcon' ? table.rows.filter(row => row.beschreibung.trim().length > 0) : table.rows;
const skipped = table.rows.length - rows.length;
const comparisons: SteuerbuttonComparison[] = [];
for (const row of rows) {
try {
const comparison = await api_compareSteuerbutton(row.id);
if (comparison.anlageId !== table.anlageId || JSON.stringify(comparison.local) !== JSON.stringify(row) ||
comparisons.length > 0 && comparison.verbindungId !== comparisons[0].verbindungId)
throw new Error('Anlage, Verbindung oder Steuertaster geändert. Bitte neu laden.');
if (input.direction === 'toProcon' ? !['Menu', 'ButtonView'].includes(row.typ.trim()) : ![0, 2].includes(comparison.remote.Typ))
throw new Error('Nicht unterstützter Taster-Typ. Unterstützt sind Menu und ButtonView.');
comparisons.push(comparison);
} catch (cause) {
throw new Error(`Taster-Nr. ${row.tasterNr}: ${cause instanceof Error ? cause.message : 'Vergleich fehlgeschlagen'} Es wurden keine Steuertaster übertragen.`);
}
}
if (input.direction === 'toLocal') {
const imported = comparisons.map(({ local, remote }) => ({ ...local, beschreibung: remote.Text ?? '',
kategorie: remote.Kategorie ?? '', typ: remote.Typ === 0 ? 'Menu' : 'ButtonView', icon: remote.Icon ?? '', tippbetrieb: !!remote.TippBetrieb }));
const latest = await api_compareSteuerbutton(rows[0].id);
if (latest.anlageId !== table.anlageId || latest.verbindungId !== comparisons[0].verbindungId)
throw new Error('Anlage oder Verbindung geändert. Es wurden keine lokalen Steuertaster übernommen.');
return { data: await api_saveSteuerbuttons({ ...table, rows: imported }), transferred: rows.length, skipped };
}
let data = table, completed = 0;
for (const comparison of comparisons) {
try {
data = await api_syncSteuerbutton(comparison.local.id, { anlageId: comparison.anlageId, verbindungId: comparison.verbindungId,
version: comparison.version, direction: 'toProcon', fields: true, layout: false });
completed++;
} catch (cause) {
throw new Error(`${completed} von ${rows.length} Steuertastern nach ProCon übertragen, ${skipped} leere Beschreibungen übersprungen. Abbruch bei Taster-Nr. ${comparison.local.tasterNr}: ${cause instanceof Error ? cause.message : 'Übertragung fehlgeschlagen'} Bereits übertragene Taster bleiben übernommen; bei einem Verbindungsabbruch den letzten Taster vergleichen.`);
}
}
return { data, transferred: completed, skipped };
}
+58 -1
View File
@@ -1,7 +1,8 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { TextTable, TextComparison } from '@/types/texte'; import type { TextTable, TextComparison } from '@/types/texte';
const url = 'http://localhost:3000/rk2/texte'; const url = BACKEND_URL + '/rk2/texte';
async function request(init?: RequestInit): Promise<TextTable> { async function request(init?: RequestInit): Promise<TextTable> {
const response = await fetch(url, { cache: 'no-store', ...init }); const response = await fetch(url, { cache: 'no-store', ...init });
const data = await response.json(); const data = await response.json();
@@ -36,3 +37,59 @@ export async function api_saveTexts(table: TextTable) {
const saved = await request({ method: 'PUT', headers: { 'Content-Type': 'application/json' }, body }); const saved = await request({ method: 'PUT', headers: { 'Content-Type': 'application/json' }, body });
revalidatePath('/texte'); return saved; revalidatePath('/texte'); return saved;
} }
type SyncTextsInput = { anlageId: string; version: number; direction: 'toLocal' | 'toProcon' };
export async function api_syncTexts(input: SyncTextsInput): Promise<{ ok: true; data: TextTable; transferred: number; skipped: number } | { ok: false; error: string }> {
try {
const data = await syncTexts(input);
const skipped = input.direction === 'toProcon' ? data.rows.filter(row => !row.text.trim()).length : 0;
return { ok: true, data, transferred: data.rows.length - skipped, skipped };
} catch (cause) {
return { ok: false, error: cause instanceof Error ? cause.message : 'Textübertragung fehlgeschlagen.' };
}
}
async function syncTexts(input: SyncTextsInput): Promise<TextTable> {
if (!['toLocal', 'toProcon'].includes(input.direction)) throw new Error('Ungültige Übertragungsrichtung.');
const table = await api_texte();
if (table.anlageId !== input.anlageId || table.version !== input.version) throw new Error('Anlage oder Texte geändert. Bitte neu laden.');
if (!table.rows.length) throw new Error('Keine lokalen Texte vorhanden.');
const transferRows = input.direction === 'toProcon' ? table.rows.filter(row => row.text.trim().length > 0) : table.rows;
const comparisons: TextComparison[] = [];
// Erst alle Zuordnungen prüfen, bevor die erste Änderung geschrieben wird.
for (const row of transferRows) {
try {
const comparison = await api_compareText(row.id);
if (comparison.anlageId !== table.anlageId || JSON.stringify(comparison.local) !== JSON.stringify(row) ||
comparisons.length > 0 && comparison.verbindungId !== comparisons[0].verbindungId)
throw new Error('Anlage, Verbindung oder Texte geändert. Bitte neu laden.');
comparisons.push(comparison);
} catch (cause) {
throw new Error(`Daten-Nr. ${row.datenNr}: ${cause instanceof Error ? cause.message : 'Vergleich fehlgeschlagen'}. Es wurden keine Texte übertragen.`.replace(/\.{2,}/g, '.'));
}
}
if (input.direction === 'toLocal') {
// Alle gelesenen Textfelder zusammen mit der ursprünglichen Tabellenrevision speichern.
const rows = comparisons.map(({ local, remote }) => ({ ...local,
text: remote.TexteVisualisierung_Text ?? '', schriftart: remote.FontFamily ?? 'Arial',
schriftgroesse: remote.FontSize ?? 16, schrifttyp: remote.FontWeight ?? 'Normal',
hintergrund: remote.Hintergrund ?? 'Transparent', textfarbe: remote.TextFarbe ?? 'Black',
}));
// Auch nach dem Lesen den Anlagen- und Verbindungskontext prüfen.
const latest = await api_compareText(table.rows[0].id);
if (latest.anlageId !== table.anlageId || latest.verbindungId !== comparisons[0].verbindungId)
throw new Error('Anlage oder Verbindung geändert. Es wurden keine lokalen Texte übernommen.');
return api_saveTexts({ ...table, rows });
}
let result = table, completed = 0;
for (const comparison of comparisons) {
try {
result = await api_syncText(comparison.local.id, { anlageId: comparison.anlageId, verbindungId: comparison.verbindungId,
version: comparison.version, direction: 'toProcon', fields: true, layout: false });
completed++;
} catch (cause) {
throw new Error(`${completed} von ${transferRows.length} Texten nach ProCon übertragen. Abbruch bei Daten-Nr. ${comparison.local.datenNr}: ${cause instanceof Error ? cause.message : 'Übertragung fehlgeschlagen'}. Bereits übertragene Texte bleiben übernommen; bei einem Verbindungsabbruch den letzten Text über den Vergleich prüfen.`);
}
}
return result;
}
@@ -0,0 +1,140 @@
'use server';
import { api_visualizationOverview } from './api-overview';
import { api_groupApply } from '@/actions/procon/api-group-sync';
import { api_groupCompare } from '@/actions/procon/api-group-sync';
import { revalidatePath } from 'next/cache';
import type { SyncDirection } from '@/types/procon/bulk-sync';
import { api_compareDisplay, api_syncDisplay } from '@/actions/anzeigen/api-anzeigewerte';
import { api_compareAnalog, api_syncAnalog } from '@/actions/sensoren/api-analog';
import { api_compareDigital, api_syncDigital } from '@/actions/sensoren/api-digital';
import { api_compareText, api_syncText } from '@/actions/texte/api-texte';
import { api_compareSteuerbutton, api_syncSteuerbutton } from '@/actions/steuerbuttons/api-steuerbuttons';
import { getMaster } from '@/lib/visualisierung/layout';
import { knownAnalogStates } from '@/types/sensoren/analog';
import { knownDigitalStates } from '@/types/sensoren/digital';
interface Layout { x: number; y: number; width: number; height: number; z: number; show: boolean }
interface RemoteLayout { PositionX: number; PositionY: number; Width: number; Height: number; PositionZ: number; Show: boolean }
function differs(local: Layout, remote: RemoteLayout) {
return local.x !== remote.PositionX || local.y !== remote.PositionY || local.width !== remote.Width ||
local.height !== remote.Height || local.z !== remote.PositionZ || local.show !== remote.Show;
}
function unique<T>(items: T[], label: string): T {
if (items.length !== 1) throw new Error(`${label}: ProCon-Zuordnung fehlt oder ist mehrdeutig. Bitte einzeln abgleichen.`);
return items[0];
}
export async function api_syncAllVisualizationLayouts(anlageId: string, verbindungId: string, direction: SyncDirection = 'toProcon') {
const result = { completed: 0, unchanged: 0, errors: [] as string[] };
try {
if (!['toLocal', 'toProcon'].includes(direction)) throw new Error('Ungültige Richtung.');
const data = await api_visualizationOverview();
function scope(value: { anlageId: string; verbindungId: string }) {
if (!verbindungId || value.anlageId !== anlageId || value.verbindungId !== verbindungId)
throw new Error('Anlage oder Verbindung geändert. Bitte neu laden.');
}
scope(data);
result.errors.push(...data.warnings);
const context = (c: { anlageId: string; verbindungId: string; version: string }) => ({ anlageId: c.anlageId, verbindungId: c.verbindungId, version: c.version });
const parts = { direction, fields: false, layout: true, graphics: false } as const;
async function process(label: string, work: () => Promise<boolean>) {
try { if (await work()) result.completed++; else result.unchanged++; }
catch (cause) { result.errors.push(`${label}: ${cause instanceof Error ? cause.message : 'Übertragung fehlgeschlagen'}`); }
}
for (const aggregate of data.aggregates) await process(`Aggregat ${aggregate.spsAntriebId}`, async () => {
const current = await api_groupCompare(aggregate.id); scope(current);
const missing = current.elements.filter(e => !e.procon);
if (missing.length) result.errors.push(`Aggregat ${aggregate.spsAntriebId}: ${missing.length} Elemente ohne ProCon-Zuordnung.`);
const elements = current.elements.filter(e => e.procon &&
(['x', 'y', 'width', 'height', 'z', 'show'] as const).some(key => e.local[key] !== e.procon![key]));
if (!elements.length) return false;
const master = getMaster({ ...aggregate, data: current });
if (!master) throw new Error('Positions-Master fehlt.');
await api_groupApply(aggregate.id, { version: current.version, masterId: master.id,
direction, elementIds: elements.map(e => e.id) });
return true;
});
for (const row of data.displays.rows.filter(r => ['Xaml', 'Text', 'Gauge'].includes(r.typ) && r.placements.length))
await process(`Anzeige ${row.datenNr}`, async () => {
const compared = await api_compareDisplay(row.id);
if (!compared.success) throw new Error(compared.error);
const c = compared.data; scope(c);
const layoutTargets: Record<string, number> = {};
const changed = new Set<string>();
for (const p of c.local.placements) {
const graphics = c.local.graphics.filter(g => g.placementId === p.id);
if (graphics.length) {
for (const g of graphics) {
const remote = unique(c.visuals.filter(v => v.Discriminator === 'AnzeigeParameterXamlVisualisierung' &&
v.State === ({ ein: 0, aus: 1, permanent: 2 })[g.slot]), g.slot);
if (differs(p, remote)) changed.add(p.id);
}
} else {
const remote = unique(c.visuals.filter(v => v.Discriminator !== 'AnzeigeParameterXamlVisualisierung'), p.id);
layoutTargets[p.id] = remote.Id;
if (differs(p, remote)) changed.add(p.id);
}
}
if (!changed.size) return false;
const saved = await api_syncDisplay(row.id, { ...context(c), ...parts, targets: {}, layoutTargets, placementIds: [...changed] });
if (!saved.success) throw new Error(saved.error);
return true;
});
for (const row of data.analog.rows.filter(r => r.placements.length)) await process(`Analogsensor ${row.datenNr}`, async () => {
const c = await api_compareAnalog(row.id); scope(c);
const changed = new Set<string>();
const placements = c.local.placements.filter(p => p.id === c.local.valuePlacementId ||
c.local.graphics.some(g => g.slot !== 'grundbild' && g.placementId === p.id));
for (const p of placements) {
if (p.id === c.local.valuePlacementId) {
const remote = unique(c.visuals.filter(v => v.SensorVisualisierung_State === 2 && v.SensorVisualisierung_ViewId == null), 'Wertanzeige');
if (differs(p, remote)) changed.add(p.id);
}
for (const g of c.local.graphics.filter(g => g.placementId === p.id)) {
const state = knownAnalogStates[g.slot];
const remote = unique(state === undefined ? [] : c.visuals.filter(v => v.SensorVisualisierung_State === state), g.slot);
if (differs(p, remote)) changed.add(p.id);
}
}
if (!changed.size) return false;
await api_syncAnalog(row.id, { ...context(c), ...parts, targets: {}, placementIds: [...changed] });
return true;
});
for (const row of data.digital.rows.filter(r => r.placements.length)) await process(`Digitalsensor ${row.datenNr}`, async () => {
const c = await api_compareDigital(row.id); scope(c);
const changed = new Set<string>();
for (const p of c.local.placements) {
const graphics = c.local.graphics.filter(g => g.placementId === p.id);
if (!graphics.length) throw new Error(`${p.id}: Keine ProCon-Grafikzuordnung.`);
for (const g of graphics) {
const state = knownDigitalStates[g.slot];
const remote = unique(state === undefined ? [] : c.visuals.filter(v => v.SensorVisualisierung_State === state), g.slot);
if (differs(p, remote)) changed.add(p.id);
}
}
if (!changed.size) return false;
await api_syncDigital(row.id, { ...context(c), ...parts, targets: {}, placementIds: [...changed] });
return true;
});
for (const row of data.buttons.rows.filter(r => (direction === 'toLocal' || r.typ.trim() === 'ButtonView' && r.beschreibung.trim()) && r.placements.length))
await process(`Steuertaster ${row.tasterNr}`, async () => {
const c = await api_compareSteuerbutton(row.id); scope(c);
if (direction === 'toLocal' && c.remote.Typ !== 2) return false;
if (direction === 'toLocal' && c.local.typ.trim() !== 'ButtonView') throw new Error('Zuerst Taster-Typ aus ProCon übernehmen.');
const p = unique(c.local.placements, 'Platzierung'), remote = unique(c.visuals, 'Taster');
if (!differs(p, remote)) return false;
await api_syncSteuerbutton(row.id, { ...context(c), ...parts, visualizationId: remote.Id });
return true;
});
for (const row of data.texts.rows.filter(r => (direction === 'toLocal' || r.text.trim()) && r.placements.length)) await process(`Text ${row.datenNr}`, async () => {
const c = await api_compareText(row.id); scope(c);
const p = unique(c.local.placements, 'Platzierung');
if (!differs(p, c.remote)) return false;
await api_syncText(row.id, { ...context(c), ...parts });
return true;
});
revalidatePath('/procon/positionen'); revalidatePath('/visualisierung');
} catch (cause) { result.errors.push(cause instanceof Error ? cause.message : 'Sammelübertragung fehlgeschlagen'); }
return result;
}
+2 -1
View File
@@ -1,8 +1,9 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import type { GraphicLibrary, LibraryGraphic } from '@/types/visualisierung/library'; import type { GraphicLibrary, LibraryGraphic } from '@/types/visualisierung/library';
import type { GrafikGeneratorDaten } from '@/types/visualisierung/graphic'; import type { GrafikGeneratorDaten } from '@/types/visualisierung/graphic';
const url = 'http://localhost:3000/visualisierung/grafik-bibliothek'; const url = BACKEND_URL + '/visualisierung/grafik-bibliothek';
async function request<T>(path = '', init?: RequestInit): Promise<T> { async function request<T>(path = '', init?: RequestInit): Promise<T> {
const response = await fetch(url + path, { cache: 'no-store', ...init }); const response = await fetch(url + path, { cache: 'no-store', ...init });
const result = await response.json(); const result = await response.json();
+2 -1
View File
@@ -1,6 +1,7 @@
'use server'; 'use server';
import { BACKEND_URL } from '@/_config/backend';
import type { VisualizationSettings } from '@/types/visualisierung/settings'; import type { VisualizationSettings } from '@/types/visualisierung/settings';
const url = (anlageId: string) => `http://localhost:3000/visualisierung/${encodeURIComponent(anlageId)}/settings`; const url = (anlageId: string) => `${BACKEND_URL}/visualisierung/${encodeURIComponent(anlageId)}/settings`;
export async function api_visualizationSettings(anlageId: string): Promise<VisualizationSettings> { export async function api_visualizationSettings(anlageId: string): Promise<VisualizationSettings> {
const response = await fetch(url(anlageId), { cache: 'no-store' }); const response = await fetch(url(anlageId), { cache: 'no-store' });
+1 -1
View File
@@ -1,7 +1,7 @@
import { Sites } from '@/_config/sites'; import { Sites } from '@/_config/sites';
import Link from 'next/link'; import Link from 'next/link';
const entries = [Sites.anlagen, Sites.groups, Sites.elements, Sites.peripheries, const entries = [Sites.groups, Sites.elements, Sites.peripheries,
Sites.visu, Sites.visu.create, Sites.visu.selectGroups, Sites.visu.elements, Sites.logNote]; Sites.visu, Sites.visu.create, Sites.visu.selectGroups, Sites.visu.elements, Sites.logNote];
export default function AltPage() { export default function AltPage() {
@@ -1,8 +1,13 @@
import { api_connections } from '@/actions/rk/api-procon-verbindungen'; import { redirect } from 'next/navigation';
import ProConConnectionsForm from '@/components/rk/anlage/proconConnections'; import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
try { return <div className="p-4"><ProConConnectionsForm initial={await api_connections(id)} /></div>; }
catch { return <p role="alert">Verbindungen konnten nicht geladen werden.</p>; }
}
export default async function PreviousPlantConnectionsPage({ params }: {
params: Promise<{ id: string }>;
}) {
const { id } = await params;
const anlage = await api_anlage_getSelected();
if (anlage?.id !== id) {
redirect('/projekte');
}
redirect('/anlagen/einstellungen/procon');
}
@@ -0,0 +1,5 @@
import { redirect } from 'next/navigation';
export default function NeueAnlagePage() {
redirect('/projekte/neu');
}
+3 -21
View File
@@ -1,23 +1,5 @@
import { redirect } from 'next/navigation';
import { Sites } from "@/_config/sites"; export default function AnlagenPage() {
import { api_anlage_getSelected, api_anlage_setSelected, api_anlagen_getAll } from "@/actions/rk/api-anlage"; redirect('/projekte');
import AnlageColumn from "@/components/rk/anlage/anlageColumn";
import Link from "next/link";
export default async function PageAnlagen() {
const anlagen = await api_anlagen_getAll();
const currentAnlage = await api_anlage_getSelected();
return (
<div className="">
<Link href={Sites.main.url}>{Sites.main.name}</Link>
<div className="flex flex-col m-4">
{anlagen.map((anlage) =>
<AnlageColumn key={anlage.id} data={anlage} isSelected={anlage.id === currentAnlage.id} />
)}
</div>
</div>
)
} }
+1 -1
View File
@@ -11,6 +11,6 @@ export default async function PageAggregate() {
} catch (error) { } catch (error) {
return <div><h2 className="mb-3 text-lg font-semibold">Aggregate</h2> return <div><h2 className="mb-3 text-lg font-semibold">Aggregate</h2>
<p role="alert" className="mb-3 text-red-600">{error instanceof Error ? error.message : 'Aggregate konnten nicht geladen werden.'}</p> <p role="alert" className="mb-3 text-red-600">{error instanceof Error ? error.message : 'Aggregate konnten nicht geladen werden.'}</p>
<Link href="/verbindungen" className="underline">ProCon-Verbindung prüfen</Link></div>; <Link href="/anlagen/einstellungen/procon" className="underline">ProCon-Verbindung prüfen</Link></div>;
} }
} }
@@ -0,0 +1,9 @@
import Link from 'next/link';
import { api_bulkSyncContext } from '@/actions/procon/api-bulk-sync';
import BulkSyncDashboard from '@/components/procon/bulkSyncDashboard';
export default async function Page() {
const result = await api_bulkSyncContext();
if (!result.ok) return <div className="space-y-3"><h1 className="text-xl font-semibold">ProCon-Gesamtabgleich</h1><p role="alert">{result.error}</p><Link href="/anlagen/einstellungen/procon" className="underline">ProCon-Verbindung prüfen</Link></div>;
return <BulkSyncDashboard context={result.data} />;
}
+12
View File
@@ -0,0 +1,12 @@
import { api_ablaeufe } from '@/actions/rk2/api-ablaeufe';
import AblaeufeEditor from '@/components/ablaeufe/ablaeufeEditor';
export default async function AblaeufePage() {
try {
const data = await api_ablaeufe();
return <AblaeufeEditor key={data.anlageId} initial={data} />;
} catch (cause) {
return <div className="space-y-3"><h1 className="text-xl font-semibold">Abläufe und Materialfluss</h1>
<p role="alert">{cause instanceof Error ? cause.message : 'Abläufe konnten nicht geladen werden.'}</p></div>;
}
}
+65
View File
@@ -0,0 +1,65 @@
import Link from 'next/link';
import { notFound, redirect } from 'next/navigation';
import { api_anlagen_getAll, api_anlage_getSelected } from '@/actions/rk/api-anlage';
import { api_units } from '@/actions/rk2/api-units';
import { api_groups } from '@/actions/rk2/api-groups';
import AnlageUnitSummary from '@/components/rk/anlage/anlageUnitSummary';
const sections = [
{ href: '/units', title: 'Units' },
{ href: '/groups', title: 'Gruppen' },
{ href: '/ablaeufe', title: 'Abläufe' },
{ href: '/procon', title: 'ProCon' },
{ href: '/visualisierung', title: 'Visualisierung' },
];
export default async function AnlagenOverviewPage({
params,
}: {
params: Promise<{ id: string }>;
}) {
const { id } = await params;
const anlagen = await api_anlagen_getAll();
const anlage = anlagen.find(item => item.id === id);
if (!anlage) {
notFound();
}
const selected = await api_anlage_getSelected();
// Ein alter Link darf keine Daten einer inzwischen anderen aktiven Anlage zeigen.
if (selected?.id !== id) {
redirect('/projekte');
}
const [units, groups] = await Promise.all([api_units(), api_groups()]);
const current = await api_anlage_getSelected();
if (current?.id !== id || units.some(unit => unit.anlageId && unit.anlageId !== id)) {
redirect('/projekte');
}
return (
<section className="mx-auto max-w-6xl space-y-6">
<header>
<p className="text-sm text-slate-500">Anlage {anlage.anlageNr}</p>
<h1 className="text-2xl font-semibold">Übersicht</h1>
<p className="mt-1 text-slate-600">{anlage.name}</p>
</header>
<nav aria-label="Anlagenbereiche" className="flex flex-wrap gap-1 rounded-lg border bg-slate-50 p-1">
{sections.map(section => (
<Link
key={section.href}
href={section.href}
className="rounded px-4 py-2 text-sm font-medium hover:bg-blue-100 focus-visible:outline-2 focus-visible:outline-blue-600"
>
{section.title}
</Link>
))}
</nav>
<AnlageUnitSummary units={units} groups={groups} />
</section>
);
}
+12
View File
@@ -0,0 +1,12 @@
import type { ReactNode } from 'react';
import { redirect } from 'next/navigation';
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
export default async function SettingsLayout({ children }: { children: ReactNode }) {
const anlage = await api_anlage_getSelected();
if (!anlage?.id) {
redirect('/projekte');
}
return children;
}
@@ -0,0 +1,34 @@
import { BACKEND_URL } from '@/_config/backend';
export async function GET(request: Request) {
const params = new URL(request.url).searchParams;
const id = params.get('id');
const anlageId = params.get('anlageId');
if (!id || !anlageId) {
return new Response('Verbindung fehlt', { status: 400 });
}
const certificateUrl = `${BACKEND_URL}/rk2/opcua/${encodeURIComponent(id)}/certificate`
+ `?anlageId=${encodeURIComponent(anlageId)}`;
try {
const response = await fetch(certificateUrl, { cache: 'no-store' });
if (!response.ok) {
return new Response('Zertifikat konnte nicht geladen werden. Anlage und Verbindung pruefen.', {
status: response.status,
});
}
return new Response(response.body, {
headers: {
'Content-Type': 'application/x-pem-file',
'Content-Disposition': 'attachment; filename="RK-OpcUaClient.pem"',
'Cache-Control': 'no-store',
},
});
} catch {
return new Response('Backend nicht erreichbar', { status: 502 });
}
}
@@ -0,0 +1,11 @@
import { api_opcConfiguration } from '@/actions/opcua/api-opcua';
import OpcPanel from '@/components/opcua/opcPanel';
export default async function OpcSettingsPage() {
try {
const configuration = await api_opcConfiguration();
return <OpcPanel initial={configuration} />;
} catch {
return <p role="alert">OPC-Konfiguration konnte nicht geladen werden.</p>;
}
}
+49
View File
@@ -0,0 +1,49 @@
import Link from 'next/link';
import { redirect } from 'next/navigation';
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
const settings = [
{
href: '/anlagen/einstellungen/pdf',
title: 'Anlagen-PDF',
description: 'PDF auswählen, hochladen oder ersetzen und Seiten den Units zuordnen.',
},
{
href: '/anlagen/einstellungen/procon',
title: 'ProCon-Verbindungen',
description: 'Datenbankverbindungen der aktiven Anlage verwalten.',
},
{
href: '/anlagen/einstellungen/opcua',
title: 'OPC-Verbindungen',
description: 'OPC-UA-Verbindungen und Sicherheit konfigurieren und die Verbindung prüfen.',
},
];
export default async function AnlagenEinstellungenPage() {
const anlage = await api_anlage_getSelected();
if (!anlage?.id) {
redirect('/projekte');
}
return (
<section className="max-w-3xl space-y-6">
<header>
<h1 className="text-2xl font-semibold">Anlageneinstellungen</h1>
<p className="mt-1 text-slate-600">Anlage {anlage.anlageNr} · {anlage.name}</p>
</header>
<div className="grid gap-4">
{settings.map(setting => (
<Link
key={setting.href}
href={setting.href}
className="block rounded-lg border p-5 hover:border-blue-500 hover:bg-blue-50 focus-visible:outline-2 focus-visible:outline-blue-600"
>
<h2 className="font-semibold">{setting.title}</h2>
<p className="mt-2 text-sm text-slate-600">{setting.description}</p>
</Link>
))}
</div>
</section>
);
}
@@ -0,0 +1,11 @@
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
import { AnlagePdfViewer } from '@/components/rk/anlage/anlagePdfViewer';
export default async function AnlagenPdfSettingsPage({ searchParams }: {
searchParams: Promise<{ unit?: string }>;
}) {
const anlage = await api_anlage_getSelected();
const { unit } = await searchParams;
return <AnlagePdfViewer key={anlage.id} anlage={anlage} initialUnitId={unit} />;
}
@@ -0,0 +1,13 @@
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
import { api_connections } from '@/actions/rk/api-procon-verbindungen';
import ProConConnectionsForm from '@/components/rk/anlage/proconConnections';
export default async function ProConSettingsPage() {
try {
const anlage = await api_anlage_getSelected();
const connections = await api_connections(anlage.id);
return <ProConConnectionsForm initial={connections} />;
} catch {
return <p role="alert">ProCon-Verbindungen konnten nicht geladen werden.</p>;
}
}
+7
View File
@@ -0,0 +1,7 @@
import { redirect } from 'next/navigation';
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
export default async function SelectedAnlagePage() {
const anlage = await api_anlage_getSelected();
redirect(anlage?.id ? `/anlagen/${anlage.id}` : '/projekte');
}
+7 -7
View File
@@ -1,9 +1,9 @@
import { api_anlage_getSelected } from '@/actions/rk/api-anlage'; import { redirect } from 'next/navigation';
import { AnlagePdfViewer } from '@/components/rk/anlage/anlagePdfViewer';
export default async function Page({ searchParams }: { searchParams: Promise<{ unit?: string }> }) { export default async function PreviousPdfPage({ searchParams }: {
const anlage = await api_anlage_getSelected(); searchParams: Promise<{ unit?: string }>;
if (!anlage?.id) return <p className="p-4">Bitte zuerst eine Anlage auswählen.</p>; }) {
const { unit } = await searchParams; const { unit } = await searchParams;
return <AnlagePdfViewer key={anlage.id} anlage={anlage} initialUnitId={unit} />; const query = unit ? '?unit=' + encodeURIComponent(unit) : '';
redirect('/anlagen/einstellungen/pdf' + query);
} }
+21 -6
View File
@@ -1,8 +1,23 @@
import { BACKEND_URL } from '@/_config/backend';
const EXCEL_CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
export async function GET() { export async function GET() {
try { try {
const response = await fetch('http://localhost:3000/rk2/anzeigewerte/export', { cache: 'no-store' }); const response = await fetch(`${BACKEND_URL}/rk2/anzeigewerte/export`, { cache: 'no-store' });
if (!response.ok) return new Response('Excel-Export fehlgeschlagen', { status: 502 });
return new Response(response.body, { headers: { 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', if (!response.ok) {
'Content-Disposition': 'attachment; filename="AllgemeinAnlagenVisualisierung.xlsx"', 'Cache-Control': 'no-store' } }); return new Response('Excel-Export fehlgeschlagen', { status: 502 });
} catch { return new Response('Keine Verbindung zum Backend', { status: 502 }); } }
return new Response(response.body, {
headers: {
'Content-Type': EXCEL_CONTENT_TYPE,
'Content-Disposition': 'attachment; filename="AllgemeinAnlagenVisualisierung.xlsx"',
'Cache-Control': 'no-store',
},
});
} catch {
return new Response('Keine Verbindung zum Backend', { status: 502 });
}
} }
+1 -1
View File
@@ -10,7 +10,7 @@ export default async function Page() {
} catch (error) { } catch (error) {
return <div><h2 className="mb-3 text-lg font-semibold">Anzeigen</h2> return <div><h2 className="mb-3 text-lg font-semibold">Anzeigen</h2>
<p role="alert" className="mb-3 text-red-600">{error instanceof Error ? error.message : 'Anzeigen konnten nicht geladen werden'}</p> <p role="alert" className="mb-3 text-red-600">{error instanceof Error ? error.message : 'Anzeigen konnten nicht geladen werden'}</p>
<div className="flex flex-wrap gap-3"><Link className="underline" href="/verbindungen">ProCon-Verbindung prüfen</Link> <div className="flex flex-wrap gap-3"><Link className="underline" href="/anlagen/einstellungen/procon">ProCon-Verbindung prüfen</Link>
<Link className="underline" href="/anzeigewerte/bearbeiten">Anzeigen und Grafiken bearbeiten</Link></div></div>; <Link className="underline" href="/anzeigewerte/bearbeiten">Anzeigen und Grafiken bearbeiten</Link></div></div>;
} }
} }
@@ -1,3 +1,4 @@
import { BACKEND_URL } from '@/_config/backend';
import { NextRequest } from 'next/server'; import { NextRequest } from 'next/server';
export const runtime = 'nodejs'; export const runtime = 'nodejs';
@@ -5,33 +6,84 @@ export const dynamic = 'force-dynamic';
type Context = { params: Promise<{ id: string; path?: string[] }> }; type Context = { params: Promise<{ id: string; path?: string[] }> };
async function proxy(request: NextRequest, context: Context) { const OBJECT_ID_PATTERN = /^[a-f\d]{24}$/i;
const { id, path = [] } = await context.params;
if (!/^[a-f\d]{24}$/i.test(id) || !( const FORWARDED_REQUEST_HEADERS = [
path.length === 0 || path.length === 1 && ['file', 'units'].includes(path[0]) || 'content-type',
path.length === 2 && path[0] === 'units' && /^[a-f\d]{24}$/i.test(path[1]) 'range',
)) return Response.json({ message: 'Ungültiger PDF-Pfad' }, { status: 400 }); 'if-range',
const url = new URL(`http://localhost:3000/anlage/${id}/pdf${path.length ? '/' + path.join('/') : ''}`); ];
url.search = request.nextUrl.search;
const headers = new Headers(); const FORWARDED_RESPONSE_HEADERS = [
for (const name of ['content-type', 'range', 'if-range']) { 'content-type',
const value = request.headers.get(name); 'content-length',
if (value) headers.set(name, value); 'content-range',
} 'accept-ranges',
try { ];
const response = await fetch(url, {
method: request.method, headers, cache: 'no-store', // Erlaubt sind nur: "", "file", "units" und "units/<id>".
body: request.method === 'GET' ? undefined : await request.arrayBuffer(), function isAllowedPdfPath(path: string[]): boolean {
}); if (path.length === 0) {
const outgoing = new Headers({ 'Cache-Control': 'no-store' }); return true;
for (const name of ['content-type', 'content-length', 'content-range', 'accept-ranges']) { }
const value = response.headers.get(name);
if (value) outgoing.set(name, value); if (path.length === 1) {
return ['file', 'units'].includes(path[0]);
}
if (path.length === 2) {
return path[0] === 'units' && OBJECT_ID_PATTERN.test(path[1]);
}
return false;
}
function copyHeaders(source: Headers, target: Headers, names: string[]): void {
for (const name of names) {
const value = source.get(name);
if (value) {
target.set(name, value);
}
}
}
async function proxy(request: NextRequest, context: Context) {
const { id, path = [] } = await context.params;
if (!OBJECT_ID_PATTERN.test(id) || !isAllowedPdfPath(path)) {
return Response.json({ message: 'Ungültiger PDF-Pfad' }, { status: 400 });
}
const pathSuffix = path.length ? '/' + path.join('/') : '';
const url = new URL(`${BACKEND_URL}/anlage/${id}/pdf${pathSuffix}`);
url.search = request.nextUrl.search;
const headers = new Headers();
copyHeaders(request.headers, headers, FORWARDED_REQUEST_HEADERS);
try {
const body = request.method === 'GET'
? undefined
: await request.arrayBuffer();
const response = await fetch(url, {
method: request.method,
headers,
cache: 'no-store',
body,
});
const outgoing = new Headers({ 'Cache-Control': 'no-store' });
copyHeaders(response.headers, outgoing, FORWARDED_RESPONSE_HEADERS);
return new Response(response.body, {
status: response.status,
headers: outgoing,
});
} catch {
return Response.json({ message: 'Keine Verbindung zum Backend' }, { status: 502 });
} }
return new Response(response.body, { status: response.status, headers: outgoing });
} catch {
return Response.json({ message: 'Keine Verbindung zum Backend' }, { status: 502 });
}
} }
export { proxy as GET, proxy as POST, proxy as PATCH }; export { proxy as GET, proxy as POST, proxy as PATCH };
+1 -8
View File
@@ -1,8 +1 @@
export async function GET(request:Request,{params}:{params:Promise<{id:string}>}){ export { GET } from '@/app/projekte/system/datensicherung/[id]/datei/route';
const {id}=await params,file=new URL(request.url).searchParams.get('file')??'manifest.json';
try{const response=await fetch('http://localhost:3000/rk2/backups/'+encodeURIComponent(id)+'/file?file='+encodeURIComponent(file),{cache:'no-store'});
if(!response.ok)return new Response('Sicherungsdatei nicht verfügbar',{status:response.status});
const filename=file.split('/').pop()?.replace(/[^A-Za-z0-9_.-]/g,'_')??'backup.json';
return new Response(response.body,{headers:{'Content-Type':response.headers.get('Content-Type')??'application/json','Content-Disposition':'attachment; filename="'+filename+'"','Cache-Control':'no-store'}});
}catch{return new Response('Keine Verbindung zum Backend',{status:502});}
}
+5 -3
View File
@@ -1,3 +1,5 @@
import {api_backups} from '@/actions/backup/api-backup'; import { redirect } from 'next/navigation';
import BackupPanel from '@/components/backup/backupPanel';
export default async function Page(){try{return <BackupPanel initial={await api_backups()}/>;}catch(cause){return <p role="alert">{cause instanceof Error?cause.message:'Datensicherungen konnten nicht geladen werden.'}</p>;}} export default function PreviousBackupPage() {
redirect('/projekte/system/datensicherung');
}
+21 -6
View File
@@ -1,8 +1,23 @@
import { BACKEND_URL } from '@/_config/backend';
const EXCEL_CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
export async function GET() { export async function GET() {
try { try {
const response = await fetch('http://localhost:3000/rk2/fehlerliste/export', { cache: 'no-store' }); const response = await fetch(`${BACKEND_URL}/rk2/fehlerliste/export`, { cache: 'no-store' });
if (!response.ok) return new Response('Fehlerlisten-Export fehlgeschlagen', { status: 502 });
return new Response(response.body, { headers: { 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', if (!response.ok) {
'Content-Disposition': 'attachment; filename="Fehlerliste.xlsx"', 'Cache-Control': 'no-store' } }); return new Response('Fehlerlisten-Export fehlgeschlagen', { status: 502 });
} catch { return new Response('Keine Verbindung zum Backend', { status: 502 }); } }
return new Response(response.body, {
headers: {
'Content-Type': EXCEL_CONTENT_TYPE,
'Content-Disposition': 'attachment; filename="Fehlerliste.xlsx"',
'Cache-Control': 'no-store',
},
});
} catch {
return new Response('Keine Verbindung zum Backend', { status: 502 });
}
} }
+37 -45
View File
@@ -1,50 +1,42 @@
import { notFound, redirect } from 'next/navigation';
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
import { api_groups, api_groups_byId } from '@/actions/rk2/api-groups';
import Breadcrumbs from '@/components/ui/navigation/breadcrumbs';
import { GroupEdit } from '@/components/rk2/groups/groupEdit';
import { Sites } from "@/_config/sites"; export default async function GroupEditPage({
import { api_units_byId } from "@/actions/rk2/api-units"; params,
}: {
params: Promise<{ id: string }>;
}) {
const { id } = await params;
const anlage = await api_anlage_getSelected();
if (!anlage?.id) {
redirect('/projekte');
}
import { api_anlage_getSelected } from "@/actions/rk/api-anlage"; const groups = await api_groups();
import { UnitCreateForm } from "@/components/rk2/units/unit_createForm"; let group;
if (id !== 'new') {
const result = await api_groups_byId(id);
if (!result.success || !result.data) {
notFound();
}
group = result.data;
}
import Link from "next/link"; const breadcrumb = [
import { UnitEdit } from "@/components/rk2/units/unitEdit"; { label: 'Anlage', href: '/' },
import { api_groups, api_groups_byId } from "@/actions/rk2/api-groups"; { label: 'Gruppen', href: '/groups' },
import { componentDefaults, componentTypeDefinitions } from "@/actions/rk2/api-compTypes"; { label: group?.name ?? 'Neue Gruppe' },
];
import Breadcrumbs from "@/components/ui/navigation/breadcrumbs"; return (
import { GroupForm } from "@/components/rk2/groups/groupForm"; <div className="space-y-4">
import { GroupEdit } from "@/components/rk2/groups/groupEdit"; <Breadcrumbs items={breadcrumb} />
<div className="max-w-3xl">
type Props = { <GroupEdit anlage={anlage} selectedGroup={group} groups={groups} />
params: Promise<{ </div>
id: string; </div>
}>; );
};
export default async function PageGroupEdit({ params }: Props) {
const { id } = await params;
const resultFindGroupById = await api_groups_byId(id);
const anlage = await api_anlage_getSelected();
const group = resultFindGroupById.data;
const groups = await api_groups();
const breadcrumb = [{ label: "RK", href: "/" },{ label: "Anlage", href: "/" },{ label: "Groups", href: "/groups" }, { label: "Edit" }, { label: group.name }]
if (!resultFindGroupById.success) return <div>Grouppe nicht gefunden {resultFindGroupById.errors} {id}</div>
return (
<div className="">
<div>
<Breadcrumbs items={breadcrumb}/>
</div>
<div className="flex flex-col m-4 w-300 ">
<GroupEdit anlage={anlage} selectedGroup={group} groups={groups} />
</div>
</div>
);
} }
+23 -25
View File
@@ -1,29 +1,27 @@
import { Sites } from "@/_config/sites"; import { redirect } from 'next/navigation';
import { api_groups } from "@/actions/rk2/api-groups"; import { api_groups } from '@/actions/rk2/api-groups';
import { api_anlage_getSelected } from "@/actions/rk/api-anlage"; import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
import { GroupViewList } from "@/components/rk2/groups/groupViewList"; import { api_groupOverview } from '@/actions/rk2/api-group-overview';
import Breadcrumbs from '@/components/ui/navigation/breadcrumbs';
import GroupOverview from '@/components/rk2/groups/groupOverview';
export default async function GroupsPage() {
const anlage = await api_anlage_getSelected();
if (!anlage?.id) {
redirect('/projekte');
}
const groups = await api_groups();
const { sections, warnings } = await api_groupOverview(groups, anlage.id);
const breadcrumb = [
{ label: 'Anlage', href: '/' },
{ label: 'Gruppen' },
];
import Link from "next/link"; return (
import Breadcrumbs from "@/components/ui/navigation/breadcrumbs"; <div className="min-w-0 space-y-4">
<Breadcrumbs items={breadcrumb} />
<GroupOverview groups={groups} sections={sections} warnings={warnings} />
export default async function PageGroups() { </div>
const currentAnlage= await api_anlage_getSelected(); );
const groups = await api_groups();
const breadcrumb = [{ label: "RK", href: "/" },{ label: "Anlage", href: "/" },{ label: "Groups" }]
return (
<div className="">
<div>
<Breadcrumbs items={breadcrumb}/>
</div>
<div className="flex flex-col m-4 w-300 ">
<GroupViewList anlage={currentAnlage} groups={groups} />
</div>
</div>
);
} }
+23
View File
@@ -0,0 +1,23 @@
import { redirect } from 'next/navigation';
import { api_anlage_getSelected } from '@/actions/rk/api-anlage';
import Breadcrumbs from '@/components/ui/navigation/breadcrumbs';
import IoExcelImport from '@/components/hardware/ioExcelImport';
export default async function IoImportPage() {
const anlage = await api_anlage_getSelected();
if (!anlage?.id) {
redirect('/projekte');
}
const breadcrumb = [
{ label: 'Hardware', href: '/hardware' },
{ label: 'IO Import' },
];
return (
<section className="space-y-4">
<Breadcrumbs items={breadcrumb} />
<h1 className="text-2xl font-semibold">IO Import</h1>
<IoExcelImport anlageId={anlage.id} />
</section>
);
}
+21
View File
@@ -0,0 +1,21 @@
import Link from "next/link";
import { api_anlage_getSelected } from "@/actions/rk/api-anlage";
import { api_ios } from "@/actions/rk2/api-ios";
import { api_signals } from "@/actions/rk2/api-signals";
import { api_units } from "@/actions/rk2/api-units";
import IoOverview from '@/components/hardware/ioOverview';
import Breadcrumbs from "@/components/ui/navigation/breadcrumbs";
export default async function IosPage() {
const anlage = await api_anlage_getSelected();
const [ios, signals, units] = await Promise.all([api_ios(), api_signals(), api_units()]);
return <div className="m-4">
<Breadcrumbs items={[{ label: 'Hardware', href: '/hardware' }, { label: 'IO-Übersicht' }, { label: `${anlage.anlageNr} ${anlage.name}` }]} />
<h1 className="my-4 text-xl font-semibold">IO-Übersicht</h1>
<Link className="mb-4 inline-block underline" href="/hardware/io-zuordnung">IOs zu Signalen zuordnen</Link>
<IoOverview ios={ios.filter((io) => io.anlageId === anlage.id)}
signals={signals.filter((signal) => signal.anlageId === anlage.id)}
units={units.filter((unit) => unit.anlageId === anlage.id)} />
</div>;
}
+18
View File
@@ -0,0 +1,18 @@
import { api_anlage_getSelected } from "@/actions/rk/api-anlage";
import { api_groups } from "@/actions/rk2/api-groups";
import { api_units } from "@/actions/rk2/api-units";
import { api_signals } from "@/actions/rk2/api-signals";
import { api_ios } from "@/actions/rk2/api-ios";
import Breadcrumbs from "@/components/ui/navigation/breadcrumbs";
import SignalIoAssignment from '@/components/hardware/signalIoAssignment';
export default async function AssignmentPage({ searchParams }: { searchParams: Promise<{ unitId?: string }> }) {
const { unitId } = await searchParams;
const anlage = await api_anlage_getSelected();
const [groups, units, signals, ios] = await Promise.all([api_groups(), api_units(), api_signals(), api_ios()]);
return <div className="m-4">
<Breadcrumbs items={[{ label: 'Hardware', href: '/hardware' }, { label: 'Zuordnung IOs' }, { label: `${anlage.anlageNr} ${anlage.name}` }]} />
<SignalIoAssignment key={`${anlage.id}:${unitId ?? ''}`} groups={groups} units={units.filter((unit) => unit.anlageId === anlage.id)}
signals={signals} ios={ios.filter((io) => io.anlageId === anlage.id)} anlageId={anlage.id} initialUnitId={unitId} />
</div>;
}
+31
View File
@@ -0,0 +1,31 @@
import Link from 'next/link';
const entries = [
{ href: '/hardware/io-uebersicht', title: 'IO-Übersicht', description: 'IOs und ihren Zuordnungsstatus anzeigen und filtern.' },
{ href: '/hardware/io-import', title: 'IO Import', description: 'IO-Daten aus Excel importieren und mit vorhandenen IOs vergleichen.' },
{ href: '/hardware/zuordnung-uebersicht', title: 'Zuordnung IOs Übersicht', description: 'MongoDB-IOs und eigene Signale mit ihren Zuordnungen anzeigen.' },
{ href: '/hardware/io-zuordnung', title: 'Zuordnung IOs', description: 'IOs den Signalen der Anlage zuordnen.' },
];
export default function HardwarePage() {
return (
<section className="max-w-5xl space-y-6">
<header>
<h1 className="text-2xl font-semibold">Hardware</h1>
<p className="mt-1 text-slate-600">IO-Import und Signalzuordnungen der ausgewählten Anlage</p>
</header>
<nav aria-label="Hardware-Bereiche" className="grid gap-4 md:grid-cols-3">
{entries.map(entry => (
<Link
key={entry.href}
href={entry.href}
className="rounded-lg border bg-white p-5 hover:border-blue-500 hover:bg-blue-50 focus-visible:outline-2 focus-visible:outline-blue-600"
>
<h2 className="font-semibold">{entry.title}</h2>
<p className="mt-2 text-sm text-slate-600">{entry.description}</p>
</Link>
))}
</nav>
</section>
);
}
@@ -0,0 +1,78 @@
import Link from "next/link";
import AssignmentsTable, { type AssignmentRow } from '@/components/hardware/assignmentsTable';
import { api_anlage_getSelected } from "@/actions/rk/api-anlage";
import { api_groups } from "@/actions/rk2/api-groups";
import { api_units } from "@/actions/rk2/api-units";
import { api_signals } from "@/actions/rk2/api-signals";
import { api_ios } from "@/actions/rk2/api-ios";
import Breadcrumbs from "@/components/ui/navigation/breadcrumbs";
import { formatComponentName } from "@/lib/componentName";
import { eaName } from "@/lib/ioEaExport";
export default async function AssignmentsPage() {
const anlage = await api_anlage_getSelected();
const [groups, units, signals, ios] = await Promise.all([api_groups(), api_units(), api_signals(), api_ios()]);
const groupMap = new Map(groups.map((group) => [group.id, group]));
const ioMap = new Map(ios.filter((io) => io.anlageId === anlage.id).map((io) => [io.id, io]));
const componentMap = new Map(units.filter((unit) => unit.anlageId === anlage.id).flatMap((unit) =>
unit.components.map((component) => [component.id, { unit, component }] as const)));
const groupPath = (id?: string) => {
const names: string[] = [];
const seen = new Set<string>();
let group = id ? groupMap.get(id) : undefined;
while (group && !seen.has(group.id)) {
seen.add(group.id);
names.unshift(group.name);
group = group.parentId ? groupMap.get(group.parentId) : undefined;
}
return names;
};
const plantSignals = signals.filter(signal => signal.anlageId === anlage.id);
const assignedIoIds = new Set(plantSignals.map(signal => signal.ioId).filter(Boolean));
const rows: AssignmentRow[] = plantSignals.map((signal) => {
const context = signal.componentId ? componentMap.get(signal.componentId) : undefined;
const io = ioMap.get(signal.ioId!);
return {
id: signal.id,
group: context ? groupPath(context.unit.groupId).join('.') || 'Ohne Gruppe' : 'Zuordnung zu Unit fehlt',
exportName: context ? eaName(context.unit, context.component, signal.name) : '',
variableTable: context ? groupPath(context.unit.groupId)[1] ?? '' : '',
exportComment: [context?.unit.bmk, io?.seiteName, io?.functionText].filter(Boolean).join(' '),
bmk: context?.unit.bmk ?? '',
unit: context?.unit.name ?? 'Nicht verfügbar',
unitId: context?.unit.id,
component: context ? formatComponentName(context.component) : 'Nicht verfügbar',
componentId: context?.component.id,
signal: signal.name,
type: io?.adrType ?? 'IO nicht verfügbar',
byte: io?.adrByte,
bit: io?.adrBit,
functionText: io?.functionText ?? '',
pageReference: io?.seiteName ?? '',
description: signal.description ?? '',
signalType: signal.type,
status: !signal.ioId ? 'Signal ohne IO' : !io ? 'IO nicht gefunden' : signal.type !== io.adrType ? 'Typabweichung' : 'Zugeordnet',
assigned: !!io,
};
});
for (const io of ioMap.values()) {
if (assignedIoIds.has(io.id)) continue;
rows.push({
id: `io-${io.id}`, type: io.adrType, byte: io.adrByte, bit: io.adrBit,
functionText: io.functionText ?? '', pageReference: io.seiteName ?? '',
group: '', bmk: '', unit: '', component: '', signal: '', signalType: '', description: '',
status: 'IO ohne Signal', assigned: false,
exportName: '', variableTable: '', exportComment: '',
});
}
return <div className="m-4">
<Breadcrumbs items={[{ label: 'Hardware', href: '/hardware' }, { label: 'Zuordnung IOs Übersicht' }, { label: `${anlage.anlageNr} ${anlage.name}` }]} />
<h1 className="my-4 text-xl font-semibold">Zuordnung IOs Übersicht</h1>
<p className="mb-3">Alle IOs und Signale der ausgewählten Anlage. Abgleich über die gespeicherte Zuordnung IOs; IOs ohne Signal und Signale ohne IO bleiben sichtbar.</p>
<Link className="mb-4 inline-block underline" href="/hardware/io-zuordnung">Zuordnungen bearbeiten</Link>
<AssignmentsTable rows={rows} />
</div>;
}
+3 -19
View File
@@ -1,21 +1,5 @@
import Link from "next/link"; import { redirect } from 'next/navigation';
import { api_anlage_getSelected } from "@/actions/rk/api-anlage";
import { api_ios } from "@/actions/rk2/api-ios";
import { api_signals } from "@/actions/rk2/api-signals";
import { api_units } from "@/actions/rk2/api-units";
import IoOverview from "@/components/rk2/ios/ioOverview";
import Breadcrumbs from "@/components/ui/navigation/breadcrumbs";
export default async function IosPage() { export default function PreviousIosPage() {
const anlage = await api_anlage_getSelected(); redirect('/hardware/io-uebersicht');
const [ios, signals, units] = await Promise.all([api_ios(), api_signals(), api_units()]);
return <div className="m-4">
<Breadcrumbs items={[{ label: 'IOs' }, { label: `${anlage.anlageNr} ${anlage.name}` }]} />
<h1 className="my-4 text-xl font-semibold">IO-Übersicht</h1>
<Link className="mb-4 inline-block underline" href="/signals/assignment">IOs zu Signalen zuordnen</Link>
<IoOverview ios={ios.filter((io) => io.anlageId === anlage.id)}
signals={signals.filter((signal) => signal.anlageId === anlage.id)}
units={units.filter((unit) => unit.anlageId === anlage.id)} />
</div>;
} }
+39 -7
View File
@@ -1,11 +1,43 @@
import { BACKEND_URL } from '@/_config/backend';
export const dynamic = 'force-dynamic'; export const dynamic = 'force-dynamic';
export const runtime = 'nodejs'; export const runtime = 'nodejs';
const SCENE_TOKEN_PATTERN = /^[a-f0-9]{64}$/;
export async function GET(request: Request) { export async function GET(request: Request) {
const params = new URL(request.url).searchParams, anlageId = params.get('anlageId'), token = params.get('token'); const params = new URL(request.url).searchParams;
if (!anlageId || !token || !/^[a-f0-9]{64}$/.test(token)) return new Response('Anlagenbild fehlt', { status: 400 }); const anlageId = params.get('anlageId');
try { const token = params.get('token');
const response = await fetch('http://localhost:3000/rk2/digital-opc/scene/events?anlageId=' + encodeURIComponent(anlageId) + '&token=' + encodeURIComponent(token), { cache: 'no-store', signal: request.signal });
if (!response.ok) return new Response('Live-Verbindung nicht erreichbar', { status: response.status }); const hasValidRequest = anlageId && token && SCENE_TOKEN_PATTERN.test(token);
return new Response(response.body, { headers: { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache, no-transform', 'X-Accel-Buffering': 'no' } });
} catch { return new Response('Backend nicht erreichbar', { status: 502 }); } if (!hasValidRequest) {
return new Response('Anlagenbild fehlt', { status: 400 });
}
const eventsUrl = `${BACKEND_URL}/rk2/digital-opc/scene/events`
+ `?anlageId=${encodeURIComponent(anlageId)}`
+ `&token=${encodeURIComponent(token)}`;
try {
const response = await fetch(eventsUrl, {
cache: 'no-store',
signal: request.signal,
});
if (!response.ok) {
return new Response('Live-Verbindung nicht erreichbar', { status: response.status });
}
return new Response(response.body, {
headers: {
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache, no-transform',
'X-Accel-Buffering': 'no',
},
});
} catch {
return new Response('Backend nicht erreichbar', { status: 502 });
}
} }
+3 -50
View File
@@ -1,52 +1,5 @@
import { formatComponentName } from "@/lib/componentName"; import { redirect } from 'next/navigation';
import { Sites } from "@/_config/sites";
import { api_units } from "@/actions/rk2/api-units";
import { api_anlage_getSelected } from "@/actions/rk/api-anlage"; export default function HomePage() {
redirect('/projekte');
import Link from "next/link";
import { List, ListItem, ListItemAction } from "@/components/ui/list";
import { Button } from "@/components/ui/button";
import Breadcrumbs from "@/components/ui/navigation/breadcrumbs";
export default async function PageUnits() {
const currentAnlage = await api_anlage_getSelected();
const units = await api_units();
const breadcrumb = [{ label: "RK", href: "/" },{ label: "Anlage" }]
return (
<>
{/* Main-Nav */}
<Breadcrumbs items={breadcrumb}/>
<div className="flex flex-col m-4 w-170 ">
<List variant={"transparent"} >
{units.map((unit) => (
<ListItem hover={true} key={unit.id}>
<div className="w-50">
{unit.name}
</div>
<div className="w-20">
{unit.type}
</div>
<div className="w-40">
{unit.components?.map((comp) => <div key={comp.id}><div>{formatComponentName(comp)}</div></div>)}
</div>
<ListItemAction>
<Button variant={"secondary"} size={"xs"} >
<Link href={`/units/edit/${unit.id}`}>Auswahl</Link>
</Button>
</ListItemAction>
</ListItem>
))}
</List>
</div>
</>
);
} }
+21 -6
View File
@@ -1,8 +1,23 @@
import { BACKEND_URL } from '@/_config/backend';
const EXCEL_CONTENT_TYPE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
export async function GET() { export async function GET() {
try { try {
const response = await fetch('http://localhost:3000/rk2/parameter/export', { cache: 'no-store' }); const response = await fetch(`${BACKEND_URL}/rk2/parameter/export`, { cache: 'no-store' });
if (!response.ok) return new Response('Parameter-Export fehlgeschlagen', { status: 502 });
return new Response(response.body, { headers: { 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', if (!response.ok) {
'Content-Disposition': 'attachment; filename="AllgemeineAnlageParameter.xlsx"', 'Cache-Control': 'no-store' } }); return new Response('Parameter-Export fehlgeschlagen', { status: 502 });
} catch { return new Response('Keine Verbindung zum Backend', { status: 502 }); } }
return new Response(response.body, {
headers: {
'Content-Type': EXCEL_CONTENT_TYPE,
'Content-Disposition': 'attachment; filename="AllgemeineAnlageParameter.xlsx"',
'Cache-Control': 'no-store',
},
});
} catch {
return new Response('Keine Verbindung zum Backend', { status: 502 });
}
} }
+13
View File
@@ -0,0 +1,13 @@
'use client';
import { Button } from '@/components/ui/button';
export default function ProjekteError({ reset }: { reset: () => void }) {
return (
<section className="mx-auto max-w-xl space-y-4">
<h1 className="text-2xl font-semibold">Projekte konnten nicht geladen werden</h1>
<p role="alert">Prüfe, ob das Backend erreichbar ist, und versuche es erneut.</p>
<Button onClick={reset}>Erneut versuchen</Button>
</section>
);
}
+5
View File
@@ -0,0 +1,5 @@
import AnlageCreate from '@/components/rk/anlage/anlageCreate';
export default function NeueAnlagePage() {
return <AnlageCreate />;
}
+8
View File
@@ -0,0 +1,8 @@
import { api_anlagen_getAll } from '@/actions/rk/api-anlage';
import ProjectList from '@/components/rk/anlage/projectList';
export default async function ProjektePage() {
const anlagen = await api_anlagen_getAll();
return <ProjectList anlagen={anlagen} />;
}
Loaded 100 of 199 files, more files were not shown because too many files have changed in this diff. Show more