LED Alarm in Kabelüberwachung

This commit is contained in:
ISA
2024-10-23 19:53:17 +02:00
parent 2de4cf6403
commit 0cff3e0ccf
2 changed files with 32 additions and 21 deletions

View File

@@ -119,21 +119,31 @@ function Kabelueberwachung() {
</div>
<div className="flex flex-row space-x-4 scale-110 ml-[5%] mt-[5%]">
{racks[`rack${activeRack}`].map((slot, index) => (
<div key={index} className="flex">
<Kue705FO
isolationswert={slot.isolationswert}
schleifenwiderstand={slot.schleifenwiderstand}
modulName={slot.modulName}
kueOnline={slot.kueOnlineStatus}
slotIndex={index + (activeRack - 1) * 8}
/>
{console.log(
`Module Data (Rack ${activeRack}, Slot ${index + 1}):`,
slot
)}
</div>
))}
{racks[`rack${activeRack}`].map((slot, index) => {
const slotIndex = index + (activeRack - 1) * 8;
const alarmStatus =
(window.kueAlarm1 && window.kueAlarm1[slotIndex]) ||
(window.kueAlarm2 && window.kueAlarm2[slotIndex]) ||
(window.kueCableBreak && window.kueCableBreak[slotIndex]) ||
(window.kueGroundFault && window.kueGroundFault[slotIndex]);
return (
<div key={index} className="flex">
<Kue705FO
isolationswert={slot.isolationswert}
schleifenwiderstand={slot.schleifenwiderstand}
modulName={slot.modulName}
kueOnline={slot.kueOnlineStatus}
alarmStatus={alarmStatus} // Pass the calculated alarm status
slotIndex={slotIndex}
/>
{console.log(
`Module Data (Rack ${activeRack}, Slot ${index + 1}):`,
slot
)}
</div>
);
})}
</div>
</div>
);

View File

@@ -13,6 +13,7 @@ function Kue705FO({
kueOnline,
slotIndex,
tdrLocation,
alarmStatus,
}) {
const [currentModulName, setCurrentModulName] = useState(modulName);
const [activeButton, setActiveButton] = useState("Schleife");
@@ -177,6 +178,11 @@ function Kue705FO({
} */
//-------------------------------------------------
let slot = slotIndex;
const alarmStatus =
(window.kueAlarm1 && window.kueAlarm1[slotIndex]) ||
(window.kueAlarm2 && window.kueAlarm2[slotIndex]) ||
(window.kueCableBreak && window.kueCableBreak[slotIndex]) ||
(window.kueGroundFault && window.kueGroundFault[slotIndex]);
if (slot >= 32) {
return;
@@ -307,12 +313,7 @@ function Kue705FO({
<div className="flex items-center mt-1">
<div
className={`w-[10px] h-[10px] rounded-full mr-2 ${
(window.kueAlarm1 && slotIndex === 1) ||
(window.kueAlarm2 && slotIndex === 1) ||
(window.kueCableBreak && slotIndex === 1) ||
(window.kueGroundFault && slotIndex === 1)
? "bg-red-500"
: "bg-gray-300"
alarmStatus ? "bg-red-500" : "bg-gray-300"
}`}
></div>
<span className="text-white text-[10px]">Alarm</span>