feat: Konstanten in separate Dateien aufteilen " /config/urls.js"

This commit is contained in:
ISA
2024-07-10 07:38:30 +02:00
parent 6cc3cdc483
commit b82253cae1
3 changed files with 74 additions and 27 deletions

View File

@@ -15,6 +15,7 @@ import "leaflet/dist/leaflet.css";
import "leaflet-contextmenu/dist/leaflet.contextmenu.css";
import "leaflet-contextmenu";
import * as config from "../config/config.js";
import * as urls from "../config/urls.js";
import dynamic from "next/dynamic";
import "leaflet.smooth_marker_bouncing";
import OverlappingMarkerSpiderfier from "overlapping-marker-spiderfier-leaflet";
@@ -137,31 +138,28 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
const [showVersionInfoModal, setShowVersionInfoModal] = useState(false);
const zoomTrigger = useRecoilValue(zoomTriggerState);
const offlineTileLayer = "/mapTiles/{z}/{x}/{y}.png";
//const onlineTileLayer = "/mapTiles/{z}/{x}/{y}.png";
//const onlineTileLayer = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png";
const onlineTileLayer = "http://10.10.0.13:3000/mapTiles/{z}/{x}/{y}.png"; //Talas_v5 Server
//const onlineTileLayer = "http://192.168.10.14:3000/mapTiles/{z}/{x}/{y}.png"; //Talas_v5 Server
const offlineTileLayer = urls.OFFLINE_TILE_LAYER;
const onlineTileLayer = urls.ONLINE_TILE_LAYER; //Talas_v5 Server
// Create map layers
const TALAS = new L.layerGroup();
const ECI = new L.layerGroup();
const ULAF = new L.layerGroup();
const GSMModem = new L.layerGroup();
const CiscoRouter = new L.layerGroup();
const WAGO = new L.layerGroup();
const Siemens = new L.layerGroup();
const OTDR = new L.layerGroup();
const WDM = new L.layerGroup();
const GMA = new L.layerGroup();
const Sonstige = new L.layerGroup();
const TALASICL = new L.layerGroup();
const lineLayer = new L.LayerGroup();
const TALAS = config.MAP_LAYERS.TALAS;
const ECI = config.MAP_LAYERS.ECI;
const ULAF = config.MAP_LAYERS.ULAF;
const GSMModem = config.MAP_LAYERS.GSMModem;
const CiscoRouter = config.MAP_LAYERS.CiscoRouter;
const WAGO = config.MAP_LAYERS.WAGO;
const Siemens = config.MAP_LAYERS.Siemens;
const OTDR = config.MAP_LAYERS.OTDR;
const WDM = config.MAP_LAYERS.WDM;
const GMA = config.MAP_LAYERS.GMA;
const Sonstige = config.MAP_LAYERS.Sonstige;
const TALASICL = config.MAP_LAYERS.TALASICL;
const lineLayer = config.MAP_LAYERS.lineLayer;
const [gisSystemStaticLoaded, setGisSystemStaticLoaded] = useState(false);
const baseUrl = "http://10.10.0.13/talas5/devices/"; // für Station öffnen in neuer tab und gleicher tab, im localhost gab es keine Probleme mit der Frame
//const baseUrl = "http://localhost:3000/talas5/devices/";
//const baseUrl = "http://192.168.10.14/talas5/devices/";
const baseUrl = urls.BASE_URL; // für Station öffnen in neuer tab und gleicher tab, im localhost gab es keine Probleme mit der Frame
const [isPoiTypLoaded, setIsPoiTypLoaded] = useState(false);
const [poiTypMap, setPoiTypMap] = useState(new Map());
const [showPopup, setShowPopup] = useState(false);
@@ -550,18 +548,15 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
//-----------------------------------------------------------
// Funktion um die Benutzerrechte zu überprüfen
// serverIP 10.10.0.13 idMap=10 idUser=485
//const serverURL = "http://10.10.0.13";
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) für GisSystemStatic für die Benutzerrechte
//const serverURL = "http://localhost:3000"; // weil ich keine API habe, ansonsten serverURL ist localhost(IP-Adresse) für GisSystemStatic für die Benutzerrechte
const serverURL = urls.SERVER_URL; // weil ich keine API habe, ansonsten serverURL ist localhost(IP-Adresse) für GisSystemStatic für die Benutzerrechte
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