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