Merge branch 'kue-modal-gesamt' into develop test sds
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
"use client"; // components/modales/settingsModal.jsx
|
||||
import React, { useState, useEffect } from "react";
|
||||
import React, { useState, useEffect } from "react"; // omponents/modales/settingsModal.jsx
|
||||
import ReactModal from "react-modal";
|
||||
import { ClipLoader } from "react-spinners";
|
||||
import "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons
|
||||
import { useSelector } from "react-redux";
|
||||
import { current } from "@reduxjs/toolkit";
|
||||
|
||||
import handleReboot from "./handlers/handleReboot";
|
||||
import handleClearDatabase from "./handlers/handleClearDatabase";
|
||||
import handleSetDateTime from "./handlers/handleSetDateTime";
|
||||
import handleSubmit from "./handlers/handleSubmit";
|
||||
|
||||
@@ -47,25 +46,25 @@ function SettingModal({ showModal, onClose }) {
|
||||
const [showRebootModal, setShowRebootModal] = useState(false);
|
||||
// Originalwerte speichern
|
||||
const [originalValues, setOriginalValues] = useState({});
|
||||
// Erzeuge das currentValues-Objekt aus den aktuellen State-Werten
|
||||
const currentValues = {
|
||||
name,
|
||||
ip,
|
||||
subnet,
|
||||
gateway,
|
||||
ntp1,
|
||||
ntp2,
|
||||
ntp3,
|
||||
ntpTimezone,
|
||||
active,
|
||||
};
|
||||
// Effekt, um Redux-Werte beim Anzeigen des Modals in lokale State-Variablen zu setzen
|
||||
// Initialisiere currentPath für die gesamte Datei
|
||||
let currentPath = window.location.pathname;
|
||||
if (!currentPath.endsWith(".html")) {
|
||||
currentPath += ".html";
|
||||
}
|
||||
const handleSubmitWrapper = () => {
|
||||
handleSubmit(originalValues, {
|
||||
name,
|
||||
ip,
|
||||
subnet,
|
||||
gateway,
|
||||
ntp1,
|
||||
ntp2,
|
||||
ntp3,
|
||||
ntpTimezone,
|
||||
active,
|
||||
});
|
||||
};
|
||||
|
||||
//---------------------------------------------------
|
||||
// Setze initiale Werte nur beim Öffnen des Modals
|
||||
useEffect(() => {
|
||||
@@ -114,6 +113,7 @@ function SettingModal({ showModal, onClose }) {
|
||||
setSystemUhr(datetime_Redux || "");
|
||||
}, [datetime_Redux]);
|
||||
//---------------------------------------------------
|
||||
|
||||
return (
|
||||
<>
|
||||
<ReactModal
|
||||
@@ -316,7 +316,7 @@ function SettingModal({ showModal, onClose }) {
|
||||
Datenbank leeren
|
||||
</button>
|
||||
<button
|
||||
onClick={handleSubmitWrapper}
|
||||
onClick={() => handleSubmit(originalValues, currentValues)}
|
||||
className="bg-littwin-blue text-white px-4 py-2 rounded"
|
||||
>
|
||||
Übernehmen
|
||||
|
||||
Reference in New Issue
Block a user