POIs visible with checkbox
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Navigiere zum Verzeichnis deines Projekts
|
# Navigiere zum Verzeichnis deines Projekts
|
||||||
cd 'C:\inetpub\wwwroot\talas5\nodeMap'
|
cd 'C:\inetpub\wwwroot\talas5\nodeMap'
|
||||||
|
|
||||||
# F<>hre den npm Befehl aus
|
# F<>hre den npm Befehl aus
|
||||||
npm run dev
|
npm start
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ import { gisSystemStaticState } from "../store/atoms/gisSystemState";
|
|||||||
import { mapLayersState } from "../store/atoms/mapLayersState";
|
import { mapLayersState } from "../store/atoms/mapLayersState";
|
||||||
import { selectedAreaState } from "../store/atoms/selectedAreaState";
|
import { selectedAreaState } from "../store/atoms/selectedAreaState";
|
||||||
import { zoomTriggerState } from "../store/atoms/zoomTriggerState";
|
import { zoomTriggerState } from "../store/atoms/zoomTriggerState";
|
||||||
|
import { poiLayerVisibleState } from "../store/atoms/poiLayerVisible";
|
||||||
|
|
||||||
function DataSheet() {
|
function DataSheet() {
|
||||||
|
const [poiVisible, setPoiVisible] = useRecoilState(poiLayerVisibleState);
|
||||||
|
|
||||||
const setSelectedArea = useSetRecoilState(selectedAreaState);
|
const setSelectedArea = useSetRecoilState(selectedAreaState);
|
||||||
const [mapLayersVisibility, setMapLayersVisibility] =
|
const [mapLayersVisibility, setMapLayersVisibility] =
|
||||||
useRecoilState(mapLayersState);
|
useRecoilState(mapLayersState);
|
||||||
@@ -142,6 +145,18 @@ function DataSheet() {
|
|||||||
<br />
|
<br />
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={poiVisible}
|
||||||
|
onChange={(e) => {
|
||||||
|
const checked = e.target.checked;
|
||||||
|
setPoiVisible(checked);
|
||||||
|
console.log(
|
||||||
|
`POIs sind jetzt ${checked ? "sichtbar" : "nicht sichtbar"}.`
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<label className="text-sm ml-2">POIs</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
// components/MapComponent.js
|
// components/MapComponent.js
|
||||||
import React, { useEffect, useRef, useState, useMemo, use } from "react";
|
import React, {
|
||||||
|
useEffect,
|
||||||
|
useRef,
|
||||||
|
useState,
|
||||||
|
useMemo,
|
||||||
|
useCallback,
|
||||||
|
} from "react";
|
||||||
//import ReactDOM from "react-dom/client"; // Import from 'react-dom/client'
|
//import ReactDOM from "react-dom/client"; // Import from 'react-dom/client'
|
||||||
import L, { marker } from "leaflet";
|
import L, { marker } from "leaflet";
|
||||||
import "leaflet/dist/leaflet.css";
|
import "leaflet/dist/leaflet.css";
|
||||||
@@ -25,6 +31,9 @@ import { selectedPoiState } from "../store/atoms/poiState.js";
|
|||||||
import { currentPoiState } from "../store/atoms/currentPoiState";
|
import { currentPoiState } from "../store/atoms/currentPoiState";
|
||||||
import { ToastContainer, toast } from "react-toastify";
|
import { ToastContainer, toast } from "react-toastify";
|
||||||
import "react-toastify/dist/ReactToastify.css";
|
import "react-toastify/dist/ReactToastify.css";
|
||||||
|
import { mapIdState, userIdState } from "../store/atoms/urlParameterState";
|
||||||
|
import { set } from "lodash";
|
||||||
|
import { poiLayerVisibleState } from "../store/atoms/poiLayerVisible";
|
||||||
|
|
||||||
//import { createRoot } from "react-dom/client";
|
//import { createRoot } from "react-dom/client";
|
||||||
|
|
||||||
@@ -37,6 +46,13 @@ const plusRoundIcon = L.icon({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const MapComponent = ({ locations, onLocationUpdate }) => {
|
const MapComponent = ({ locations, onLocationUpdate }) => {
|
||||||
|
const poiLayerVisible = useRecoilValue(poiLayerVisibleState);
|
||||||
|
|
||||||
|
const [contextMenuItems, setContextMenuItems] = useState([]);
|
||||||
|
const [isRightsLoaded, setIsRightsLoaded] = useState(false);
|
||||||
|
const [hasRights, setHasRights] = useState(false);
|
||||||
|
const [mapId, setMapId] = useRecoilState(mapIdState);
|
||||||
|
const [userId, setUserId] = useRecoilState(userIdState);
|
||||||
const [showAddStationPopup, setShowAddStationPopup] = useState(false);
|
const [showAddStationPopup, setShowAddStationPopup] = useState(false);
|
||||||
const [userRights, setUserRights] = useState(null);
|
const [userRights, setUserRights] = useState(null);
|
||||||
const setSelectedPoi = useSetRecoilState(selectedPoiState);
|
const setSelectedPoi = useSetRecoilState(selectedPoiState);
|
||||||
@@ -51,6 +67,17 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
// Open the modal or any other logic
|
// Open the modal or any other logic
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const params = new URL(window.location.href).searchParams;
|
||||||
|
setMapId(params.get("m"));
|
||||||
|
setUserId(params.get("u"));
|
||||||
|
}, [setMapId, setUserId]);
|
||||||
|
useEffect(() => {
|
||||||
|
fetchUserRights().then(() => {
|
||||||
|
setIsRightsLoaded(true);
|
||||||
|
});
|
||||||
|
}, []); // Lade die Berechtigungen beim Initialisieren der Komponente
|
||||||
|
|
||||||
const handleEditPoi = (marker) => {
|
const handleEditPoi = (marker) => {
|
||||||
// Prüfung, ob der Benutzer die notwendigen Rechte hat
|
// Prüfung, ob der Benutzer die notwendigen Rechte hat
|
||||||
if (!userRights || !userRights.includes(56)) {
|
if (!userRights || !userRights.includes(56)) {
|
||||||
@@ -132,6 +159,8 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
|
|
||||||
const handleAddStation = (stationData) => {
|
const handleAddStation = (stationData) => {
|
||||||
// Station-Daten speichern oder API-Aufruf durchführen
|
// Station-Daten speichern oder API-Aufruf durchführen
|
||||||
|
console.log("Neue Station:", userRights.includes(56));
|
||||||
|
|
||||||
console.log("Neue Station:", stationData);
|
console.log("Neue Station:", stationData);
|
||||||
setShowAddStationPopup(false);
|
setShowAddStationPopup(false);
|
||||||
closePopup(); // Schließt das Popup nach dem Hinzufügen
|
closePopup(); // Schließt das Popup nach dem Hinzufügen
|
||||||
@@ -278,15 +307,57 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Kontextmenü Callback für "POI hinzufügen"
|
// Kontextmenü Callback für "POI hinzufügen"
|
||||||
const addStationCallback = (event) => {
|
/* const addStationCallback = useCallback(
|
||||||
setPopupCoordinates(event.latlng); // Koordinaten des Klicks verwenden
|
(event, hasRights) => {
|
||||||
setShowPopup(true); // Popup öffnen
|
console.log("Kontextmenü-Callback für 'POI hinzufügen' aufgerufen");
|
||||||
};
|
console.log(event);
|
||||||
|
console.log("Benutzerrechte zum Zeitpunkt des Aufrufs:", hasRights);
|
||||||
|
|
||||||
|
if (hasRights) {
|
||||||
|
setPopupCoordinates(event.latlng);
|
||||||
|
setShowPopup(true);
|
||||||
|
} else {
|
||||||
|
toast.error("Benutzer hat keine Berechtigung zum Hinzufügen.", {
|
||||||
|
position: "top-center",
|
||||||
|
autoClose: 5000,
|
||||||
|
hideProgressBar: false,
|
||||||
|
closeOnClick: true,
|
||||||
|
pauseOnHover: true,
|
||||||
|
draggable: true,
|
||||||
|
progress: undefined,
|
||||||
|
});
|
||||||
|
console.log("Benutzer hat keine Berechtigung zum Hinzufügen.");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[hasRights, isRightsLoaded]
|
||||||
|
); // Keine Abhängigkeiten, da `hasRights` als Parameter übergeben wird */
|
||||||
|
const addStationCallback = useCallback(
|
||||||
|
(event) => {
|
||||||
|
console.log("Benutzerrechte zum Zeitpunkt des Aufrufs:", hasRights);
|
||||||
|
if (hasRights) {
|
||||||
|
setPopupCoordinates(event.latlng);
|
||||||
|
setShowPopup(true);
|
||||||
|
} else {
|
||||||
|
toast.error("Benutzer hat keine Berechtigung zum Hinzufügen.", {
|
||||||
|
position: "top-center",
|
||||||
|
autoClose: 5000,
|
||||||
|
hideProgressBar: false,
|
||||||
|
closeOnClick: true,
|
||||||
|
pauseOnHover: true,
|
||||||
|
draggable: true,
|
||||||
|
progress: undefined,
|
||||||
|
});
|
||||||
|
console.log("Benutzer hat keine Berechtigung zum Hinzufügen.");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[hasRights]
|
||||||
|
); // Abhängigkeit zu hasRights hinzufügen
|
||||||
|
|
||||||
//-----Kontextmenu----ende------------
|
//-----Kontextmenu----ende------------
|
||||||
//--------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Verwende useMemo, um die Kontextmenü-Items nur zu initialisieren, wenn notwendig
|
// Verwende useMemo, um die Kontextmenü-Items nur zu initialisieren, wenn notwendig
|
||||||
const contextMenuItems = useMemo(
|
/* const contextMenuItems = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
text: "Station öffnen (Tab)",
|
text: "Station öffnen (Tab)",
|
||||||
@@ -310,7 +381,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
text: "POI hinzufügen",
|
text: "POI hinzufügen",
|
||||||
icon: "img/add_station.png",
|
icon: "img/add_station.png",
|
||||||
className: "background-red",
|
className: "background-red",
|
||||||
callback: addStationCallback,
|
callback: (event) => addStationCallback(event, hasRights),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -327,8 +398,22 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
callback: centerHere,
|
callback: centerHere,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[]
|
[hasRights]
|
||||||
);
|
); */
|
||||||
|
/* useEffect(() => {
|
||||||
|
if (hasRights) {
|
||||||
|
setContextMenuItems([
|
||||||
|
{
|
||||||
|
text: "POI hinzufügen test",
|
||||||
|
icon: "img/add_station.png",
|
||||||
|
className: "background-red",
|
||||||
|
callback: (event) => addStationCallback(event),
|
||||||
|
},
|
||||||
|
// Weitere Menüpunkte...
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}, [isRightsLoaded, hasRights]);
|
||||||
|
*/
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
//------------------------------------------ */
|
//------------------------------------------ */
|
||||||
const layerNames = {
|
const layerNames = {
|
||||||
@@ -622,14 +707,27 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
//-----------------------------------------------------------
|
//-----------------------------------------------------------
|
||||||
// Funktion um die Benutzerrechte zu überprüfen
|
// Funktion um die Benutzerrechte zu überprüfen
|
||||||
// serverIP 10.10.0.13 idMap=10 idUser=485
|
// serverIP 10.10.0.13 idMap=10 idUser=485
|
||||||
const serverURL = "http://10.10.0.13";
|
//const serverURL = "http://10.10.0.13";
|
||||||
const c = 10; // Beispielwert für idMap
|
|
||||||
const user = 486; // Beispielwert für idUser
|
|
||||||
|
|
||||||
|
const url = new URL(window.location.href);
|
||||||
|
const hostname = url.hostname; // Gibt den Hostnamen (IP oder Domain) zurück
|
||||||
|
const port = url.port; // Gibt den Port zurück, leer wenn Standardport verwendet wird
|
||||||
|
const protocol = url.protocol; // "http:" oder "https:"
|
||||||
|
//const serverURL = `${protocol}//${hostname}`;
|
||||||
|
const serverURL = "http://10.10.0.13"; // weil ich keine API habe, ansonsten serverURL ist localhost(IP-Adresse)
|
||||||
|
//const serverURL = "http://localhost:3000";
|
||||||
|
|
||||||
|
const params = new URL(window.location.href).searchParams;
|
||||||
|
//const serverURL = `${protocol}//${hostname}${port ? `:${port}` : ""}`;
|
||||||
|
|
||||||
|
const c = params.get("m"); // Beispielwert für idMap
|
||||||
|
const user = params.get("u"); // Beispielwert für idUser
|
||||||
|
//console.log("serverURL:", serverURL);
|
||||||
const fetchUserRights = async () => {
|
const fetchUserRights = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${c}&idUser=${user}`
|
`${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${c}&idUser=${user}`
|
||||||
|
//`${serverURL}/api/rights?idMap=${c}&idUser=${user}`
|
||||||
);
|
);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const rightsArray = data.Rights; // Nehmen an, dass 'Rights' das Array von Rechten ist
|
const rightsArray = data.Rights; // Nehmen an, dass 'Rights' das Array von Rechten ist
|
||||||
@@ -639,10 +737,16 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
setUserRights(userRightsIds); // Speichert die Rechte in den Zustand
|
setUserRights(userRightsIds); // Speichert die Rechte in den Zustand
|
||||||
|
|
||||||
console.log("Benutzerrechte:", rightsArray);
|
console.log("Benutzerrechte:", rightsArray);
|
||||||
|
console.log("Benutzerrechte IDs:", userRightsIds);
|
||||||
|
console.log("Benutzerrechte in if :", userRightsIds.includes(56));
|
||||||
|
setHasRights(userRightsIds.includes(56));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Fehler beim Abrufen der Benutzerrechte", error);
|
console.error("Fehler beim Abrufen der Benutzerrechte", error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("Aktualisierter Status von hasRights: ", hasRights);
|
||||||
|
}, [hasRights]); // Dieser Effekt läuft jedes Mal, wenn sich `hasRights` ändert.
|
||||||
|
|
||||||
// Überprüfen der Benutzerrechte beim Initialisieren der Komponente
|
// Überprüfen der Benutzerrechte beim Initialisieren der Komponente
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -828,7 +932,41 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
maxZoom: 15, // Maximale Zoomstufe
|
maxZoom: 15, // Maximale Zoomstufe
|
||||||
zoomControl: false,
|
zoomControl: false,
|
||||||
contextmenu: true,
|
contextmenu: true,
|
||||||
contextmenuItems: contextMenuItems,
|
contextmenuItems: [
|
||||||
|
{
|
||||||
|
text: "Station öffnen (Tab)",
|
||||||
|
icon: "/img/screen_new.png",
|
||||||
|
callback: (e) => {
|
||||||
|
const clickedMarker = e.relatedTarget; // Zugriff auf den Marker, der das Event ausgelöst hat
|
||||||
|
openInNewTab(e, clickedMarker);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "Station öffnen",
|
||||||
|
icon: "/img/screen_same.png",
|
||||||
|
//callback: (e) => openInSameWindow(e, marker),
|
||||||
|
callback: (e) => {
|
||||||
|
const clickedMarker = e.relatedTarget; // Zugriff auf den Marker, der das Event ausgelöst hat
|
||||||
|
openInSameWindow(e, clickedMarker);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"-", // Divider
|
||||||
|
|
||||||
|
{
|
||||||
|
text: "Koordinaten anzeigen",
|
||||||
|
icon: "img/not_listed_location.png",
|
||||||
|
callback: showCoordinates,
|
||||||
|
},
|
||||||
|
"-", // Divider
|
||||||
|
{ text: "Reinzoomen", icon: "img/zoom_in.png", callback: zoomIn },
|
||||||
|
{ text: "Rauszoomen", icon: "img/zoom_out.png", callback: zoomOut },
|
||||||
|
{
|
||||||
|
text: "Hier zentrieren",
|
||||||
|
icon: "img/center_focus.png",
|
||||||
|
callback: centerHere,
|
||||||
|
},
|
||||||
|
"-", // Divider
|
||||||
|
],
|
||||||
});
|
});
|
||||||
|
|
||||||
L.tileLayer(online ? onlineTileLayer : offlineTileLayer, {
|
L.tileLayer(online ? onlineTileLayer : offlineTileLayer, {
|
||||||
@@ -860,7 +998,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
//console.log("trigger in MapComponent.js:", poiReadTrigger);
|
//console.log("trigger in MapComponent.js:", poiReadTrigger);
|
||||||
}, [mapRef, map, poiReadTrigger]); // Prüfe die Abhängigkeiten sorgfältig
|
}, [mapRef, map, poiReadTrigger, contextMenuItems]); // Prüfe die Abhängigkeiten sorgfältig
|
||||||
|
|
||||||
// poiTyp Daten hinzufügen
|
// poiTyp Daten hinzufügen
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
@@ -972,7 +1110,45 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
return "Unbekannt";
|
return "Unbekannt";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
//--------------------------------------------------
|
||||||
|
/* useEffect(() => {
|
||||||
|
fetchUserRights().then(() => {
|
||||||
|
setIsRightsLoaded(true); // Stellen Sie sicher, dass Sie diesen Status verwenden, um die Initialisierung zu kontrollieren.
|
||||||
|
});
|
||||||
|
}, []); */
|
||||||
|
|
||||||
|
/* useEffect(() => {
|
||||||
|
if (map && !map.contextmenu) {
|
||||||
|
map.contextmenu = new L.Control.ContextMenu({
|
||||||
|
contextmenu: true,
|
||||||
|
contextmenuWidth: 140,
|
||||||
|
contextmenuItems: [], // Starten mit einem leeren Array oder initialen Einträgen
|
||||||
|
}).addTo(map);
|
||||||
|
}
|
||||||
|
}, [map]); */
|
||||||
|
const addItemsToMapContextMenu = () => {
|
||||||
|
console.log("contextMenuItems hasRights:", hasRights);
|
||||||
|
|
||||||
|
map.contextmenu.addItem({
|
||||||
|
text: "POI hinzufügen",
|
||||||
|
icon: "img/add_station.png",
|
||||||
|
className: "background-red",
|
||||||
|
callback: (event) => addStationCallback(event, hasRights),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
//--------------------------------------------------
|
||||||
|
useEffect(() => {
|
||||||
|
if (map && poiLayerRef.current && isPoiTypLoaded) {
|
||||||
|
addItemsToMapContextMenu();
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
map,
|
||||||
|
locations,
|
||||||
|
onLocationUpdate,
|
||||||
|
poiReadTrigger,
|
||||||
|
isPoiTypLoaded,
|
||||||
|
userRights,
|
||||||
|
]);
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
|
|
||||||
// poiLayerRef(poiDbLayer) POI hinzufügen
|
// poiLayerRef(poiDbLayer) POI hinzufügen
|
||||||
@@ -1047,8 +1223,10 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
console.log("Drag operation not allowed");
|
console.log("Drag operation not allowed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//poiLayer ein - oder ausschalten
|
||||||
marker.addTo(poiLayerRef.current);
|
if (poiLayerVisible) {
|
||||||
|
marker.addTo(poiLayerRef.current);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@@ -1058,8 +1236,11 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
poiReadTrigger,
|
poiReadTrigger,
|
||||||
isPoiTypLoaded,
|
isPoiTypLoaded,
|
||||||
userRights,
|
userRights,
|
||||||
|
poiLayerVisible,
|
||||||
]);
|
]);
|
||||||
|
//---------------------------------------------
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (gisSystemStaticLoaded && map) {
|
if (gisSystemStaticLoaded && map) {
|
||||||
createAndSetMarkers(1, setTalasMarkers); // TALAS-System
|
createAndSetMarkers(1, setTalasMarkers); // TALAS-System
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ if (typeof window !== "undefined") {
|
|||||||
c = url.searchParams.get("m") || "10"; // Ein Parameter aus der URL, Standardwert ist '10'
|
c = url.searchParams.get("m") || "10"; // Ein Parameter aus der URL, Standardwert ist '10'
|
||||||
user = url.searchParams.get("u") || "484"; // Ein weiterer Parameter aus der URL, Standardwert ist '484 admin zu testen von Stationen ausblenden und einblenden in der Card'
|
user = url.searchParams.get("u") || "484"; // Ein weiterer Parameter aus der URL, Standardwert ist '484 admin zu testen von Stationen ausblenden und einblenden in der Card'
|
||||||
|
|
||||||
|
console.log(`Parameter 'idMap' : ${c}`);
|
||||||
|
console.log(`Parameter 'idUser': ${user}`);
|
||||||
|
|
||||||
// Konstruktion von URLs, die auf spezifische Ressourcen auf dem Server zeigen
|
// Konstruktion von URLs, die auf spezifische Ressourcen auf dem Server zeigen
|
||||||
//http://localhost:3000/?m=10&u=485
|
//http://localhost:3000/?m=10&u=485
|
||||||
mapGisStationsStaticDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict?idMap=${c}&idUser=${user}`; //idMap: 10, idUser: 484
|
mapGisStationsStaticDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict?idMap=${c}&idUser=${user}`; //idMap: 10, idUser: 484
|
||||||
@@ -30,8 +33,9 @@ if (typeof window !== "undefined") {
|
|||||||
mapGisSystemStaticUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${c}&idUser=${user}`;
|
mapGisSystemStaticUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${c}&idUser=${user}`;
|
||||||
mapDataIconUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GetIconsStatic`;
|
mapDataIconUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GetIconsStatic`;
|
||||||
|
|
||||||
/* mapGisStationsStaticDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict`;
|
//http://10.10.0.13/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=12&idUser=484
|
||||||
|
|
||||||
|
/* mapGisStationsStaticDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict`;
|
||||||
mapGisStationsStatusDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict`;
|
mapGisStationsStatusDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict`;
|
||||||
mapGisStationsMeasurementsUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsMeasurements`;
|
mapGisStationsMeasurementsUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsMeasurements`;
|
||||||
mapGisSystemStaticUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic`;
|
mapGisSystemStaticUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic`;
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
// pages/api/readPoiTyp.js
|
// pages/api/readPoiTyp.js
|
||||||
import mysql from 'mysql';
|
import mysql from "mysql";
|
||||||
|
|
||||||
const pool = mysql.createPool({
|
const pool = mysql.createPool({
|
||||||
connectionLimit: 10,
|
//connectionLimit: 10,
|
||||||
host: process.env.DB_HOST,
|
host: process.env.DB_HOST,
|
||||||
user: process.env.DB_USER,
|
user: process.env.DB_USER,
|
||||||
password: process.env.DB_PASSWORD,
|
password: process.env.DB_PASSWORD,
|
||||||
@@ -13,7 +13,7 @@ const pool = mysql.createPool({
|
|||||||
export default function handler(req, res) {
|
export default function handler(req, res) {
|
||||||
if (req.method === "GET") {
|
if (req.method === "GET") {
|
||||||
const query = "SELECT * FROM poityp";
|
const query = "SELECT * FROM poityp";
|
||||||
|
|
||||||
pool.query(query, (error, results) => {
|
pool.query(query, (error, results) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error("Fehler beim Abfragen der Datenbank:", error);
|
console.error("Fehler beim Abfragen der Datenbank:", error);
|
||||||
|
|||||||
29
pages/api/rights.js
Normal file
29
pages/api/rights.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
// pages/api/rights.js
|
||||||
|
|
||||||
|
export default function handler(req, res) {
|
||||||
|
const { idMap, idUser } = req.query;
|
||||||
|
|
||||||
|
// Beispielhafte Rechte, die je nach idMap und idUser variieren können
|
||||||
|
const rights = {
|
||||||
|
'10': [
|
||||||
|
{ IdRight: 1, Name: "Zugriff auf Dashboard" },
|
||||||
|
{ IdRight: 56, Name: "Erweiterte Berechtigungen" }
|
||||||
|
],
|
||||||
|
'2': [
|
||||||
|
{ IdRight: 2, Name: "Zugriff auf Einstellungen" }
|
||||||
|
],
|
||||||
|
'1': [
|
||||||
|
{ IdRight: 10, Name: "Admin-Zugriff" },
|
||||||
|
{ IdRight: 11, Name: "Zugriff auf alle Daten" }
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
// Prüfung, ob eine gültige idMap und idUser vorhanden sind
|
||||||
|
if (rights[idMap] && idUser === '484') {
|
||||||
|
// Rückgabe der spezifischen Rechte basierend auf der idMap und idUser
|
||||||
|
res.status(200).json({ Rights: rights[idMap] });
|
||||||
|
} else {
|
||||||
|
// Rückgabe leerer Rechte für ungültige idMap oder andere Benutzer
|
||||||
|
res.status(200).json({ Rights: [] });
|
||||||
|
}
|
||||||
|
}
|
||||||
9
store/atoms/poiLayerVisible.js
Normal file
9
store/atoms/poiLayerVisible.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
// /store/atoms/poiLayerVisible.js
|
||||||
|
// Recoil atom for the visibility of the POI layer
|
||||||
|
//
|
||||||
|
import { atom } from "recoil";
|
||||||
|
|
||||||
|
export const poiLayerVisibleState = atom({
|
||||||
|
key: "poiLayerVisibleState",
|
||||||
|
default: true,
|
||||||
|
});
|
||||||
13
store/atoms/urlParameterState.js
Normal file
13
store/atoms/urlParameterState.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { atom } from "recoil";
|
||||||
|
|
||||||
|
// Atom für die Speicherung der mapId aus der URL
|
||||||
|
export const mapIdState = atom({
|
||||||
|
key: "mapIdState", // Eindeutiger Schlüssel (innerhalb des gesamten Projekts)
|
||||||
|
default: "10", // Standardwert
|
||||||
|
});
|
||||||
|
|
||||||
|
// Atom für die Speicherung der userId aus der URL
|
||||||
|
export const userIdState = atom({
|
||||||
|
key: "userIdState",
|
||||||
|
default: "484",
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user