fix: Kabelstrecken-Checkbox und Anzeige an TALAS Allow-Status gekoppelt
- Checkbox für Kabelstrecken (polylines) wird deaktiviert, wenn TALAS (IdSystem: 1) Allow: 0 ist - Polylinien werden auf der Karte nur angezeigt, wenn Allow: 1 für TALAS gesetzt ist - Synchronisation zwischen UI
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.300
|
NEXT_PUBLIC_APP_VERSION=1.1.301
|
||||||
|
|||||||
@@ -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.300
|
NEXT_PUBLIC_APP_VERSION=1.1.301
|
||||||
@@ -96,6 +96,11 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const countdownActive = useSelector(state => state.polylineContextMenu.countdownActive);
|
const countdownActive = useSelector(state => state.polylineContextMenu.countdownActive);
|
||||||
const isPolylineContextMenuOpen = useSelector(state => state.polylineContextMenu.isOpen);
|
const isPolylineContextMenuOpen = useSelector(state => state.polylineContextMenu.isOpen);
|
||||||
const polylineVisible = useSelector(selectPolylineVisible);
|
const polylineVisible = useSelector(selectPolylineVisible);
|
||||||
|
const GisSystemStatic = useSelector(selectGisSystemStatic);
|
||||||
|
// Prüfen, ob TALAS (IdSystem 1) erlaubt ist
|
||||||
|
const isTalasAllowed = Array.isArray(GisSystemStatic)
|
||||||
|
? GisSystemStatic.some(system => system.IdSystem === 1 && system.Allow === 1)
|
||||||
|
: false;
|
||||||
|
|
||||||
const isPoiTypLoaded = useSelector(state => state.poiTypes.status === "succeeded");
|
const isPoiTypLoaded = useSelector(state => state.poiTypes.status === "succeeded");
|
||||||
const statusMeasurements = useSelector(state => state.gisStationsMeasurements.status);
|
const statusMeasurements = useSelector(state => state.gisStationsMeasurements.status);
|
||||||
@@ -107,7 +112,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const zoomTrigger = useSelector(state => state.zoomTrigger.trigger);
|
const zoomTrigger = useSelector(state => state.zoomTrigger.trigger);
|
||||||
const poiReadTrigger = useSelector(state => state.poiReadFromDbTrigger.trigger);
|
const poiReadTrigger = useSelector(state => state.poiReadFromDbTrigger.trigger);
|
||||||
const GisStationsStaticDistrict = useSelector(selectGisStationsStaticDistrict);
|
const GisStationsStaticDistrict = useSelector(selectGisStationsStaticDistrict);
|
||||||
const GisSystemStatic = useSelector(selectGisSystemStatic);
|
|
||||||
const gisSystemStaticStatus = useSelector(state => state.gisSystemStatic.status);
|
const gisSystemStaticStatus = useSelector(state => state.gisSystemStatic.status);
|
||||||
const polylineEventsDisabled = useSelector(state => state.polylineEventsDisabled.disabled);
|
const polylineEventsDisabled = useSelector(state => state.polylineEventsDisabled.disabled);
|
||||||
const mapLayersVisibility = useSelector(selectMapLayersState) || {};
|
const mapLayersVisibility = useSelector(selectMapLayersState) || {};
|
||||||
@@ -310,14 +314,24 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!map) return;
|
if (!map) return;
|
||||||
|
|
||||||
// vorherige Marker & Polylinien vollständig bereinigen
|
// Wenn TALAS nicht erlaubt ist, Polyline-Checkbox und Anzeige deaktivieren
|
||||||
|
if (!isTalasAllowed) {
|
||||||
|
if (polylineVisible) {
|
||||||
|
dispatch(setPolylineVisible(false));
|
||||||
|
}
|
||||||
|
cleanupPolylinesForMemory(polylines, map);
|
||||||
|
setPolylines([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// vorherige Marker & Polylinien vollständig bereinigen
|
||||||
markers.forEach(marker => {
|
markers.forEach(marker => {
|
||||||
marker.remove();
|
marker.remove();
|
||||||
});
|
});
|
||||||
cleanupPolylinesForMemory(polylines, map);
|
cleanupPolylinesForMemory(polylines, map);
|
||||||
|
|
||||||
// Setze neue Marker und Polylinien mit den aktuellen Daten
|
// Setze neue Marker und Polylinien mit den aktuellen Daten
|
||||||
|
if (polylineVisible) {
|
||||||
const { markers: newMarkers, polylines: newPolylines } = setupPolylines(
|
const { markers: newMarkers, polylines: newPolylines } = setupPolylines(
|
||||||
map,
|
map,
|
||||||
linePositions,
|
linePositions,
|
||||||
@@ -375,6 +389,10 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
cleanupMarkers(markers, oms);
|
cleanupMarkers(markers, oms);
|
||||||
setMarkers(newMarkers);
|
setMarkers(newMarkers);
|
||||||
setPolylines(newPolylines);
|
setPolylines(newPolylines);
|
||||||
|
} else {
|
||||||
|
cleanupPolylinesForMemory(polylines, map);
|
||||||
|
setPolylines([]);
|
||||||
|
}
|
||||||
}, [
|
}, [
|
||||||
map,
|
map,
|
||||||
linePositions,
|
linePositions,
|
||||||
@@ -384,6 +402,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
newCoords,
|
newCoords,
|
||||||
tempMarker,
|
tempMarker,
|
||||||
polylineVisible,
|
polylineVisible,
|
||||||
|
isTalasAllowed,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ function MapLayersControlPanel() {
|
|||||||
|
|
||||||
const polylineVisible = useSelector(selectPolylineVisible);
|
const polylineVisible = useSelector(selectPolylineVisible);
|
||||||
|
|
||||||
|
// Prüfen, ob TALAS (IdSystem 1) erlaubt ist
|
||||||
|
const isTalasAllowed = Array.isArray(GisSystemStatic)
|
||||||
|
? GisSystemStatic.some(system => system.IdSystem === 1 && system.Allow === 1)
|
||||||
|
: false;
|
||||||
|
|
||||||
const handlePolylineCheckboxChange = event => {
|
const handlePolylineCheckboxChange = event => {
|
||||||
const checked = event.target.checked;
|
const checked = event.target.checked;
|
||||||
dispatch(setPolylineVisible(checked));
|
dispatch(setPolylineVisible(checked));
|
||||||
@@ -258,6 +263,7 @@ function MapLayersControlPanel() {
|
|||||||
checked={polylineVisible} // Zustand für Kabelstrecken
|
checked={polylineVisible} // Zustand für Kabelstrecken
|
||||||
onChange={handlePolylineCheckboxChange}
|
onChange={handlePolylineCheckboxChange}
|
||||||
id="polyline-checkbox"
|
id="polyline-checkbox"
|
||||||
|
disabled={!isTalasAllowed || editMode}
|
||||||
/>
|
/>
|
||||||
<label htmlFor="polyline-checkbox" className="text-sm ml-2">
|
<label htmlFor="polyline-checkbox" className="text-sm ml-2">
|
||||||
Kabelstrecken
|
Kabelstrecken
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.300",
|
"version": "1.1.301",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.300",
|
"version": "1.1.301",
|
||||||
"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.300",
|
"version": "1.1.301",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
@@ -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
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user