From d1735d66de29616dd50bf06329323f6a97c8e474 Mon Sep 17 00:00:00 2001 From: ISA Date: Wed, 16 Oct 2024 18:08:17 +0200 Subject: [PATCH] Access und XIOPM ausblenden --- app/dashboard/page.jsx | 9 ++++++--- app/kabelueberwachung/page.jsx | 26 ++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/dashboard/page.jsx b/app/dashboard/page.jsx index b9ef7b2..315618d 100644 --- a/app/dashboard/page.jsx +++ b/app/dashboard/page.jsx @@ -253,8 +253,10 @@ function Dashboard() {
- + {/* + + */}
@@ -270,12 +272,13 @@ function Dashboard() {
{/* Die Box für XIOPM1 und XIOPM2, jeweils unter CPL und Access 1 */} +
- {/* Unter CPL */} + {/* */} {/* Unter CPL */}
- {/* Unter Access 1 */} + {/* */} {/* Unter Access 1 */}
diff --git a/app/kabelueberwachung/page.jsx b/app/kabelueberwachung/page.jsx index f33f67d..3d0e561 100644 --- a/app/kabelueberwachung/page.jsx +++ b/app/kabelueberwachung/page.jsx @@ -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 () => {