From 2d8c51525dc3c2f5ed78370d10ca6478f618bd54 Mon Sep 17 00:00:00 2001 From: Ismail Ali Date: Wed, 25 Jun 2025 22:49:02 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Filter=20f=C3=BCr=20Quelle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 5 + .../main/analogInputs/AnalogInputsChart.tsx | 6 +- docs/TODO.md | 12 +- .../SERVICE/SystemMockData.json | 17 ++ .../SERVICE/digitalInputsMockData.json | 64 ++++++ .../SERVICE/digitalOutputsMockData.json | 4 + .../SERVICE/kabelueberwachungMockData.json | 203 ++++++++++++++++++ .../SERVICE/last20MessagesMockData.json | 142 ++++++++++++ .../SERVICE/opcuaMockData.json | 5 + .../SERVICE/systemVoltTempMockData.json | 5 + package-lock.json | 4 +- package.json | 2 +- pages/api/cpl/last20MessagesAPIHandler.ts | 2 +- pages/meldungen.tsx | 40 +++- 16 files changed, 492 insertions(+), 23 deletions(-) create mode 100644 mocks/device-cgi-simulator/SERVICE/SystemMockData.json create mode 100644 mocks/device-cgi-simulator/SERVICE/digitalInputsMockData.json create mode 100644 mocks/device-cgi-simulator/SERVICE/digitalOutputsMockData.json create mode 100644 mocks/device-cgi-simulator/SERVICE/kabelueberwachungMockData.json create mode 100644 mocks/device-cgi-simulator/SERVICE/last20MessagesMockData.json create mode 100644 mocks/device-cgi-simulator/SERVICE/opcuaMockData.json create mode 100644 mocks/device-cgi-simulator/SERVICE/systemVoltTempMockData.json diff --git a/.env.development b/.env.development index 8602c7a..333940b 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_USE_CGI=false # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.448 +NEXT_PUBLIC_APP_VERSION=1.6.449 NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) diff --git a/.env.production b/.env.production index dfd4702..9224353 100644 --- a/.env.production +++ b/.env.production @@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_USE_CGI=true # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.448 +NEXT_PUBLIC_APP_VERSION=1.6.449 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ecf5f02..8583d43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.6.449] – 2025-06-25 + +- refactor: alle Feature-Flags entfernt wegen Aufwand und Zeit + +--- ## [1.6.448] – 2025-06-25 - Add: SERVICE JSON Files diff --git a/components/main/analogInputs/AnalogInputsChart.tsx b/components/main/analogInputs/AnalogInputsChart.tsx index 07b3563..061b0d0 100644 --- a/components/main/analogInputs/AnalogInputsChart.tsx +++ b/components/main/analogInputs/AnalogInputsChart.tsx @@ -84,9 +84,9 @@ export default function AnalogInputsChart({ const chartData = { datasets: [ { - label: `Messkurve ${selectedInput?.label ?? "Eingang"} (${ + label: `Messkurve ${selectedInput?.label ?? "Eingang"} [${ selectedInput?.unit ?? "" - })`, + }]`, data: inputData.map((point: any) => ({ x: point.t, y: point.m, @@ -147,7 +147,7 @@ export default function AnalogInputsChart({ y: { title: { display: true, - text: `Messwert (${selectedInput?.unit ?? ""})`, + text: `Messwert [${selectedInput?.unit ?? ""}]`, }, }, }, diff --git a/docs/TODO.md b/docs/TODO.md index f62c5cf..4040ab4 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -2,13 +2,13 @@ ## 🔄 Zusatzfunktionen (prio niedrig) – Kai, 25. Juni 2025 -- [ ] TODO:Messwertanzeige eines Eingangs: Zeitraum einstellbar, Bezeichnung und Einheit in die Messkurve, Datum in die Messkurve +- [ ] TODO:Messwertanzeige eines Eingangs: Zeitraum einstellbar, Bezeichnung und Einheit in die Messkurve, Datum in die Messkurve von DIA0 als Parameter - Einheit in eckigen Klammern und Chart Daten mit Parameter DIA0 usw. -- [ ] FIXME: Kabelüberwachung vertikal angezeigt -- [ ] TODO: Startseite Meldungen: Spalte Quelle wie bei Berichte (nicht "Modul") -- [ ] TODO: Startseite Spaltenreihenfolge: Pop (farbiger Punkt), Zeitstempel, Quelle, Meldung, Status -- [ ] TODO: Berichte Spaltenreihenfolge: Pop (farbiger Punkt), Zeitstempel, Quelle, Meldung, Status -- [ ] TODO: Filter für Quelle +- [x] FIXME: Kabelüberwachung vertikal angezeigt +- [ ] TODO: Startseite Meldungen: Spalte Quelle wie bei Berichte (nicht "Modul") , kommen die von JSON nur 20 darstellen? +- [ ] TODO: Startseite Spaltenreihenfolge: Prio (farbiger Punkt), Zeitstempel, Quelle, Meldung, Status +- [x] TODO: Berichte Spaltenreihenfolge: Prio (farbiger Punkt), Zeitstempel, Quelle, Meldung, Status +- [x] TODO: Filter für Quelle - [ ] TODO: System: Button bei jedem Messwert für Detailansicht (inkl. Kurve im Popup und Zeitauswahl) - [ ] TODO: Einstellungen – Benutzerverwaltung: Admin kann Adminpasswort ändern - [ ] TODO: Einstellungen – OPC: Anzahl der aktuellen Clients (ggf. KAS-Variable einbauen) diff --git a/mocks/device-cgi-simulator/SERVICE/SystemMockData.json b/mocks/device-cgi-simulator/SERVICE/SystemMockData.json new file mode 100644 index 0000000..8a193b1 --- /dev/null +++ b/mocks/device-cgi-simulator/SERVICE/SystemMockData.json @@ -0,0 +1,17 @@ +{ + "win_appVersion": "0.02", + "win_deviceName": "CPLV4 Ismail Rastede", + "win_mac1": "0 48 86 81 46 143", + "win_ip": "10.10.0.243", + "win_subnet": "255.255.255.0", + "win_gateway": "10.10.0.1", + "win_cplInternalTimestamp": "23.10.24 15:10:28 Uhr", + "win_opcState": "1", + "win_opcSessions": "0", + "win_opcName": "CPL V4 OPC UA Application Deutsche Bahne", + "win_ntp1": "192.53.103.108", + "win_ntp2": "0.0.0.0", + "win_ntp3": "0.0.0.0", + "win_ntpTimezone": "2", + "win_ntpActive": "1" +} diff --git a/mocks/device-cgi-simulator/SERVICE/digitalInputsMockData.json b/mocks/device-cgi-simulator/SERVICE/digitalInputsMockData.json new file mode 100644 index 0000000..b0e2bea --- /dev/null +++ b/mocks/device-cgi-simulator/SERVICE/digitalInputsMockData.json @@ -0,0 +1,64 @@ +{ + "win_de_state": [ + 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_de_invert": [ + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_de_counter": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_de_time_filter": [ + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_de_weighting": [ + 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_de_counter_active": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_de_offline": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_de_label": [ + "DE1", + "DE2", + "DE3", + "DE4", + "DE5", + "DE6", + "DE7", + "DE8", + "DE9", + "DE10", + "DE11", + "DE12", + "DE13", + "DE14", + "DE15", + "DE16", + "DE17", + "DE18", + "DE19", + "DE20", + "DE21", + "DE22", + "DE23", + "DE24", + "DE25", + "DE26", + "DE27", + "DE28", + "DE29", + "DE30", + "DE31", + "DE32" + ] +} diff --git a/mocks/device-cgi-simulator/SERVICE/digitalOutputsMockData.json b/mocks/device-cgi-simulator/SERVICE/digitalOutputsMockData.json new file mode 100644 index 0000000..3488f54 --- /dev/null +++ b/mocks/device-cgi-simulator/SERVICE/digitalOutputsMockData.json @@ -0,0 +1,4 @@ +{ + "win_da_state": [1, 1, 1, 1], + "win_da_bezeichnung": ["Ausgang2", "Ausgang2", "Ausgang3", "Ausgang4"] +} diff --git a/mocks/device-cgi-simulator/SERVICE/kabelueberwachungMockData.json b/mocks/device-cgi-simulator/SERVICE/kabelueberwachungMockData.json new file mode 100644 index 0000000..bd27394 --- /dev/null +++ b/mocks/device-cgi-simulator/SERVICE/kabelueberwachungMockData.json @@ -0,0 +1,203 @@ +{ + "win_kueOnline": [ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1 + ], + "win_kuePSTmMinus96V": [ + 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_kueCableBreak": [ + 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 1, 1 + ], + "win_kueGroundFault": [ + 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_kueAlarm1": [ + 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0 + ], + "win_kueAlarm2": [ + 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_kueOverflow": [ + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_kueIso": [ + 10.0, 10.0, 10.0, 10.5, 10.0, 10.0, 10.0, 10.0, 10.5, 10.0, 10.0, 10.0, + 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.5, 10.0, 10.0, 10.0, + 10.0, 10.0, 10.5, 10.0, 200.0, 200.0, 200.0, 200.0 + ], + "win_kueLimit1": [ + 3, 9.9, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, + 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, + 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0 + ], + "win_kueDelay1": [ + 3, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, + 420, 420 + ], + "win_kueResidence": [ + 0.0, 0.612, 0.0, 0.645, 0.822, 0.97, 0.0, 0.0, 1.452, 0.0, 0.734, 0.37, + 0.566, 0.0, 0.738, 0.684, 1.166, 0.595, 0.0, 1.651, 1.18, 1.387, 1.214, 0.0, + 1.475, 0.615, 0.494, 1.217, 65.0, 65.0, 65.0, 65.0 + ], + "win_kueLimit2Low": [ + 3, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, + 0.1, 0.1 + ], + "win_kueLimit2High": [ + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1 + ], + "win_kueLoopInterval": [ + 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6 + ], + "win_kueVersion": [ + 420, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, + 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, + 419, 419 + ], + "win_kueID": [ + "Test3", + "B23", + "Kabel 3", + "Kabel 4", + "Kabel 5", + "Kabel 6", + "FTZ4562", + "Kabel 8", + "12344", + "Kabel 10", + "Kabel 11", + "Kabel 12", + "Kabel 13", + "Kabel 14", + "Kabel 15", + "H56-77", + "Kabel 17", + "Kabel 18", + "Kabel 19", + "Kabel 20", + "Kabel 21", + "Kabel 22", + "Kabel 23", + "Kabel 24", + "Kabel 25", + "Kabel 26", + "Kabel 27", + "Kabel 28", + "Kabel 29", + "Kabel 30", + "Kabel 31", + "Kabel 32" + ], + "win_kueName": [ + "Kabel 1", + "Kabel 2", + "Kabel 3", + "Kabel 4", + "Kabel 5", + "Kabel 6", + "Kabel 7", + "Kabel 8", + "Kabel 9", + "Kabel 10", + "Kabel 11", + "Kabel 12", + "Kabel 13", + "Kabel 14", + "Kabel 15", + "Kabel 16", + "Kabel 17", + "Kabel 18", + "Kabel 19", + "Kabel 20", + "Kabel 21", + "Kabel 22", + "Kabel 23", + "Kabel 24", + "Kabel 25", + "Kabel 26", + "Kabel 27", + "Kabel 28", + "Kabel 29", + "Kabel 30", + "Kabel 31", + "Kabel 32" + ], + "win_tdrActive": [ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1 + ], + "win_tdrAtten": [ + 11, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, + 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, + 2.0, 2.0 + ], + "win_tdrSpeed": [ + 112, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, + 100, 100 + ], + "win_tdrTrigger": [ + 102, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, + 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80 + ], + "win_tdrPulse": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_tdrAmp": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_tdrLocation": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 + ], + "win_tdrLast": [ + "2024-10-17 07:51:54:000", + "2024-09-30 08:38:50:000", + "?", + "?", + "?", + "?", + "?", + "?", + "2024-09-30 08:36:43:000", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?", + "?" + ], + "win_memoryInterval": [ + 5, 0, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0 + ] +} diff --git a/mocks/device-cgi-simulator/SERVICE/last20MessagesMockData.json b/mocks/device-cgi-simulator/SERVICE/last20MessagesMockData.json new file mode 100644 index 0000000..050d84c --- /dev/null +++ b/mocks/device-cgi-simulator/SERVICE/last20MessagesMockData.json @@ -0,0 +1,142 @@ +[ + { + "id": 11595, + "code": "02501", + "timestamp": "2025-06-20 10:01:33", + "message": "Isofehler gehend", + "status": 0 + }, + { + "id": 11594, + "code": "02501", + "timestamp": "2025-06-20 10:01:12", + "message": "Isofehler kommend", + "status": 1 + }, + { + "id": 11593, + "code": "02000", + "timestamp": "2025-06-20 09:51:37", + "message": "DE 1 gehend", + "status": 0 + }, + { + "id": 11592, + "code": "02001", + "timestamp": "2025-06-20 09:51:20", + "message": "DE 2 gehend", + "status": 0 + }, + { + "id": 11591, + "code": "02001", + "timestamp": "2025-06-20 09:50:50", + "message": "DE 2 kommend", + "status": 1 + }, + { + "id": 11590, + "code": "02031", + "timestamp": "2025-06-20 09:42:38", + "message": "DE 32 gehend", + "status": 0 + }, + { + "id": 11589, + "code": "02031", + "timestamp": "2025-06-20 09:42:27", + "message": "DE 32 kommend", + "status": 1 + }, + { + "id": 11588, + "code": "02031", + "timestamp": "2025-06-20 09:42:16", + "message": "DE 32 gehend", + "status": 0 + }, + { + "id": 11587, + "code": "02000", + "timestamp": "2025-06-20 09:41:36", + "message": "DE 11 kommend", + "status": 1 + }, + { + "id": 11586, + "code": "02003", + "timestamp": "2025-06-20 09:41:16", + "message": "DE 4 gehend", + "status": 0 + }, + { + "id": 11585, + "code": "02501", + "timestamp": "2025-06-20 09:31:57", + "message": "Isofehler gehend", + "status": 0 + }, + { + "id": 11584, + "code": "02501", + "timestamp": "2025-06-20 09:26:26", + "message": "Isofehler kommend", + "status": 1 + }, + { + "id": 11583, + "code": "02501", + "timestamp": "2025-06-20 09:19:26", + "message": "Isofehler gehend", + "status": 0 + }, + { + "id": 11582, + "code": "02002", + "timestamp": "2025-06-20 09:17:53", + "message": "DE 3 kommend", + "status": 1 + }, + { + "id": 11581, + "code": "02501", + "timestamp": "2025-06-20 09:17:33", + "message": "Isofehler kommend", + "status": 1 + }, + { + "id": 11580, + "code": "02000", + "timestamp": "2025-06-20 09:12:09", + "message": "DE 1 gehend", + "status": 0 + }, + { + "id": 11579, + "code": "02003", + "timestamp": "2025-06-20 09:05:30", + "message": "DE 4 kommend", + "status": 1 + }, + { + "id": 11578, + "code": "02002", + "timestamp": "2025-06-20 09:05:27", + "message": "DE 3 gehend", + "status": 0 + }, + { + "id": 11577, + "code": "02001", + "timestamp": "2025-06-20 09:05:23", + "message": "DE 2 gehend", + "status": 0 + }, + { + "id": 11576, + "code": "02000", + "timestamp": "2025-06-20 09:02:09", + "message": "DE 11 kommend", + "status": 1 + } +] diff --git a/mocks/device-cgi-simulator/SERVICE/opcuaMockData.json b/mocks/device-cgi-simulator/SERVICE/opcuaMockData.json new file mode 100644 index 0000000..b7ea632 --- /dev/null +++ b/mocks/device-cgi-simulator/SERVICE/opcuaMockData.json @@ -0,0 +1,5 @@ +{ + "win_opcUaZustand": "1", + "win_opcUaActiveClientCount": "0", + "win_opcUaNodesetName": "CPL V4 OPC UA Application Deutsche Bahn" +} diff --git a/mocks/device-cgi-simulator/SERVICE/systemVoltTempMockData.json b/mocks/device-cgi-simulator/SERVICE/systemVoltTempMockData.json new file mode 100644 index 0000000..ca03592 --- /dev/null +++ b/mocks/device-cgi-simulator/SERVICE/systemVoltTempMockData.json @@ -0,0 +1,5 @@ +{ + "win_systemVoltTempMockData": [ + 15.06, 4.984809, -15.086375, -96.480942, 59.782001, 56.919998 + ] +} diff --git a/package-lock.json b/package-lock.json index 711eb41..a3a9875 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.448", + "version": "1.6.449", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.448", + "version": "1.6.449", "dependencies": { "@fontsource/roboto": "^5.1.0", "@iconify-icons/ri": "^1.2.10", diff --git a/package.json b/package.json index 5cae5db..41acd12 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.448", + "version": "1.6.449", "private": true, "scripts": { "dev": "next dev", diff --git a/pages/api/cpl/last20MessagesAPIHandler.ts b/pages/api/cpl/last20MessagesAPIHandler.ts index c30a245..a67f259 100644 --- a/pages/api/cpl/last20MessagesAPIHandler.ts +++ b/pages/api/cpl/last20MessagesAPIHandler.ts @@ -12,7 +12,7 @@ export default async function handler( "mocks", "device-cgi-simulator", "SERVICE", - "last20MessagesMockData.js" + "last20MessagesMockData.json" ); try { diff --git a/pages/meldungen.tsx b/pages/meldungen.tsx index cfa508d..d2195c4 100644 --- a/pages/meldungen.tsx +++ b/pages/meldungen.tsx @@ -1,6 +1,6 @@ "use client"; // /pages/meldungen.tsx -import React, { useState } from "react"; +import React, { useState, useEffect } from "react"; import DateRangePickerMeldungen from "../components/main/meldungen/DateRangePickerMeldungen"; type Meldung = { @@ -16,6 +16,7 @@ const ITEMS_PER_PAGE = 10; export default function Messages() { const [messages, setMessages] = useState([]); const [currentPage, setCurrentPage] = useState(1); + const [sourceFilter, setSourceFilter] = useState("Alle"); // Datum initialisieren: von = heute - 30 Tage, bis = heute const today = new Date(); @@ -60,12 +61,23 @@ export default function Messages() { } }; - const totalPages = Math.ceil(messages.length / ITEMS_PER_PAGE); - const currentMessages = messages.slice( + const filteredMessages = + sourceFilter === "Alle" + ? messages + : messages.filter((m) => m.i === sourceFilter); + + const totalPages = Math.ceil(filteredMessages.length / ITEMS_PER_PAGE); + const currentMessages = filteredMessages.slice( (currentPage - 1) * ITEMS_PER_PAGE, currentPage * ITEMS_PER_PAGE ); + const allSources = Array.from(new Set(messages.map((m) => m.i))).sort(); + // einmal beim laden de Seite die Meldungen abrufen + useEffect(() => { + fetchMessages(); + }, []); + return (

Berichte

@@ -83,17 +95,29 @@ export default function Messages() { > Anzeigen +
- + - - + + @@ -106,9 +130,9 @@ export default function Messages() { > - - + + ))}
StatusPrio ZeitstempelGewichtText QuelleMeldungStatus
{msg.t}{msg.s}{msg.m} {msg.i}{msg.m}{msg.s}