docs: vollständige Redux-Slices und Webservice-APIs dokumentiert (v1.1.100)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# 📈 gisStationsMeasurementsSlice
|
||||
|
||||
Verwaltet Messdaten für GIS-Stationen, z. B. Spannungen, Strom, Sensorwerte etc.
|
||||
|
||||
## 🔧 Pfad
|
||||
`/redux/slices/webService/gisStationsMeasurementsSlice.js`
|
||||
|
||||
## 📦 Initial State
|
||||
|
||||
```ts
|
||||
{
|
||||
data: [],
|
||||
status: "idle",
|
||||
error: null
|
||||
}
|
||||
```
|
||||
|
||||
## 🔁 Thunk: `fetchGisStationsMeasurementsFromWebService`
|
||||
|
||||
Verwendet `fetchGisStationsMeasurements()` als API-Quelle.
|
||||
|
||||
## 📊 Selector
|
||||
|
||||
```ts
|
||||
selectGisStationsMeasurements = (state) => state.gisStationsMeasurements.data;
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
# 🏙️ gisStationsStaticDistrictSlice
|
||||
|
||||
Verwaltet statische Daten für GIS-Bezirksstationen.
|
||||
|
||||
## 🔧 Pfad
|
||||
`/redux/slices/webService/gisStationsStaticDistrictSlice.js`
|
||||
|
||||
## 📦 Initial State
|
||||
|
||||
```ts
|
||||
{
|
||||
data: [],
|
||||
status: "idle",
|
||||
error: null
|
||||
}
|
||||
```
|
||||
|
||||
## 🔁 Thunk: `fetchGisStationsStaticDistrictFromWebService`
|
||||
@@ -1,92 +1,26 @@
|
||||
# Redux Slice Dokumentation: `gisStationsStaticSlice.js`
|
||||
# 🛰️ gisStationsStaticSlice
|
||||
|
||||
## Zweck
|
||||
Dieses Slice verwaltet die Daten für **GisStationsStatic**, welche statische Standorte (z. B. Bereiche oder Stationen) für die Kartenanwendung darstellen. Diese Daten werden im `DataSheet.js` Dropdown-Menü verwendet, um auswählbare Stationen darzustellen.
|
||||
Verwaltet statische Informationen zu GIS-Stationen – z. B. für das Dropdown im DataSheet-Bereich.
|
||||
|
||||
---
|
||||
## 🔧 Pfad
|
||||
`/redux/slices/webService/gisStationsStaticSlice.js`
|
||||
|
||||
## Speicherort
|
||||
```
|
||||
/redux/slices/webService/gisStationsStaticSlice.js
|
||||
```
|
||||
## 📦 Initial State
|
||||
|
||||
---
|
||||
|
||||
## Zustandsstruktur (`initialState`)
|
||||
```js
|
||||
```ts
|
||||
{
|
||||
data: null, // enthält die API-Datenstruktur (z. B. { Points: [...] })
|
||||
status: "idle", // "idle" | "loading" | "succeeded" | "failed"
|
||||
error: null // Fehlernachricht bei einem API-Fehler
|
||||
data: null,
|
||||
status: "idle",
|
||||
error: null
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
## 🔁 Thunk: `fetchGisStationsStatic`
|
||||
|
||||
## Enthaltene Funktionen
|
||||
Lädt Daten über dynamisch erzeugte URL (`idMap` aus `window.location.search`).
|
||||
|
||||
### 1. `fetchGisStationsStatic`
|
||||
Ein `createAsyncThunk`, der die GIS-Daten vom Webservice lädt.
|
||||
## 🧪 Logging
|
||||
|
||||
```js
|
||||
export const fetchGisStationsStatic = createAsyncThunk(
|
||||
"gisStationsStatic/fetchGisStationsStatic",
|
||||
async (_, { rejectWithValue }) => { ... }
|
||||
);
|
||||
```
|
||||
|
||||
- Die URL wird dynamisch aus `window.location.protocol`, `window.location.hostname` und Port 80 zusammengesetzt.
|
||||
- `idMap` wird aus der aktuellen URL gelesen (`?m=...`).
|
||||
- Es wird erwartet, dass der Webservice JSON im Format `{ Points: [...] }` zurückliefert.
|
||||
|
||||
### 2. `gisStationsStaticSlice`
|
||||
Das eigentliche Redux-Slice mit `createSlice`:
|
||||
|
||||
- Behandelt `pending`, `fulfilled`, `rejected` für `fetchGisStationsStatic`
|
||||
- Speichert den Ladezustand und die API-Antwort
|
||||
|
||||
### 3. `selectGisStationsStatic`
|
||||
Selector zum Zugriff auf `state.gisStationsStatic.data`.
|
||||
|
||||
```js
|
||||
export const selectGisStationsStatic = (state) => state.gisStationsStatic.data;
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## API-Endpunkt
|
||||
Der folgende Endpunkt wird aufgerufen:
|
||||
|
||||
```
|
||||
http://<hostname>:80/talas5/ClientData/WebServiceMap.asmx/GisStationsStatic?idMap=<id>
|
||||
```
|
||||
|
||||
Dabei wird `idMap` dynamisch aus der aktuellen Browser-URL geholt.
|
||||
|
||||
---
|
||||
|
||||
## Verwendungsbeispiel
|
||||
Wird z. B. in `DataSheet.js` verwendet, um die Dropdown-Auswahl zu befüllen:
|
||||
|
||||
```js
|
||||
const GisStationsStatic = useSelector(selectGisStationsStatic) || [];
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Besonderheiten
|
||||
- Der API-Port ist **hart auf 80 gesetzt**, da der Webservice sowohl in Dev- als auch Prod-Umgebung darüber erreichbar ist.
|
||||
- Eine Browser-basierte URL-Analyse (`window.location`) bestimmt dynamisch den Host.
|
||||
- Fehler werden über `rejectWithValue` zurückgegeben und im Slice gespeichert.
|
||||
|
||||
---
|
||||
|
||||
## Verknüpfte Komponenten
|
||||
- `DataSheet.js`
|
||||
- `useMapComponentState.js`
|
||||
- Webservice: `WebServiceMap.asmx`
|
||||
|
||||
---
|
||||
|
||||
## Ziel für Dokumentation
|
||||
Empfohlener Pfad: `/docs/gisStationsStaticSlice.md`
|
||||
```ts
|
||||
console.log("📡 API Request URL in redux slice:", url);
|
||||
```
|
||||
@@ -0,0 +1,18 @@
|
||||
# 📶 gisStationsStatusDistrictSlice
|
||||
|
||||
Verwaltet Statusinformationen für GIS-Bezirksstationen (z. B. online/offline, Fehlerstatus).
|
||||
|
||||
## 🔧 Pfad
|
||||
`/redux/slices/webService/gisStationsStatusDistrictSlice.js`
|
||||
|
||||
## 📦 Initial State
|
||||
|
||||
```ts
|
||||
{
|
||||
data: [],
|
||||
status: "idle",
|
||||
error: null
|
||||
}
|
||||
```
|
||||
|
||||
## 🔁 Thunk: `fetchGisStationsStatusDistrictFromWebService`
|
||||
@@ -0,0 +1,25 @@
|
||||
# 🧭 gisSystemStaticSlice
|
||||
|
||||
Verwaltet statische GIS-Systemdaten (`Systems[]`), die vom Server zurückgegeben werden.
|
||||
|
||||
## 🔧 Pfad
|
||||
`/redux/slices/webService/gisSystemStaticSlice.js`
|
||||
|
||||
## 📦 Initial State
|
||||
|
||||
```ts
|
||||
{
|
||||
data: [], // enthält Systems[]
|
||||
status: "idle", // Ladezustand
|
||||
error: null
|
||||
}
|
||||
```
|
||||
|
||||
## 🔁 Thunk: `fetchGisSystemStaticFromWebService`
|
||||
|
||||
Ruft `fetchGisSystemStatic()` auf und speichert nur das Feld `Systems` im Redux-State.
|
||||
|
||||
## 🧩 Aktionen
|
||||
|
||||
- `setGisSystemStatic(data)` → manuelles Setzen von `Systems[]`
|
||||
- `fulfilled` → speichert Systems[]
|
||||
Reference in New Issue
Block a user