chore: fetch to get in redux thunks files name
This commit is contained in:
@@ -6,5 +6,5 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
|
|||||||
NEXT_PUBLIC_EXPORT_STATIC=false
|
NEXT_PUBLIC_EXPORT_STATIC=false
|
||||||
NEXT_PUBLIC_USE_CGI=false
|
NEXT_PUBLIC_USE_CGI=false
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.6.437
|
NEXT_PUBLIC_APP_VERSION=1.6.438
|
||||||
NEXT_PUBLIC_CPL_MODE=jsmock # json (Entwicklungsumgebung) oder jsmock (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)
|
NEXT_PUBLIC_CPL_MODE=jsmock # json (Entwicklungsumgebung) oder jsmock (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)
|
||||||
@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
|
|||||||
NEXT_PUBLIC_EXPORT_STATIC=true
|
NEXT_PUBLIC_EXPORT_STATIC=true
|
||||||
NEXT_PUBLIC_USE_CGI=true
|
NEXT_PUBLIC_USE_CGI=true
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.6.437
|
NEXT_PUBLIC_APP_VERSION=1.6.438
|
||||||
NEXT_PUBLIC_CPL_MODE=production
|
NEXT_PUBLIC_CPL_MODE=production
|
||||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,38 +1,50 @@
|
|||||||
|
## [1.6.438] – 2025-06-21
|
||||||
|
|
||||||
|
- chore(tsconfig): fix moduleResolution and path aliases for Next.js project
|
||||||
|
|
||||||
|
---
|
||||||
## [1.6.437] – 2025-06-21
|
## [1.6.437] – 2025-06-21
|
||||||
|
|
||||||
- chore: rename service/thunk files to follow get/fetch naming convention
|
- chore: rename service/thunk files to follow get/fetch naming convention
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## [1.6.436] – 2025-06-20
|
## [1.6.436] – 2025-06-20
|
||||||
|
|
||||||
- Mocks erstellt für API für Entwicklungsumgebung
|
- Mocks erstellt für API für Entwicklungsumgebung
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## [1.6.435] – 2025-06-20
|
## [1.6.435] – 2025-06-20
|
||||||
|
|
||||||
- auto CHANGELOG.md
|
- auto CHANGELOG.md
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## [1.6.434] – 2025-06-20
|
## [1.6.434] – 2025-06-20
|
||||||
|
|
||||||
- pre-commit
|
- pre-commit
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## [1.6.433] – 2025-06-20
|
## [1.6.433] – 2025-06-20
|
||||||
|
|
||||||
- CHANGELOG auto
|
- CHANGELOG auto
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## [1.6.432] – 2025-06-20
|
## [1.6.432] – 2025-06-20
|
||||||
|
|
||||||
- feat: Statusanzeige für Eingänge implementiert
|
- feat: Statusanzeige für Eingänge implementiert
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## [1.6.431] – 2025-06-20
|
## [1.6.431] – 2025-06-20
|
||||||
|
|
||||||
- feat: Digitale & analoge Eingänge in allen Modi (json/jsmock/production) vollständig implementiert
|
- feat: Digitale & analoge Eingänge in allen Modi (json/jsmock/production) vollständig implementiert
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# 📦 CHANGELOG – CPLv4.0
|
# 📦 CHANGELOG – CPLv4.0
|
||||||
|
|
||||||
Alle Änderungen und Versionen des CPLv4.0 Frontends chronologisch dokumentiert.
|
Alle Änderungen und Versionen des CPLv4.0 Frontends chronologisch dokumentiert.
|
||||||
@@ -145,7 +157,7 @@ Scahlter für Ein/Aus muss noch im Backend programmiert werden
|
|||||||
|
|
||||||
- In `_app.tsx` wurde ein zentrales Redux-Update-System implementiert:
|
- In `_app.tsx` wurde ein zentrales Redux-Update-System implementiert:
|
||||||
- Die aktuelle Seite wird automatisch erkannt (`window.location.pathname`)
|
- Die aktuelle Seite wird automatisch erkannt (`window.location.pathname`)
|
||||||
- Abhängig von der Seite werden die passenden Thunks geladen (z. B. `fetchKueDataThunk`, `fetchDigitalOutputsThunk` usw.)
|
- Abhängig von der Seite werden die passenden Thunks geladen (z. B. `getKueDataThunk`, `getDigitalOutputsThunk` usw.)
|
||||||
- Die Daten werden alle 10 Sekunden erneut geladen
|
- Die Daten werden alle 10 Sekunden erneut geladen
|
||||||
- Dadurch muss auf den Unterseiten kein separater Redux-Aufruf mehr erfolgen
|
- Dadurch muss auf den Unterseiten kein separater Redux-Aufruf mehr erfolgen
|
||||||
- Unterstützt alle Slices: digitale/analoge Ein- und Ausgänge, Meldungen, Systemstatus, Einstellungen, TDR/Loop-Daten
|
- Unterstützt alle Slices: digitale/analoge Ein- und Ausgänge, Meldungen, Systemstatus, Einstellungen, TDR/Loop-Daten
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -298,22 +298,22 @@ npm run build
|
|||||||
|
|
||||||
| Thunk Name | Zweck |
|
| Thunk Name | Zweck |
|
||||||
| :-------------------------------------- | :-------------------------------------- |
|
| :-------------------------------------- | :-------------------------------------- |
|
||||||
| `fetchSystemVoltTempThunk` | Lade Systemspannungen und Temperaturen |
|
| `getSystemVoltTempThunk` | Lade Systemspannungen und Temperaturen |
|
||||||
| `fetchDigitalOutputsThunk` | Lade Status der digitalen Ausgänge |
|
| `getDigitalOutputsThunk` | Lade Status der digitalen Ausgänge |
|
||||||
| `fetchDigitalInputsThunk` | Lade Status der digitalen Eingänge |
|
| `getDigitalInputsThunk` | Lade Status der digitalen Eingänge |
|
||||||
| `fetchAnalogeEingaengeThunk` | Lade analoge Eingänge |
|
| `fetchAnalogeEingaengeThunk` | Lade analoge Eingänge |
|
||||||
| `fetchTDRChartDataThunk` | Lade TDR-Messkurve für einen Slot |
|
| `fetchTDRChartDataThunk` | Lade TDR-Messkurve für einen Slot |
|
||||||
| `fetchTDRReferenceChartThunk` | Lade TDR-Referenzkurve |
|
| `fetchTDRReferenceChartThunk` | Lade TDR-Referenzkurve |
|
||||||
| `fetchLoopChartDataThunk` | Lade Schleifen- und Isolationsmesswerte |
|
| `getLoopChartDataThunk` | Lade Schleifen- und Isolationsmesswerte |
|
||||||
| `fetchLast20MessagesThunk` | Lade letzte 20 Systemmeldungen |
|
| `getLast20MessagesThunk` | Lade letzte 20 Systemmeldungen |
|
||||||
| `fetchKabelueberwachungChartThunk` | Lade Visualisierungsdaten der Slots |
|
| `fetchKabelueberwachungChartThunk` | Lade Visualisierungsdaten der Slots |
|
||||||
| `fetchTDMChartThunk` | Lade TDM (Multiple TDR) Messungen |
|
| `fetchTDMChartThunk` | Lade TDM (Multiple TDR) Messungen |
|
||||||
| `fetchTDRDataByIdThunk` | Lade TDR-Daten anhand einer ID |
|
| `fetchTDRDataByIdThunk` | Lade TDR-Daten anhand einer ID |
|
||||||
| `fetchTdmSingleChartThunk` | Lade Einzel-TDM-Messung |
|
| `fetchTdmSingleChartThunk` | Lade Einzel-TDM-Messung |
|
||||||
| `fetchSelectedChartDataThunk` | Lade selektierte Diagrammdaten |
|
| `fetchSelectedChartDataThunk` | Lade selektierte Diagrammdaten |
|
||||||
| `fetchTDRReferenceChartDataBySlotThunk` | Lade Referenzkurven pro Slot |
|
| `fetchTDRReferenceChartDataBySlotThunk` | Lade Referenzkurven pro Slot |
|
||||||
| `fetchSystemSettingsThunk` | Lade Systemeinstellungen |
|
| `getSystemSettingsThunk` | Lade Systemeinstellungen |
|
||||||
| `fetchOpcuaSettingsThunk` | Lade OPC UA Einstellungen und Benutzer |
|
| `getOpcUaSettingsThunk` | Lade OPC UA Einstellungen und Benutzer |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { RootState } from "@/redux/store";
|
|||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { AppDispatch } from "@/redux/store";
|
import { AppDispatch } from "@/redux/store";
|
||||||
import decodeToken from "@/utils/decodeToken";
|
import decodeToken from "@/utils/decodeToken";
|
||||||
import { fetchSystemSettingsThunk } from "@/redux/thunks/fetchSystemSettingsThunk";
|
import { getSystemSettingsThunk } from "@/redux/thunks/getSystemSettingsThunk";
|
||||||
|
|
||||||
function Header() {
|
function Header() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
@@ -59,7 +59,7 @@ function Header() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!deviceName) {
|
if (!deviceName) {
|
||||||
dispatch(fetchSystemSettingsThunk());
|
dispatch(getSystemSettingsThunk());
|
||||||
}
|
}
|
||||||
}, [deviceName, dispatch]);
|
}, [deviceName, dispatch]);
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { RootState, AppDispatch } from "@/redux/store";
|
import { RootState, AppDispatch } from "@/redux/store";
|
||||||
import { fetchAnalogInputsThunk } from "@/redux/thunks/fetchAnalogInputsThunk";
|
import { getAnalogInputsThunk } from "@/redux/thunks/getAnalogInputsThunk";
|
||||||
import { Icon } from "@iconify/react";
|
import { Icon } from "@iconify/react";
|
||||||
import settingsIcon from "@iconify/icons-mdi/settings";
|
import settingsIcon from "@iconify/icons-mdi/settings";
|
||||||
import waveformIcon from "@iconify/icons-mdi/waveform";
|
import waveformIcon from "@iconify/icons-mdi/waveform";
|
||||||
@@ -20,7 +20,7 @@ export default function AnalogInputsTable({
|
|||||||
const [activeId, setActiveId] = React.useState<number | null>(null);
|
const [activeId, setActiveId] = React.useState<number | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchAnalogInputsThunk());
|
dispatch(getAnalogInputsThunk());
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
const analogInputs = useSelector(
|
const analogInputs = useSelector(
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
setSelectedChartType,
|
setSelectedChartType,
|
||||||
} from "../../../../../redux/slices/tdrChartSlice";
|
} from "../../../../../redux/slices/tdrChartSlice";
|
||||||
import { resetBrushRange } from "../../../../../redux/slices/brushSlice";
|
import { resetBrushRange } from "../../../../../redux/slices/brushSlice";
|
||||||
import { fetchTDMDataBySlotThunk } from "../../../../../redux/thunks/fetchTDMListBySlotThunk";
|
import { fetchTDMDataBySlotThunk } from "../../../../../redux/thunks/getTDMListBySlotThunk";
|
||||||
import { useLoopChartLoader } from "./LoopMeasurementChart/LoopChartActionBar";
|
import { useLoopChartLoader } from "./LoopMeasurementChart/LoopChartActionBar";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { Chart, registerables } from "chart.js";
|
|||||||
import "chartjs-adapter-date-fns";
|
import "chartjs-adapter-date-fns";
|
||||||
import { getColor } from "../../../../../../utils/colors";
|
import { getColor } from "../../../../../../utils/colors";
|
||||||
import TDRChartActionBar from "./TDRChartActionBar";
|
import TDRChartActionBar from "./TDRChartActionBar";
|
||||||
import { fetchReferenceCurveBySlotThunk } from "../../../../../../redux/thunks/fetchReferenceCurveBySlotThunk";
|
import { getReferenceCurveBySlotThunk } from "../../../../../../redux/thunks/getReferenceCurveBySlotThunk";
|
||||||
|
|
||||||
const TDRChart: React.FC<{ isFullScreen: boolean }> = ({ isFullScreen }) => {
|
const TDRChart: React.FC<{ isFullScreen: boolean }> = ({ isFullScreen }) => {
|
||||||
const dispatch = useDispatch<AppDispatch>();
|
const dispatch = useDispatch<AppDispatch>();
|
||||||
@@ -52,7 +52,7 @@ const TDRChart: React.FC<{ isFullScreen: boolean }> = ({ isFullScreen }) => {
|
|||||||
//--------------------------------
|
//--------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedSlot !== null) {
|
if (selectedSlot !== null) {
|
||||||
dispatch(fetchReferenceCurveBySlotThunk(selectedSlot));
|
dispatch(getReferenceCurveBySlotThunk(selectedSlot));
|
||||||
}
|
}
|
||||||
}, [selectedSlot, dispatch]);
|
}, [selectedSlot, dispatch]);
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import React, { useState, useEffect } from "react";
|
|||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { useAppDispatch } from "../../../../../../redux/store";
|
import { useAppDispatch } from "../../../../../../redux/store";
|
||||||
import { RootState } from "../../../../../../redux/store";
|
import { RootState } from "../../../../../../redux/store";
|
||||||
import { fetchTDMDataBySlotThunk } from "../../../../../../redux/thunks/fetchTDMListBySlotThunk";
|
import { fetchTDMDataBySlotThunk } from "../../../../../../redux/thunks/getTDMListBySlotThunk";
|
||||||
import { fetchTDRChartDataByIdThunk } from "../../../../../../redux/thunks/fetchTDRChartDataByIdThunk";
|
import { getTDRChartDataByIdThunk } from "../../../../../../redux/thunks/getTDRChartDataByIdThunk";
|
||||||
import { fetchReferenceCurveBySlotThunk } from "../../../../../../redux/thunks/fetchReferenceCurveBySlotThunk"; // ⬅ import ergänzen
|
import { getReferenceCurveBySlotThunk } from "../../../../../../redux/thunks/getReferenceCurveBySlotThunk"; // ⬅ import ergänzen
|
||||||
|
|
||||||
const TDRChartActionBar: React.FC = () => {
|
const TDRChartActionBar: React.FC = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
@@ -33,7 +33,7 @@ const TDRChartActionBar: React.FC = () => {
|
|||||||
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
const handleSelectChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
const id = parseInt(e.target.value);
|
const id = parseInt(e.target.value);
|
||||||
setSelectedId(id);
|
setSelectedId(id);
|
||||||
dispatch(fetchTDRChartDataByIdThunk(id));
|
dispatch(getTDRChartDataByIdThunk(id));
|
||||||
};
|
};
|
||||||
|
|
||||||
// 📌 Referenz setzen (nutzt Slotnummer + 1 für die API)
|
// 📌 Referenz setzen (nutzt Slotnummer + 1 für die API)
|
||||||
@@ -79,7 +79,7 @@ const TDRChartActionBar: React.FC = () => {
|
|||||||
JSON.stringify(currentChartData)
|
JSON.stringify(currentChartData)
|
||||||
);
|
);
|
||||||
|
|
||||||
dispatch(fetchReferenceCurveBySlotThunk(selectedSlot));
|
dispatch(getReferenceCurveBySlotThunk(selectedSlot));
|
||||||
|
|
||||||
alert("Referenzkurve wurde erfolgreich gesetzt!");
|
alert("Referenzkurve wurde erfolgreich gesetzt!");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -96,7 +96,7 @@ const TDRChartActionBar: React.FC = () => {
|
|||||||
if (slotData?.length > 0) {
|
if (slotData?.length > 0) {
|
||||||
const lastId = slotData[0].id;
|
const lastId = slotData[0].id;
|
||||||
setSelectedId(lastId);
|
setSelectedId(lastId);
|
||||||
dispatch(fetchTDRChartDataByIdThunk(lastId));
|
dispatch(getTDRChartDataByIdThunk(lastId));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { useAdminAuth } from "./hooks/useAdminAuth";
|
|||||||
import handleAdminLogin from "./handlers/handleAdminLogin";
|
import handleAdminLogin from "./handlers/handleAdminLogin";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
import { AppDispatch } from "../../../redux/store";
|
import { AppDispatch } from "../../../redux/store";
|
||||||
import { fetchSystemSettingsThunk } from "../../../redux/thunks/fetchSystemSettingsThunk";
|
import { getSystemSettingsThunk } from "../../../redux/thunks/getSystemSettingsThunk";
|
||||||
import handleGeneralSubmit from "./handlers/handleGeneralSubmit";
|
import handleGeneralSubmit from "./handlers/handleGeneralSubmit";
|
||||||
|
|
||||||
const GeneralSettings: React.FC = () => {
|
const GeneralSettings: React.FC = () => {
|
||||||
@@ -52,7 +52,7 @@ const GeneralSettings: React.FC = () => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!systemSettings.deviceName) {
|
if (!systemSettings.deviceName) {
|
||||||
dispatch(fetchSystemSettingsThunk());
|
dispatch(getSystemSettingsThunk());
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { useSelector } from "react-redux";
|
|||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { RootState, useAppDispatch } from "../../../redux/store";
|
import { RootState, useAppDispatch } from "../../../redux/store";
|
||||||
import KabelModulStatus from "./modulesStatus/KabelModulStatus";
|
import KabelModulStatus from "./modulesStatus/KabelModulStatus";
|
||||||
import { fetchKueDataThunk } from "../../../redux/thunks/fetchKueDataThunk";
|
import { getKueDataThunk } from "../../../redux/thunks/getKueDataThunk";
|
||||||
|
|
||||||
const Baugruppentraeger: React.FC = () => {
|
const Baugruppentraeger: React.FC = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
@@ -83,7 +83,7 @@ const Baugruppentraeger: React.FC = () => {
|
|||||||
}
|
}
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchKueDataThunk());
|
dispatch(getKueDataThunk());
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
//--------------------------------------------
|
//--------------------------------------------
|
||||||
return <>{baugruppen}</>;
|
return <>{baugruppen}</>;
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { RootState, AppDispatch } from "../../../redux/store";
|
import { RootState, AppDispatch } from "../../../redux/store";
|
||||||
import { fetchSystemSettingsThunk } from "../../../redux/thunks/fetchSystemSettingsThunk";
|
import { getSystemSettingsThunk } from "../../../redux/thunks/getSystemSettingsThunk";
|
||||||
import { fetchOpcUaSettingsThunk } from "../../../redux/thunks/fetchOpcUaSettingsThunk";
|
import { getOpcUaSettingsThunk } from "../../../redux/thunks/getOpcUaSettingsThunk";
|
||||||
|
|
||||||
const NetworkInfo: React.FC = () => {
|
const NetworkInfo: React.FC = () => {
|
||||||
const dispatch: AppDispatch = useDispatch();
|
const dispatch: AppDispatch = useDispatch();
|
||||||
|
|
||||||
// ✅ OPC UA Daten laden, wenn Komponente angezeigt wird
|
// ✅ OPC UA Daten laden, wenn Komponente angezeigt wird
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchSystemSettingsThunk());
|
dispatch(getSystemSettingsThunk());
|
||||||
dispatch(fetchOpcUaSettingsThunk());
|
dispatch(getOpcUaSettingsThunk());
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
// Werte direkt aus Redux holen
|
// Werte direkt aus Redux holen
|
||||||
const ip =
|
const ip =
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ Dieses Dokument beschreibt die Architektur und Datenflüsse für das **Lesen** u
|
|||||||
```mermaid
|
```mermaid
|
||||||
flowchart TD
|
flowchart TD
|
||||||
A[DigitalOutputsWidget.tsx] --> B[useEffect]
|
A[DigitalOutputsWidget.tsx] --> B[useEffect]
|
||||||
B --> C[dispatch fetchDigitalOutputsThunk]
|
B --> C[dispatch getDigitalOutputsThunk]
|
||||||
C --> D[fetchDigitalOutputsService]
|
C --> D[fetchDigitalOutputsService]
|
||||||
D --> E{Moduswahl: NEXT_PUBLIC_CPL_MODE}
|
D --> E{Moduswahl: NEXT_PUBLIC_CPL_MODE}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
```mermaid
|
```mermaid
|
||||||
flowchart TD
|
flowchart TD
|
||||||
Start([SystemPage geöffnet])
|
Start([SystemPage geöffnet])
|
||||||
Start --> DispatchThunk[Dispatch fetchSystemVoltTempThunk]
|
Start --> DispatchThunk[Dispatch getSystemVoltTempThunk]
|
||||||
DispatchThunk --> Service[fetchSystemVoltTempService lädt Daten]
|
DispatchThunk --> Service[fetchSystemVoltTempService lädt Daten]
|
||||||
Service -->|Erfolg| ReduxStore[Redux Store aktualisiert]
|
Service -->|Erfolg| ReduxStore[Redux Store aktualisiert]
|
||||||
ReduxStore --> View[Anzeige der Werte und Charts]
|
ReduxStore --> View[Anzeige der Werte und Charts]
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
```mermaid
|
```mermaid
|
||||||
flowchart LR
|
flowchart LR
|
||||||
User(User öffnet Seite)
|
User(User öffnet Seite)
|
||||||
User --> DispatchThunk(fetchSystemVoltTempThunk)
|
User --> DispatchThunk(getSystemVoltTempThunk)
|
||||||
DispatchThunk --> ServiceCall(fetchSystemVoltTempService)
|
DispatchThunk --> ServiceCall(fetchSystemVoltTempService)
|
||||||
ServiceCall --> API(API Handler / Mock Daten)
|
ServiceCall --> API(API Handler / Mock Daten)
|
||||||
API --> ScriptLoaded(Mock-Daten im window geladen)
|
API --> ScriptLoaded(Mock-Daten im window geladen)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ sequenceDiagram
|
|||||||
participant MockData
|
participant MockData
|
||||||
|
|
||||||
User->>SystemPage: Öffnet System-Seite
|
User->>SystemPage: Öffnet System-Seite
|
||||||
SystemPage->>ReduxStore: dispatch(fetchSystemVoltTempThunk)
|
SystemPage->>ReduxStore: dispatch(getSystemVoltTempThunk)
|
||||||
ReduxStore->>Service: fetchSystemVoltTempService()
|
ReduxStore->>Service: fetchSystemVoltTempService()
|
||||||
Service->>API: Anfrage an /api/cpl/systemVoltTempAPIHandler
|
Service->>API: Anfrage an /api/cpl/systemVoltTempAPIHandler
|
||||||
API->>MockData: Lese systemVoltTempMockData.js
|
API->>MockData: Lese systemVoltTempMockData.js
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "cpl-v4",
|
"name": "cpl-v4",
|
||||||
"version": "1.6.437",
|
"version": "1.6.438",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "cpl-v4",
|
"name": "cpl-v4",
|
||||||
"version": "1.6.437",
|
"version": "1.6.438",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/roboto": "^5.1.0",
|
"@fontsource/roboto": "^5.1.0",
|
||||||
"@iconify-icons/ri": "^1.2.10",
|
"@iconify-icons/ri": "^1.2.10",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "cpl-v4",
|
"name": "cpl-v4",
|
||||||
"version": "1.6.437",
|
"version": "1.6.438",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|||||||
@@ -3,29 +3,29 @@
|
|||||||
|
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Provider } from "react-redux";
|
import { Provider } from "react-redux";
|
||||||
import store, { useAppDispatch } from "../redux/store";
|
import store, { useAppDispatch } from "@/redux/store";
|
||||||
import { AppProps } from "next/app";
|
import { AppProps } from "next/app";
|
||||||
import { loadWindowVariables } from "../utils/loadWindowVariables";
|
import { loadWindowVariables } from "@/utils/loadWindowVariables";
|
||||||
|
|
||||||
import Header from "../components/header/Header";
|
import Header from "@/components/header/Header";
|
||||||
import Navigation from "../components/navigation/Navigation";
|
import Navigation from "@/components/navigation/Navigation";
|
||||||
import Footer from "../components/footer/Footer";
|
import Footer from "@/components/footer/Footer";
|
||||||
|
|
||||||
// Thunks importieren
|
// Thunks importieren
|
||||||
import { fetchKueDataThunk } from "../redux/thunks/fetchKueDataThunk";
|
import { getKueDataThunk } from "@/redux/thunks/getKueDataThunk";
|
||||||
import { fetchDigitalOutputsThunk } from "../redux/thunks/fetchDigitalOutputsThunk";
|
import { getDigitalOutputsThunk } from "@/redux/thunks/getDigitalOutputsThunk";
|
||||||
import { fetchAnalogInputsThunk } from "../redux/thunks/fetchAnalogInputsThunk";
|
import { getAnalogInputsThunk } from "@/redux/thunks/getAnalogInputsThunk";
|
||||||
import { getAnalogInputsHistoryThunk } from "../redux/thunks/getAnalogInputsHistoryThunk";
|
import { getAnalogInputsHistoryThunk } from "@/redux/thunks/getAnalogInputsHistoryThunk";
|
||||||
import { fetchLast20MessagesThunk } from "../redux/thunks/fetchLast20MessagesThunk";
|
import { getLast20MessagesThunk } from "@/redux/thunks/getLast20MessagesThunk";
|
||||||
import { fetchOpcUaSettingsThunk } from "../redux/thunks/fetchOpcUaSettingsThunk";
|
import { getOpcUaSettingsThunk } from "@/redux/thunks/getOpcUaSettingsThunk";
|
||||||
import { fetchSystemSettingsThunk } from "../redux/thunks/fetchSystemSettingsThunk";
|
import { getSystemSettingsThunk } from "@/redux/thunks/getSystemSettingsThunk";
|
||||||
import { fetchSystemVoltTempThunk } from "../redux/thunks/fetchSystemVoltTempThunk";
|
import { getSystemVoltTempThunk } from "@/redux/thunks/getSystemVoltTempThunk";
|
||||||
import { fetchReferenceCurveBySlotThunk } from "../redux/thunks/fetchReferenceCurveBySlotThunk";
|
import { getReferenceCurveBySlotThunk } from "@/redux/thunks/getReferenceCurveBySlotThunk";
|
||||||
import { getAllTDRReferenceChartThunk } from "@/redux/thunks/getAllTDRReferenceChartThunk";
|
import { getAllTDRReferenceChartThunk } from "@/redux/thunks/getAllTDRReferenceChartThunk";
|
||||||
import { fetchTDRChartDataByIdThunk } from "../redux/thunks/fetchTDRChartDataByIdThunk";
|
import { getTDRChartDataByIdThunk } from "@/redux/thunks/getTDRChartDataByIdThunk";
|
||||||
import { fetchLoopChartDataThunk } from "../redux/thunks/fetchLoopChartDataThunk";
|
import { getLoopChartDataThunk } from "@/redux/thunks/getLoopChartDataThunk";
|
||||||
|
|
||||||
import "../styles/globals.css";
|
import "@/styles/globals.css";
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }: AppProps) {
|
function MyApp({ Component, pageProps }: AppProps) {
|
||||||
return (
|
return (
|
||||||
@@ -35,7 +35,13 @@ function MyApp({ Component, pageProps }: AppProps) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function AppContent({ Component, pageProps }: AppProps) {
|
function AppContent({
|
||||||
|
Component,
|
||||||
|
pageProps,
|
||||||
|
}: {
|
||||||
|
Component: AppProps["Component"];
|
||||||
|
pageProps: AppProps["pageProps"];
|
||||||
|
}): JSX.Element {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const [sessionExpired, setSessionExpired] = useState(false);
|
const [sessionExpired, setSessionExpired] = useState(false);
|
||||||
|
|
||||||
@@ -45,31 +51,31 @@ function AppContent({ Component, pageProps }: AppProps) {
|
|||||||
|
|
||||||
const loadAndDispatch = () => {
|
const loadAndDispatch = () => {
|
||||||
if (pathname.includes("kabelueberwachung")) {
|
if (pathname.includes("kabelueberwachung")) {
|
||||||
dispatch(fetchKueDataThunk());
|
dispatch(getKueDataThunk());
|
||||||
} else if (pathname.includes("digitalOutputs")) {
|
} else if (pathname.includes("digitalOutputs")) {
|
||||||
dispatch(fetchDigitalOutputsThunk());
|
dispatch(getDigitalOutputsThunk());
|
||||||
} else if (pathname.includes("digitalInputs")) {
|
} else if (pathname.includes("digitalInputs")) {
|
||||||
dispatch(fetchDigitalOutputsThunk()); // 🟠 evtl. anpassen
|
dispatch(getDigitalOutputsThunk()); // 🟠 evtl. anpassen
|
||||||
} else if (pathname.includes("analogInputs")) {
|
} else if (pathname.includes("analogInputs")) {
|
||||||
dispatch(fetchAnalogInputsThunk());
|
dispatch(getAnalogInputsThunk());
|
||||||
} else if (pathname.includes("analogHistory")) {
|
} else if (pathname.includes("analogHistory")) {
|
||||||
dispatch(getAnalogInputsHistoryThunk());
|
dispatch(getAnalogInputsHistoryThunk());
|
||||||
} else if (pathname.includes("dashboard")) {
|
} else if (pathname.includes("dashboard")) {
|
||||||
dispatch(fetchLast20MessagesThunk());
|
dispatch(getLast20MessagesThunk());
|
||||||
} else if (pathname.includes("einstellungen")) {
|
} else if (pathname.includes("einstellungen")) {
|
||||||
dispatch(fetchOpcUaSettingsThunk());
|
dispatch(getOpcUaSettingsThunk());
|
||||||
} else if (pathname.includes("systemvolt")) {
|
} else if (pathname.includes("systemvolt")) {
|
||||||
dispatch(fetchSystemVoltTempThunk());
|
dispatch(getSystemVoltTempThunk());
|
||||||
} else if (pathname.includes("system")) {
|
} else if (pathname.includes("system")) {
|
||||||
dispatch(fetchSystemSettingsThunk());
|
dispatch(getSystemSettingsThunk());
|
||||||
} else if (pathname.includes("tdrRef")) {
|
} else if (pathname.includes("tdrRef")) {
|
||||||
dispatch(getAllTDRReferenceChartThunk());
|
dispatch(getAllTDRReferenceChartThunk());
|
||||||
} else if (pathname.includes("tdrSlot")) {
|
} else if (pathname.includes("tdrSlot")) {
|
||||||
dispatch(fetchReferenceCurveBySlotThunk());
|
dispatch(getReferenceCurveBySlotThunk());
|
||||||
} else if (pathname.includes("tdrId")) {
|
} else if (pathname.includes("tdrId")) {
|
||||||
dispatch(fetchTDRChartDataByIdThunk());
|
dispatch(getTDRChartDataByIdThunk());
|
||||||
} else if (pathname.includes("loopChart")) {
|
} else if (pathname.includes("loopChart")) {
|
||||||
dispatch(fetchLoopChartDataThunk());
|
dispatch(getLoopChartDataThunk());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import React, { useState, useEffect } from "react";
|
|||||||
import AnalogInputsTable from "../components/main/analogInputs/AnalogInputsTable";
|
import AnalogInputsTable from "../components/main/analogInputs/AnalogInputsTable";
|
||||||
import AnalogInputsChart from "../components/main/analogInputs/AnalogInputsChart";
|
import AnalogInputsChart from "../components/main/analogInputs/AnalogInputsChart";
|
||||||
import AnalogInputsSettingsModal from "../components/main/analogInputs/AnalogInputsSettingsModal";
|
import AnalogInputsSettingsModal from "../components/main/analogInputs/AnalogInputsSettingsModal";
|
||||||
import { fetchAnalogInputsThunk } from "../redux/thunks/fetchAnalogInputsThunk";
|
import { getAnalogInputsThunk } from "../redux/thunks/getAnalogInputsThunk";
|
||||||
import { useAppDispatch } from "../redux/store";
|
import { useAppDispatch } from "../redux/store";
|
||||||
|
|
||||||
function AnalogInputs() {
|
function AnalogInputs() {
|
||||||
@@ -14,9 +14,9 @@ function AnalogInputs() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (typeof window !== "undefined") {
|
if (typeof window !== "undefined") {
|
||||||
dispatch(fetchAnalogInputsThunk());
|
dispatch(getAnalogInputsThunk());
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
dispatch(fetchAnalogInputsThunk());
|
dispatch(getAnalogInputsThunk());
|
||||||
}, 10000);
|
}, 10000);
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,16 +9,16 @@ import Last20MessagesTable from "../components/main/uebersicht/Last20MessagesTab
|
|||||||
import NetworkInfo from "../components/main/uebersicht/NetworkInfo";
|
import NetworkInfo from "../components/main/uebersicht/NetworkInfo";
|
||||||
import VersionInfo from "../components/main/uebersicht/VersionInfo";
|
import VersionInfo from "../components/main/uebersicht/VersionInfo";
|
||||||
import Baugruppentraeger from "../components/main/uebersicht/Baugruppentraeger";
|
import Baugruppentraeger from "../components/main/uebersicht/Baugruppentraeger";
|
||||||
import { fetchLast20MessagesThunk } from "../redux/thunks/fetchLast20MessagesThunk";
|
import { getLast20MessagesThunk } from "../redux/thunks/getLast20MessagesThunk";
|
||||||
import { useAppDispatch } from "../redux/store";
|
import { useAppDispatch } from "../redux/store";
|
||||||
|
|
||||||
const Dashboard: React.FC = () => {
|
const Dashboard: React.FC = () => {
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchLast20MessagesThunk());
|
dispatch(getLast20MessagesThunk());
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
dispatch(fetchLast20MessagesThunk());
|
dispatch(getLast20MessagesThunk());
|
||||||
}, 10000); // oder 5000
|
}, 10000); // oder 5000
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import { AppDispatch, RootState } from "../redux/store";
|
|||||||
|
|
||||||
import InputModal from "../components/main/einausgaenge/modals/InputModal";
|
import InputModal from "../components/main/einausgaenge/modals/InputModal";
|
||||||
|
|
||||||
import { fetchDigitalInputsThunk } from "@/redux/thunks/fetchDigitalInputsThunk";
|
import { getDigitalInputsThunk } from "@/redux/thunks/getDigitalInputsThunk";
|
||||||
import { fetchDigitalOutputsThunk } from "../redux/thunks/fetchDigitalOutputsThunk";
|
import { getDigitalOutputsThunk } from "../redux/thunks/getDigitalOutputsThunk";
|
||||||
|
|
||||||
import DigitalInputs from "../components/main/einausgaenge/DigitalInputs";
|
import DigitalInputs from "../components/main/einausgaenge/DigitalInputs";
|
||||||
|
|
||||||
@@ -26,12 +26,12 @@ const EinAusgaenge: React.FC = () => {
|
|||||||
const [isOutputModalOpen, setIsOutputModalOpen] = useState(false);
|
const [isOutputModalOpen, setIsOutputModalOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchDigitalInputsThunk());
|
dispatch(getDigitalInputsThunk());
|
||||||
dispatch(fetchDigitalOutputsThunk());
|
dispatch(getDigitalOutputsThunk());
|
||||||
|
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
dispatch(fetchDigitalInputsThunk());
|
dispatch(getDigitalInputsThunk());
|
||||||
dispatch(fetchDigitalOutputsThunk());
|
dispatch(getDigitalOutputsThunk());
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import { AppDispatch, RootState } from "@/redux/store";
|
|||||||
|
|
||||||
import DigitalOutputsModal from "../components/main/einausgaenge/modals/DigitalOutputsModal";
|
import DigitalOutputsModal from "../components/main/einausgaenge/modals/DigitalOutputsModal";
|
||||||
|
|
||||||
import { fetchDigitalInputsThunk } from "@/redux/thunks/fetchDigitalInputsThunk";
|
import { getDigitalInputsThunk } from "@/redux/thunks/getDigitalInputsThunk";
|
||||||
import { fetchDigitalOutputsThunk } from "@/redux/thunks/fetchDigitalOutputsThunk";
|
import { getDigitalOutputsThunk } from "@/redux/thunks/getDigitalOutputsThunk";
|
||||||
|
|
||||||
import DigitalOutputs from "../components/main/einausgaenge/DigitalOutputsWidget";
|
import DigitalOutputs from "../components/main/einausgaenge/DigitalOutputsWidget";
|
||||||
|
|
||||||
@@ -21,11 +21,11 @@ const EinAusgaenge: React.FC = () => {
|
|||||||
const [isOutputModalOpen, setIsOutputModalOpen] = useState(false);
|
const [isOutputModalOpen, setIsOutputModalOpen] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchDigitalOutputsThunk());
|
dispatch(getDigitalOutputsThunk());
|
||||||
|
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
dispatch(fetchDigitalInputsThunk());
|
dispatch(getDigitalInputsThunk());
|
||||||
dispatch(fetchDigitalOutputsThunk());
|
dispatch(getDigitalOutputsThunk());
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// /pages/einstellungen.tsx
|
// /pages/einstellungen.tsx
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { useAppDispatch } from "../redux/store";
|
import { useAppDispatch } from "../redux/store";
|
||||||
import { fetchSystemSettingsThunk } from "../redux/thunks/fetchSystemSettingsThunk";
|
import { getSystemSettingsThunk } from "../redux/thunks/getSystemSettingsThunk";
|
||||||
import GeneralSettings from "../components/main/settingsPageComponents/GeneralSettings";
|
import GeneralSettings from "../components/main/settingsPageComponents/GeneralSettings";
|
||||||
import OPCUAInterfaceSettings from "../components/main/settingsPageComponents/OPCUAInterfaceSettings";
|
import OPCUAInterfaceSettings from "../components/main/settingsPageComponents/OPCUAInterfaceSettings";
|
||||||
import DatabaseSettings from "../components/main/settingsPageComponents/DatabaseSettings";
|
import DatabaseSettings from "../components/main/settingsPageComponents/DatabaseSettings";
|
||||||
@@ -13,7 +13,7 @@ export default function Settings() {
|
|||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchSystemSettingsThunk());
|
dispatch(getSystemSettingsThunk());
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import Kue705FO from "../components/main/kabelueberwachung/kue705FO/Kue705FO";
|
|||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { AppDispatch } from "../redux/store"; // Adjust the path to your Redux store file
|
import { AppDispatch } from "../redux/store"; // Adjust the path to your Redux store file
|
||||||
import { RootState } from "../redux/store"; // Adjust the path to your Redux store file
|
import { RootState } from "../redux/store"; // Adjust the path to your Redux store file
|
||||||
import { fetchKueDataThunk } from "../redux/thunks/fetchKueDataThunk";
|
import { getKueDataThunk } from "../redux/thunks/getKueDataThunk";
|
||||||
|
|
||||||
function Kabelueberwachung() {
|
function Kabelueberwachung() {
|
||||||
const dispatch: AppDispatch = useDispatch();
|
const dispatch: AppDispatch = useDispatch();
|
||||||
@@ -119,8 +119,8 @@ function Kabelueberwachung() {
|
|||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (kueIso.length === 0) {
|
if (kueIso.length === 0) {
|
||||||
console.log("📦 Lade KUE-Daten aus fetchKueDataThunk...");
|
console.log("📦 Lade KUE-Daten aus getKueDataThunk...");
|
||||||
dispatch(fetchKueDataThunk());
|
dispatch(getKueDataThunk());
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
//------------------------------------------------------------
|
//------------------------------------------------------------
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { AppDispatch, RootState } from "../redux/store";
|
import { AppDispatch, RootState } from "../redux/store";
|
||||||
import { fetchSystemVoltTempThunk } from "../redux/thunks/fetchSystemVoltTempThunk";
|
import { getSystemVoltTempThunk } from "../redux/thunks/getSystemVoltTempThunk";
|
||||||
import {
|
import {
|
||||||
Chart as ChartJS,
|
Chart as ChartJS,
|
||||||
CategoryScale,
|
CategoryScale,
|
||||||
@@ -35,9 +35,9 @@ const SystemPage = () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchSystemVoltTempThunk());
|
dispatch(getSystemVoltTempThunk());
|
||||||
const interval = setInterval(() => {
|
const interval = setInterval(() => {
|
||||||
dispatch(fetchSystemVoltTempThunk());
|
dispatch(getSystemVoltTempThunk());
|
||||||
}, 5000);
|
}, 5000);
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, [dispatch]);
|
}, [dispatch]);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// /redux/slices/loopChartSlice.ts
|
// /redux/slices/loopChartSlice.ts
|
||||||
import { createSlice } from "@reduxjs/toolkit";
|
import { createSlice } from "@reduxjs/toolkit";
|
||||||
import { fetchLoopChartDataThunk } from "../thunks/fetchLoopChartDataThunk";
|
import { getLoopChartDataThunk } from "../thunks/getLoopChartDataThunk";
|
||||||
|
|
||||||
interface ChartData {
|
interface ChartData {
|
||||||
[mode: string]: {
|
[mode: string]: {
|
||||||
@@ -26,11 +26,11 @@ const loopChartSlice = createSlice({
|
|||||||
reducers: {},
|
reducers: {},
|
||||||
extraReducers: (builder) => {
|
extraReducers: (builder) => {
|
||||||
builder
|
builder
|
||||||
.addCase(fetchLoopChartDataThunk.pending, (state) => {
|
.addCase(getLoopChartDataThunk.pending, (state) => {
|
||||||
state.loading = true;
|
state.loading = true;
|
||||||
state.error = null;
|
state.error = null;
|
||||||
})
|
})
|
||||||
.addCase(fetchLoopChartDataThunk.fulfilled, (state, action) => {
|
.addCase(getLoopChartDataThunk.fulfilled, (state, action) => {
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
const { mode, type } = action.meta.arg;
|
const { mode, type } = action.meta.arg;
|
||||||
if (!state.data[mode]) {
|
if (!state.data[mode]) {
|
||||||
@@ -38,7 +38,7 @@ const loopChartSlice = createSlice({
|
|||||||
}
|
}
|
||||||
state.data[mode][type] = action.payload;
|
state.data[mode][type] = action.payload;
|
||||||
})
|
})
|
||||||
.addCase(fetchLoopChartDataThunk.rejected, (state, action) => {
|
.addCase(getLoopChartDataThunk.rejected, (state, action) => {
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
state.error = action.payload as string;
|
state.error = action.payload as string;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
// /redux/slices/tdmSingleChartSlice.ts
|
// /redux/slices/tdmSingleChartSlice.ts
|
||||||
|
|
||||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||||
import { fetchTDMDataBySlotThunk } from "../thunks/fetchTDMListBySlotThunk";
|
import { fetchTDMDataBySlotThunk } from "../thunks/getTDMListBySlotThunk";
|
||||||
|
|
||||||
interface TDMChartEntry {
|
interface TDMChartEntry {
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// redux/slices/tdrDataByIdSlice.ts
|
// redux/slices/tdrDataByIdSlice.ts
|
||||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||||
import { fetchTDRChartDataByIdThunk } from "../thunks/fetchTDRChartDataByIdThunk";
|
import { getTDRChartDataByIdThunk } from "../thunks/getTDRChartDataByIdThunk";
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
dataById: {} as Record<number, { d: number; p: number }[]>,
|
dataById: {} as Record<number, { d: number; p: number }[]>,
|
||||||
@@ -22,7 +22,7 @@ const tdrDataByIdSlice = createSlice({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
extraReducers: (builder) => {
|
extraReducers: (builder) => {
|
||||||
builder.addCase(fetchTDRChartDataByIdThunk.fulfilled, (state, action) => {
|
builder.addCase(getTDRChartDataByIdThunk.fulfilled, (state, action) => {
|
||||||
const { id, data } = action.payload;
|
const { id, data } = action.payload;
|
||||||
state.dataById[id] = data;
|
state.dataById[id] = data;
|
||||||
state.selectedId = id;
|
state.selectedId = id;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// /redux/slices/tdrReferenceChartDataBySlotSlice.ts
|
// /redux/slices/tdrReferenceChartDataBySlotSlice.ts
|
||||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||||
import { fetchReferenceCurveBySlotThunk } from "../thunks/fetchReferenceCurveBySlotThunk";
|
import { getReferenceCurveBySlotThunk } from "../thunks/getReferenceCurveBySlotThunk";
|
||||||
|
|
||||||
interface TDRReferenceChartState {
|
interface TDRReferenceChartState {
|
||||||
referenceData: { [slot: number]: any[] };
|
referenceData: { [slot: number]: any[] };
|
||||||
@@ -20,18 +20,18 @@ const tdrReferenceChartDataBySlotSlice = createSlice({
|
|||||||
reducers: {},
|
reducers: {},
|
||||||
extraReducers: (builder) => {
|
extraReducers: (builder) => {
|
||||||
builder
|
builder
|
||||||
.addCase(fetchReferenceCurveBySlotThunk.pending, (state) => {
|
.addCase(getReferenceCurveBySlotThunk.pending, (state) => {
|
||||||
state.loading = true;
|
state.loading = true;
|
||||||
state.error = null;
|
state.error = null;
|
||||||
})
|
})
|
||||||
.addCase(
|
.addCase(
|
||||||
fetchReferenceCurveBySlotThunk.fulfilled,
|
getReferenceCurveBySlotThunk.fulfilled,
|
||||||
(state, action: PayloadAction<{ slot: number; data: any[] }>) => {
|
(state, action: PayloadAction<{ slot: number; data: any[] }>) => {
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
state.referenceData[action.payload.slot] = action.payload.data;
|
state.referenceData[action.payload.slot] = action.payload.data;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.addCase(fetchReferenceCurveBySlotThunk.rejected, (state, action) => {
|
.addCase(getReferenceCurveBySlotThunk.rejected, (state, action) => {
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
state.error = action.error.message ?? "Unbekannter Fehler";
|
state.error = action.error.message ?? "Unbekannter Fehler";
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// /redux/thunks/fetchAnalogInputsThunk.ts
|
// /redux/thunks/getAnalogInputsThunk.ts
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchAnalogInputsService } from "@/services/fetchAnalogInputsService";
|
import { fetchAnalogInputsService } from "@/services/fetchAnalogInputsService";
|
||||||
import { setAnalogInputs } from "@/redux/slices/analogInputsSlice";
|
import { setAnalogInputs } from "@/redux/slices/analogInputsSlice";
|
||||||
@@ -6,7 +6,7 @@ import { setAnalogInputs } from "@/redux/slices/analogInputsSlice";
|
|||||||
/**
|
/**
|
||||||
* Holt die analogen Eingänge von der API und speichert sie in Redux.
|
* Holt die analogen Eingänge von der API und speichert sie in Redux.
|
||||||
*/
|
*/
|
||||||
export const fetchAnalogInputsThunk = createAsyncThunk(
|
export const getAnalogInputsThunk = createAsyncThunk(
|
||||||
"analogeInputs/fetchAnalogInputs",
|
"analogeInputs/fetchAnalogInputs",
|
||||||
async (_, { dispatch }) => {
|
async (_, { dispatch }) => {
|
||||||
if (typeof window === "undefined") return; // Server-Side Execution blockieren
|
if (typeof window === "undefined") return; // Server-Side Execution blockieren
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// @/redux/thunks/fetchDigitalInputsThunk.ts
|
// @/redux/thunks/getDigitalInputsThunk.ts
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchDigitalInputsService } from "@/services/fetchDigitalInputsService";
|
import { fetchDigitalInputsService } from "@/services/fetchDigitalInputsService";
|
||||||
import { setInputs } from "@/redux/slices/digitalInputsSlice";
|
import { setInputs } from "@/redux/slices/digitalInputsSlice";
|
||||||
@@ -6,7 +6,7 @@ import { setInputs } from "@/redux/slices/digitalInputsSlice";
|
|||||||
/**
|
/**
|
||||||
* Holt digitale Eingänge von der API und speichert sie in Redux.
|
* Holt digitale Eingänge von der API und speichert sie in Redux.
|
||||||
*/
|
*/
|
||||||
export const fetchDigitalInputsThunk = createAsyncThunk(
|
export const getDigitalInputsThunk = createAsyncThunk(
|
||||||
"digitalInputs/fetchDigitalInputs",
|
"digitalInputs/fetchDigitalInputs",
|
||||||
async (_, { dispatch }) => {
|
async (_, { dispatch }) => {
|
||||||
if (typeof window === "undefined") return;
|
if (typeof window === "undefined") return;
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
// ✅ Thunk: /redux/thunks/fetchDigitalOutputsThunk.ts
|
// ✅ Thunk: /redux/thunks/getDigitalOutputsThunk.ts
|
||||||
|
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchDigitalOutputsService } from "../../services/fetchDigitalOutputsService";
|
import { fetchDigitalOutputsService } from "../../services/fetchDigitalOutputsService";
|
||||||
import { setDigitalOutputs } from "../slices/digitalOutputsSlice";
|
import { setDigitalOutputs } from "../slices/digitalOutputsSlice";
|
||||||
|
|
||||||
export const fetchDigitalOutputsThunk = createAsyncThunk(
|
export const getDigitalOutputsThunk = createAsyncThunk(
|
||||||
"digitalOutputs/fetch",
|
"digitalOutputs/fetch",
|
||||||
async (_, { dispatch }) => {
|
async (_, { dispatch }) => {
|
||||||
const outputs = await fetchDigitalOutputsService();
|
const outputs = await fetchDigitalOutputsService();
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
// ✅ Thunk: /redux/thunks/fetchKueDataThunk.ts
|
// ✅ Thunk: /redux/thunks/getKueDataThunk.ts
|
||||||
|
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchKueDataService } from "../../services/fetchKueDataService";
|
import { fetchKueDataService } from "../../services/fetchKueDataService";
|
||||||
import { setKueData } from "../slices/kueDataSlice";
|
import { setKueData } from "../slices/kueDataSlice";
|
||||||
|
|
||||||
export const fetchKueDataThunk = createAsyncThunk(
|
export const getKueDataThunk = createAsyncThunk(
|
||||||
"kueData/fetch",
|
"kueData/fetch",
|
||||||
async (_, { dispatch }) => {
|
async (_, { dispatch }) => {
|
||||||
const data = await fetchKueDataService();
|
const data = await fetchKueDataService();
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
// /redux/thunks/fetchLast20MessagesThunk.ts
|
// /redux/thunks/getLast20MessagesThunk.ts
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchLast20MessagesFromWindow } from "../../services/fetchLast20MessagesService";
|
import { fetchLast20MessagesFromWindow } from "../../services/fetchLast20MessagesService";
|
||||||
import { setLast20Messages } from "../slices/last20MessagesSlice";
|
import { setLast20Messages } from "../slices/last20MessagesSlice";
|
||||||
|
|
||||||
export const fetchLast20MessagesThunk = createAsyncThunk(
|
export const getLast20MessagesThunk = createAsyncThunk(
|
||||||
"last20Messages/fetchLast20Messages",
|
"last20Messages/fetchLast20Messages",
|
||||||
async (_, { dispatch }) => {
|
async (_, { dispatch }) => {
|
||||||
const messages = await fetchLast20MessagesFromWindow();
|
const messages = await fetchLast20MessagesFromWindow();
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// /redux/thunks/fetchLoopChartDataThunk.ts
|
// /redux/thunks/getLoopChartDataThunk.ts
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchLoopChartData } from "../../services/fetchLoopChartDataService";
|
import { fetchLoopChartData } from "../../services/fetchLoopChartDataService";
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ interface FetchLoopChartDataParams {
|
|||||||
bisDatum: string;
|
bisDatum: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fetchLoopChartDataThunk = createAsyncThunk(
|
export const getLoopChartDataThunk = createAsyncThunk(
|
||||||
"loopChart/fetchLoopChartData",
|
"loopChart/fetchLoopChartData",
|
||||||
async (params: FetchLoopChartDataParams, { rejectWithValue }) => {
|
async (params: FetchLoopChartDataParams, { rejectWithValue }) => {
|
||||||
try {
|
try {
|
||||||
@@ -28,7 +28,7 @@ export const fetchLoopChartDataThunk = createAsyncThunk(
|
|||||||
|
|
||||||
return data;
|
return data;
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
console.error("❌ Fehler in fetchLoopChartDataThunk:", error);
|
console.error("❌ Fehler in getLoopChartDataThunk:", error);
|
||||||
return rejectWithValue(error.message || "Unbekannter Fehler");
|
return rejectWithValue(error.message || "Unbekannter Fehler");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// ✅ 2. Thunk: /redux/thunks/fetchOpcUaSettingsThunk.ts
|
// ✅ 2. Thunk: /redux/thunks/getOpcUaSettingsThunk.ts
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchOpcUaSettingsService } from "../../services/fetchOpcUaSettingsService";
|
import { fetchOpcUaSettingsService } from "../../services/fetchOpcUaSettingsService";
|
||||||
import {
|
import {
|
||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
//setOpcUaUsers,
|
//setOpcUaUsers,
|
||||||
} from "../slices/opcuaSettingsSlice";
|
} from "../slices/opcuaSettingsSlice";
|
||||||
|
|
||||||
export const fetchOpcUaSettingsThunk = createAsyncThunk(
|
export const getOpcUaSettingsThunk = createAsyncThunk(
|
||||||
"opcuaSettings/fetch",
|
"opcuaSettings/fetch",
|
||||||
async (_, { dispatch }) => {
|
async (_, { dispatch }) => {
|
||||||
const data = await fetchOpcUaSettingsService();
|
const data = await fetchOpcUaSettingsService();
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
// /redux/thunks/fetchReferenceCurveBySlotThunk.ts
|
// /redux/thunks/getReferenceCurveBySlotThunk.ts
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchTDRReferenceCurveService } from "../../services/fetchTDRReferenceCurveService";
|
import { fetchTDRReferenceCurveService } from "../../services/fetchTDRReferenceCurveService";
|
||||||
|
|
||||||
export const fetchReferenceCurveBySlotThunk = createAsyncThunk(
|
export const getReferenceCurveBySlotThunk = createAsyncThunk(
|
||||||
"tdrReferenceChart/fetchBySlot",
|
"tdrReferenceChart/fetchBySlot",
|
||||||
async (slot: number) => {
|
async (slot: number) => {
|
||||||
const data = await fetchTDRReferenceCurveService(slot);
|
const data = await fetchTDRReferenceCurveService(slot);
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
// /redux/thunks/fetchSystemSettingsThunk.ts
|
// /redux/thunks/getSystemSettingsThunk.ts
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchSystemService } from "../../services/fetchSystemService";
|
import { fetchSystemService } from "../../services/fetchSystemService";
|
||||||
import { setSystemSettings } from "../slices/systemSettingsSlice";
|
import { setSystemSettings } from "../slices/systemSettingsSlice";
|
||||||
|
|
||||||
export const fetchSystemSettingsThunk = createAsyncThunk(
|
export const getSystemSettingsThunk = createAsyncThunk(
|
||||||
"systemSettings/fetch",
|
"systemSettings/fetch",
|
||||||
async (_, { dispatch }) => {
|
async (_, { dispatch }) => {
|
||||||
const data = await fetchSystemService();
|
const data = await fetchSystemService();
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
// /redux/thunks/fetchSystemVoltTempThunk.ts
|
// /redux/thunks/getSystemVoltTempThunk.ts
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchSystemVoltTempService } from "../../services/fetchSystemVoltTempService";
|
import { fetchSystemVoltTempService } from "../../services/fetchSystemVoltTempService";
|
||||||
import { setVoltages, addHistory } from "../slices/systemVoltTempSlice";
|
import { setVoltages, addHistory } from "../slices/systemVoltTempSlice";
|
||||||
|
|
||||||
export const fetchSystemVoltTempThunk = createAsyncThunk(
|
export const getSystemVoltTempThunk = createAsyncThunk(
|
||||||
"systemVoltTemp/fetch",
|
"systemVoltTemp/fetch",
|
||||||
async (_, { dispatch }) => {
|
async (_, { dispatch }) => {
|
||||||
const data = await fetchSystemVoltTempService();
|
const data = await fetchSystemVoltTempService();
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
// /redux/thunks/fetchTDRChartDataByIdThunk.ts
|
// /redux/thunks/getTDRChartDataByIdThunk.ts
|
||||||
import { createAsyncThunk } from "@reduxjs/toolkit";
|
import { createAsyncThunk } from "@reduxjs/toolkit";
|
||||||
import { fetchTDRChartDataByIdService } from "../../services/fetchTDRChartDataByIdService";
|
import { fetchTDRChartDataByIdService } from "../../services/fetchTDRChartDataByIdService";
|
||||||
|
|
||||||
export const fetchTDRChartDataByIdThunk = createAsyncThunk(
|
export const getTDRChartDataByIdThunk = createAsyncThunk(
|
||||||
"tdrDataById/fetchById",
|
"tdrDataById/fetchById",
|
||||||
async (id: number) => {
|
async (id: number) => {
|
||||||
const data = await fetchTDRChartDataByIdService(id);
|
const data = await fetchTDRChartDataByIdService(id);
|
||||||
Reference in New Issue
Block a user