diff --git a/.env.local b/.env.local index b022440..8b0fee5 100644 --- a/.env.local +++ b/.env.local @@ -1,4 +1,4 @@ #Next.js Webserver, bleibt localhost auf CPL bei production -NEXT_PUBLIC_API_BASE_URL=http://localhost:3000 +#NEXT_PUBLIC_API_BASE_URL=http://localhost:3000 #CPL Webserver für die Entwicklung , um Daten von CPL zu bekommen, hat funktioniert auf dem CPL selbst -#NEXT_PUBLIC_API_BASE_URL=https://10.10.0.118:443 +NEXT_PUBLIC_API_BASE_URL=https://10.10.0.118:443 diff --git a/app/kabelueberwachung/page.jsx b/app/kabelueberwachung/page.jsx index b9cc03b..51e8b5a 100644 --- a/app/kabelueberwachung/page.jsx +++ b/app/kabelueberwachung/page.jsx @@ -7,6 +7,8 @@ function Kabelueberwachung() { const [kueIso, setKueIso] = useState([]); // State to store isolation values const [kueName, setKueName] = useState([]); // State to store the KUE names const [schleifenwiderstand, setSchleifenwiderstand] = useState([]); // State to store the resistance values + //const [kueOnline, setKueOnline] = useState([ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]); // Example array for module status + const [kueOnline, setKueOnline] = useState([]); // State to store the module status // Function to handle rack change const changeRack = (rack) => { @@ -30,21 +32,25 @@ function Kabelueberwachung() { isolationswert: value, // Isolation value for this slot schleifenwiderstand: schleifenwiderstand[index], // Resistance for this slot modulName: kueName[index] || "Unknown", // Name for this slot + kueOnlineStatus: kueOnline[index], // Online status for this slot })), rack2: kueIso.slice(8, 16).map((value, index) => ({ isolationswert: value, schleifenwiderstand: schleifenwiderstand[8 + index], modulName: kueName[8 + index] || "Unknown", + kueOnlineStatus: kueOnline[8 + index], // Online status for this slot })), rack3: kueIso.slice(16, 24).map((value, index) => ({ isolationswert: value, schleifenwiderstand: schleifenwiderstand[16 + index], modulName: kueName[16 + index] || "Unknown", + kueOnlineStatus: kueOnline[16 + index], // Online status for this slot })), rack4: kueIso.slice(24, 32).map((value, index) => ({ isolationswert: value, schleifenwiderstand: schleifenwiderstand[24 + index], modulName: kueName[24 + index] || "Unknown", + kueOnlineStatus: kueOnline[24 + index], // Online status for this slot })), }; @@ -108,13 +114,15 @@ function Kabelueberwachung() { {/* Slots for the active rack */} -
+
{racks[`rack${activeRack}`].map((slot, index) => (
))} diff --git a/components/modules/Kue705FO.jsx b/components/modules/Kue705FO.jsx index 871e974..22171a1 100644 --- a/components/modules/Kue705FO.jsx +++ b/components/modules/Kue705FO.jsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import { Icon } from "@iconify/react"; // Für Iconify Icons function Kue705FO({ @@ -6,114 +6,146 @@ function Kue705FO({ schleifenwiderstand, // Übergabeparameter für den Schleifenwiderstand modulName, // Übergabeparameter für den Modulnamen 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 }) { + const [activeButton, setActiveButton] = useState("Schleife"); + const [displayText, setDisplayText] = useState("Schleifenwiderstand [kOhm]"); + + const handleButtonClick = (button) => { + if (button === "Schleife") { + setActiveButton("Schleife"); + setDisplayText("Schleifenwiderstand [kOhm]"); + } else if (button === "TDR") { + setActiveButton("TDR"); + setDisplayText("Entfernung [Km]"); + } + }; + + // Überprüfe, ob ein Modul im Slot vorhanden ist + const isModulPresent = kueOnline[slotIndex] === 1; + return (
- {/* Hauptkörper - Linker Bereich */} -
- {/* Header-Bereich mit Slotnummer und Zahnrad */} -
- {/* Slotnummer */} -
- 1 -
+ {isModulPresent ? ( + <> + {/* Hauptkörper - Linker Bereich */} +
+ {/* Header-Bereich mit Slotnummer und Zahnrad */} +
+ {/* Slotnummer */} +
+ {slotIndex + 1} +
- {/* KÜ705-FO Text */} -

KÜ705-FO

+ {/* KÜ705-FO Text */} +

KÜ705-FO

- {/* Zahnrad-Icon */} - -
+ {/* Zahnrad-Icon */} + +
- {/* Betrieb und Alarm Status */} -
-
-
- Betrieb -
-
-
- Alarm -
-
+ {/* Betrieb und Alarm Status */} +
+
+
+ Betrieb +
+
+
+ Alarm +
+
- {/* Isolationswert-Anzeige */} -
-
- {isolationswert || ">200"}{" "} - {/* Dynamischer Isolationswert */} -
ISO MOhm
-
-
+ {/* Isolationswert-Anzeige */} +
+
+ {isolationswert || ">200"}{" "} + {/* Dynamischer Isolationswert */} +
ISO MOhm
+
+
- {/* Weiße Linien */} -
-
+ {/* Weiße Linien */} +
+
- {/* Modulname-Anzeige */} -
- {modulName || "Test1"} {/* Dynamischer Modulname */} -
+ {/* Modulname-Anzeige */} +
+ {modulName || "Test1"} {/* Dynamischer Modulname */} +
- {/* Version */} -
- {kueVersion} {/* Dynamische Version */} -
-
- - {/* Unterer Bereich - Schleifenwiderstand und Messkurve */} -
- - Schleifenwiderstand [kOhm] - - {/* Schleifenwiderstand Anzeige */} -
- {/* Icon rechts oben */} - - - {/* Wertanzeige */} -
- {/* Dynamischer Schleifenwiderstand */} -
-

{schleifenwiderstand || "0"} kOhm

+ {/* Version */} +
+ {kueVersion} {/* Dynamische Version */}
-
- {/* Schleife und TDR Buttons nebeneinander */} -
- - -
+ {/* Unterer Bereich - Schleifenwiderstand und Messkurve */} +
+ + {displayText} + + {/* Schleifenwiderstand Anzeige */} +
+ {/* Icon rechts oben */} + - {/* Messkurve Button */} - -
+ {/* Wertanzeige */} +
+ {/* Dynamischer Schleifenwiderstand */} +
+

{schleifenwiderstand || "0"} kOhm

+
+
+
+ + {/* Schleife und TDR Buttons nebeneinander */} +
+ + +
+ + {/* Messkurve Button */} + +
+ + ) : ( +
+

Kein Modul im Slot {slotIndex + 1}

+
+ )}
); }