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:
@@ -6,5 +6,5 @@
|
||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||
|
||||
*/
|
||||
const webVersion = "1.6.92";
|
||||
const webVersion = "1.6.93";
|
||||
export default webVersion;
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ export interface VariablesState {
|
||||
obereSchleifenGrenzwerte: number[];
|
||||
schleifenintervall: number[];
|
||||
//---------------
|
||||
|
||||
de: string | null;
|
||||
counter: number | null;
|
||||
flutter: string | null;
|
||||
@@ -25,8 +24,8 @@ export interface VariablesState {
|
||||
kueAlarm1: number[];
|
||||
kueAlarm2: number[];
|
||||
kueResidence: string[];
|
||||
kueCableBreak: number[];
|
||||
kueGroundFault: number[];
|
||||
kueCableBreak: string[];
|
||||
kueGroundFault: string[];
|
||||
kueLimit1: number | null;
|
||||
kueLimit2Low: number | null;
|
||||
kueDelay1: number | null;
|
||||
@@ -50,15 +49,11 @@ export interface VariablesState {
|
||||
win_analogeEingaenge6: string | null;
|
||||
win_analogeEingaenge7: string | null;
|
||||
win_analogeEingaenge8: string | null;
|
||||
opcUaZustand: string | null;
|
||||
opcUaActiveClientCount: number | null;
|
||||
opcUaNodesetName: string | null;
|
||||
}
|
||||
|
||||
// Initialer Zustand
|
||||
const initialState: VariablesState = {
|
||||
selectedFileName: null,
|
||||
//------------
|
||||
selectedChartData: null,
|
||||
kueBezeichnungen: [],
|
||||
isolationsgrenzwerte: [],
|
||||
@@ -66,8 +61,6 @@ const initialState: VariablesState = {
|
||||
untereSchleifenGrenzwerte: [],
|
||||
obereSchleifenGrenzwerte: [],
|
||||
schleifenintervall: [],
|
||||
//---------------
|
||||
|
||||
de: null,
|
||||
counter: null,
|
||||
flutter: null,
|
||||
@@ -103,9 +96,6 @@ const initialState: VariablesState = {
|
||||
win_analogeEingaenge6: null,
|
||||
win_analogeEingaenge7: null,
|
||||
win_analogeEingaenge8: null,
|
||||
opcUaZustand: null,
|
||||
opcUaActiveClientCount: null,
|
||||
opcUaNodesetName: null,
|
||||
};
|
||||
|
||||
// Slice erstellen
|
||||
@@ -124,7 +114,6 @@ const variablesSlice = createSlice({
|
||||
(state[key] as VariablesState[keyof VariablesState]) = value;
|
||||
},
|
||||
setVariables(state, action: PayloadAction<Partial<VariablesState>>) {
|
||||
//console.log("setVariables aufgerufen mit:", action.payload);
|
||||
Object.entries(action.payload).forEach(([key, value]) => {
|
||||
(state[
|
||||
key as keyof VariablesState
|
||||
@@ -137,15 +126,6 @@ const variablesSlice = createSlice({
|
||||
setSelectedFileName(state, action: PayloadAction<string | null>) {
|
||||
state.selectedFileName = action.payload;
|
||||
},
|
||||
setOpcUaZustand(state, action: PayloadAction<string | null>) {
|
||||
state.opcUaZustand = action.payload;
|
||||
},
|
||||
setOpcUaActiveClientCount(state, action: PayloadAction<number | null>) {
|
||||
state.opcUaActiveClientCount = action.payload;
|
||||
},
|
||||
setOpcUaNodesetName(state, action: PayloadAction<string | null>) {
|
||||
state.opcUaNodesetName = action.payload;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -154,8 +134,6 @@ export const {
|
||||
setVariables,
|
||||
setSelectedChartData,
|
||||
setSelectedFileName,
|
||||
setOpcUaZustand,
|
||||
setOpcUaActiveClientCount,
|
||||
setOpcUaNodesetName,
|
||||
} = variablesSlice.actions;
|
||||
|
||||
export default variablesSlice.reducer;
|
||||
|
||||
Reference in New Issue
Block a user