feat: implement device filtering based on GisSystemStatic Allow property

- Add Allow=1 filter in createAndSetDevices.js to hide devices with Allow=0
- Update mapLayersSlice.js setInitialLayers to respect Allow values for visibility
- Modify MapLayersControlPanel.js localStorage initialization to set visibility based on Allow property
- Only systems with Allow=1 are now visible by default, Allow=0 systems are hidden
- Ensures consistent filtering across device markers and layer visibility controls

This change addresses the requirement to hide stations/devices when their corresponding
IdSystem in GisSystemStatic.json has Allow=0, improving the map display by showing
only authorized/allowed systems to users.
This commit is contained in:
ISA
2025-07-29 08:11:31 +02:00
parent 37aec649ee
commit 4755cefdd7
7 changed files with 26 additions and 10 deletions

View File

@@ -115,6 +115,22 @@ function MapLayersControlPanel() {
Object.keys(parsedVisibility).forEach(key => {
dispatch(setLayerVisibility({ layer: key, visibility: parsedVisibility[key] }));
});
} else {
// Initialisiere mapLayersVisibility basierend auf GisSystemStatic Allow-Werten
console.log("🚀 No stored mapLayersVisibility found, initializing based on Allow values...");
if (Array.isArray(GisSystemStatic)) {
const initialVisibility = {};
GisSystemStatic.forEach(system => {
const visibility = system.Allow === 1;
initialVisibility[system.SystemName] = visibility;
dispatch(setLayerVisibility({ layer: system.SystemName, visibility }));
console.log(
`🎯 Setting ${system.SystemName} visibility to ${visibility} (Allow=${system.Allow})`
);
});
localStorage.setItem("mapLayersVisibility", JSON.stringify(initialVisibility));
console.log("💾 Saved initial mapLayersVisibility to localStorage:", initialVisibility);
}
}
const storedEditMode = localStorage.getItem("editMode");