Modul vorhanden test

This commit is contained in:
ISA
2024-10-16 08:01:54 +02:00
parent 0fb0e67df4
commit 8ef87d3779
3 changed files with 138 additions and 98 deletions

View File

@@ -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() {
</div>
{/* Slots for the active rack */}
<div className="flex flex-row justify-between">
<div className="flex flex-row justify-between">
{racks[`rack${activeRack}`].map((slot, index) => (
<div key={index} className="flex-grow">
<Kue705FO
isolationswert={slot.isolationswert}
schleifenwiderstand={slot.schleifenwiderstand}
modulName={slot.modulName}
kueOnline={kueOnline}
slotIndex={index + (activeRack - 1) * 8} // Slot index calculation for each rack
/>
</div>
))}