feat: Healthcheck um Webservices, API-Routen und .env-Prüfungen erweitert

- Externe Webservices von TALAS V5 integriert und geprüft (Statuscode + Antwortstruktur)
- Eigene API-Endpunkte wie /api/talas_v5_DB/getDevices hinzugefügt und validiert
- Prüfung von NEXT_PUBLIC_USE_MOCKS zur Vermeidung von Mockdaten in Produktion
- Validierung der Umgebungsvariablen wie DB_HOST, DB_NAME und NODE_ENV ergänzt
- Response-Status 200 bei vollständigem Erfolg, 207 bei Teilfehlern
- Verbesserung der JSON-Antwortstruktur zur einfacheren Analyse
This commit is contained in:
ISA
2025-06-05 15:23:59 +02:00
parent 9273195d8f
commit ec31b36b3d
31 changed files with 397 additions and 163 deletions

View File

@@ -148,7 +148,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
// Konstanten für die URLs
//console.log("priorityConfig in MapComponent1: ", priorityConfig);
//-----------------------------------------
const [linePositions, setLinePositions] = useState([]);
const { lineColors, tooltipContents } = useLineData();
@@ -234,7 +233,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
}
locations.forEach(location => {});
};
//console.log("trigger in MapComponent.js:", poiReadTrigger);
}, [map, locations, poiReadTrigger]);
//--------------------------------------------
@@ -275,7 +273,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
]);
//---------------------------------------------
//console.log("priorityConfig in MapComponent2: ", priorityConfig);
useEffect(() => {
if (map) {
}
@@ -319,7 +317,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
);
newPolylines.forEach((polyline, index) => {
//console.log("polyline: ", polyline);
const tooltipContent =
tooltipContents[`${linePositions[index].idLD}-${linePositions[index].idModul}`] ||
"Die Linie ist noch nicht in Webservice vorhanden oder bekommt keine Daten";
@@ -380,14 +377,18 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//Test in useEffect
useEffect(() => {
if (map) {
console.log("🗺️ Map-Einstellungen werden wiederhergestellt...");
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log("🗺️ Map-Einstellungen werden wiederhergestellt...");
}
restoreMapSettings(map);
}
}, [map]);
//--------------------------------------------
useEffect(() => {
if (map) {
console.log("map in MapComponent: ", map);
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log("map in MapComponent: ", map);
}
const handleMapMoveEnd = event => {
const newCenter = map.getCenter();
const newZoom = map.getZoom();
@@ -411,8 +412,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//--------------------------------------------
// Area in DataSheet ->dropdownmenu
useEffect(() => {
//console.log("🔍 GisStationsStaticDistrict Inhalt:", GisStationsStaticDistrict);
// Sicherstellen, dass `Points` existiert und ein Array ist
const points = GisStationsStaticDistrict?.Points;
@@ -420,7 +419,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const station = points.find(s => s.Area_Name === selectedArea);
if (station) {
console.log("📌 Gefundene Station:", station);
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log("📌 Gefundene Station:", station);
}
map.flyTo([station.X, station.Y], 14);
} else {
console.warn("⚠️ Keine passende Station für die Area gefunden:", selectedArea);
@@ -464,7 +465,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//--------------------------------------------
useEffect(() => {
if (map) {
console.log("6- Karteninstanz (map) wurde jetzt erfolgreich initialisiert");
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log("6- Karteninstanz (map) wurde jetzt erfolgreich initialisiert");
}
}
}, [map]);
//--------------------------------------------
@@ -474,7 +477,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
map.whenReady(() => {
setTimeout(() => {
if (map.contextmenu) {
//console.log("Contextmenu ist vorhanden");
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
//console.log("Contextmenu ist vorhanden");
}
} else {
console.warn("Contextmenu ist nicht verfügbar.");
}
@@ -499,7 +504,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const handleLocationUpdate = async (idLocation, idMap, newCoords) => {
try {
await dispatch(updateAreaThunk({ idLocation, idMap, newCoords })).unwrap();
console.log("Koordinaten erfolgreich aktualisiert:", result);
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log("Koordinaten erfolgreich aktualisiert:", result);
}
} catch (error) {
console.error("Fehler beim Aktualisieren der Location:", error);
}
@@ -661,15 +668,15 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//--------------------------------------
useEffect(() => {
if (isPolylineContextMenuOpen && countdownActive) {
//console.log("🔄 Starte Redux-Countdown für Kontextmenü!");
const interval = setInterval(() => {
dispatch(updateCountdown());
// console.log(`⏳ Redux Countdown: ${countdown} Sekunden`);
if (countdown <= 2) {
console.log("🚀 Kontextmenü wird wegen Countdown < 2 geschlossen.");
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log("🚀 Kontextmenü wird wegen Countdown < 2 geschlossen.");
}
dispatch(closePolylineContextMenu());
if (window.map?.contextmenu) {
@@ -690,7 +697,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
useEffect(() => {
if (map) {
window.map = map;
console.log("✅ window.map wurde gesetzt:", window.map);
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log("✅ window.map wurde gesetzt:", window.map);
}
}
}, [map]);
@@ -756,7 +765,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
// 🧠 Optional für Debugging für überlappende Markers
useEffect(() => {
if (oms) {
console.log("📌 OMS ready:", oms);
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
console.log("📌 OMS ready:", oms);
}
window.oms = oms; // Für Debugging global
}
}, [oms]);
@@ -764,7 +775,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//----------------------------------------------
useEffect(() => {
if (process.env.NODE_ENV === "development") {
alert("🚧 Development Mode aktiviert Mock-Daten werden verwendet!");
console.log("🚧 Development Mode aktiviert Mock-Daten werden verwendet!");
} else {
console.log("Production Mode aktiviert");
}
}, []);
//---------------------------------------------