diff --git a/.env.local b/.env.local index fe5055a2e..a36bad83a 100644 --- a/.env.local +++ b/.env.local @@ -7,7 +7,7 @@ DB_NAME=talas_v5 DB_PORT=3306 # Public Settings (Client braucht IP/Domain) -NEXT_PUBLIC_SERVER_URL="http://192.168.10.33" # oder evtl. später https://nodemap.firma.de +NEXT_PUBLIC_SERVER_URL="http://10.10.0.70" # oder evtl. später https://nodemap.firma.de NEXT_PUBLIC_ENABLE_GEOCODER=true -NEXT_PUBLIC_USE_MOCK_API=true +NEXT_PUBLIC_USE_MOCK_API=false diff --git a/components/MapComponent.js b/components/MapComponent.js index 669b99548..dfe046430 100644 --- a/components/MapComponent.js +++ b/components/MapComponent.js @@ -253,9 +253,18 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { mapLayersVisibility.SMSFunkmodem // Sichtbarkeitsstatus aus dem State ); */ + const useMock = process.env.NEXT_PUBLIC_USE_MOCK_API === "true"; useEffect(() => { const fetchWebServiceMap = async () => { try { + let stationsStaticUrl = useMock ? "/mockData/gisStationsStaticDistrictMock.json" : mapGisStationsStaticDistrictUrl; + + let stationsStatusUrl = useMock ? "/mockData/gisStationsStatusDistrictMock.json" : mapGisStationsStatusDistrictUrl; + + let stationsMeasurementsUrl = useMock ? "/mockData/gisStationsMeasurementsMock.json" : mapGisStationsMeasurementsUrl; + + let systemStaticUrl = useMock ? "/mockData/gisSystemStaticMock.json" : mapGisSystemStaticUrl; + // Zähler für externe API-Aufrufe in localStorage speichern let requestCount = localStorage.getItem("fetchWebServiceMap") || 0; requestCount = parseInt(requestCount, 10); @@ -823,9 +832,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { updateAllMarkers(); // Setze ein Intervall für regelmäßige Updates - /* const intervalId = setInterval(() => { + const intervalId = setInterval(() => { updateAllMarkers(); - }, 60000); // 20 Sekunden + }, 60000); // 60 Sekunden dann werden die Marker aktualisiert, später mit Redux Store lösen, damit nicht flackert // Aufräumen bei Komponentenentladung return () => { @@ -837,7 +846,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { ref.current.clearLayers(); } }); - }; */ + }; }, [gisSystemStaticLoaded, map, GisSystemStatic, priorityConfig]); //--------------------------------------- @@ -914,6 +923,13 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { //-------------------------------------------- const fetchGisStationsStaticDistrict = async (idMap, idUser, dispatch) => { try { + let stationsStaticUrl = useMock ? "/mockData/gisStationsStaticDistrictMock.json" : mapGisStationsStaticDistrictUrl; + + let stationsStatusUrl = useMock ? "/mockData/gisStationsStatusDistrictMock.json" : mapGisStationsStatusDistrictUrl; + + let stationsMeasurementsUrl = useMock ? "/mockData/gisStationsMeasurementsMock.json" : mapGisStationsMeasurementsUrl; + + let systemStaticUrl = useMock ? "/mockData/gisSystemStaticMock.json" : mapGisSystemStaticUrl; // API-Endpunkt mit Query-Parametern aufrufen const response = await fetch(`/api/gisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`); @@ -977,6 +993,8 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { }, [map, menuItemAdded]); //-------------------------------------------- + //---------------------------------------------- + return ( <> diff --git a/config/appVersion.js b/config/appVersion.js index 25b7f43b1..8350f75ad 100644 --- a/config/appVersion.js +++ b/config/appVersion.js @@ -1,2 +1,2 @@ // /config/appVersion -export const APP_VERSION = "1.1.8"; +export const APP_VERSION = "1.1.9"; diff --git a/public/mockData/gisStationsStatusDistrictMock.json b/public/mockData/gisStationsStatusDistrictMock.json index 12b74bf0d..dffbb6bbc 100644 --- a/public/mockData/gisStationsStatusDistrictMock.json +++ b/public/mockData/gisStationsStatusDistrictMock.json @@ -8,7 +8,7 @@ "Na": "system", "Le": 4, "Co": "#FF00FF", - "Me": "Eingang DE 01 test", + "Me": "Eingang DE 01 test3", "Feld": 4, "Icon": 0 }, diff --git a/utils/createAndSetDevices.js b/utils/createAndSetDevices.js index 0e9a60248..c3f9416f5 100644 --- a/utils/createAndSetDevices.js +++ b/utils/createAndSetDevices.js @@ -84,7 +84,7 @@ export const createAndSetDevices = async (systemId, setMarkersFunction, GisSyste marker.bindPopup(`
- ${station.LD_Name} + ${station.LD_Name} ${station.Device}
${station.Area_Short} (${station.Area_Name})
${station.Location_Short} (${station.Location_Name}) diff --git a/utils/utils.js b/utils/utils.js index edc55ecd0..e7ca14388 100644 --- a/utils/utils.js +++ b/utils/utils.js @@ -68,7 +68,7 @@ export const createAndSetMarkers = async (systemId, setMarkersFunction) => { marker.bindPopup(`
- ${station.LD_Name} + test zum löschen ${station.LD_Name} ${station.Device}
${station.Area_Short} (${station.Area_Name})
${station.Location_Short} (${station.Location_Name})