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:
@@ -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.304
|
NEXT_PUBLIC_APP_VERSION=1.1.305
|
||||||
|
|||||||
@@ -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.304
|
NEXT_PUBLIC_APP_VERSION=1.1.305
|
||||||
@@ -115,6 +115,22 @@ function MapLayersControlPanel() {
|
|||||||
Object.keys(parsedVisibility).forEach(key => {
|
Object.keys(parsedVisibility).forEach(key => {
|
||||||
dispatch(setLayerVisibility({ layer: key, visibility: parsedVisibility[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");
|
const storedEditMode = localStorage.getItem("editMode");
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.304",
|
"version": "1.1.305",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.304",
|
"version": "1.1.305",
|
||||||
"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.304",
|
"version": "1.1.305",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ const mapLayersSlice = createSlice({
|
|||||||
},
|
},
|
||||||
setInitialLayers: (state, action) => {
|
setInitialLayers: (state, action) => {
|
||||||
const systems = action.payload; // Array of GisSystem
|
const systems = action.payload; // Array of GisSystem
|
||||||
systems.forEach((system) => {
|
systems.forEach(system => {
|
||||||
const key = `system-${system.IdSystem}`;
|
const key = `system-${system.IdSystem}`;
|
||||||
state[key] = true; // oder false, je nach Default
|
state[key] = system.Allow === 1; // true wenn Allow=1, false wenn Allow=0
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const { toggleLayer, setLayerVisibility, setInitialLayers } = mapLayersSlice.actions;
|
export const { toggleLayer, setLayerVisibility, setInitialLayers } = mapLayersSlice.actions;
|
||||||
export const selectMapLayersState = (state) => state.mapLayers || initialState;
|
export const selectMapLayersState = state => state.mapLayers || initialState;
|
||||||
export default mapLayersSlice.reducer;
|
export default mapLayersSlice.reducer;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"IdSystem": 1,
|
"IdSystem": 1,
|
||||||
"Name": "TALAS",
|
"Name": "TALAS",
|
||||||
"Longname": "Talas Meldestationen",
|
"Longname": "Talas Meldestationen",
|
||||||
"Allow": 1,
|
"Allow": 0,
|
||||||
"Icon": 1
|
"Icon": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
"IdSystem": 11,
|
"IdSystem": 11,
|
||||||
"Name": "GMA",
|
"Name": "GMA",
|
||||||
"Longname": "Glättemeldeanlagen",
|
"Longname": "Glättemeldeanlagen",
|
||||||
"Allow": 0,
|
"Allow": 1,
|
||||||
"Icon": 11
|
"Icon": 11
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user