diff --git a/.env.local b/.env.local index 290bb00ee..da9516171 100644 --- a/.env.local +++ b/.env.local @@ -14,3 +14,9 @@ NEXT_PUBLIC_DEBUG_LOG=true #auf dem Entwicklungsrechner dev und auf dem Server prod NEXT_PUBLIC_API_PORT_MODE=dev + +# Der Unterordner talas5 gleich hinter der IP-Adresse (oder Servername) muss konfigurierbar sein. +# Es muss auch möglich sein kein Unterorder anzugeben (z.B. nur http://talasserver/). +# Ein Unterordner in der dort hinter liegenden Ordnerstruktur (z.B. http://talasserver/talas5/nodemap/api/talas_v5_DB/ usw.) +# kann bleiben da der Kunde diesen Unterordner talas:v5_db nicht ändert. +NEXT_PUBLIC_BASE_PATH=talas5 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d7cbb1fd..614c73e76 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,27 @@ Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentie --- +## [1.1.108] – 2025-05-20 + +### Removed + +- 🧼 Alte POI-Komponenten gelöscht: + - `AddPoiModalWindowWrapper.js` + - `PoiUpdateModalWrapper.js` + - `PoiUpdateModalWindow.js` +- Ersetzt durch moderne Komponenten mit direkter Redux-Anbindung (`ShowAddStationPopup`, `PoiUpdateModal`) + +### Cleanup + +- MapComponent.js nutzt jetzt ausschließlich `ShowAddStationPopup` für das Hinzufügen von POIs +- Kein indirekter Wrapper oder Popup-Overhead mehr nötig + +### Fixed + +- Verwirrende doppelte Komponentenbenennungen bereinigt + +--- + ## [1.1.104] – 2025-05-19 ### Removed diff --git a/components/AddPOIModal.js b/components/AddPOIModal.js index 237e57865..59a6c5c92 100644 --- a/components/AddPOIModal.js +++ b/components/AddPOIModal.js @@ -18,7 +18,6 @@ const ShowAddStationPopup = ({ onClose, map, latlng }) => { const [latitude] = useState(latlng.lat.toFixed(5)); const [longitude] = useState(latlng.lng.toFixed(5)); - dispatch(setPoiMarkers(data)); const [deviceName, setDeviceName] = useState(""); //----------------------------------------------------- diff --git a/components/mainComponent/MapComponent.js b/components/mainComponent/MapComponent.js index d12da7a91..479542642 100644 --- a/components/mainComponent/MapComponent.js +++ b/components/mainComponent/MapComponent.js @@ -9,7 +9,7 @@ import "leaflet.smooth_marker_bouncing"; import OverlappingMarkerSpiderfier from "overlapping-marker-spiderfier-leaflet"; //sieht deaktiviert aber ist das nicht so und wird benötigt import "react-toastify/dist/ReactToastify.css"; import DataSheet from "../DataSheet.js"; -import AddPoiModalWindow from "../pois/AddPoiModalWindow.js"; + import { InformationCircleIcon } from "@heroicons/react/20/solid"; import PoiUpdateModal from "../pois/PoiUpdateModal.js"; import { ToastContainer, toast } from "react-toastify"; @@ -954,7 +954,6 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { - )} diff --git a/components/pois/AddPoiModalWindow.js b/components/pois/AddPoiModalWindow.js deleted file mode 100644 index 95bea6dc4..000000000 --- a/components/pois/AddPoiModalWindow.js +++ /dev/null @@ -1,218 +0,0 @@ -// components/pois/AddPoiModalWindow.js -import React, { useState, useEffect } from "react"; -import Select from "react-select"; // Importiere react-select - -import { useSelector, useDispatch } from "react-redux"; -import { incrementTrigger } from "../../redux/slices/poiReadFromDbTriggerSlice"; - -const AddPoiModalWindow = ({ onClose, map, latlng }) => { - const [poiTypData, setpoiTypData] = useState([]); - const [name, setName] = useState(""); - const [poiTypeId, setPoiTypeId] = useState(null); // Verwende null für react-select - const [latitude] = useState(latlng.lat.toFixed(5)); - const [longitude] = useState(latlng.lng.toFixed(5)); - const [locationDeviceData, setLocationDeviceData] = useState([]); - const [filteredDevices, setFilteredDevices] = useState([]); // Gefilterte Geräte - const [deviceName, setDeviceName] = useState(null); // Verwende null für react-select - const mapLayersVisibility = useSelector((state) => state.mapLayers.visibility); - const dispatch = useDispatch(); - - // Map von Systemnamen zu ids (wie zuvor) - const systemNameToIdMap = { - TALAS: 1, - ECI: 2, - ULAF: 3, - GSMModem: 5, - CiscoRouter: 6, - WAGO: 7, - Siemens: 8, - OTDR: 9, - WDM: 10, - GMA: 11, - Messdatensammler: 12, - Messstellen: 13, - TALASICL: 100, - DAUZ: 110, - SMSFunkmodem: 111, - Basisgerät: 200, - }; - - // API-Abfrage, um die Geräte zu laden - useEffect(() => { - const fetchInitialData = async () => { - try { - const [poiTypResponse, locationDeviceResponse] = await Promise.all([fetch("/api/talas_v5_DB/poiTyp/readPoiTyp"), fetch("/api/talas5/location_device")]); - - const poiTypData = await poiTypResponse.json(); - setpoiTypData(poiTypData); - - const locationDeviceData = await locationDeviceResponse.json(); - console.log("Geräte von der API:", locationDeviceData); // Geräte-Daten aus der API anzeigen - setLocationDeviceData(locationDeviceData); - - // Filtere die Geräte basierend auf den sichtbaren Systemen - filterDevices(locationDeviceData); - } catch (error) { - console.error("Fehler beim Abrufen der Daten in AddPoiModalWindow.js :", error); - } - }; - - fetchInitialData(); - }, []); - - // Funktion zum Filtern der Geräte basierend auf den aktiven Systemen (Layern) - const filterDevices = (devices) => { - const activeSystems = Object.keys(mapLayersVisibility).filter((system) => mapLayersVisibility[system]); - console.log("Aktive Systeme:", activeSystems); // Anzeigen der aktiven Systeme - - // Mappe aktive Systeme auf ihre ids - const activeSystemIds = activeSystems.map((system) => systemNameToIdMap[system]).filter((id) => id !== undefined); - console.log("Aktive System-IDs:", activeSystemIds); // Anzeigen der aktiven System-IDs - - // Filtere die Geräte nach aktiven Systemen basierend auf idsystem_typ - const filtered = devices.filter((device) => activeSystemIds.includes(device.idsystem_typ)); - console.log("Gefilterte Geräte:", filtered); // Gefilterte Geräte anzeigen - - setFilteredDevices(filtered); // Setze die gefilterten Geräte - }; - - // Wenn mapLayersVisibility sich ändert, filtere die Geräte erneut - useEffect(() => { - if (locationDeviceData.length > 0) { - filterDevices(locationDeviceData); - } - }, [mapLayersVisibility, locationDeviceData]); - - const handleSubmit = async (event) => { - event.preventDefault(); - dispatch(incrementTrigger()); - - if (!poiTypeId) { - alert("Bitte wählen Sie einen Typ aus."); - return; - } - - const formData = { - name, - poiTypeId: poiTypeId.value, - latitude, - longitude, - idLD: filteredDevices.find((device) => device.name === deviceName?.value).idLD, - }; - - const response = await fetch("/api/talas_v5_DB/pois/addLocation", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(formData), - }); - - if (response.ok) { - dispatch(incrementTrigger()); // Redux Trigger erhöhen - onClose(); - window.location.reload(); - } else { - console.error("Fehler beim Hinzufügen des POI"); - } - - if (map && typeof map.closePopup === "function") { - map.closePopup(); - } - }; - - // Erstelle Optionen für react-select - const poiTypeOptions = poiTypData.map((poiTyp) => ({ - value: poiTyp.idPoiTyp, - label: poiTyp.name, - })); - - const deviceOptions = filteredDevices.map((device) => ({ - value: device.name, - label: device.name, - })); - - // Custom styles for react-select - const customStyles = { - control: (provided) => ({ - ...provided, - width: "100%", - minWidth: "300px", // Minimum width for the dropdown - maxWidth: "100%", // Maximum width (you can adjust this if needed) - }), - menu: (provided) => ({ - ...provided, - width: "100%", - minWidth: "300px", // Ensure the dropdown menu stays at the minimum width - }), - }; - - // Style für größere Breite des Modals und für Inputs - const modalStyles = { - // width: "300px", // größere Breite für das Modal - //maxWidth: "100%", // responsive, passt sich an - //padding: "20px", // Polsterung für das Modal - //backgroundColor: "white", // Hintergrundfarbe - //borderRadius: "8px", // Abgerundete Ecken - //boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)", // Schatten für das Modal - }; - - return ( -
-
- - setName(e.target.value)} className="block p-2 w-full border-2 border-gray-200 rounded-md text-sm" /> -
- - {/* React Select for Devices */} -
- - -
- -
-
- -
-
- -
-
- - -
- ); -}; - -export default AddPoiModalWindow; diff --git a/components/pois/AddPoiModalWindowPopup.js b/components/pois/AddPoiModalWindowPopup.js deleted file mode 100644 index f535a5c33..000000000 --- a/components/pois/AddPoiModalWindowPopup.js +++ /dev/null @@ -1,24 +0,0 @@ -// components/pois/AddPoiModalWindowPopup.js -import React from "react"; -import AddPoiModalWindow from "./AddPoiModalWindow.js"; - -const AddPoiModalWindowPopup = ({ showPopup, closePopup, handleAddStation, popupCoordinates }) => { - return ( - <> - {showPopup && ( -
-
e.stopPropagation()}> - - -
-
- )} - - ); -}; - -export default AddPoiModalWindowPopup; diff --git a/components/pois/AddPoiModalWindowWrapper.js b/components/pois/AddPoiModalWindowWrapper.js deleted file mode 100644 index 1ac3402bd..000000000 --- a/components/pois/AddPoiModalWindowWrapper.js +++ /dev/null @@ -1,30 +0,0 @@ -// components/pois/AddPoiModalWindowWrapper.js -import React from "react"; -import AddPoiModalWindow from "./AddPoiModalWindow"; - -const AddPoiModalWindowWrapper = ({ show, onClose, latlng, handleAddStation }) => { - return ( - show && ( -
-
e.stopPropagation()} - role="dialog" // Hinzugefügt, um das Dialog-Element zu identifizieren - > - - -
-
- ) - ); -}; - -export default AddPoiModalWindowWrapper; diff --git a/components/pois/PoiUpdateModalWindow.js b/components/pois/PoiUpdateModalWindow.js deleted file mode 100644 index 9badee70a..000000000 --- a/components/pois/PoiUpdateModalWindow.js +++ /dev/null @@ -1,9 +0,0 @@ -// components/pois/PoiUpdateModalWindow.js -import React from "react"; -import PoiUpdateModal from "./PoiUpdateModal.js"; - -const PoiUpdateModalWindow = ({ showPoiUpdateModal, closePoiUpdateModal, currentPoiData, popupCoordinates }) => { - return <>{showPoiUpdateModal && {}} latlng={popupCoordinates} />}; -}; - -export default PoiUpdateModalWindow; diff --git a/components/pois/PoiUpdateModalWrapper.js b/components/pois/PoiUpdateModalWrapper.js deleted file mode 100644 index 7a2273b6e..000000000 --- a/components/pois/PoiUpdateModalWrapper.js +++ /dev/null @@ -1,17 +0,0 @@ -// components/pois/PoiUpdateModalWrapper.js -import { useDispatch } from "react-redux"; -import { setCurrentPoi } from "../../redux/slices/currentPoiSlice"; - -const PoiUpdateModalWrapper = ({ show, onClose, latlng, poiData }) => { - const dispatch = useDispatch(); - - useEffect(() => { - if (show && poiData) { - dispatch(setCurrentPoi(poiData)); - } - }, [show, poiData, dispatch]); - - const currentPoi = useSelector(selectCurrentPoi); // Direkt aus Redux holen - - return show && {}} latlng={latlng} />; -}; diff --git a/config/appVersion.js b/config/appVersion.js index d75f1468e..9af96ceae 100644 --- a/config/appVersion.js +++ b/config/appVersion.js @@ -1,2 +1,2 @@ // /config/appVersion -export const APP_VERSION = "1.1.107"; +export const APP_VERSION = "1.1.109"; diff --git a/config/config.js b/config/config.js index 8ab06cca1..a07208e9f 100644 --- a/config/config.js +++ b/config/config.js @@ -1,5 +1,6 @@ // Datei: /config/config.js import * as urls from "../config/urls.js"; +import { BASE_URL } from "../config/paths"; // Definieren der grundlegenden Umgebungseinstellungen und Konfigurationen der Karte const mapVersion = "0.5.3"; @@ -48,12 +49,19 @@ if (typeof window !== "undefined") { console.log("📡 Mock-Mode aktiv: Daten werden aus /api/mockData/webService geladen."); } else { // Echte URLs zur Webservice-API - mapGisStationsStaticDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`; - mapGisStationsStatusDistrictUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`; - mapGisStationsMeasurementsUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisStationsMeasurements?idMap=${idMap}`; - mapGisSystemStaticUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`; - mapDataIconUrl = `${serverURL}/talas5/ClientData/WebserviceMap.asmx/GetIconsStatic`; - webserviceGisLinesStatusUrl = `${serverURL}/talas5/ClientData/WebServiceMap.asmx/GisLinesStatus?idMap=${idMap}`; + + mapGisStationsStaticDistrictUrl = `${serverURL}${BASE_URL}/ClientData/WebserviceMap.asmx/GisStationsStaticDistrict?idMap=${idMap}&idUser=${idUser}`; + + mapGisStationsStatusDistrictUrl = `${serverURL}${BASE_URL}/ClientData/WebserviceMap.asmx/GisStationsStatusDistrict?idMap=${idMap}&idUser=${idUser}`; + + mapGisStationsMeasurementsUrl = `${serverURL}${BASE_URL}/ClientData/WebserviceMap.asmx/GisStationsMeasurements?idMap=${idMap}`; + + mapGisSystemStaticUrl = `${serverURL}${BASE_URL}/ClientData/WebserviceMap.asmx/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`; + + mapDataIconUrl = `${serverURL}${BASE_URL}/ClientData/WebserviceMap.asmx/GetIconsStatic`; + + webserviceGisLinesStatusUrl = `${serverURL}${BASE_URL}/ClientData/WebServiceMap.asmx/GisLinesStatus?idMap=${idMap}`; + console.log("🌐 Echt-Mode aktiv: Daten werden von der API geholt."); } } diff --git a/config/paths.js b/config/paths.js new file mode 100644 index 000000000..31b2ab0da --- /dev/null +++ b/config/paths.js @@ -0,0 +1,4 @@ +// config/paths.js +const basePathRaw = process.env.NEXT_PUBLIC_BASE_PATH || ""; +const BASE_PATH = basePathRaw.replace(/^\/|\/$/g, ""); +export const BASE_URL = BASE_PATH ? `/${BASE_PATH}` : ""; diff --git a/public/Web.config.13 b/public/Web.config.13 deleted file mode 100644 index 6e9b0f62c..000000000 --- a/public/Web.config.13 +++ /dev/null @@ -1,152 +0,0 @@ - - - - -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/public/Web.config.30 b/public/Web.config.30 deleted file mode 100644 index 543d70382..000000000 --- a/public/Web.config.30 +++ /dev/null @@ -1,140 +0,0 @@ - - - - -
-
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "/> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file