fix: Initial-Bezeichnung für KÜ "---" entfernt
This commit is contained in:
@@ -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>
|
||||
)}
|
||||
|
||||
16
components/modales/kueModal/handlers/firmwareUpdate.js
Normal file
16
components/modales/kueModal/handlers/firmwareUpdate.js
Normal 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;
|
||||
Reference in New Issue
Block a user