feat: systemSettingsSlice hinzugefügt und Header sowie Einstellungen angepasst

- Neuen Redux Slice `systemSettingsSlice` erstellt, um Systemdaten zentral zu verwalten.
- Header-Icon für Systemeinstellungen holt jetzt Daten aus `systemSettingsSlice` statt `variablesSlice`.
- Die Einstellungen-Seite (`Allgemeine Einstellungen`) wurde umgestellt und liest nun ebenfalls aus `systemSettingsSlice`.
- UI-Optimierungen für die Einstellungen-Seite, um alle Eingabefelder kompakter darzustellen.
This commit is contained in:
Ismail Ali
2025-02-23 09:09:47 +01:00
parent 262e8b1527
commit b85c8c67e2
10 changed files with 332 additions and 148 deletions

View File

@@ -0,0 +1,48 @@
// /redux/slices/systemSettingsSlice.ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
interface SystemSettingsState {
deviceName: string | null;
mac1: string | null;
ip: string | null;
subnet: string | null;
gateway: string | null;
cplInternalTimestamp: string | null;
ntp1: string | null;
ntp2: string | null;
ntp3: string | null;
ntpTimezone: string | null;
ntpActive: boolean | null;
}
const initialState: SystemSettingsState = {
deviceName: "",
mac1: "",
ip: "",
subnet: "",
gateway: "",
cplInternalTimestamp: "",
ntp1: "",
ntp2: "",
ntp3: "",
ntpTimezone: "",
ntpActive: false,
};
const systemSettingsSlice = createSlice({
name: "systemSettings",
initialState,
reducers: {
setSystemSettings: (
state,
action: PayloadAction<Partial<SystemSettingsState>>
) => {
return { ...state, ...action.payload };
},
resetSystemSettings: () => initialState,
},
});
export const { setSystemSettings, resetSystemSettings } =
systemSettingsSlice.actions;
export default systemSettingsSlice.reducer;

View File

@@ -15,17 +15,6 @@ export interface VariablesState {
schleifenintervall: number[];
//---------------
deviceName: string | null;
mac1: string | null;
ip: string | null;
subnet: string | null;
gateway: string | null;
cplInternalTimestamp: string | null;
ntp1: string | null;
ntp2: string | null;
ntp3: string | null;
ntpTimezone: string | null;
ntpActive: boolean | null;
de: string | null;
counter: number | null;
flutter: string | null;
@@ -79,17 +68,6 @@ const initialState: VariablesState = {
schleifenintervall: [],
//---------------
deviceName: null,
mac1: null,
ip: null,
subnet: null,
gateway: null,
cplInternalTimestamp: null,
ntp1: null,
ntp2: null,
ntp3: null,
ntpTimezone: null,
ntpActive: null,
de: null,
counter: null,
flutter: null,

View File

@@ -7,6 +7,7 @@ import webVersionReducer from "./slices/webVersionSlice";
import digitalInputsReducer from "./slices/digitalInputsSlice";
import kabelueberwachungChartReducer from "./slices/kabelueberwachungChartSlice";
import dashboardReducer from "./slices/dashboardSlice";
import systemSettingsReducer from "./slices/systemSettingsSlice";
const store = configureStore({
reducer: {
@@ -17,6 +18,7 @@ const store = configureStore({
digitalInputs: digitalInputsReducer,
kabelueberwachungChart: kabelueberwachungChartReducer,
dashboard: dashboardReducer,
systemSettings: systemSettingsReducer,
},
});