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

View File

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