umstellung auf claud

This commit is contained in:
marco committed 2026-12-04 10:14:49 +01:00
1 parent 79c5f0c5cd
commit 5bb4e063da
171 files changed
+5451 -1313

No files matched your search

+3
View File
@@ -1,2 +1,5 @@
{ {
"editor.tabSize": 4,
"editor.insertSpaces": true,
"editor.detectIndentation": false
} }
+347 -1
View File
@@ -5,4 +5,350 @@
· serverActions · serverActions
✓ Starting... ✓ Starting...
✓ Ready in 2.2s ✓ 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",
+1 -1
View File
@@ -3,4 +3,4 @@
- Network: http://10.8.1.11:3001 - Network: http://10.8.1.11:3001
✓ Starting... ✓ Starting...
✓ Ready in 746ms ✓ Ready in 699ms
+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
View File
@@ -11,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>> {
+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>> {
+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 { ProjectImportContext, ProjectImportPreview, ProjectImportResult } from '@/types/procon/project-import'; import type { ProjectImportContext, ProjectImportPreview, ProjectImportResult } from '@/types/procon/project-import';
const url = 'http://localhost:3000/procon/project-import'; const url = BACKEND_URL + '/procon/project-import';
async function request<T>(action: string, input: unknown): Promise<T> { 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 response = await fetch(`${url}/${action}`, { method: 'POST', cache: 'no-store', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(input) });
const data = await response.json(); const data = await response.json();
+6 -1
View File
@@ -1,9 +1,14 @@
'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';
import { api_groupCompare } from './api-group-sync'; import { api_groupCompare } from './api-group-sync';
import { api_savedAggregateLinks } from './api-zuordnung'; import { api_savedAggregateLinks } from './api-zuordnung';
import { api_viewAggregate_exportXaml } from '@/actions/rk2/api-procon-view-aggregate'; import { api_viewAggregate_exportXaml } from '@/actions/rk2/api-procon-view-aggregate';
const url = (id: number, visuId: number) => 'http://localhost:3000/procon/aggregate/' + id + '/visualisierungen/' + visuId + '/sync';
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) { export async function api_exportAggregateXaml(id: number, version: string) {
try { try {
const group = await api_groupCompare(id); const group = await api_groupCompare(id);
+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.');
+56 -33
View File
@@ -1,62 +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> { export async function api_anlage_create(input: { name: string; anlageNr: number }): Promise<Anlage> {
const response = await fetch('http://localhost:3000/anlage', { const response = await fetch(`${BACKEND_URL}/anlage`, {
method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(input), method: 'POST',
}); headers: { 'Content-Type': 'application/json' },
const data = await response.json(); body: JSON.stringify(input),
if (!response.ok) throw new Error(data.message ?? 'Anlage konnte nicht angelegt werden.'); });
revalidatePath(Sites.anlagen.url);
return data; 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) {
throw new Error(data.message ?? `Anlage konnte nicht ausgewählt werden (${result.status}).`); throw new Error(data.message ?? `Anlage konnte nicht ausgewählt werden (${result.status}).`);
} }
revalidatePath('/', 'layout'); revalidatePath('/', 'layout');
return data;
return toAnlageSummary(data);
} }
+17 -16
View File
@@ -1,28 +1,29 @@
import { BACKEND_URL } from '@/_config/backend';
import { DrawShapeData, DrawShapeOptionen } from "@/types/draw/draw.types"; import { DrawShapeData, DrawShapeOptionen } from "@/types/draw/draw.types";
import { Anlage } from "@/types/rk"; 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) {
if (optionen) { optionenStr = '?';
optionenStr = '?'
let separator = '' let separator = '';
for (const [key, value] of Object.entries(optionen)) {
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}`, { const result = await fetch(`${BACKEND_URL}/draw/gurtfoerderer${optionenStr}`, {
method: 'GET', method: 'GET',
headers: { 'Content-Type': 'application/json' } headers: { 'Content-Type': 'application/json' },
}); });
const data = await result.json() as DrawShapeData; const data = await result.json() as DrawShapeData;
return data; return data;
}␍ }␍
+66 -61
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 { success: true, data: resultData };
return {
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();
} }
+70 -61
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 = '?';
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; console.log(filterStr);
separator = '&' console.log(`${BACKEND_URL}/group${filter}`);
} }
console.log(filterStr)
console.log(`http://localhost:3000/group${filter}`);
}
const result = await fetch(`${BACKEND_URL}/group${filterStr}`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
});
const result = await fetch(`http://localhost:3000/group${filterStr}`, { const data = await result.json();
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json(); return data;
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,
};
} }
+68 -62
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 { success: true, data: resultData };
return {
success: true,
data: resultData,
};
} }
+52 -38
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 { success: true, data: resultData };
return {
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/`, { if (!result.ok) {
method: 'POST', return {
headers: { 'Content-Type': 'application/json' }, success: false,
body: JSON.stringify(data), errors: resultData.message, // kommt aus NestJS
}) };
}
const resultData = await result.json(); revalidatePath(Sites.visu.url);
if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.visu.url);
return { success: true, data: resultData };
return {
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}`, { if (!result.ok) {
method: 'PATCH', return {
headers: { 'Content-Type': 'application/json' }, success: false,
body: JSON.stringify(data), errors: resultData.message, // kommt aus NestJS
}) };
}
const resultData = await result.json(); revalidatePath(Sites.visu.url);
if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.visu.url);
return { success: true, data: resultData };
return {
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.'] };
+2 -1
View File
@@ -1,10 +1,11 @@
'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 { revalidatePath } from 'next/cache';
import type { AggregateTableComparison, AggregateSyncField } from '@/types/anlagen/visu-aggregate-sync'; 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> { 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 response = await fetch(`${url}/sync/${action}`, { method: 'POST', cache: 'no-store', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(input) });
+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 { 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');
+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)});}
@@ -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();
+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 { 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();
+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');
}
+4 -2
View File
@@ -1,3 +1,5 @@
import AnlageCreate from '@/components/rk/anlage/anlageCreate'; import { redirect } from 'next/navigation';
export default function NeueAnlagePage() { return <AnlageCreate />; } export default function NeueAnlagePage() {
redirect('/projekte/neu');
}
+3 -25
View File
@@ -1,27 +1,5 @@
import { redirect } from 'next/navigation';
import { Sites } from "@/_config/sites"; export default function AnlagenPage() {
import { 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 = anlagen.find(anlage => anlage.selected);
return (
<div className="">
<Link href={Sites.main.url}>{Sites.main.name}</Link>
<div className="my-4 flex items-center justify-between gap-3">
<h1 className="text-xl font-semibold">Anlagen</h1>
<Link href={Sites.anlagen.new.url} className="rounded bg-blue-600 px-4 py-2 text-sm text-white">Neue Anlage anlegen</Link>
</div>
<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>;
} }
} }
@@ -4,6 +4,6 @@ import BulkSyncDashboard from '@/components/procon/bulkSyncDashboard';
export default async function Page() { export default async function Page() {
const result = await api_bulkSyncContext(); 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="/verbindungen" className="underline">ProCon-Verbindung prüfen</Link></div>; 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} />; 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} />;
}
@@ -0,0 +1,43 @@
import { BACKEND_URL } from '@/_config/backend';
type BackupFileRouteContext = {
params: Promise<{ id: string }>;
};
const UNSAFE_FILENAME_CHARACTERS = /[^A-Za-z0-9_.-]/g;
// Nur der letzte Pfadteil wird als Download-Name verwendet,
// unsichere Zeichen werden ersetzt.
function toDownloadFilename(file: string): string {
const lastPathPart = file.split('/').pop();
return lastPathPart?.replace(UNSAFE_FILENAME_CHARACTERS, '_') ?? 'backup.json';
}
export async function GET(request: Request, { params }: BackupFileRouteContext) {
const { id } = await params;
const file = new URL(request.url).searchParams.get('file') ?? 'manifest.json';
const backupFileUrl = `${BACKEND_URL}/rk2/backups/${encodeURIComponent(id)}/file`
+ `?file=${encodeURIComponent(file)}`;
try {
const response = await fetch(backupFileUrl, { cache: 'no-store' });
if (!response.ok) {
return new Response('Sicherungsdatei nicht verfügbar', { status: response.status });
}
const filename = toDownloadFilename(file);
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 });
}
}
@@ -0,0 +1,17 @@
import Link from 'next/link';
import { api_backups } from '@/actions/backup/api-backup';
import BackupPanel from '@/components/backup/backupPanel';
export default async function DatensicherungPage() {
try {
const backups = await api_backups();
return (
<section className="space-y-4">
<Link href="/projekte/system" className="text-sm text-blue-700 underline">Zurück zu System</Link>
<BackupPanel initial={backups} />
</section>
);
} catch {
return <p role="alert">Datensicherungen konnten nicht geladen werden.</p>;
}
}
+17
View File
@@ -0,0 +1,17 @@
import Link from 'next/link';
export default function SystemPage() {
return (
<section className="mx-auto max-w-4xl space-y-6">
<Link href="/projekte" className="text-sm text-blue-700 underline">Zur Projektliste</Link>
<h1 className="text-2xl font-semibold">System</h1>
<Link
href="/projekte/system/datensicherung"
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">Datensicherung</h2>
<p className="mt-2 text-sm text-slate-600">Sicherungen erstellen, herunterladen und wiederherstellen.</p>
</Link>
</section>
);
}
+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/sensoren-analog/export', { cache: 'no-store' }); const response = await fetch(`${BACKEND_URL}/rk2/sensoren-analog/export`, { cache: 'no-store' });
if (!response.ok) return new Response('Sensoren-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="Sensoren_Analog.xlsx"', 'Cache-Control': 'no-store' } }); return new Response('Sensoren-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="Sensoren_Analog.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">Sensoren Analog</h2> return <div><h2 className="mb-3 text-lg font-semibold">Sensoren Analog</h2>
<p role="alert" className="mb-3 text-red-600">{error instanceof Error ? error.message : 'Sensoren konnten nicht geladen werden'}</p> <p role="alert" className="mb-3 text-red-600">{error instanceof Error ? error.message : 'Sensoren konnten nicht geladen werden'}</p>
<div className="flex flex-wrap gap-3"><Link href="/verbindungen" className="underline">ProCon-Verbindung prüfen</Link> <div className="flex flex-wrap gap-3"><Link href="/anlagen/einstellungen/procon" className="underline">ProCon-Verbindung prüfen</Link>
<Link href="/sensoren-analog/bearbeiten" className="underline">Sensoren und Grafiken bearbeiten</Link></div></div>; <Link href="/sensoren-analog/bearbeiten" className="underline">Sensoren und Grafiken bearbeiten</Link></div></div>;
} }
} }
+19 -5
View File
@@ -1,7 +1,21 @@
import { BACKEND_URL } from '@/_config/backend';
export async function GET() { export async function GET() {
try { try {
const response = await fetch('http://localhost:3000/rk2/sensoren-analog/xaml-zip', { cache: 'no-store' }); const response = await fetch(`${BACKEND_URL}/rk2/sensoren-analog/xaml-zip`, { cache: 'no-store' });
if (!response.ok) return new Response('XAML-Export fehlgeschlagen', { status: 502 });
return new Response(response.body, { headers: { 'Content-Type': 'application/zip', 'Content-Disposition': 'attachment; filename="Sensoren_Analog-XAML.zip"', 'Cache-Control': 'no-store' } }); if (!response.ok) {
} catch { return new Response('Keine Verbindung zum Backend', { status: 502 }); } return new Response('XAML-Export fehlgeschlagen', { status: 502 });
}
return new Response(response.body, {
headers: {
'Content-Type': 'application/zip',
'Content-Disposition': 'attachment; filename="Sensoren_Analog-XAML.zip"',
'Cache-Control': 'no-store',
},
});
} catch {
return new Response('Keine Verbindung zum Backend', { status: 502 });
}
} }
Loaded 100 of 171 files, more files were not shown because too many files have changed in this diff. Show more