Debug-Logging zentralisiert: Nutzung von process.env.NEXT_PUBLIC_DEBUG_LOG entfernt und auf getDebugLog() mit config.json umgestellt
- Alle Vorkommen von process.env.NEXT_PUBLIC_DEBUG_LOG entfernt - Debug-Konfiguration erfolgt jetzt ausschließlich über public/config.json - getDebugLog()-Utility überall verwendet - .env-Dateien werden für Debug-Logging nicht mehr benötigt - Alle betroffenen Komponenten, Services und API
This commit is contained in:
@@ -7,7 +7,6 @@ DB_NAME=talas_v5
|
|||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
|
|
||||||
# Public Settings (Client braucht IP/Domain) , Variablen mit dem Präfix "NEXT_PUBLIC" ist in Browser sichtbar
|
# Public Settings (Client braucht IP/Domain) , Variablen mit dem Präfix "NEXT_PUBLIC" ist in Browser sichtbar
|
||||||
NEXT_PUBLIC_DEBUG_LOG=true
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -24,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.343
|
NEXT_PUBLIC_APP_VERSION=1.1.344
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ DB_NAME=talas_v5
|
|||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
|
|
||||||
# Public Settings (Client braucht IP/Domain) , Variablen mit dem Präfix "NEXT_PUBLIC" ist in Browser sichtbar
|
# Public Settings (Client braucht IP/Domain) , Variablen mit dem Präfix "NEXT_PUBLIC" ist in Browser sichtbar
|
||||||
NEXT_PUBLIC_DEBUG_LOG=false
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -25,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.343
|
NEXT_PUBLIC_APP_VERSION=1.1.344
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { getDebugLog } from "@/utils/configUtils.js";
|
||||||
// /hooks/layers/useAreaMarkersLayer.js
|
// /hooks/layers/useAreaMarkersLayer.js
|
||||||
import { useEffect, useState, useRef } from "react";
|
import { useEffect, useState, useRef } from "react";
|
||||||
import L from "leaflet";
|
import L from "leaflet";
|
||||||
@@ -100,7 +101,7 @@ const useAreaMarkersLayer = (map, oms, apiUrl, onUpdateSuccess) => {
|
|||||||
newCoords: { x: lat, y: lng },
|
newCoords: { x: lat, y: lng },
|
||||||
})
|
})
|
||||||
).unwrap();
|
).unwrap();
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("✔️ Koordinaten erfolgreich aktualisiert:", { lat, lng });
|
console.log("✔️ Koordinaten erfolgreich aktualisiert:", { lat, lng });
|
||||||
}
|
}
|
||||||
onUpdateSuccess?.(); // optionaler Callback
|
onUpdateSuccess?.(); // optionaler Callback
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { getDebugLog } from "@/utils/configUtils.js";
|
||||||
// components/contextmenu/useMapContextMenu.js
|
// components/contextmenu/useMapContextMenu.js
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { zoomIn, zoomOut, centerHere } from "../../utils/zoomAndCenterUtils";
|
import { zoomIn, zoomOut, centerHere } from "../../utils/zoomAndCenterUtils";
|
||||||
@@ -71,7 +72,7 @@ const addItemsToMapContextMenu = (
|
|||||||
if (!menuItemAdded && map && map.contextmenu) {
|
if (!menuItemAdded && map && map.contextmenu) {
|
||||||
const editMode = localStorage.getItem("editMode") === "true";
|
const editMode = localStorage.getItem("editMode") === "true";
|
||||||
if (editMode) {
|
if (editMode) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("editMode localStorage:", localStorage.getItem("editMode"));
|
console.log("editMode localStorage:", localStorage.getItem("editMode"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ import { monitorHeapWithRedux } from "@/utils/common/monitorMemory";
|
|||||||
import { io } from "socket.io-client";
|
import { io } from "socket.io-client";
|
||||||
|
|
||||||
import { setGisStationsStaticDistrict } from "@/redux/slices/webservice/gisStationsStaticDistrictSlice.js";
|
import { setGisStationsStaticDistrict } from "@/redux/slices/webservice/gisStationsStaticDistrictSlice.js";
|
||||||
|
import { getDebugLog } from "../../utils/configUtils";
|
||||||
//-----------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------
|
||||||
const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
@@ -509,7 +510,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
//Test in useEffect
|
//Test in useEffect
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (map) {
|
if (map) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🗺️ Map-Einstellungen werden wiederhergestellt...");
|
console.log("🗺️ Map-Einstellungen werden wiederhergestellt...");
|
||||||
}
|
}
|
||||||
restoreMapSettings(map);
|
restoreMapSettings(map);
|
||||||
@@ -518,7 +519,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (map) {
|
if (map) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("map in MapComponent: ", map);
|
console.log("map in MapComponent: ", map);
|
||||||
}
|
}
|
||||||
const handleMapMoveEnd = event => {
|
const handleMapMoveEnd = event => {
|
||||||
@@ -551,7 +552,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const station = points.find(s => s.Area_Name === selectedArea);
|
const station = points.find(s => s.Area_Name === selectedArea);
|
||||||
|
|
||||||
if (station) {
|
if (station) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("📌 Gefundene Station:", station);
|
console.log("📌 Gefundene Station:", station);
|
||||||
}
|
}
|
||||||
map.flyTo([station.X, station.Y], 14);
|
map.flyTo([station.X, station.Y], 14);
|
||||||
@@ -597,7 +598,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (map) {
|
if (map) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("6- Karteninstanz (map) wurde jetzt erfolgreich initialisiert");
|
console.log("6- Karteninstanz (map) wurde jetzt erfolgreich initialisiert");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -610,7 +611,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
map.whenReady(() => {
|
map.whenReady(() => {
|
||||||
timeoutId = setTimeout(() => {
|
timeoutId = setTimeout(() => {
|
||||||
if (map.contextmenu) {
|
if (map.contextmenu) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Contextmenu ist vorhanden");
|
console.log("Contextmenu ist vorhanden");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -641,7 +642,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const handleLocationUpdate = async (idLocation, idMap, newCoords) => {
|
const handleLocationUpdate = async (idLocation, idMap, newCoords) => {
|
||||||
try {
|
try {
|
||||||
await dispatch(updateAreaThunk({ idLocation, idMap, newCoords })).unwrap();
|
await dispatch(updateAreaThunk({ idLocation, idMap, newCoords })).unwrap();
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Koordinaten erfolgreich aktualisiert:", result);
|
console.log("Koordinaten erfolgreich aktualisiert:", result);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -810,7 +811,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
// console.log(`⏳ Redux Countdown: ${countdown} Sekunden`);
|
// console.log(`⏳ Redux Countdown: ${countdown} Sekunden`);
|
||||||
|
|
||||||
if (countdown <= 2) {
|
if (countdown <= 2) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🚀 Kontextmenü wird wegen Countdown < 2 geschlossen.");
|
console.log("🚀 Kontextmenü wird wegen Countdown < 2 geschlossen.");
|
||||||
}
|
}
|
||||||
dispatch(closePolylineContextMenu());
|
dispatch(closePolylineContextMenu());
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// /components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js
|
// /components/uiWidgets/mapLayersControlPanel/MapLayersControlPanel.js
|
||||||
|
import { getDebugLog } from "../../../utils/configUtils";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import { setSelectedArea } from "@/redux/slices/selectedAreaSlice";
|
import { setSelectedArea } from "@/redux/slices/selectedAreaSlice";
|
||||||
import EditModeToggle from "@/components/uiWidgets/mapLayersControlPanel/EditModeToggle";
|
import EditModeToggle from "@/components/uiWidgets/mapLayersControlPanel/EditModeToggle";
|
||||||
@@ -218,7 +219,7 @@ function MapLayersControlPanel() {
|
|||||||
|
|
||||||
//------------------------------
|
//------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
window.__debug = window.__debug || {};
|
window.__debug = window.__debug || {};
|
||||||
window.__debug.gisStations = GisStationsStaticDistrict;
|
window.__debug.gisStations = GisStationsStaticDistrict;
|
||||||
}
|
}
|
||||||
@@ -250,7 +251,7 @@ function MapLayersControlPanel() {
|
|||||||
}
|
}
|
||||||
return isUnique;
|
return isUnique;
|
||||||
});
|
});
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("📌 stationListing aktualisiert:", filteredAreas);
|
console.log("📌 stationListing aktualisiert:", filteredAreas);
|
||||||
}
|
}
|
||||||
}, [GisStationsStaticDistrict, GisSystemStatic]);
|
}, [GisStationsStaticDistrict, GisSystemStatic]);
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ DB_PASSWORD="root#$"
|
|||||||
DB_NAME=talas_v5
|
DB_NAME=talas_v5
|
||||||
DB_PORT=3306
|
DB_PORT=3306
|
||||||
|
|
||||||
# Public Settings (Client braucht IP/Domain) , Variablen mit dem Präfix "NEXT_PUBLIC" ist in Browser sichtbar
|
|
||||||
NEXT_PUBLIC_DEBUG_LOG=false
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#auf dem Entwicklungsrechner dev läuft auf Port 3000 und auf dem Server prod auf Port 80, aber der WebService ist immer auf PORT 80
|
#auf dem Entwicklungsrechner dev läuft auf Port 3000 und auf dem Server prod auf Port 80, aber der WebService ist immer auf PORT 80
|
||||||
NEXT_PUBLIC_API_PORT_MODE=prod
|
NEXT_PUBLIC_API_PORT_MODE=prod
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import L from "leaflet";
|
import L from "leaflet";
|
||||||
|
import { getDebugLog } from "../utils/configUtils";
|
||||||
|
|
||||||
export class OverlappingMarkerSpiderfier {
|
export class OverlappingMarkerSpiderfier {
|
||||||
constructor(map, options = {}) {
|
constructor(map, options = {}) {
|
||||||
@@ -118,7 +119,7 @@ export class OverlappingMarkerSpiderfier {
|
|||||||
// 🔥 Künstliches Click-Event auslösen, um die UI zu aktualisieren
|
// 🔥 Künstliches Click-Event auslösen, um die UI zu aktualisieren
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.map.fire("click");
|
this.map.fire("click");
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Click-Event ausgelöst in OverlappingMarkerspiderfier.js in unspiderfy ");
|
console.log("Click-Event ausgelöst in OverlappingMarkerspiderfier.js in unspiderfy ");
|
||||||
}
|
}
|
||||||
}, 10); // Kurze Verzögerung, um sicherzustellen, dass die UI neu gerendert wird
|
}, 10); // Kurze Verzögerung, um sicherzustellen, dass die UI neu gerendert wird
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.343",
|
"version": "1.1.344",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.343",
|
"version": "1.1.344",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.343",
|
"version": "1.1.344",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
// /pages/api/talas_v5_DB/area/updateArea.js
|
// /pages/api/talas_v5_DB/area/updateArea.js
|
||||||
import getPool from "../../../../utils/mysqlPool";
|
import getPool from "../../../../utils/mysqlPool";
|
||||||
|
import { getDebugLog } from "../../../../utils/configUtils";
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Request erhalten:", req.method, req.body); // Debugging
|
console.log("Request erhalten:", req.method, req.body); // Debugging
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
// /pages/api/talas_v5_DB/gisLines/updateLineCoordinates.js
|
// /pages/api/talas_v5_DB/gisLines/updateLineCoordinates.js
|
||||||
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
|
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
|
||||||
|
import { getDebugLog } from "../../../../utils/configUtils";
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
const pool = getPool(); // Singleton-Pool verwenden
|
const pool = getPool(); // Singleton-Pool verwenden
|
||||||
@@ -34,7 +35,7 @@ export default async function handler(req, res) {
|
|||||||
|
|
||||||
// Commit der Transaktion
|
// Commit der Transaktion
|
||||||
await connection.commit();
|
await connection.commit();
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Transaction Complete.");
|
console.log("Transaction Complete.");
|
||||||
}
|
}
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
// pages/api/talas_v5_DB/pois/addPoi.js
|
// pages/api/talas_v5_DB/pois/addPoi.js
|
||||||
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
|
import getPool from "../../../../utils/mysqlPool"; // Singleton-Pool importieren
|
||||||
|
import { getDebugLog } from "../../../../utils/configUtils";
|
||||||
|
|
||||||
export default async function handler(req, res) {
|
export default async function handler(req, res) {
|
||||||
const pool = getPool(); // Singleton-Pool verwenden
|
const pool = getPool(); // Singleton-Pool verwenden
|
||||||
|
|
||||||
if (req.method === "POST") {
|
if (req.method === "POST") {
|
||||||
const { name, poiTypeId, latitude, longitude, idLD } = req.body;
|
const { name, poiTypeId, latitude, longitude, idLD } = req.body;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Received data:", req.body); // Überprüfen der empfangenen Daten
|
console.log("Received data:", req.body); // Überprüfen der empfangenen Daten
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,5 +28,7 @@
|
|||||||
"_comment_zoomOutCenter": "Zielkoordinaten für Herauszoomen (lat, lng)",
|
"_comment_zoomOutCenter": "Zielkoordinaten für Herauszoomen (lat, lng)",
|
||||||
|
|
||||||
"basePath": "/talas5",
|
"basePath": "/talas5",
|
||||||
"_comment_basePath": "Basis-URL für API und Routing"
|
"_comment_basePath": "Basis-URL für API und Routing",
|
||||||
|
"debugLog": false,
|
||||||
|
"_comment_debugLog": "Debug-Logging für Client "
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { getDebugLog } from "../../utils/configUtils";
|
||||||
// /services/webservice/fetchGisLinesStatusService.js
|
// /services/webservice/fetchGisLinesStatusService.js
|
||||||
let __configCache;
|
let __configCache;
|
||||||
async function getConfig() {
|
async function getConfig() {
|
||||||
@@ -16,7 +17,7 @@ export const fetchGisLinesStatusService = async () => {
|
|||||||
if (useMocks) {
|
if (useMocks) {
|
||||||
const mockBasePath = "/api/mocks/webservice/gisLinesStatus";
|
const mockBasePath = "/api/mocks/webservice/gisLinesStatus";
|
||||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🧪 Mock-Modus aktiviert: fetchGisLinesStatusService ", mockURL);
|
console.log("🧪 Mock-Modus aktiviert: fetchGisLinesStatusService ", mockURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ export const fetchGisLinesStatusService = async () => {
|
|||||||
const idMap = params.get("m");
|
const idMap = params.get("m");
|
||||||
|
|
||||||
const url = `${baseUrl}/GisLinesStatus?idMap=${idMap}`;
|
const url = `${baseUrl}/GisLinesStatus?idMap=${idMap}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("📡 fetchGisLinesStatusService URL:", url);
|
console.log("📡 fetchGisLinesStatusService URL:", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { getDebugLog } from "../../utils/configUtils";
|
||||||
let __configCache;
|
let __configCache;
|
||||||
async function getConfig() {
|
async function getConfig() {
|
||||||
if (__configCache) return __configCache;
|
if (__configCache) return __configCache;
|
||||||
@@ -15,7 +16,7 @@ export const fetchGisStationsMeasurementsService = async () => {
|
|||||||
if (useMocks) {
|
if (useMocks) {
|
||||||
const mockBasePath = "/api/mocks/webservice/gisStationsMeasurements";
|
const mockBasePath = "/api/mocks/webservice/gisStationsMeasurements";
|
||||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsMeasurementsService ", mockURL);
|
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsMeasurementsService ", mockURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +39,7 @@ export const fetchGisStationsMeasurementsService = async () => {
|
|||||||
const idUser = params.get("u");
|
const idUser = params.get("u");
|
||||||
|
|
||||||
const url = `${baseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`;
|
const url = `${baseUrl}/GisStationsMeasurements?idMap=${idMap}&idUser=${idUser}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("📡 fetchGisStationsMeasurementsService URL:", url);
|
console.log("📡 fetchGisStationsMeasurementsService URL:", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,8 @@
|
|||||||
* @returns {Promise<Array>} Liste mit Points[]
|
* @returns {Promise<Array>} Liste mit Points[]
|
||||||
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
|
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
|
||||||
*/
|
*/
|
||||||
let __configCache;
|
|
||||||
async function getConfig() {
|
import { getDebugLog, getConfig } from "../../utils/configUtils";
|
||||||
if (__configCache) return __configCache;
|
|
||||||
const res = await fetch("/config.json");
|
|
||||||
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
|
|
||||||
__configCache = await res.json();
|
|
||||||
return __configCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const fetchGisStationsStaticDistrictService = async () => {
|
export const fetchGisStationsStaticDistrictService = async () => {
|
||||||
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
||||||
@@ -22,7 +16,7 @@ export const fetchGisStationsStaticDistrictService = async () => {
|
|||||||
if (useMocks) {
|
if (useMocks) {
|
||||||
const mockBasePath = "/api/mocks/webservice/gisStationsStaticDistrict";
|
const mockBasePath = "/api/mocks/webservice/gisStationsStaticDistrict";
|
||||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStaticDistrictService ", mockURL);
|
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStaticDistrictService ", mockURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +39,7 @@ export const fetchGisStationsStaticDistrictService = async () => {
|
|||||||
const idUser = params.get("u");
|
const idUser = params.get("u");
|
||||||
|
|
||||||
const url = `${baseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`;
|
const url = `${baseUrl}/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("📡 fetchGisStationsStaticDistrictService URL:", url);
|
console.log("📡 fetchGisStationsStaticDistrictService URL:", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,8 @@
|
|||||||
* @returns {Promise<Array>} Liste mit Statis[]
|
* @returns {Promise<Array>} Liste mit Statis[]
|
||||||
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
|
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
|
||||||
*/
|
*/
|
||||||
let __configCache;
|
|
||||||
async function getConfig() {
|
import { getDebugLog, getConfig } from "../../utils/configUtils";
|
||||||
if (__configCache) return __configCache;
|
|
||||||
const res = await fetch("/config.json");
|
|
||||||
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
|
|
||||||
__configCache = await res.json();
|
|
||||||
return __configCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const fetchGisStationsStatusDistrictService = async () => {
|
export const fetchGisStationsStatusDistrictService = async () => {
|
||||||
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
||||||
@@ -22,7 +16,7 @@ export const fetchGisStationsStatusDistrictService = async () => {
|
|||||||
if (useMocks) {
|
if (useMocks) {
|
||||||
const mockBasePath = "/api/mocks/webservice/gisStationsStatusDistrict";
|
const mockBasePath = "/api/mocks/webservice/gisStationsStatusDistrict";
|
||||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStatusDistrictService ", mockURL);
|
console.log("🧪 Mock-Modus aktiviert: fetchGisStationsStatusDistrictService ", mockURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +39,7 @@ export const fetchGisStationsStatusDistrictService = async () => {
|
|||||||
const idUser = params.get("u");
|
const idUser = params.get("u");
|
||||||
|
|
||||||
const url = `${baseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`;
|
const url = `${baseUrl}/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("📡 fetchGisStationsStatusDistrictService URL:", url);
|
console.log("📡 fetchGisStationsStatusDistrictService URL:", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,8 @@
|
|||||||
* @returns {Promise<Array>} Liste mit Systems[]
|
* @returns {Promise<Array>} Liste mit Systems[]
|
||||||
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
|
* @throws {Error} bei Fehler oder ungültiger Antwortstruktur
|
||||||
*/
|
*/
|
||||||
let __configCache;
|
|
||||||
async function getConfig() {
|
import { getDebugLog, getConfig } from "../../utils/configUtils";
|
||||||
if (__configCache) return __configCache;
|
|
||||||
const res = await fetch("/config.json");
|
|
||||||
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
|
|
||||||
__configCache = await res.json();
|
|
||||||
return __configCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const fetchGisSystemStaticService = async () => {
|
export const fetchGisSystemStaticService = async () => {
|
||||||
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
||||||
@@ -21,7 +15,7 @@ export const fetchGisSystemStaticService = async () => {
|
|||||||
if (useMocks) {
|
if (useMocks) {
|
||||||
const mockBasePath = "/api/mocks/webservice/gisSystemStatic";
|
const mockBasePath = "/api/mocks/webservice/gisSystemStatic";
|
||||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🧪 Mock-Modus aktiviert: fetchGisSystemStaticService ", mockURL);
|
console.log("🧪 Mock-Modus aktiviert: fetchGisSystemStaticService ", mockURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,7 +38,7 @@ export const fetchGisSystemStaticService = async () => {
|
|||||||
const idUser = params.get("u");
|
const idUser = params.get("u");
|
||||||
|
|
||||||
const url = `${baseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
|
const url = `${baseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("📡 fetchGisSystemStaticService von service URL:", url);
|
console.log("📡 fetchGisSystemStaticService von service URL:", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,8 @@
|
|||||||
* @returns {Promise<Array>} Rechte-Array
|
* @returns {Promise<Array>} Rechte-Array
|
||||||
* @throws {Error} bei Lade- oder Strukturfehler
|
* @throws {Error} bei Lade- oder Strukturfehler
|
||||||
*/
|
*/
|
||||||
let __configCache;
|
|
||||||
async function getConfig() {
|
import { getDebugLog, getConfig } from "../../utils/configUtils";
|
||||||
if (__configCache) return __configCache;
|
|
||||||
const res = await fetch("/config.json");
|
|
||||||
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
|
|
||||||
__configCache = await res.json();
|
|
||||||
return __configCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const fetchUserRightsService = async () => {
|
export const fetchUserRightsService = async () => {
|
||||||
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
|
||||||
@@ -21,7 +15,7 @@ export const fetchUserRightsService = async () => {
|
|||||||
if (useMocks) {
|
if (useMocks) {
|
||||||
const mockBasePath = "/api/mocks/webservice/gisSystemStatic";
|
const mockBasePath = "/api/mocks/webservice/gisSystemStatic";
|
||||||
const mockURL = `${window.location.origin}${mockBasePath}`;
|
const mockURL = `${window.location.origin}${mockBasePath}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🧪 Mock-Modus aktiviert: fetchUserRightsService ", mockURL);
|
console.log("🧪 Mock-Modus aktiviert: fetchUserRightsService ", mockURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +34,7 @@ export const fetchUserRightsService = async () => {
|
|||||||
const idUser = params.get("u");
|
const idUser = params.get("u");
|
||||||
|
|
||||||
const url = `${baseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
|
const url = `${baseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🔍 Rechte-Fetch URL:", url);
|
console.log("🔍 Rechte-Fetch URL:", url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +50,7 @@ export const fetchUserRightsService = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("👤 Rechte-Response JSON:", json);
|
console.log("👤 Rechte-Response JSON:", json);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
26
utils/configUtils.js
Normal file
26
utils/configUtils.js
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
// utils/configUtils.js
|
||||||
|
let __configCache;
|
||||||
|
export async function getConfig() {
|
||||||
|
if (__configCache) return __configCache;
|
||||||
|
const res = await fetch("/config.json");
|
||||||
|
if (!res.ok) throw new Error("config.json konnte nicht geladen werden");
|
||||||
|
__configCache = await res.json();
|
||||||
|
return __configCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sync helper for debugLog (for use in event handlers etc.)
|
||||||
|
let debugLogValue;
|
||||||
|
export function getDebugLog() {
|
||||||
|
if (debugLogValue !== undefined) return debugLogValue;
|
||||||
|
// Try to read from window.__appConfig if available (set at app start)
|
||||||
|
if (
|
||||||
|
typeof window !== "undefined" &&
|
||||||
|
window.__appConfig &&
|
||||||
|
typeof window.__appConfig.debugLog !== "undefined"
|
||||||
|
) {
|
||||||
|
debugLogValue = !!window.__appConfig.debugLog;
|
||||||
|
return debugLogValue;
|
||||||
|
}
|
||||||
|
// Fallback: default false
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@@ -62,7 +62,7 @@ export const checkOverlappingMarkers = (map, markers, plusIcon, oms) => {
|
|||||||
|
|
||||||
export const handlePlusIconClick = (map, markers, oms, clickedLatLng) => {
|
export const handlePlusIconClick = (map, markers, oms, clickedLatLng) => {
|
||||||
// Debugging-Ausgabe
|
// Debugging-Ausgabe
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Plus-Icon Position:", clickedLatLng);
|
console.log("Plus-Icon Position:", clickedLatLng);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ export const handlePlusIconClick = (map, markers, oms, clickedLatLng) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Debugging-Ausgabe
|
// Debugging-Ausgabe
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Gefundene Marker in der Nähe:", nearbyMarkers);
|
console.log("Gefundene Marker in der Nähe:", nearbyMarkers);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ export const handlePlusIconClick = (map, markers, oms, clickedLatLng) => {
|
|||||||
// Spiderfy die gefundenen Marker
|
// Spiderfy die gefundenen Marker
|
||||||
oms.spiderfy(nearbyMarkers);
|
oms.spiderfy(nearbyMarkers);
|
||||||
} else {
|
} else {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Keine überlappenden Marker gefunden.");
|
console.log("Keine überlappenden Marker gefunden.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,12 +26,12 @@ function getPool() {
|
|||||||
cachedPool.on("acquire", () => {
|
cachedPool.on("acquire", () => {
|
||||||
connectionCount++;
|
connectionCount++;
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("\x1b[36m%s\x1b[0m", `➕ Connection acquired (${connectionCount} total)`);
|
console.log("\x1b[36m%s\x1b[0m", `➕ Connection acquired (${connectionCount} total)`);
|
||||||
}
|
}
|
||||||
if (connectionCount > maxUsed) {
|
if (connectionCount > maxUsed) {
|
||||||
maxUsed = connectionCount;
|
maxUsed = connectionCount;
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log(`📈 Neue Höchstzahl aktiver gleichzeitiger Verbindungen: ${maxUsed}`);
|
console.log(`📈 Neue Höchstzahl aktiver gleichzeitiger Verbindungen: ${maxUsed}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,7 +40,7 @@ function getPool() {
|
|||||||
cachedPool.on("release", () => {
|
cachedPool.on("release", () => {
|
||||||
connectionCount--;
|
connectionCount--;
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("\x1b[32m%s\x1b[0m", `➖ Connection released (${connectionCount} total)`);
|
console.log("\x1b[32m%s\x1b[0m", `➖ Connection released (${connectionCount} total)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ function getPool() {
|
|||||||
|
|
||||||
cachedPool.on("enqueue", () => {
|
cachedPool.on("enqueue", () => {
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.warn("\x1b[33m%s\x1b[0m", "⏳ Pool voll – Anfrage in Warteschlange");
|
console.warn("\x1b[33m%s\x1b[0m", "⏳ Pool voll – Anfrage in Warteschlange");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export async function openInNewTab(e, target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (link) {
|
if (link) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🟢 Öffne Link:", link);
|
console.log("🟢 Öffne Link:", link);
|
||||||
}
|
}
|
||||||
window.open(link, "_blank");
|
window.open(link, "_blank");
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export function subscribeToPolylineContextMenu() {
|
|||||||
store.subscribe(() => {
|
store.subscribe(() => {
|
||||||
const state = store.getState(); // Redux-Toolkit empfohlene Methode
|
const state = store.getState(); // Redux-Toolkit empfohlene Methode
|
||||||
if (state.polylineContextMenu.forceClose) {
|
if (state.polylineContextMenu.forceClose) {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("🚀 Redux-Event erkannt - Kontextmenü wird geschlossen.");
|
console.log("🚀 Redux-Event erkannt - Kontextmenü wird geschlossen.");
|
||||||
}
|
}
|
||||||
store.dispatch(closePolylineContextMenu());
|
store.dispatch(closePolylineContextMenu());
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export const setupPolylines = async (
|
|||||||
.dispatch(updatePolylineCoordinatesThunk(requestData))
|
.dispatch(updatePolylineCoordinatesThunk(requestData))
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.then(data => {
|
.then(data => {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("Koordinaten erfolgreich aktualisiert:", data);
|
console.log("Koordinaten erfolgreich aktualisiert:", data);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
// utils/setupDevices.js
|
// utils/setupDevices.js
|
||||||
|
|
||||||
import { setSelectedDevice, clearSelectedDevice } from "../redux/slices/selectedDeviceSlice";
|
import { setSelectedDevice, clearSelectedDevice } from "../redux/slices/selectedDeviceSlice";
|
||||||
|
import { getDebugLog } from "./configUtils";
|
||||||
|
|
||||||
export const setupDevices = async (map, deviceMarkers, dispatch) => {
|
export const setupDevices = async (map, deviceMarkers, dispatch) => {
|
||||||
for (const marker of deviceMarkers) {
|
for (const marker of deviceMarkers) {
|
||||||
marker.on("mouseover", function () {
|
marker.on("mouseover", function () {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("✅ Gerät ausgewählt:", marker);
|
console.log("✅ Gerät ausgewählt:", marker);
|
||||||
}
|
}
|
||||||
dispatch(setSelectedDevice(marker.options)); // Gerät in Redux speichern
|
dispatch(setSelectedDevice(marker.options)); // Gerät in Redux speichern
|
||||||
});
|
});
|
||||||
|
|
||||||
marker.on("mouseout", function () {
|
marker.on("mouseout", function () {
|
||||||
if (process.env.NEXT_PUBLIC_DEBUG_LOG === "true") {
|
if (getDebugLog()) {
|
||||||
console.log("❌ Gerät abgewählt");
|
console.log("❌ Gerät abgewählt");
|
||||||
}
|
}
|
||||||
dispatch(clearSelectedDevice()); // Gerät aus Redux entfernen
|
dispatch(clearSelectedDevice()); // Gerät aus Redux entfernen
|
||||||
|
|||||||
Reference in New Issue
Block a user