fix: Geräte-Marker für Systeme ohne Statusdaten anzeigen (z. B. GMA)
- `createAndSetDevices.js` angepasst, sodass Marker auch ohne `statusDistrictData` erzeugt werden. - Problem behoben, dass Marker wie GMA trotz vorhandener Koordinaten und Sichtbarkeit nicht gezeichnet wurden. - Sicherheitsprüfung für Statusdaten optional gemacht, um Systems ohne Messdaten darzustellen.
This commit is contained in:
@@ -25,4 +25,4 @@ NEXT_PUBLIC_USE_MOCKS=true
|
|||||||
NEXT_PUBLIC_BASE_PATH=/talas5
|
NEXT_PUBLIC_BASE_PATH=/talas5
|
||||||
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
|
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.1.306
|
NEXT_PUBLIC_APP_VERSION=1.1.307
|
||||||
|
|||||||
@@ -26,4 +26,4 @@ NEXT_PUBLIC_BASE_PATH=/talas5
|
|||||||
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
|
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
|
||||||
|
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.1.306
|
NEXT_PUBLIC_APP_VERSION=1.1.307
|
||||||
@@ -70,7 +70,8 @@ const useDynamicDeviceLayers = (map, GisSystemStatic, mapLayersVisibility, prior
|
|||||||
const editMode = localStorage.getItem("editMode") === "true";
|
const editMode = localStorage.getItem("editMode") === "true";
|
||||||
|
|
||||||
Object.entries(markerStates).forEach(([key, markers]) => {
|
Object.entries(markerStates).forEach(([key, markers]) => {
|
||||||
const isVisible = mapLayersVisibility[key];
|
const isVisible = mapLayersVisibility[key] ?? true; // undefined = true
|
||||||
|
|
||||||
markers.forEach(marker => {
|
markers.forEach(marker => {
|
||||||
const hasLayer = map.hasLayer(marker);
|
const hasLayer = map.hasLayer(marker);
|
||||||
if (editMode || !isVisible) {
|
if (editMode || !isVisible) {
|
||||||
|
|||||||
0
components/hooks/useStationCache.js
Normal file
0
components/hooks/useStationCache.js
Normal file
@@ -797,30 +797,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
}
|
}
|
||||||
}, [poiIconsData, poiIconsStatus]);
|
}, [poiIconsData, poiIconsStatus]);
|
||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
useEffect(() => {
|
|
||||||
if (!map) return;
|
|
||||||
|
|
||||||
const editMode = localStorage.getItem("editMode") === "true";
|
|
||||||
|
|
||||||
Object.entries(markerStates).forEach(([systemName, markers]) => {
|
|
||||||
const isVisible = mapLayersVisibility[systemName];
|
|
||||||
markers.forEach(marker => {
|
|
||||||
const hasLayer = map.hasLayer(marker);
|
|
||||||
if (editMode || !isVisible) {
|
|
||||||
if (hasLayer) map.removeLayer(marker);
|
|
||||||
} else {
|
|
||||||
if (!hasLayer) marker.addTo(map);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// optional für alle zusammen
|
|
||||||
const allMarkers = Object.values(markerStates)
|
|
||||||
.filter(entry => Array.isArray(entry))
|
|
||||||
.flat();
|
|
||||||
|
|
||||||
checkOverlappingMarkers(map, allMarkers, plusRoundIcon);
|
|
||||||
}, [map, markerStates, mapLayersVisibility]);
|
|
||||||
|
|
||||||
//----------------------------------------------
|
//----------------------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -896,6 +872,21 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
}, [GisStationsStaticDistrict]);
|
}, [GisStationsStaticDistrict]);
|
||||||
const { Points = [] } = useSelector(selectGisStationsStaticDistrict);
|
const { Points = [] } = useSelector(selectGisStationsStaticDistrict);
|
||||||
useEffect(() => {}, [triggerUpdate]);
|
useEffect(() => {}, [triggerUpdate]);
|
||||||
|
//--------------------------------------------------------------------------------
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("📊 GisSystemStatic:", GisSystemStatic);
|
||||||
|
}, [GisSystemStatic]);
|
||||||
|
useEffect(() => {
|
||||||
|
if (Array.isArray(GisSystemStatic)) {
|
||||||
|
GisSystemStatic.forEach(system => {
|
||||||
|
const key = `system-${system.IdSystem}`;
|
||||||
|
if (!(key in mapLayersVisibility)) {
|
||||||
|
dispatch(setLayerVisibility({ key, value: true })); // Sichtbarkeit aktivieren
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [GisSystemStatic, mapLayersVisibility, dispatch]);
|
||||||
|
|
||||||
//---------------------------------------------
|
//---------------------------------------------
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -9,7 +9,11 @@ import {
|
|||||||
} from "@/redux/slices/database/polylines/polylineLayerVisibleSlice";
|
} from "@/redux/slices/database/polylines/polylineLayerVisibleSlice";
|
||||||
import { selectGisSystemStatic } from "@/redux/slices/webservice/gisSystemStaticSlice";
|
import { selectGisSystemStatic } from "@/redux/slices/webservice/gisSystemStaticSlice";
|
||||||
import { selectGisStationsStaticDistrict } from "@/redux/slices/webservice/gisStationsStaticDistrictSlice";
|
import { selectGisStationsStaticDistrict } from "@/redux/slices/webservice/gisStationsStaticDistrictSlice";
|
||||||
import { selectMapLayersState, setLayerVisibility } from "@/redux/slices/mapLayersSlice";
|
import {
|
||||||
|
selectMapLayersState,
|
||||||
|
setLayerVisibility,
|
||||||
|
setInitialLayers,
|
||||||
|
} from "@/redux/slices/mapLayersSlice";
|
||||||
import { setVisible } from "@/redux/slices/database/pois/poiLayerVisibleSlice";
|
import { setVisible } from "@/redux/slices/database/pois/poiLayerVisibleSlice";
|
||||||
import { incrementZoomTrigger } from "@/redux/slices/zoomTriggerSlice";
|
import { incrementZoomTrigger } from "@/redux/slices/zoomTriggerSlice";
|
||||||
|
|
||||||
@@ -122,13 +126,16 @@ function MapLayersControlPanel() {
|
|||||||
const initialVisibility = {};
|
const initialVisibility = {};
|
||||||
GisSystemStatic.forEach(system => {
|
GisSystemStatic.forEach(system => {
|
||||||
const visibility = system.Allow === 1;
|
const visibility = system.Allow === 1;
|
||||||
initialVisibility[system.SystemName] = visibility;
|
const key = `system-${system.IdSystem}`;
|
||||||
dispatch(setLayerVisibility({ layer: system.SystemName, visibility }));
|
initialVisibility[key] = visibility;
|
||||||
|
dispatch(setLayerVisibility({ layer: key, visibility }));
|
||||||
console.log(
|
console.log(
|
||||||
`🎯 Setting ${system.SystemName} visibility to ${visibility} (Allow=${system.Allow})`
|
`🎯 Setting ${system.SystemName} visibility to ${visibility} (Allow=${system.Allow})`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
localStorage.setItem("mapLayersVisibility", JSON.stringify(initialVisibility));
|
localStorage.setItem("mapLayersVisibility", JSON.stringify(initialVisibility));
|
||||||
|
|
||||||
console.log("💾 Saved initial mapLayersVisibility to localStorage:", initialVisibility);
|
console.log("💾 Saved initial mapLayersVisibility to localStorage:", initialVisibility);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,6 +264,16 @@ function MapLayersControlPanel() {
|
|||||||
console.log("📌 stationListing aktualisiert:", filteredAreas);
|
console.log("📌 stationListing aktualisiert:", filteredAreas);
|
||||||
}
|
}
|
||||||
}, [GisStationsStaticDistrict, GisSystemStatic]);
|
}, [GisStationsStaticDistrict, GisSystemStatic]);
|
||||||
|
|
||||||
|
//---------------------------
|
||||||
|
// ✅ Redux mapLayers mit GisSystemStatic initialisieren
|
||||||
|
useEffect(() => {
|
||||||
|
if (Array.isArray(GisSystemStatic) && GisSystemStatic.length > 0) {
|
||||||
|
console.log("🔧 Initializing mapLayers in Redux with GisSystemStatic:", GisSystemStatic);
|
||||||
|
dispatch(setInitialLayers(GisSystemStatic));
|
||||||
|
}
|
||||||
|
}, [GisSystemStatic, dispatch]);
|
||||||
|
|
||||||
//---------------------------
|
//---------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const next = (GisStationsStaticDistrict.Points || []).map(p => p.Area_Name).join("|");
|
const next = (GisStationsStaticDistrict.Points || []).map(p => p.Area_Name).join("|");
|
||||||
|
|||||||
Binary file not shown.
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.306",
|
"version": "1.1.307",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.306",
|
"version": "1.1.307",
|
||||||
"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.306",
|
"version": "1.1.307",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
37
server.js
37
server.js
@@ -33,10 +33,15 @@ app.prepare().then(() => {
|
|||||||
|
|
||||||
const io = new Server(server);
|
const io = new Server(server);
|
||||||
|
|
||||||
|
// ✅ Globaler Cache für alle aktuellen Daten
|
||||||
|
const globalDataCache = new Map();
|
||||||
|
|
||||||
io.on("connection", socket => {
|
io.on("connection", socket => {
|
||||||
const { m: idMap, u: idUser } = socket.handshake.query;
|
const { m: idMap, u: idUser } = socket.handshake.query;
|
||||||
console.log(`🔌 WebSocket verbunden (idMap=${idMap}, idUser=${idUser})`);
|
console.log(`🔌 WebSocket verbunden (idMap=${idMap}, idUser=${idUser})`);
|
||||||
|
|
||||||
|
const cacheKey = `${idMap}_${idUser}`;
|
||||||
|
|
||||||
const endpoints = [
|
const endpoints = [
|
||||||
{
|
{
|
||||||
name: "GisLinesStatus",
|
name: "GisLinesStatus",
|
||||||
@@ -69,6 +74,22 @@ app.prepare().then(() => {
|
|||||||
|
|
||||||
const lastDataMap = {};
|
const lastDataMap = {};
|
||||||
|
|
||||||
|
// ✅ Funktion um sofort alle verfügbaren Daten zu senden (für Browser-Reload)
|
||||||
|
const sendAllCurrentData = () => {
|
||||||
|
const cachedData = globalDataCache.get(cacheKey);
|
||||||
|
if (cachedData && Object.keys(cachedData).length > 0) {
|
||||||
|
console.log(
|
||||||
|
`📦 Sending all current data to client (${Object.keys(cachedData).length} endpoints)`
|
||||||
|
);
|
||||||
|
Object.entries(cachedData).forEach(([name, data]) => {
|
||||||
|
socket.emit(`${name}Updated`, data);
|
||||||
|
console.log(`🔄 Browser-Reload: ${name} data sent`);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
console.log(`📭 No cached data available for ${cacheKey}, will fetch fresh data`);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
for (const { name, getUrl, mock } of endpoints) {
|
for (const { name, getUrl, mock } of endpoints) {
|
||||||
try {
|
try {
|
||||||
@@ -99,6 +120,14 @@ app.prepare().then(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newDataStr = JSON.stringify(statis);
|
const newDataStr = JSON.stringify(statis);
|
||||||
|
|
||||||
|
// ✅ Cache aktualisieren
|
||||||
|
if (!globalDataCache.has(cacheKey)) {
|
||||||
|
globalDataCache.set(cacheKey, {});
|
||||||
|
}
|
||||||
|
globalDataCache.get(cacheKey)[name] = statis;
|
||||||
|
|
||||||
|
// ✅ Nur bei Änderungen senden (setInterval-Logik)
|
||||||
if (newDataStr !== lastDataMap[name]) {
|
if (newDataStr !== lastDataMap[name]) {
|
||||||
lastDataMap[name] = newDataStr;
|
lastDataMap[name] = newDataStr;
|
||||||
socket.emit(`${name}Updated`, statis);
|
socket.emit(`${name}Updated`, statis);
|
||||||
@@ -113,9 +142,15 @@ app.prepare().then(() => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// fetchData immer ausführen – unabhängig vom Modus
|
// ✅ Beim Connect: Sofort alle aktuellen Daten senden (für Browser-Reload)
|
||||||
|
sendAllCurrentData();
|
||||||
|
|
||||||
|
// ✅ Dann erste Datenabfrage durchführen
|
||||||
fetchData();
|
fetchData();
|
||||||
|
|
||||||
|
// ✅ setInterval für regelmäßige Updates (nur bei Änderungen)
|
||||||
const interval = setInterval(fetchData, 5000); // 5 Sekunden ,TALAS.web nutzt 12 Sekunden
|
const interval = setInterval(fetchData, 5000); // 5 Sekunden ,TALAS.web nutzt 12 Sekunden
|
||||||
|
|
||||||
socket.on("disconnect", () => {
|
socket.on("disconnect", () => {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
console.log("❌ WebSocket getrennt");
|
console.log("❌ WebSocket getrennt");
|
||||||
|
|||||||
0
services/localStorage/stationCacheService.js
Normal file
0
services/localStorage/stationCacheService.js
Normal file
0
services/webservice/idsystemTypFilterService.js
Normal file
0
services/webservice/idsystemTypFilterService.js
Normal file
@@ -30,7 +30,8 @@ export const createAndSetDevices = async (
|
|||||||
const systemConfig = Array.isArray(GisSystemStatic)
|
const systemConfig = Array.isArray(GisSystemStatic)
|
||||||
? GisSystemStatic.find(sys => sys.IdSystem === systemId)
|
? GisSystemStatic.find(sys => sys.IdSystem === systemId)
|
||||||
: null;
|
: null;
|
||||||
if (!systemConfig || systemConfig.Allow !== 1) {
|
if (!systemConfig) {
|
||||||
|
console.warn(`🚫 Kein Marker für System ${systemId}, Allow = ${systemConfig?.Allow}`);
|
||||||
setMarkersFunction([]);
|
setMarkersFunction([]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -42,7 +43,8 @@ export const createAndSetDevices = async (
|
|||||||
const statusDistrictData = selectGisStationsStatusDistrict(state);
|
const statusDistrictData = selectGisStationsStatusDistrict(state);
|
||||||
const measurementData = selectGisStationsMeasurements(state);
|
const measurementData = selectGisStationsMeasurements(state);
|
||||||
|
|
||||||
if (!staticDistrictData?.Points?.length || !statusDistrictData?.length) return;
|
if (!staticDistrictData?.Points?.length) return;
|
||||||
|
const hasStatus = Array.isArray(statusDistrictData) && statusDistrictData.length > 0;
|
||||||
|
|
||||||
const statisMap = new Map(statusDistrictData.map(s => [s.IdLD, s]));
|
const statisMap = new Map(statusDistrictData.map(s => [s.IdLD, s]));
|
||||||
const measurementsMap = new Map();
|
const measurementsMap = new Map();
|
||||||
|
|||||||
0
utils/filters/idsystemTypFilter.js
Normal file
0
utils/filters/idsystemTypFilter.js
Normal file
@@ -3,35 +3,35 @@
|
|||||||
"IdSystem": 1,
|
"IdSystem": 1,
|
||||||
"Name": "TALAS",
|
"Name": "TALAS",
|
||||||
"Longname": "Talas Meldestationen",
|
"Longname": "Talas Meldestationen",
|
||||||
"Allow": 0,
|
"Allow": 1,
|
||||||
"Icon": 1
|
"Icon": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"IdSystem": 2,
|
"IdSystem": 2,
|
||||||
"Name": "ECI",
|
"Name": "ECI",
|
||||||
"Longname": "ECI Geräte",
|
"Longname": "ECI Geräte",
|
||||||
"Allow": 0,
|
"Allow": 1,
|
||||||
"Icon": 2
|
"Icon": 2
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"IdSystem": 3,
|
"IdSystem": 3,
|
||||||
"Name": "ULAF",
|
"Name": "ULAF",
|
||||||
"Longname": "ULAF Geräte",
|
"Longname": "ULAF Geräte",
|
||||||
"Allow": 0,
|
"Allow": 1,
|
||||||
"Icon": 3
|
"Icon": 3
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"IdSystem": 5,
|
"IdSystem": 5,
|
||||||
"Name": "GSM Modem",
|
"Name": "GSM Modem",
|
||||||
"Longname": "LR77 GSM Modems",
|
"Longname": "LR77 GSM Modems",
|
||||||
"Allow": 0,
|
"Allow": 1,
|
||||||
"Icon": 5
|
"Icon": 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"IdSystem": 6,
|
"IdSystem": 6,
|
||||||
"Name": "Cisco Router",
|
"Name": "Cisco Router",
|
||||||
"Longname": "Cisco Router",
|
"Longname": "Cisco Router",
|
||||||
"Allow": 0,
|
"Allow": 1,
|
||||||
"Icon": 6
|
"Icon": 6
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user