goLoop und goTDR Funktionen implementieren
This commit is contained in:
@@ -73,6 +73,77 @@ function Kue705FO({
|
|||||||
setCurrentDisplayValue(tdrLocation || "0");
|
setCurrentDisplayValue(tdrLocation || "0");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// Funktion für die Schleifenmessung
|
||||||
|
const goLoop = () => {
|
||||||
|
let slot = slotIndex;
|
||||||
|
|
||||||
|
if (slot >= 32) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let slotFormat = slot < 10 ? `0${slot}` : `${slot}`;
|
||||||
|
|
||||||
|
setLoading(true); // Setze den Ladezustand auf true
|
||||||
|
alert(`Schleifenmessung wird für Slot ${slot + 1} gestartet...`);
|
||||||
|
|
||||||
|
fetch(`/CPL?Service/KUEdetail.HTML&KS_${slotFormat}=1&slot=${slot}`, {
|
||||||
|
method: "GET",
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (response.ok) {
|
||||||
|
alert(`Schleifenmessung erfolgreich gestartet für Slot ${slot + 1}`);
|
||||||
|
console.log("Schleifenmessung erfolgreich gestartet für Slot", slot);
|
||||||
|
} else {
|
||||||
|
alert("Fehler beim Starten der Schleifenmessung.");
|
||||||
|
console.error("Fehler beim Senden der Schleifen-Anfrage");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
alert("Ein Fehler ist aufgetreten.");
|
||||||
|
console.error("Fehler:", error);
|
||||||
|
})
|
||||||
|
.finally(() => setLoading(false)); // Ladezustand zurücksetzen
|
||||||
|
};
|
||||||
|
// Funktion für die TDR-Messung
|
||||||
|
const goTDR = () => {
|
||||||
|
//-------------------------------------------------
|
||||||
|
/* const [isClient, setIsClient] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// This will only run in the client/browser, not on the server
|
||||||
|
setIsClient(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (!isClient) {
|
||||||
|
return null; // or a loading spinner
|
||||||
|
} */
|
||||||
|
//-------------------------------------------------
|
||||||
|
let slot = slotIndex;
|
||||||
|
|
||||||
|
if (slot >= 32) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let slotFormat = slot < 10 ? `0${slot}` : `${slot}`;
|
||||||
|
|
||||||
|
setLoading(true);
|
||||||
|
alert(`TDR wird für Slot ${slot + 1} gestartet...`);
|
||||||
|
fetch(`/CPL?Service/KUEdetailTDR.ACP&KTT${slotFormat}=1&slot=${slot}`, {
|
||||||
|
method: "GET",
|
||||||
|
})
|
||||||
|
.then((response) => {
|
||||||
|
if (response.ok) {
|
||||||
|
alert(`TDR erfolgreich gestartet für Slot ${slot + 1}`);
|
||||||
|
console.log("TDR erfolgreich gestartet für Slot", slot + 1);
|
||||||
|
} else {
|
||||||
|
console.error("Fehler beim Senden der TDR-Anfrage");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Fehler:", error);
|
||||||
|
})
|
||||||
|
.finally(() => setLoading(false));
|
||||||
|
};
|
||||||
// Bestimme, welche Funktion ausgeführt wird, basierend auf dem aktiven Button
|
// Bestimme, welche Funktion ausgeführt wird, basierend auf dem aktiven Button
|
||||||
const handleRefreshClick = () => {
|
const handleRefreshClick = () => {
|
||||||
if (activeButton === "Schleife") {
|
if (activeButton === "Schleife") {
|
||||||
|
|||||||
Reference in New Issue
Block a user