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:
48
redux/slices/systemSettingsSlice.ts
Normal file
48
redux/slices/systemSettingsSlice.ts
Normal 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;
|
||||
Reference in New Issue
Block a user