mockData in app/api/
This commit is contained in:
@@ -7,18 +7,25 @@ function Kue705FO({
|
||||
kueVersion = "V4.19", // Optionaler Parameter für die Version (Standardwert)
|
||||
kueOnline, // Array für den Modulstatus (1: Modul vorhanden, 0: kein Modul)
|
||||
slotIndex, // Der Index des Slots, für den die Anzeige gilt
|
||||
tdrLocation, // Wert für die TDR-Entfernung
|
||||
}) {
|
||||
const [activeButton, setActiveButton] = useState("Schleife");
|
||||
const [displayText, setDisplayText] = useState("Schleifenwiderstand [kOhm]");
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [currentDisplayValue, setCurrentDisplayValue] = useState(
|
||||
schleifenwiderstand || "0"
|
||||
); // Wert, der im unteren Display angezeigt wird
|
||||
|
||||
// Funktion zum Wechseln der Buttons und Anpassen des Anzeigewerts
|
||||
const handleButtonClick = (button) => {
|
||||
if (button === "Schleife") {
|
||||
setActiveButton("Schleife");
|
||||
setDisplayText("Schleifenwiderstand [kOhm]");
|
||||
setCurrentDisplayValue(schleifenwiderstand || "0");
|
||||
} else if (button === "TDR") {
|
||||
setActiveButton("TDR");
|
||||
setDisplayText("Entfernung [Km]");
|
||||
setCurrentDisplayValue(tdrLocation || "0");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -43,11 +50,6 @@ function Kue705FO({
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
console.log("TDR erfolgreich gestartet für Slot", slot);
|
||||
console.log(
|
||||
"URL:",
|
||||
`${apiUrl}/CPL?Service/KUEdetailTDR.ACP&KTT${slotFormat}=1&slot=${slot}`
|
||||
);
|
||||
console.log("Antwort:", response);
|
||||
} else {
|
||||
console.error("Fehler beim Senden der TDR-Anfrage");
|
||||
}
|
||||
@@ -79,11 +81,6 @@ function Kue705FO({
|
||||
.then((response) => {
|
||||
if (response.ok) {
|
||||
console.log("Schleifenmessung erfolgreich gestartet für Slot", slot);
|
||||
console.log(
|
||||
"URL:",
|
||||
`${apiUrl}/CPL?Service/KUEdetail.HTML&KS_${slotFormat}=1&slot=${slot}`
|
||||
);
|
||||
console.log("Antwort:", response);
|
||||
} else {
|
||||
console.error("Fehler beim Senden der Schleifen-Anfrage");
|
||||
}
|
||||
@@ -161,6 +158,7 @@ function Kue705FO({
|
||||
{displayText}
|
||||
</span>
|
||||
|
||||
{/* Unterer Bereich, der den dynamischen Wert anzeigt */}
|
||||
<div className="relative w-full h-[45px] bg-gray-100 border border-gray-400 flex items-center justify-center mt-3">
|
||||
<button
|
||||
onClick={handleRefreshClick} // Dynamische Funktion basierend auf aktivem Button
|
||||
@@ -172,11 +170,12 @@ function Kue705FO({
|
||||
|
||||
<div className="absolute bottom-[5px] left-1/2 transform -translate-x-1/2">
|
||||
<div className="top-[220px] left-[10px] text-black text-[10px]">
|
||||
<p>{schleifenwiderstand || "0"} kOhm</p>
|
||||
<p>{currentDisplayValue}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Buttons für Schleife und TDR */}
|
||||
<div className="flex mt-2 space-x-1">
|
||||
<button
|
||||
onClick={() => handleButtonClick("Schleife")}
|
||||
|
||||
Reference in New Issue
Block a user