WIP: POI->contextmenu ->POI bearbeiten ->Gerät: Dropdown
This commit is contained in:
@@ -7,10 +7,10 @@ DB_NAME=talas_v5
|
||||
DB_PORT=3306
|
||||
|
||||
# Public Settings (Client braucht IP/Domain)
|
||||
NEXT_PUBLIC_SERVER_URL="http://10.10.0.70" # oder evtl. später https://nodemap.firma.de
|
||||
NEXT_PUBLIC_SERVER_URL="http://192.168.10.33" # oder evtl. später https://nodemap.firma.de
|
||||
NEXT_PUBLIC_ENABLE_GEOCODER=true
|
||||
NEXT_PUBLIC_USE_MOCK_API=true
|
||||
NEXT_PUBLIC_DEBUG_LOG=true
|
||||
|
||||
# für Polylines/kabelstecken -> in Konextmenü "Station öffnen" "
|
||||
NEXT_PUBLIC_BASE_URL=http://10.10.0.70/talas5/devices/
|
||||
NEXT_PUBLIC_BASE_URL=http://192.168.10.33/talas5/devices/
|
||||
@@ -1,8 +1,8 @@
|
||||
// /componentss/DataSheet.js
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { useRecoilState, useRecoilValue, useSetRecoilState } from "recoil";
|
||||
import { gisStationsStaticDistrictState } from "../redux/slices/gisStationsStaticDistrictSlice";
|
||||
import { gisSystemStaticState } from "../redux/slices/gisSystemStaticSlice";
|
||||
import { gisStationsStaticDistrictState } from "../redux/slices/webService/gisStationsStaticDistrictSlice";
|
||||
import { gisSystemStaticState } from "../redux/slices/webService/gisSystemStaticSlice.js";
|
||||
import { mapLayersState } from "../redux/slices/mapLayersSlice";
|
||||
import { selectedAreaState } from "../redux/slices/selectedAreaSlice";
|
||||
import { zoomTriggerState } from "../redux/slices/zoomTriggerSlice.js";
|
||||
@@ -10,7 +10,7 @@ import { poiLayerVisibleState } from "../redux/slices/poiLayerVisibleSlice";
|
||||
import EditModeToggle from "./EditModeToggle";
|
||||
import { polylineLayerVisibleState } from "../redux/slices/polylineLayerVisibleSlice"; // Import für Polyline-Visibility
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { selectGisStationsStaticDistrict } from "../redux/slices/gisStationsStaticDistrictSlice";
|
||||
import { selectGisStationsStaticDistrict } from "../redux/slices/webService/gisStationsStaticDistrictSlice";
|
||||
import { selectPolylineVisible, setPolylineVisible } from "../redux/slices/polylineLayerVisibleSlice";
|
||||
|
||||
function DataSheet() {
|
||||
|
||||
@@ -40,13 +40,13 @@ import { updateLocation } from "../utils/updateBereichUtil";
|
||||
import { initGeocoderFeature } from "../components/features/GeocoderFeature";
|
||||
//--------------------------------------------
|
||||
//import { currentPoiState } from "../redux/slices/currentPoiSlice.js";
|
||||
import { selectGisStationsStaticDistrict, setGisStationsStaticDistrict } from "../redux/slices/gisStationsStaticDistrictSlice";
|
||||
import { selectGisStationsStaticDistrict, setGisStationsStaticDistrict } from "../redux/slices/webService/gisStationsStaticDistrictSlice";
|
||||
import { mapIdState, userIdState } from "../redux/slices/urlParameterSlice.js";
|
||||
import { poiLayerVisibleState } from "../redux/slices/poiLayerVisibleSlice.js";
|
||||
import { selectedPoiState } from "../redux/slices/selectedPoiSlice.js";
|
||||
import { poiReadFromDbTriggerAtom } from "../redux/slices/poiReadFromDbTriggerSlice";
|
||||
import { gisStationsStaticDistrictState } from "../redux/slices/gisStationsStaticDistrictSlice";
|
||||
import { gisSystemStaticState } from "../redux/slices/gisSystemStaticSlice";
|
||||
import { gisStationsStaticDistrictState } from "../redux/slices/webService/gisStationsStaticDistrictSlice";
|
||||
import { gisSystemStaticState } from "../redux/slices/webService/gisSystemStaticSlice";
|
||||
import { mapLayersState } from "../redux/slices/mapLayersSlice";
|
||||
import { selectedAreaState } from "../redux/slices/selectedAreaSlice";
|
||||
import { zoomTriggerState } from "../redux/slices/zoomTriggerSlice.js";
|
||||
|
||||
@@ -5,9 +5,11 @@ import { useRecoilState } from "recoil";
|
||||
import { selectedPoiState } from "../../redux/slices/selectedPoiSlice";
|
||||
import { currentPoiState } from "../../redux/slices/currentPoiSlice";
|
||||
import { mapLayersState } from "../../redux/slices/mapLayersSlice";
|
||||
import { useSelector } from "react-redux";
|
||||
import { selectCurrentPoi } from "../../redux/slices/currentPoiSlice";
|
||||
|
||||
const PoiUpdateModal = ({ onClose, poiData, onSubmit }) => {
|
||||
const currentPoi = useRecoilState(currentPoiState);
|
||||
const currentPoi = useSelector(selectCurrentPoi);
|
||||
const selectedPoi = useRecoilState(selectedPoiState);
|
||||
const [mapLayersVisibility] = useRecoilState(mapLayersState);
|
||||
|
||||
@@ -168,10 +170,12 @@ const PoiUpdateModal = ({ onClose, poiData, onSubmit }) => {
|
||||
};
|
||||
|
||||
// Erstelle Optionen für react-select
|
||||
const poiTypeOptions = poiTypData.map((poiTyp) => ({
|
||||
value: poiTyp.idPoiTyp,
|
||||
label: poiTyp.name,
|
||||
}));
|
||||
const poiTypeOptions = Array.isArray(poiTypData)
|
||||
? poiTypData.map((poiTyp) => ({
|
||||
value: poiTyp.idPoiTyp,
|
||||
label: poiTyp.name,
|
||||
}))
|
||||
: []; // Falls kein Array, dann leeres Array zurückgeben
|
||||
|
||||
const deviceOptions = filteredDevices.map((device) => ({
|
||||
value: device.name,
|
||||
|
||||
@@ -1,26 +1,17 @@
|
||||
// components/pois/PoiUpdateModalWrapper.js
|
||||
import React, { useState } from "react";
|
||||
import PoiUpdateModal from "./PoiUpdateModal";
|
||||
import { useRecoilValue, useSetRecoilState } from "recoil";
|
||||
import { currentPoiState, selectedPoiState } from "../../redux/slices/currentPoiSlice";
|
||||
import { poiReadFromDbTriggerAtom } from "../../redux/slices/poiReadFromDbTriggerSlice";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { setCurrentPoi } from "../../redux/slices/currentPoiSlice";
|
||||
|
||||
const PoiUpdateModalWrapper = ({ show, onClose, latlng }) => {
|
||||
const setSelectedPoi = useSetRecoilState(selectedPoiState);
|
||||
const setCurrentPoi = useSetRecoilState(currentPoiState);
|
||||
const currentPoi = useRecoilValue(currentPoiState);
|
||||
const poiReadTrigger = useRecoilValue(poiReadFromDbTriggerAtom);
|
||||
const PoiUpdateModalWrapper = ({ show, onClose, latlng, poiData }) => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
return (
|
||||
show && (
|
||||
<PoiUpdateModal
|
||||
onClose={onClose}
|
||||
poiData={currentPoi}
|
||||
onSubmit={() => {}} // Add your submit logic here
|
||||
latlng={latlng}
|
||||
/>
|
||||
)
|
||||
);
|
||||
useEffect(() => {
|
||||
if (show && poiData) {
|
||||
dispatch(setCurrentPoi(poiData));
|
||||
}
|
||||
}, [show, poiData, dispatch]);
|
||||
|
||||
const currentPoi = useSelector(selectCurrentPoi); // Direkt aus Redux holen
|
||||
|
||||
return show && <PoiUpdateModal onClose={onClose} poiData={currentPoi} onSubmit={() => {}} latlng={latlng} />;
|
||||
};
|
||||
|
||||
export default PoiUpdateModalWrapper;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
// /config/appVersion
|
||||
export const APP_VERSION = "1.1.21";
|
||||
export const APP_VERSION = "1.1.22";
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// hooks/useMapComponentState.js
|
||||
// POI -> Kontextmenü -> POI bearbeiten -> Dropdown Geräteauswahl
|
||||
import { useState, useEffect } from "react";
|
||||
import usePoiTypData from "./usePoiTypData";
|
||||
import { useRecoilValue } from "recoil";
|
||||
import { poiLayerVisibleState } from "../redux/slices/poiLayerVisibleSlice";
|
||||
import { isMockMode } from "../config/config";
|
||||
|
||||
export const useMapComponentState = () => {
|
||||
const { poiTypData, isPoiTypLoaded } = usePoiTypData("/api/talas_v5_DB/poiTyp/readPoiTyp");
|
||||
const [poiTypData, setPoiTypData] = useState([]);
|
||||
const [isPoiTypLoaded, setIsPoiTypLoaded] = useState(false);
|
||||
const [deviceName, setDeviceName] = useState("");
|
||||
const [locationDeviceData, setLocationDeviceData] = useState([]);
|
||||
const [priorityConfig, setPriorityConfig] = useState([]);
|
||||
@@ -14,11 +15,52 @@ export const useMapComponentState = () => {
|
||||
const poiLayerVisible = useRecoilValue(poiLayerVisibleState);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchPoiTypData = async () => {
|
||||
if (isMockMode()) {
|
||||
console.log("⚠️ Mock-API: POI Typen geladen (Mock)");
|
||||
|
||||
const mockData = [
|
||||
{ idPoiTyp: 1, name: "Mock Zähleranschlusskasten", icon: 4, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 2, name: "Mock Geräteschrank", icon: 2, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 4, name: "Mock Parkplatz", icon: 3, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 6, name: "Mock Zufahrt", icon: 4, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 20, name: "Mock Zählgerät", icon: 5, onlySystemTyp: 110 },
|
||||
{ idPoiTyp: 21, name: "Mock Messschleife", icon: 6, onlySystemTyp: 110 },
|
||||
{ idPoiTyp: 25, name: "Mock Sonstige", icon: 0, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 33, name: "Mock Autobahnauffahrt", icon: 4, onlySystemTyp: null },
|
||||
];
|
||||
|
||||
setPoiTypData(mockData);
|
||||
setIsPoiTypLoaded(true);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch("/api/talas_v5_DB/poiTyp/readPoiTyp");
|
||||
const data = await response.json();
|
||||
setPoiTypData(data);
|
||||
setIsPoiTypLoaded(true);
|
||||
} catch (error) {
|
||||
console.error("❌ Fehler beim Abrufen der POI-Typen:", error);
|
||||
setPoiTypData([]);
|
||||
setIsPoiTypLoaded(true);
|
||||
}
|
||||
};
|
||||
|
||||
const fetchDeviceData = async () => {
|
||||
if (isMockMode()) {
|
||||
console.log("⚠️ Mock-API: Gerätedaten geladen");
|
||||
console.log("⚠️ Mock-API: Geräte für POI -> Kontextmenü -> POI bearbeiten -> Dropdown Geräteauswahl geladen (Mock)");
|
||||
|
||||
const mockData = [{ name: "Mock-Gerät 1" }, { name: "Mock-Gerät 2" }];
|
||||
const mockData = [
|
||||
{ idPoiTyp: 1, name: "Mock Zähleranschlusskasten", icon: 4, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 2, name: "Mock Geräteschrank", icon: 2, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 4, name: "Mock Parkplatz", icon: 3, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 6, name: "Mock Zufahrt", icon: 4, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 20, name: "Mock Zählgerät", icon: 5, onlySystemTyp: 110 },
|
||||
{ idPoiTyp: 21, name: "Mock Messschleife", icon: 6, onlySystemTyp: 110 },
|
||||
{ idPoiTyp: 25, name: "Mock Sonstige", icon: 0, onlySystemTyp: 0 },
|
||||
{ idPoiTyp: 33, name: "Mock Autobahnauffahrt", icon: 4, onlySystemTyp: null },
|
||||
];
|
||||
setLocationDeviceData(mockData);
|
||||
setDeviceName(mockData[0].name);
|
||||
return;
|
||||
@@ -37,6 +79,7 @@ export const useMapComponentState = () => {
|
||||
}
|
||||
};
|
||||
|
||||
fetchPoiTypData();
|
||||
fetchDeviceData();
|
||||
}, []);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// /redux/slices/gisStationsStaticDistrictSlice.js
|
||||
// /redux/slices/webService/gisStationsStaticDistrictSlice.js
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
const initialState = [];
|
||||
@@ -1,4 +1,4 @@
|
||||
// /redux/slices/gisSystemStaticSlice.js
|
||||
// /redux/slices/webService/gisSystemStaticSlice.js
|
||||
import { atom } from "recoil";
|
||||
|
||||
export const gisSystemStaticState = atom({
|
||||
@@ -1,7 +1,7 @@
|
||||
import { configureStore } from "@reduxjs/toolkit";
|
||||
import lineVisibilityReducer from "./slices/lineVisibilitySlice";
|
||||
import currentPoiReducer from "./slices/currentPoiSlice";
|
||||
import gisStationsStaticDistrictReducer from "./slices/gisStationsStaticDistrictSlice";
|
||||
import gisStationsStaticDistrictReducer from "./slices/webService/gisStationsStaticDistrictSlice";
|
||||
import polylineLayerVisibleReducer from "./slices/polylineLayerVisibleSlice";
|
||||
|
||||
export const store = configureStore({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { setGisStationsStaticDistrict } from "../../redux/slices/gisStationsStaticDistrictSlice";
|
||||
import { setGisStationsStaticDistrict } from "../../redux/slices/webService/gisStationsStaticDistrictSlice";
|
||||
|
||||
export const fetchGisStationsStaticDistrict = async (url, dispatch, fetchOptions) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user