Version 1.0.4 Links open in new tab for polylines and devices work it!

This commit is contained in:
ISA
2024-09-04 19:26:08 +02:00
parent f8e35cece6
commit 9e4a229248
2 changed files with 32 additions and 22 deletions

View File

@@ -18,30 +18,30 @@
######################### #########################
DB_HOST=10.10.0.70 #DB_HOST=10.10.0.70
DB_USER=root
DB_PASSWORD="root#$"
DB_NAME=talas_v5
DB_PORT=3306
#########################
NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
NEXT_PUBLIC_SERVER_URL="http://10.10.0.70"
NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.70"
NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
#NEXT_PUBLIC_ONLINE_TILE_LAYER="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
#########################
#DB_HOST=192.168.10.167
#DB_USER=root #DB_USER=root
#DB_PASSWORD="root#$" #DB_PASSWORD="root#$"
#DB_NAME=talas_v5 #DB_NAME=talas_v5
#DB_PORT=3306 #DB_PORT=3306
#########################
#NEXT_PUBLIC_BASE_URL="http://10.10.0.30/talas5/devices/"
#NEXT_PUBLIC_SERVER_URL="http://10.10.0.70"
#NEXT_PUBLIC_PROXY_TARGET="http://10.10.0.70"
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"
#NEXT_PUBLIC_ONLINE_TILE_LAYER="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
#########################
DB_HOST=192.168.10.167
DB_USER=root
DB_PASSWORD="root#$"
DB_NAME=talas_v5
DB_PORT=3306
######################### #########################
#URLs für den Client (clientseitig) #URLs für den Client (clientseitig)
#NEXT_PUBLIC_BASE_URL="http://192.168.10.167/talas5/devices/" NEXT_PUBLIC_BASE_URL="http://192.168.10.167/talas5/devices/"
#NEXT_PUBLIC_SERVER_URL="http://192.168.10.167" NEXT_PUBLIC_SERVER_URL="http://192.168.10.167"
#NEXT_PUBLIC_PROXY_TARGET="http://192.168.10.167" NEXT_PUBLIC_PROXY_TARGET="http://192.168.10.167"
#NEXT_PUBLIC_ONLINE_TILE_LAYER="http://192.168.10.14:3000/mapTiles/{z}/{x}/{y}.png" NEXT_PUBLIC_ONLINE_TILE_LAYER="http://192.168.10.14:3000/mapTiles/{z}/{x}/{y}.png"

View File

@@ -22,10 +22,20 @@ export const initializeMap = (mapRef, setMap, setOms, setMenuItemAdded, addItems
text: "Station öffnen (Tab)", text: "Station öffnen (Tab)",
icon: "/img/screen_new.png", icon: "/img/screen_new.png",
callback: (e) => { callback: (e) => {
const link = localStorage.getItem("polylineLink");
const clickedElement = e.relatedTarget; const clickedElement = e.relatedTarget;
// Überprüfe, ob der Kontextklick auf eine Polyline oder einen Marker erfolgt ist // Überprüfe, ob der Kontextklick auf eine Polyline oder einen Marker erfolgt ist
if (clickedElement instanceof L.Marker || clickedElement instanceof L.Polyline) { if (link) {
const newTab = window.open(link, "_blank");
if (newTab) {
// Wenn der Tab geöffnet wird, lösche die `localStorage`-Einträge
localStorage.removeItem("polylineLink");
localStorage.removeItem("lastElementType");
} else {
console.error("Fehler: Das neue Tab konnte nicht geöffnet werden.");
}
} else if (clickedElement instanceof L.Marker || clickedElement instanceof L.Polyline) {
openInNewTab(e, clickedElement); // Verwende openInNewTab für beide Fälle openInNewTab(e, clickedElement); // Verwende openInNewTab für beide Fälle
} else { } else {
console.error("Kein gültiges Ziel für den Kontextmenüeintrag"); console.error("Kein gültiges Ziel für den Kontextmenüeintrag");