refactor: OPC-UA Variablen aus variablesSlice entfernt und in opcuaSettingsSlice integriert
- OPC-UA Variablen (`opcUaZustand`, `opcUaActiveClientCount`, `opcUaNodesetName`) aus `variablesSlice` entfernt - `_app.tsx` angepasst, um OPC-UA Daten direkt in `opcuaSettingsSlice` zu speichern - `loadWindowVariables.ts` aktualisiert: - OPC-UA Status, Verschlüsselung, aktive Clients und Nodeset werden nun in `opcuaSettingsSlice` gespeichert - `variablesSlice` speichert keine OPC-UA Daten mehr - Redux-Store aufgeräumt: DevTools zeigt keine OPC-UA Variablen mehr in `variablesSlice` Jetzt ist die Trennung zwischen `variablesSlice` und `opcuaSettingsSlice` vollständig! 🚀🔥
This commit is contained in:
@@ -8,7 +8,12 @@ import Footer from "../components/footer/Footer";
|
||||
import "../styles/globals.css";
|
||||
import { Provider } from "react-redux";
|
||||
import { setVariables } from "../redux/slices/variablesSlice";
|
||||
import { setSystemSettings } from "../redux/slices/systemSettingsSlice"; // ✅ Für System-Settings
|
||||
import { setSystemSettings } from "../redux/slices/systemSettingsSlice"; // ✅ System-Settings
|
||||
import {
|
||||
setOpcUaZustand,
|
||||
setOpcUaActiveClientCount,
|
||||
setOpcUaNodesetName,
|
||||
} from "../redux/slices/opcuaSettingsSlice"; // ✅ OPC-UA Settings
|
||||
import store from "../redux/store";
|
||||
import { AppProps } from "next/app";
|
||||
import WindowVariablesInitializer from "../components/WindowVariablesInitializer";
|
||||
@@ -22,9 +27,12 @@ function MyApp({ Component, pageProps }: AppProps) {
|
||||
const variables = await loadWindowVariables();
|
||||
if (!variables) throw new Error("Sitzungsfehler");
|
||||
|
||||
// ✅ System-Settings und last20Messages separat speichern
|
||||
// ✅ OPC-UA Werte, System-Settings und last20Messages separat speichern
|
||||
const {
|
||||
last20Messages, // Entfernen für eigenes Redux-Slice
|
||||
opcUaZustand,
|
||||
opcUaActiveClientCount,
|
||||
opcUaNodesetName,
|
||||
deviceName,
|
||||
mac1,
|
||||
ip,
|
||||
@@ -56,6 +64,13 @@ function MyApp({ Component, pageProps }: AppProps) {
|
||||
})
|
||||
);
|
||||
|
||||
// ✅ Speichere OPC-UA Einstellungen in opcuaSettingsSlice
|
||||
store.dispatch(setOpcUaZustand(opcUaZustand || "Offline"));
|
||||
store.dispatch(setOpcUaActiveClientCount(opcUaActiveClientCount || 0));
|
||||
store.dispatch(
|
||||
setOpcUaNodesetName(opcUaNodesetName || "DefaultNodeset")
|
||||
);
|
||||
|
||||
// ✅ Speichere alle anderen Variablen in variablesSlice
|
||||
store.dispatch(setVariables(restVariables));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user