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

@@ -3,6 +3,7 @@ import React, { useState, useEffect } from "react";
import Kue705FO from "../../components/modules/Kue705FO";
function Kabelueberwachung() {
const apiUrl = process.env.NEXT_PUBLIC_API_BASE_URL;
const [activeRack, setActiveRack] = useState(1); // Track the active rack
const [kueIso, setKueIso] = useState([]); // State to store isolation values
const [kueName, setKueName] = useState([]); // State to store the KUE names
@@ -28,6 +29,9 @@ function Kabelueberwachung() {
if (window.kueOnline && Array.isArray(window.kueOnline)) {
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
@@ -60,16 +64,34 @@ function Kabelueberwachung() {
useEffect(() => {
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;
document.body.appendChild(script);
// Once the script is loaded, get the isolation values
script.onload = () => {
/* 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
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
return () => {