Access und XIOPM ausblenden

This commit is contained in:
ISA
2024-10-16 18:08:17 +02:00
parent b425a1f38f
commit d1735d66de
2 changed files with 30 additions and 5 deletions

View File

@@ -253,8 +253,10 @@ function Dashboard() {
<div className="bg-gray-50 rounded-lg shadow-sm border border-gray-200 justify-between space-y-1"> <div className="bg-gray-50 rounded-lg shadow-sm border border-gray-200 justify-between space-y-1">
<div className="flex flex-row item-center justify-between p-1"> <div className="flex flex-row item-center justify-between p-1">
<CPLStatus /> <CPLStatus />
<Access1Status /> {/*
<Access1Status />
<Access2Status /> <Access2Status />
*/}
</div> </div>
<div className="flex flex-col item-center justify-between gap-1"> <div className="flex flex-col item-center justify-between gap-1">
<div className="flex flex-row item-center justify-between space-y-0"> <div className="flex flex-row item-center justify-between space-y-0">
@@ -270,12 +272,13 @@ function Dashboard() {
</div> </div>
</div> </div>
{/* Die Box für XIOPM1 und XIOPM2, jeweils unter CPL und Access 1 */} {/* Die Box für XIOPM1 und XIOPM2, jeweils unter CPL und Access 1 */}
<div className="grid grid-cols-3 gap-4 p-4"> <div className="grid grid-cols-3 gap-4 p-4">
<div className="flex justify-start items-center"> <div className="flex justify-start items-center">
<XioPM1Status /> {/* Unter CPL */} {/* <XioPM1Status />*/} {/* Unter CPL */}
</div> </div>
<div className="flex justify-center items-center"> <div className="flex justify-center items-center">
<XioPM2Status /> {/* Unter Access 1 */} {/*<XioPM2Status /> */} {/* Unter Access 1 */}
</div> </div>
</div> </div>
</div> </div>

View File

@@ -3,6 +3,7 @@ import React, { useState, useEffect } from "react";
import Kue705FO from "../../components/modules/Kue705FO"; import Kue705FO from "../../components/modules/Kue705FO";
function Kabelueberwachung() { function Kabelueberwachung() {
const apiUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
const [activeRack, setActiveRack] = useState(1); // Track the active rack const [activeRack, setActiveRack] = useState(1); // Track the active rack
const [kueIso, setKueIso] = useState([]); // State to store isolation values const [kueIso, setKueIso] = useState([]); // State to store isolation values
const [kueName, setKueName] = useState([]); // State to store the KUE names const [kueName, setKueName] = useState([]); // State to store the KUE names
@@ -28,6 +29,9 @@ function Kabelueberwachung() {
if (window.kueOnline && Array.isArray(window.kueOnline)) { if (window.kueOnline && Array.isArray(window.kueOnline)) {
setKueOnline(window.kueOnline); // Store the module status from the global variable setKueOnline(window.kueOnline); // Store the module status from the global variable
} }
if (window.kueName && Array.isArray(window.kueName)) {
setKueName(window.kueName); // Store the KUE names from the global variable
}
}, []); }, []);
// Data for each rack, using isolation values from kueIso, kueName, and schleifenwiderstand // Data for each rack, using isolation values from kueIso, kueName, and schleifenwiderstand
@@ -60,16 +64,34 @@ function Kabelueberwachung() {
useEffect(() => { useEffect(() => {
const script = document.createElement("script"); const script = document.createElement("script");
script.src = "CPL?Service/kueData.js"; // Path to your JavaScript file script.src = `${apiUrl}CPL?Service/kueData.js`; // Path to your JavaScript file
script.async = true; script.async = true;
document.body.appendChild(script); document.body.appendChild(script);
// Once the script is loaded, get the isolation values // Once the script is loaded, get the isolation values
script.onload = () => { /* script.onload = () => {
if (window.kueName && Array.isArray(window.kueName)) { if (window.kueName && Array.isArray(window.kueName)) {
setKueName(window.kueName); // Store the KUE names from the global variable setKueName(window.kueName); // Store the KUE names from the global variable
} }
}; */
// Cleanup the script if the component unmounts
return () => {
document.body.removeChild(script);
}; };
}, []);
useEffect(() => {
const script = document.createElement("script");
script.src = "CPL?last20Messages.acp"; // Path to your JavaScript file
script.async = true;
document.body.appendChild(script);
// Once the script is loaded, get the isolation values
/* script.onload = () => {
if (window.kueName && Array.isArray(window.kueName)) {
setKueName(window.kueName); // Store the KUE names from the global variable
}
}; */
// Cleanup the script if the component unmounts // Cleanup the script if the component unmounts
return () => { return () => {