feat: Alarm UI Widget

This commit is contained in:
ISA
2025-09-17 09:16:04 +02:00
parent 13ca1cece0
commit ea6d71a4f5
7 changed files with 73 additions and 107 deletions

View File

@@ -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 # 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 # basePath wird jetzt in public/config.json gepflegt
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.1.384 NEXT_PUBLIC_APP_VERSION=1.1.385

View File

@@ -24,4 +24,4 @@ NEXT_PUBLIC_USE_MOCKS=false
# basePath wird jetzt in public/config.json gepflegt # basePath wird jetzt in public/config.json gepflegt
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.1.384 NEXT_PUBLIC_APP_VERSION=1.1.385

View File

@@ -133,7 +133,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const poiLayerVisible = useSelector(state => state.poiLayerVisible.visible); const poiLayerVisible = useSelector(state => state.poiLayerVisible.visible);
const zoomTrigger = useSelector(state => state.zoomTrigger.trigger); const zoomTrigger = useSelector(state => state.zoomTrigger.trigger);
const poiReadTrigger = useSelector(state => state.poiReadFromDbTrigger.trigger); const poiReadTrigger = useSelector(state => state.poiReadFromDbTrigger.trigger);
const GisStationsStaticDistrict = useSelector(selectGisStationsStaticDistrict); // entfernt, da weiter unten dynamisch und mit Fallback deklariert
const gisSystemStaticStatus = useSelector(state => state.gisSystemStatic.status); const gisSystemStaticStatus = useSelector(state => state.gisSystemStatic.status);
const polylineEventsDisabled = useSelector(state => state.polylineEventsDisabled.disabled); const polylineEventsDisabled = useSelector(state => state.polylineEventsDisabled.disabled);
const mapLayersVisibility = useSelector(selectMapLayersState) || {}; const mapLayersVisibility = useSelector(selectMapLayersState) || {};
@@ -144,25 +144,37 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
selectGisLinesStatusFromWebservice selectGisLinesStatusFromWebservice
); );
// Alarm Status und Link aus GisStationsStatusDistrict // Alarm Status und Link dynamisch aus GisStationsStaticDistrict
const gisStationsStatusDistrict = useSelector(state => state.gisStationsStatusDistrict.data); const gisStationsStatusDistrict = useSelector(state => state.gisStationsStatusDistrict.data);
// Unterstützt sowohl Array-Shape (Statis[]) als auch Objekt mit Statis-Array const GisStationsStaticDistrict = useSelector(selectGisStationsStaticDistrict) || {};
const pointsArr = GisStationsStaticDistrict.Points || [];
let hasActiveAlarm = false; let hasActiveAlarm = false;
let alarmLink = ""; let alarmLink = "";
let alarmText = ""; let alarmText = "";
let alarmIdLD = null;
if (Array.isArray(gisStationsStatusDistrict)) { if (Array.isArray(gisStationsStatusDistrict)) {
const alarmObj = gisStationsStatusDistrict.find(item => item?.Alarm === 1 && item?.AlarmLink); const alarmObj = gisStationsStatusDistrict.find(item => item?.Alarm === 1);
hasActiveAlarm = !!alarmObj; hasActiveAlarm = !!alarmObj;
alarmLink = alarmObj?.AlarmLink || ""; alarmIdLD = alarmObj?.IdLD;
alarmText = alarmObj?.Me || "Alarm aktiv"; alarmText = alarmObj?.Me || "Alarm aktiv";
} else if (gisStationsStatusDistrict?.Statis) { } else if (gisStationsStatusDistrict?.Statis) {
const alarmObj = gisStationsStatusDistrict.Statis.find( const alarmObj = gisStationsStatusDistrict.Statis.find(item => item?.Alarm === 1);
item => item?.Alarm === 1 && item?.AlarmLink
);
hasActiveAlarm = !!alarmObj; hasActiveAlarm = !!alarmObj;
alarmLink = alarmObj?.AlarmLink || ""; alarmIdLD = alarmObj?.IdLD;
alarmText = alarmObj?.Me || "Alarm aktiv"; alarmText = alarmObj?.Me || "Alarm aktiv";
} }
if (hasActiveAlarm && alarmIdLD) {
const staticObj = pointsArr.find(p => p.IdLD === alarmIdLD);
if (staticObj && staticObj.Link) {
// Link kann relativ sein, ggf. mit Host ergänzen
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
}
}
const poiIconsData = useSelector(selectPoiIconsData); const poiIconsData = useSelector(selectPoiIconsData);
const poiIconsStatus = useSelector(selectPoiIconsStatus); const poiIconsStatus = useSelector(selectPoiIconsStatus);
const poiTypData = useSelector(selectPoiTypData); const poiTypData = useSelector(selectPoiTypData);

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "nodemap", "name": "nodemap",
"version": "1.1.384", "version": "1.1.385",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "nodemap", "name": "nodemap",
"version": "1.1.384", "version": "1.1.385",
"dependencies": { "dependencies": {
"@emotion/react": "^11.13.3", "@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0", "@emotion/styled": "^11.13.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "nodemap", "name": "nodemap",
"version": "1.1.384", "version": "1.1.385",
"dependencies": { "dependencies": {
"@emotion/react": "^11.13.3", "@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0", "@emotion/styled": "^11.13.0",

View File

@@ -18,7 +18,7 @@
}, },
{ {
"LD_Name": "GMA-isa-test", "LD_Name": "GMA-isa-test",
"IdLD": 50981, "IdLD": 50922,
"Device": "Glättemeldeanlage", "Device": "Glättemeldeanlage",
"Link": "gma.aspx?ver=1&id=50981", "Link": "gma.aspx?ver=1&id=50981",
"Location_Name": "Littwin", "Location_Name": "Littwin",

View File

@@ -7,8 +7,7 @@
"Me": "Eingang DE 01 kommend", "Me": "Eingang DE 01 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -18,8 +17,7 @@
"Me": "Eingang DE 31 kommend", "Me": "Eingang DE 31 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -29,8 +27,7 @@
"Me": "Eingang DE 17 kommend", "Me": "Eingang DE 17 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -40,8 +37,7 @@
"Me": "Eingang DE 05 kommend", "Me": "Eingang DE 05 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50984, "IdLD": 50984,
@@ -51,8 +47,7 @@
"Me": "Eingang DE 20 kommend", "Me": "Eingang DE 20 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50975, "IdLD": 50975,
@@ -62,8 +57,7 @@
"Me": "Eingang DE 32 kommend", "Me": "Eingang DE 32 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50984, "IdLD": 50984,
@@ -73,8 +67,7 @@
"Me": "Eingang DE 01 kommend", "Me": "Eingang DE 01 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50977, "IdLD": 50977,
@@ -84,8 +77,7 @@
"Me": "Station offline", "Me": "Station offline",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50977, "IdLD": 50977,
@@ -95,8 +87,7 @@
"Me": "Eingang DE 01 kommend", "Me": "Eingang DE 01 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50975, "IdLD": 50975,
@@ -106,8 +97,7 @@
"Me": "Station offline", "Me": "Station offline",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50066, "IdLD": 50066,
@@ -117,8 +107,7 @@
"Me": "CPL offline", "Me": "CPL offline",
"Feld": 5, "Feld": 5,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50011, "IdLD": 50011,
@@ -128,8 +117,7 @@
"Me": "CPL offline", "Me": "CPL offline",
"Feld": 16, "Feld": 16,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50011, "IdLD": 50011,
@@ -139,8 +127,7 @@
"Me": "Wasserdruck aus", "Me": "Wasserdruck aus",
"Feld": 16, "Feld": 16,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50011, "IdLD": 50011,
@@ -150,8 +137,7 @@
"Me": "Ein", "Me": "Ein",
"Feld": 16, "Feld": 16,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50011, "IdLD": 50011,
@@ -161,8 +147,7 @@
"Me": "Digitaleingang 1 ON", "Me": "Digitaleingang 1 ON",
"Feld": 16, "Feld": 16,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50000, "IdLD": 50000,
@@ -172,8 +157,7 @@
"Me": "Ein", "Me": "Ein",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -183,8 +167,7 @@
"Me": "Station offline", "Me": "Station offline",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -194,8 +177,7 @@
"Me": "Eingang DE 32 kommend", "Me": "Eingang DE 32 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50975, "IdLD": 50975,
@@ -205,8 +187,7 @@
"Me": "KÜG 07: Überspannung kommend", "Me": "KÜG 07: Überspannung kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50975, "IdLD": 50975,
@@ -216,8 +197,7 @@
"Me": "KÜG 08: Überspannung gehend", "Me": "KÜG 08: Überspannung gehend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50977, "IdLD": 50977,
@@ -227,8 +207,7 @@
"Me": "KÜG 08: Überspannung gehend", "Me": "KÜG 08: Überspannung gehend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50984, "IdLD": 50984,
@@ -238,8 +217,7 @@
"Me": "KÜG 08: Überspannung gehend", "Me": "KÜG 08: Überspannung gehend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -249,8 +227,7 @@
"Me": "Eingang DE 02 kommend", "Me": "Eingang DE 02 kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -260,8 +237,7 @@
"Me": "KÜG 08: Überspannung gehend", "Me": "KÜG 08: Überspannung gehend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -271,8 +247,7 @@
"Me": "Eingang DE 03 Test Karte kommend", "Me": "Eingang DE 03 Test Karte kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -282,8 +257,7 @@
"Me": "KÜG 01: Aderbruch kommend", "Me": "KÜG 01: Aderbruch kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 1, "Alarm": 0
"AlarmLink": "http://10.10.0.13/talas5/devices/cpl.aspx?ver=35&kue=24&id=50977"
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -293,8 +267,7 @@
"Me": "KÜG 02: Aderbruch kommend", "Me": "KÜG 02: Aderbruch kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50922, "IdLD": 50922,
@@ -304,8 +277,7 @@
"Me": "KÜG 03: Aderbruch kommend", "Me": "KÜG 03: Aderbruch kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50000, "IdLD": 50000,
@@ -315,8 +287,7 @@
"Me": "über 8V kommend", "Me": "über 8V kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50984, "IdLD": 50984,
@@ -326,8 +297,7 @@
"Me": "KÜG 05: Aderbruch kommend", "Me": "KÜG 05: Aderbruch kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50984, "IdLD": 50984,
@@ -337,8 +307,7 @@
"Me": "KÜG 02: Isolationsminderung kommend", "Me": "KÜG 02: Isolationsminderung kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50984, "IdLD": 50984,
@@ -348,8 +317,7 @@
"Me": "KÜG 06: Aderbruch kommend", "Me": "KÜG 06: Aderbruch kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 1
"AlarmLink": ""
}, },
{ {
"IdLD": 50977, "IdLD": 50977,
@@ -359,8 +327,7 @@
"Me": "KÜG 01: Isolationsminderung kommend", "Me": "KÜG 01: Isolationsminderung kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50977, "IdLD": 50977,
@@ -370,8 +337,7 @@
"Me": "KÜG 06: Aderbruch kommend", "Me": "KÜG 06: Aderbruch kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50977, "IdLD": 50977,
@@ -381,8 +347,7 @@
"Me": "KÜG 05: Aderbruch kommend", "Me": "KÜG 05: Aderbruch kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50976, "IdLD": 50976,
@@ -392,8 +357,7 @@
"Me": "CPL offline", "Me": "CPL offline",
"Feld": 3, "Feld": 3,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50976, "IdLD": 50976,
@@ -403,8 +367,7 @@
"Me": "KÜG 03: Isolationsminderung kommend", "Me": "KÜG 03: Isolationsminderung kommend",
"Feld": 3, "Feld": 3,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50975, "IdLD": 50975,
@@ -414,8 +377,7 @@
"Me": "KÜG 04: Isolationsminderung kommend", "Me": "KÜG 04: Isolationsminderung kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50975, "IdLD": 50975,
@@ -425,8 +387,7 @@
"Me": "KÜG 02: Isolationsminderung kommend", "Me": "KÜG 02: Isolationsminderung kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50975, "IdLD": 50975,
@@ -436,8 +397,7 @@
"Me": "KÜG 01: Isolationsminderung kommend", "Me": "KÜG 01: Isolationsminderung kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50001, "IdLD": 50001,
@@ -447,8 +407,7 @@
"Me": "Sammelstörung kommend", "Me": "Sammelstörung kommend",
"Feld": 5, "Feld": 5,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50975, "IdLD": 50975,
@@ -458,8 +417,7 @@
"Me": "KÜG 06: Aderbruch kommend", "Me": "KÜG 06: Aderbruch kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50975, "IdLD": 50975,
@@ -469,8 +427,7 @@
"Me": "KÜG 05: Aderbruch kommend", "Me": "KÜG 05: Aderbruch kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50963, "IdLD": 50963,
@@ -480,8 +437,7 @@
"Me": "CPL offline", "Me": "CPL offline",
"Feld": 3, "Feld": 3,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50063, "IdLD": 50063,
@@ -491,8 +447,7 @@
"Me": "Digitaleingang 1 EIN", "Me": "Digitaleingang 1 EIN",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
}, },
{ {
"IdLD": 50000, "IdLD": 50000,
@@ -502,7 +457,6 @@
"Me": "über 10V kommend", "Me": "über 10V kommend",
"Feld": 4, "Feld": 4,
"Icon": 0, "Icon": 0,
"Alarm": 0, "Alarm": 0
"AlarmLink": ""
} }
] ]