OPCUA Info Lesen in dashboard

This commit is contained in:
ISA
2025-02-10 07:38:09 +01:00
parent 34ff252d80
commit 89c36fc071
12 changed files with 108 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
// redux/store/authSlice.ts
// redux/slices/authSlice.ts
import { createSlice } from "@reduxjs/toolkit";
const authSlice = createSlice({

View File

@@ -1,4 +1,4 @@
// redux/store/variablesSlice.ts
// redux/slices/variablesSlice.ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { DataTDR } from "../types/chartDataTypesTDR";
@@ -61,6 +61,9 @@ 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
@@ -122,6 +125,9 @@ const initialState: VariablesState = {
win_analogeEingaenge6: null,
win_analogeEingaenge7: null,
win_analogeEingaenge8: null,
opcUaZustand: null,
opcUaActiveClientCount: null,
opcUaNodesetName: null,
};
// Slice erstellen
@@ -152,6 +158,15 @@ 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;
},
},
});
@@ -160,5 +175,8 @@ export const {
setVariables,
setSelectedChartData,
setSelectedFileName,
setOpcUaZustand,
setOpcUaActiveClientCount,
setOpcUaNodesetName,
} = variablesSlice.actions;
export default variablesSlice.reducer;

16
redux/store.ts Normal file
View File

@@ -0,0 +1,16 @@
// redux/store.ts
import { configureStore } from "@reduxjs/toolkit";
import authReducer from "./slices/authSlice";
import variablesReducer from "./slices/variablesSlice";
const store = configureStore({
reducer: {
auth: authReducer,
variables: variablesReducer,
},
});
export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
export default store;

View File

@@ -1,11 +0,0 @@
// redux/store/rootReducer.ts
import { combineReducers } from "redux";
import variablesReducer from "./variablesSlice";
import authReducer from "./authSlice";
const rootReducer = combineReducers({
variables: variablesReducer,
auth: authReducer,
});
export default rootReducer;

View File

@@ -1,16 +0,0 @@
// redux/store/store.ts
import { configureStore } from "@reduxjs/toolkit";
import rootReducer from "./rootReducer";
const store = configureStore({
reducer: rootReducer,
//devTools: process.env.NODE_ENV !== "production",
});
// Exportiere den Typ RootState für den gesamten State
export type RootState = ReturnType<typeof rootReducer>;
export type AppDispatch = typeof store.dispatch;
export default store;
//devTools: process.env.NODE_ENV !== "production", // Aktiviert DevTools nur in der Entwicklung