feat: GIS-Linien von direktem fetch auf Redux umgestellt
- fetchGisLinesService, Thunk und Slice erstellt - MapComponent nutzt dispatch(fetchGisLinesThunk()) - Linien-Daten zentral aus Redux (state.gisLines.data) übernommen - fetch(...) entfernt und durch Redux-Logik ersetzt - Version erhöht auf 1.1.130
This commit is contained in:
18
CHANGELOG.md
18
CHANGELOG.md
@@ -4,6 +4,24 @@ Alle bedeutenden Änderungen an diesem Projekt werden in dieser Datei dokumentie
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## [1.1.130] – 2025-05-21
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- 🔁 GIS-Linien in `MapComponent.js` vollständig von `fetch(...)` auf Redux-Architektur umgestellt
|
||||||
|
- Neuer Service: `fetchGisLinesService.js` für API-Aufruf
|
||||||
|
- Neuer Thunk: `fetchGisLinesThunk.js` unter `/redux/thunks/database/`
|
||||||
|
- Neuer Slice: `gisLinesSlice.js` mit Statusverwaltung (idle/loading/succeeded/failed)
|
||||||
|
- Redux-Selektor `selectGisLines` in `MapComponent.js` genutzt
|
||||||
|
- Direkter `fetch("/api/talas_v5_DB/gisLines/readGisLines")` entfernt und durch `dispatch(fetchGisLinesThunk())` ersetzt
|
||||||
|
- Alle Linien-Daten werden nun zentral über Redux geladen und in `linePositions` umgewandelt
|
||||||
|
|
||||||
|
### Version
|
||||||
|
|
||||||
|
- 📦 Version erhöht auf **1.1.130**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## [1.1.128] – 2025-05-21
|
## [1.1.128] – 2025-05-21
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -87,7 +87,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
const polylineEventsDisabled = useSelector((state) => state.polylineEventsDisabled.disabled);
|
const polylineEventsDisabled = useSelector((state) => state.polylineEventsDisabled.disabled);
|
||||||
const mapLayersVisibility = useSelector(selectMapLayersState) || {};
|
const mapLayersVisibility = useSelector(selectMapLayersState) || {};
|
||||||
const selectedArea = useSelector((state) => state.selectedArea.area);
|
const selectedArea = useSelector((state) => state.selectedArea.area);
|
||||||
const linesData = useSelector(selectGisLines);
|
const linesData = useSelector((state) => state.gisLines.data);
|
||||||
|
const gisLinesStatus = useSelector((state) => state.gisLines.status);
|
||||||
|
|
||||||
//-------------------------------
|
//-------------------------------
|
||||||
const { deviceName, setDeviceName } = useMapComponentState();
|
const { deviceName, setDeviceName } = useMapComponentState();
|
||||||
const [locationDeviceData, setLocationDeviceData] = useState([]);
|
const [locationDeviceData, setLocationDeviceData] = useState([]);
|
||||||
@@ -222,34 +224,22 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const endpoint = "/api/talas_v5_DB/gisLines/readGisLines";
|
if (gisLinesStatus === "idle") {
|
||||||
|
dispatch(fetchGisLinesThunk());
|
||||||
fetch(endpoint)
|
}
|
||||||
.then((response) => response.json())
|
}, [gisLinesStatus, dispatch]);
|
||||||
.then((data) => {
|
//--------------------------------------------------------
|
||||||
if (data.message) {
|
|
||||||
console.warn(data.message);
|
|
||||||
return; // Falls die Tabelle nicht existiert, keine weitere Verarbeitung
|
|
||||||
}
|
|
||||||
|
|
||||||
const newLinePositions = data.map((item) => {
|
|
||||||
if (item.points && Array.isArray(item.points)) {
|
|
||||||
return {
|
|
||||||
coordinates: item.points.map((point) => [point.x, point.y]),
|
|
||||||
idModul: item.idModul,
|
|
||||||
idLD: item.idLD,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
throw new Error("Points missing or not an array");
|
|
||||||
});
|
|
||||||
|
|
||||||
setLinePositions(newLinePositions);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.error("Error fetching data:", error.message);
|
|
||||||
});
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (linesData && Array.isArray(linesData)) {
|
||||||
|
const transformed = linesData.map((item) => ({
|
||||||
|
coordinates: item.points.map((point) => [point.x, point.y]),
|
||||||
|
idModul: item.idModul,
|
||||||
|
idLD: item.idLD,
|
||||||
|
}));
|
||||||
|
setLinePositions(transformed);
|
||||||
|
}
|
||||||
|
}, [linesData]);
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
const [poiData, setPoiData] = useState([]);
|
const [poiData, setPoiData] = useState([]);
|
||||||
// POIs Popup Informationen anzeigen
|
// POIs Popup Informationen anzeigen
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
// /config/appVersion
|
// /config/appVersion
|
||||||
export const APP_VERSION = "1.1.130";
|
export const APP_VERSION = "1.1.131";
|
||||||
|
|||||||
Reference in New Issue
Block a user