feat(redux): Rename all Redux slices and store keys to match file names for clarity
- Renamed all slice names (createSlice `name` attribute) to match their file names (e.g. loopChartSlice, authSlice, kueDataSlice etc.) - Updated `store.ts` to register each reducer with consistent key names (e.g. state.loopChartSlice instead of state.loopChart) - Adjusted all `useSelector` and Redux state accesses across the codebase - Improves maintainability, searchability and consistency across files and Redux DevTools
This commit is contained in:
@@ -68,7 +68,7 @@ export const loadFromWindow = createAsyncThunk(
|
||||
|
||||
// Redux Slice
|
||||
const analogeEingaengeSlice = createSlice({
|
||||
name: "analogeEingaenge",
|
||||
name: "analogeEingaengeSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setAnalogerEingang(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
const authSlice = createSlice({
|
||||
name: "auth",
|
||||
name: "authSlice",
|
||||
initialState: {
|
||||
isAdminLoggedIn: false,
|
||||
users: {
|
||||
|
||||
@@ -18,7 +18,7 @@ const initialState: DigitalInputsState = {
|
||||
};
|
||||
|
||||
const digitalInputsSlice = createSlice({
|
||||
name: "digitalInputs",
|
||||
name: "digitalInputsSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setInputs: (state, action: PayloadAction<DigitalInput[]>) => {
|
||||
|
||||
@@ -19,7 +19,7 @@ const initialState: DigitalOutputsState = {
|
||||
|
||||
// Slice erstellen
|
||||
const digitalOutputsSlice = createSlice({
|
||||
name: "digitalOutputs",
|
||||
name: "digitalOutputsSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setDigitalOutputs(state, action: PayloadAction<DigitalOutput[]>) {
|
||||
|
||||
@@ -43,7 +43,7 @@ const initialState: KabelueberwachungChartState = {
|
||||
|
||||
// Erstellung des Slices
|
||||
const kabelueberwachungChartSlice = createSlice({
|
||||
name: "kabelueberwachungChart",
|
||||
name: "kabelueberwachungChartSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setSlotNumber: (state, action: PayloadAction<number | null>) => {
|
||||
|
||||
@@ -12,7 +12,7 @@ const initialState: KueChartModeState = {
|
||||
};
|
||||
|
||||
export const kueChartModeSlice = createSlice({
|
||||
name: "kueChartMode",
|
||||
name: "kueChartModeSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setActiveMode: (state, action: PayloadAction<"Schleife" | "TDR">) => {
|
||||
|
||||
@@ -82,7 +82,7 @@ const initialState: KueDataState = {
|
||||
};
|
||||
|
||||
const kueDataSlice = createSlice({
|
||||
name: "kueData",
|
||||
name: "kueDataSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setKueData: (state, action: PayloadAction<Partial<KueDataState>>) => {
|
||||
|
||||
@@ -10,7 +10,7 @@ const initialState: Last20MessagesSlice = {
|
||||
};
|
||||
|
||||
export const last20MessagesSlice = createSlice({
|
||||
name: "last20Messages",
|
||||
name: "last20MessagesSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setLast20Messages: (state, action: PayloadAction<string | null>) => {
|
||||
|
||||
@@ -21,7 +21,7 @@ const initialState: LoopChartState = {
|
||||
};
|
||||
|
||||
const loopChartSlice = createSlice({
|
||||
name: "loopChart",
|
||||
name: "loopChartSlice",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
|
||||
@@ -29,7 +29,7 @@ const initialState: OPCUASettingsState = {
|
||||
};
|
||||
|
||||
const opcuaSettingsSlice = createSlice({
|
||||
name: "opcuaSettings",
|
||||
name: "opcuaSettingsSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
toggleOpcUaServer(state) {
|
||||
|
||||
@@ -9,7 +9,7 @@ const initialState: SelectedChartDataState = {
|
||||
};
|
||||
|
||||
const selectedChartDataSlice = createSlice({
|
||||
name: "selectedChartData",
|
||||
name: "selectedChartDataSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setSelectedChartData(state, action: PayloadAction<any>) {
|
||||
|
||||
@@ -32,7 +32,7 @@ const initialState: SystemSettingsState = {
|
||||
};
|
||||
|
||||
const systemSettingsSlice = createSlice({
|
||||
name: "systemSettings",
|
||||
name: "systemSettingsSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setSystemSettings: (
|
||||
|
||||
@@ -16,7 +16,7 @@ const initialState: TDMChartState = {
|
||||
};
|
||||
|
||||
const tdmChartSlice = createSlice({
|
||||
name: "tdmChart",
|
||||
name: "tdmChartSlice",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
|
||||
@@ -24,7 +24,7 @@ const initialState: TDMChartState = {
|
||||
};
|
||||
|
||||
const tdmSingleChartSlice = createSlice({
|
||||
name: "tdmSingleChart",
|
||||
name: "tdmSingleChartSlice",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
|
||||
@@ -19,7 +19,7 @@ const initialState: TDRChartState = {
|
||||
};
|
||||
|
||||
const tdrChartSlice = createSlice({
|
||||
name: "tdrChart",
|
||||
name: "tdrChartSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setSelectedSlot: (state, action: PayloadAction<number>) => {
|
||||
|
||||
@@ -8,7 +8,7 @@ const initialState = {
|
||||
};
|
||||
|
||||
const tdrDataByIdSlice = createSlice({
|
||||
name: "tdrDataById",
|
||||
name: "tdrDataByIdSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setTDRChartDataById: (
|
||||
|
||||
@@ -15,7 +15,7 @@ const initialState: TDRReferenceChartState = {
|
||||
};
|
||||
|
||||
const tdrReferenceChartDataBySlotSlice = createSlice({
|
||||
name: "tdrReferenceChartDataBySlot",
|
||||
name: "tdrReferenceChartDataBySlotSlice",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
|
||||
@@ -16,7 +16,7 @@ const initialState: TDRReferenceChartState = {
|
||||
};
|
||||
|
||||
const tdrReferenceChartSlice = createSlice({
|
||||
name: "tdrReferenceChart",
|
||||
name: "tdrReferenceChartSlice",
|
||||
initialState,
|
||||
reducers: {},
|
||||
extraReducers: (builder) => {
|
||||
|
||||
@@ -11,7 +11,7 @@ const initialState: WebVersionState = {
|
||||
};
|
||||
|
||||
const webVersionSlice = createSlice({
|
||||
name: "webVersion",
|
||||
name: "webVersionSlice",
|
||||
initialState,
|
||||
reducers: {
|
||||
setWebVersion(state, action: PayloadAction<string>) {
|
||||
|
||||
@@ -24,26 +24,26 @@ import tdrReferenceChartDataBySlotReducer from "./slices/tdrReferenceChartDataBy
|
||||
|
||||
const store = configureStore({
|
||||
reducer: {
|
||||
auth: authReducer,
|
||||
kueChartMode: kueChartModeReducer,
|
||||
webVersion: webVersionReducer,
|
||||
digitalInputs: digitalInputsReducer,
|
||||
kabelueberwachungChart: kabelueberwachungChartReducer,
|
||||
last20Messages: last20MessagesReducer,
|
||||
systemSettings: systemSettingsReducer,
|
||||
opcuaSettings: opcuaSettingsReducer,
|
||||
digitalOutputs: digitalOutputsReducer,
|
||||
analogeEingaenge: analogeEingaengeReducer,
|
||||
brush: brushReducer,
|
||||
tdrChart: tdrChartReducer,
|
||||
tdrReferenceChart: tdrReferenceChartReducer,
|
||||
loopChart: loopChartReducer,
|
||||
tdmChart: tdmChartReducer,
|
||||
tdrDataById: tdrDataByIdReducer,
|
||||
kueData: kueDataReducer,
|
||||
selectedChartData: selectedChartDataReducer,
|
||||
tdmSingleChart: tdmSingleChartReducer,
|
||||
tdrReferenceChartDataBySlot: tdrReferenceChartDataBySlotReducer,
|
||||
authSlice: authReducer,
|
||||
kueChartModeSlice: kueChartModeReducer,
|
||||
webVersionSlice: webVersionReducer,
|
||||
digitalInputsSlice: digitalInputsReducer,
|
||||
kabelueberwachungChartSlice: kabelueberwachungChartReducer,
|
||||
last20MessagesSlice: last20MessagesReducer,
|
||||
systemSettingsSlice: systemSettingsReducer,
|
||||
opcuaSettingsSlice: opcuaSettingsReducer,
|
||||
digitalOutputsSlice: digitalOutputsReducer,
|
||||
analogeEingaengeSlice: analogeEingaengeReducer,
|
||||
brushSlice: brushReducer,
|
||||
tdrChartSlice: tdrChartReducer,
|
||||
tdrReferenceChartSlice: tdrReferenceChartReducer,
|
||||
loopChartSlice: loopChartReducer,
|
||||
tdmChartSlice: tdmChartReducer,
|
||||
tdrDataByIdSlice: tdrDataByIdReducer,
|
||||
kueDataSlice: kueDataReducer,
|
||||
selectedChartDataSlice: selectedChartDataReducer,
|
||||
tdmSingleChartSlice: tdmSingleChartReducer,
|
||||
tdrReferenceChartDataBySlotSlice: tdrReferenceChartDataBySlotReducer,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user