From 07f343e25a0c887b6029e64bb97ba77f0f1db91c Mon Sep 17 00:00:00 2001 From: ISA Date: Tue, 18 Jun 2024 15:35:32 +0200 Subject: [PATCH] add: add linescolor from API --- components/MapComponent.js | 2 ++ pages/api/linesColorApi.js | 54 +++++++++++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/components/MapComponent.js b/components/MapComponent.js index f759eed7f..69c63e7a5 100644 --- a/components/MapComponent.js +++ b/components/MapComponent.js @@ -2088,11 +2088,13 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { try { const response = await fetch(webserviceGisLinesStatusUrl); const data = await response.json(); + console.log("data.Statis: ", data); const colorsByModule = {}; data.Statis.forEach((item) => { colorsByModule[item.Modul] = item.PrioColor; }); setLineColors(colorsByModule); + console.log("colorsByModule", colorsByModule); } catch (error) { console.error("Fehler beim Abrufen der linesColorApi Daten:", error); } diff --git a/pages/api/linesColorApi.js b/pages/api/linesColorApi.js index 33ddb46a4..74069ab49 100644 --- a/pages/api/linesColorApi.js +++ b/pages/api/linesColorApi.js @@ -2,7 +2,55 @@ // http://10.10.0.13/talas5/ClientData/WebServiceMap.asmx/GisStationsStatusDistrict export default function handler(req, res) { - /* const linesColor = { + const response = { + Name: "Liste aller Statis der Linien", + Zeitstempel: new Date().toISOString(), // Aktuellen Zeitstempel hinzufügen + IdMap: "10", + Statis: [ + { + IdLD: 25440, + Modul: 1, + DpName: "KUE01_Ausfall", + ModulName: "42 Wippershain Sender", + ModulTyp: "nicht vorhanden", + Message: "KUEG 01: 42 Wippershain Sender Messwerkausfall kommend", + Level: 4, + PrioColor: "#FF00FF", + PrioName: "system", + Value: "?", + }, + { + IdLD: 25440, + Modul: 3, + DpName: "KUE03_Ausfall", + ModulName: "42 Solz Sender", + ModulTyp: "nicht vorhanden", + Message: "KUEG 03: 42 Solz Sender Messwerkausfall kommend", + Level: 4, + PrioColor: "#FF00FF", + PrioName: "system", + Value: "?", + }, + { + IdLD: 25440, + Modul: 4, + DpName: "KUE04_Ausfall", + ModulName: "42/13 Bad Hersfeld Gaswerk", + ModulTyp: "Kue705-FO", + Message: "KUEG 04: 42/13 Bad Hersfeld Gaswerk Messwerkausfall kommend", + Level: 4, + PrioColor: "#FF00FF", + PrioName: "system", + Value: "?", + }, + ], + }; + + res.status(200).json(response); +} + +/* export default function handler(req, res) { + const linesColor = { Statis: [ { IdModul: 1, @@ -32,7 +80,7 @@ export default function handler(req, res) { Icon: 0, }, ], - }; */ + }; const linesColor = { Statis: [ { @@ -75,4 +123,4 @@ export default function handler(req, res) { }; res.status(200).json({ linesColor }); -} +} */