From 4f0527e8a9d78a9a4590bffc2625ffbf0bf2ab65 Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 19 Sep 2025 12:29:33 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Die=20Logik=20f=C3=BCr=20die=20Alarmanze?= =?UTF-8?q?ige=20wurde=20angepasst:=20Jetzt=20wird=20das=20Alarm-Icon=20nu?= =?UTF-8?q?r=20angezeigt,=20wenn=20ein=20aktiver=20Alarm=20existiert=20und?= =?UTF-8?q?=20f=C3=BCr=20diesen=20auch=20ein=20passender=20Link=20im=20Sta?= =?UTF-8?q?ticDistrict=20vorhanden=20ist=20=E2=80=93=20unabh=C3=A4ngig=20v?= =?UTF-8?q?on=20der=20Reihenfolge.=20Damit=20wird=20der=20Bug=20behoben,?= =?UTF-8?q?=20dass=20das=20Icon=20manchmal=20nicht=20erscheint,=20obwohl?= =?UTF-8?q?=20ein=20Alarm=20mit=20Link=20existiert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.production | 2 +- components/mainComponent/MapComponent.js | 28 +++++++++++--------- package-lock.json | 4 +-- package.json | 2 +- websocketDump/GisStationsStatusDistrict.json | 4 +-- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.env.development b/.env.development index b4d49a4be..c73ffe1db 100644 --- a/.env.development +++ b/.env.development @@ -23,4 +23,4 @@ NEXT_PUBLIC_USE_MOCKS=true # z.B. http://10.10.0.13/xyz/index.aspx -> basePath in config.json auf /xyz setzen # basePath wird jetzt in public/config.json gepflegt # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.1.393 +NEXT_PUBLIC_APP_VERSION=1.1.394 diff --git a/.env.production b/.env.production index 0a2fab053..d4d9b2686 100644 --- a/.env.production +++ b/.env.production @@ -24,4 +24,4 @@ NEXT_PUBLIC_USE_MOCKS=false # basePath wird jetzt in public/config.json gepflegt # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.1.393 +NEXT_PUBLIC_APP_VERSION=1.1.394 diff --git a/components/mainComponent/MapComponent.js b/components/mainComponent/MapComponent.js index 98483b695..7d5223353 100644 --- a/components/mainComponent/MapComponent.js +++ b/components/mainComponent/MapComponent.js @@ -152,27 +152,29 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { let alarmLink = ""; let alarmText = ""; let alarmIdLD = null; + // Hilfsfunktion: alle aktiven Alarme sammeln + let alarmList = []; if (Array.isArray(gisStationsStatusDistrict)) { - const alarmObj = gisStationsStatusDistrict.find(item => item?.Alarm === 1); - hasActiveAlarm = !!alarmObj; - alarmIdLD = alarmObj?.IdLD; - alarmText = alarmObj?.Me || "Alarm aktiv"; + alarmList = gisStationsStatusDistrict.filter(item => item?.Alarm === 1); } else if (gisStationsStatusDistrict?.Statis) { - const alarmObj = gisStationsStatusDistrict.Statis.find(item => item?.Alarm === 1); - hasActiveAlarm = !!alarmObj; - alarmIdLD = alarmObj?.IdLD; - alarmText = alarmObj?.Me || "Alarm aktiv"; + alarmList = gisStationsStatusDistrict.Statis.filter(item => item?.Alarm === 1); } - if (hasActiveAlarm && alarmIdLD) { - const staticObj = pointsArr.find(p => p.IdLD === alarmIdLD); + // Suche das erste Alarmobjekt, das auch einen Link im StaticDistrict hat + let found = false; + for (let i = 0; i < alarmList.length; i++) { + const alarmObj = alarmList[i]; + const staticObj = pointsArr.find(p => p.IdLD === alarmObj.IdLD); if (staticObj && staticObj.Link) { - // Link kann relativ sein, ggf. mit Host ergänzen + hasActiveAlarm = true; + alarmIdLD = alarmObj.IdLD; + alarmText = alarmObj.Me || "Alarm aktiv"; const isAbsolute = staticObj.Link.startsWith("http://") || staticObj.Link.startsWith("https://"); alarmLink = isAbsolute ? staticObj.Link - : // : `${window.location.origin}/talas5/devices/${staticObj.Link}`; - `http://10.10.0.13/talas5/devices/${staticObj.Link}`; // nur zum Testen + : `http://10.10.0.13/talas5/devices/${staticObj.Link}`; + found = true; + break; } } const poiIconsData = useSelector(selectPoiIconsData); diff --git a/package-lock.json b/package-lock.json index 55b7355db..32fd13803 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "nodemap", - "version": "1.1.393", + "version": "1.1.394", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nodemap", - "version": "1.1.393", + "version": "1.1.394", "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", diff --git a/package.json b/package.json index 454d098de..94d3c44ce 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodemap", - "version": "1.1.393", + "version": "1.1.394", "dependencies": { "@emotion/react": "^11.13.3", "@emotion/styled": "^11.13.0", diff --git a/websocketDump/GisStationsStatusDistrict.json b/websocketDump/GisStationsStatusDistrict.json index 2cf063d4e..3dfd1edde 100644 --- a/websocketDump/GisStationsStatusDistrict.json +++ b/websocketDump/GisStationsStatusDistrict.json @@ -327,7 +327,7 @@ "Me": "KÜG 01: Isolationsminderung kommend", "Feld": 4, "Icon": 0, - "Alarm": 0 + "Alarm": 1 }, { "IdLD": 50977, @@ -387,7 +387,7 @@ "Me": "KÜG 02: Isolationsminderung kommend", "Feld": 4, "Icon": 0, - "Alarm": 0 + "Alarm": 1 }, { "IdLD": 50975,