refactor: Systemdaten über eigenen Redux Thunk und Service laden
- Systeminformationen (IP, Subnetz, Gateway, NTP, etc.) werden nun über fetchSystemSettingsThunk geladen - loadWindowVariables.ts von systemSettings-Logik bereinigt - Aufruf erfolgt lokal in NetworkInfo.tsx statt global in _app.tsx - Verbesserte Struktur, reduzierte Netzwerklast, klarere Trennung der Zuständigkeiten
This commit is contained in:
@@ -46,18 +46,6 @@ interface OpcUaSettings {
|
||||
export async function loadWindowVariables(): Promise<Record<string, any>> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const requiredVars: string[] = [
|
||||
"win_deviceName",
|
||||
"win_mac1",
|
||||
"win_ip",
|
||||
"win_subnet",
|
||||
"win_gateway",
|
||||
"win_cplInternalTimestamp",
|
||||
"win_ntp1",
|
||||
"win_ntp2",
|
||||
"win_ntp3",
|
||||
"win_systemZeit",
|
||||
"win_ntpTimezone",
|
||||
"win_ntpActive",
|
||||
"win_de_state",
|
||||
"win_counter",
|
||||
"win_flutter",
|
||||
@@ -135,7 +123,6 @@ export async function loadWindowVariables(): Promise<Record<string, any>> {
|
||||
);
|
||||
|
||||
// ✅ Redux mit Systemvariablen aktualisieren
|
||||
loadAndStoreSystemSettings(win);
|
||||
|
||||
resolve(variablesObj);
|
||||
})
|
||||
@@ -146,25 +133,6 @@ export async function loadWindowVariables(): Promise<Record<string, any>> {
|
||||
});
|
||||
}
|
||||
|
||||
// ✅ Funktion zum Speichern von System-Variablen in Redux
|
||||
const loadAndStoreSystemSettings = (win: CustomWindow) => {
|
||||
const settings: SystemSettings = {
|
||||
deviceName: win.win_deviceName || "",
|
||||
mac1: win.win_mac1 || "",
|
||||
ip: win.win_ip || "",
|
||||
subnet: win.win_subnet || "",
|
||||
gateway: win.win_gateway || "",
|
||||
cplInternalTimestamp: win.win_cplInternalTimestamp || "",
|
||||
ntp1: win.win_ntp1 || "",
|
||||
ntp2: win.win_ntp2 || "",
|
||||
ntp3: win.win_ntp3 || "",
|
||||
ntpTimezone: win.win_ntpTimezone || "",
|
||||
ntpActive: win.win_ntpActive || false,
|
||||
};
|
||||
|
||||
store.dispatch(setSystemSettings(settings));
|
||||
};
|
||||
|
||||
// ✅ Funktion zum Speichern der digitalen Ausgänge in Redux
|
||||
const loadAndStoreDigitalOutputs = (win: CustomWindow) => {
|
||||
console.log("Prüfe digitale Ausgänge in window:");
|
||||
|
||||
Reference in New Issue
Block a user