fix: Initial-Bezeichnung für KÜ "---" entfernt

This commit is contained in:
ISA
2024-11-14 07:14:26 +01:00
parent 1420569a59
commit 81076559a6
2 changed files with 23 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons
import handleSave from "./handlers/handleSave";
import handleDisplayEinschalten from "./handlers/handleDisplayEinschalten";
import handleChange from "./handlers/handleChange";
import firmwareUpdate from "./handlers/firmwareUpdate";
function decodeToken(token) {
try {
@@ -21,8 +22,8 @@ function decodeToken(token) {
function KueModal({ showModal, onClose, slot, onModulNameChange }) {
const [isAdmin, setIsAdmin] = useState(false);
const dispatch = useDispatch();
const [ids, setIds] = useState(Array(32).fill("---"));
const [bezeichnungen, setBezeichnungen] = useState(Array(32).fill("---"));
const [ids, setIds] = useState(Array(32).fill(""));
const [bezeichnungen, setBezeichnungen] = useState(Array(32).fill(""));
const [isolationsgrenzwerte, setIsolationsgrenzwerte] = useState(
Array(32).fill(10.0)
);
@@ -242,7 +243,10 @@ function KueModal({ showModal, onClose, slot, onModulNameChange }) {
<div className="flex justify-end bg-gray-100 p-4 rounded-b-lg">
{/* Bedingte Anzeige der Firmware-Update-Schaltfläche */}
{isAdmin && (
<button className="bg-littwin-blue text-white p-2 rounded flex items-center mr-2">
<button
onClick={() => firmwareUpdate(slot)}
className="bg-littwin-blue text-white p-2 rounded flex items-center mr-2"
>
Firmware Update
</button>
)}

View File

@@ -0,0 +1,16 @@
const firmwareUpdate = (slot) => {
const url = `${window.location.origin}/CPL?/kabelueberwachung.html&KSU${slot}=1`;
fetch(url, { method: "GET" })
.then((response) => {
if (response.ok) {
alert(`Update an ${slot + 1} erfolgreich gestartet!`);
} else {
alert("Fehler beim Update!");
}
})
.catch((error) => {
console.error("Fehler:", error);
alert("Fehler beim Update!");
});
};
export default firmwareUpdate;