Bei Kabelbruch (cableBreak), Erdschluss (groundFault), Isolationsfehler (measure1Alarm) oder Schleifenfehler (measure2Alarm) wird der Status rot angezeigt. Ansonsten grün.
This commit is contained in:
@@ -8,7 +8,7 @@ import SettingsModal from "./modales/SettingsModal";
|
||||
|
||||
function Header() {
|
||||
const [isClient, setIsClient] = useState(false);
|
||||
const [apiUrl, setApiUrl] = useState("");
|
||||
|
||||
const [stationsname, setStationsname] = useState("Lädt..."); // Platzhalter
|
||||
const [cplStatus, setCplStatus] = useState("Lädt...");
|
||||
const [showSettingsModal, setShowSettingsModal] = useState(false);
|
||||
@@ -31,10 +31,9 @@ function Header() {
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== "undefined") {
|
||||
loadWindowVariables(apiUrl)
|
||||
loadWindowVariables()
|
||||
.then(() => {
|
||||
if (window.ip) {
|
||||
setApiUrl(`https://${window.ip}:443`);
|
||||
setStationsname(window.deviceName || "Unbekannt");
|
||||
setCplStatus(window.hardware_version || "Unbekannt");
|
||||
} else {
|
||||
@@ -60,7 +59,13 @@ function Header() {
|
||||
|
||||
files.forEach((file) => {
|
||||
const script = document.createElement("script");
|
||||
script.src = `/CPL?/CPL/SERVICE/${file}`;
|
||||
const environment = process.env.NODE_ENV;
|
||||
if (environment === "production") {
|
||||
script.src = `/CPL?/CPL/SERVICE/${file}`; // Produktions-Pfad
|
||||
} else {
|
||||
script.src = `/CPL/CPL/SERVICE/${file}`; // Entwicklungs-Pfad
|
||||
}
|
||||
//script.src = `/CPL?/CPL/SERVICE/${file}`;
|
||||
script.async = true;
|
||||
script.onload = () => console.log(`${file} wurde erfolgreich geladen.`);
|
||||
script.onerror = (error) =>
|
||||
|
||||
@@ -7,7 +7,7 @@ function SettingModal({ showModal, onClose }) {
|
||||
const [name, setName] = useState("CPLV4");
|
||||
const [mac1, setMac1] = useState("0 48 86 81 46 157");
|
||||
const [mac2, setMac2] = useState("0 48 86 81 46 158");
|
||||
const [ip, setIp] = useState("10.10.0.118");
|
||||
const [ip, setIp] = useState("");
|
||||
const [subnet, setSubnet] = useState("255.255.255.0");
|
||||
const [gateway, setGateway] = useState("10.10.0.1");
|
||||
const [systemUhr, setSystemUhr] = useState("16.10.24 15:27:23 Uhr");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"use client";
|
||||
"use client"; // components/modules/Kue705FO.jsx
|
||||
import React, { useState, useEffect } from "react";
|
||||
import ReactModal from "react-modal";
|
||||
import Chart from "chart.js/auto";
|
||||
@@ -288,7 +288,9 @@ function Kue705FO({
|
||||
slot={slotIndex}
|
||||
onModulNameChange={handleModulNameChange}
|
||||
/>
|
||||
|
||||
{/*
|
||||
Bei Kabelbruch (cableBreak), Erdschluss (groundFault), Isolationsfehler (measure1Alarm) oder Schleifenfehler (measure2Alarm)
|
||||
*/}
|
||||
<div className="flex flex-col mt-[10px] ml-[10px]">
|
||||
<div className="flex items-center">
|
||||
<div className="w-[10px] h-[10px] bg-green-500 rounded-full mr-2"></div>
|
||||
@@ -297,7 +299,10 @@ function Kue705FO({
|
||||
<div className="flex items-center mt-1">
|
||||
<div
|
||||
className={`w-[10px] h-[10px] rounded-full mr-2 ${
|
||||
window.kueAlarm1 && slotIndex === 1
|
||||
(window.kueAlarm1 && slotIndex === 1) ||
|
||||
(window.kueAlarm2 && slotIndex === 1) ||
|
||||
(window.kueCableBreak && slotIndex === 1) ||
|
||||
(window.kueGroundFault && slotIndex === 1)
|
||||
? "bg-red-500"
|
||||
: "bg-gray-300"
|
||||
}`}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// components/modulesStatus/KabelModulStatus.jsx
|
||||
//Bei Kabelbruch (cableBreak), Erdschluss (groundFault), Isolationsfehler (measure1Alarm) oder Schleifenfehler (measure2Alarm) wird der Status rot angezeigt. Ansonsten grün.
|
||||
import React from "react";
|
||||
|
||||
const KabelModulStatus = ({ slot, kueCableBreak, isOnline, moduleVersion }) => {
|
||||
@@ -26,6 +27,9 @@ const KabelModulStatus = ({ slot, kueCableBreak, isOnline, moduleVersion }) => {
|
||||
}
|
||||
|
||||
const isCableBreak = kueCableBreak[slot - 1] === 1;
|
||||
const isAlarm1 = kueAlarm1[slot - 1] === 1;
|
||||
const isAlarm2 = kueAlarm2[slot - 1] === 1;
|
||||
const groundFault = kueGroundFault[slot - 1] === 1;
|
||||
|
||||
return (
|
||||
<div className="border border-gray-400 w-10 h-20 flex flex-col">
|
||||
@@ -38,7 +42,9 @@ const KabelModulStatus = ({ slot, kueCableBreak, isOnline, moduleVersion }) => {
|
||||
{/* Status-Anzeige */}
|
||||
<div
|
||||
className={`w-full h-2/6 ${
|
||||
isCableBreak ? "bg-red-500" : "bg-green-500"
|
||||
isCableBreak || isAlarm1 || isAlarm2 || groundFault
|
||||
? "bg-red-500"
|
||||
: "bg-green-500"
|
||||
}`}
|
||||
></div>
|
||||
<div className="bg-littwin-blue w-full h-1/6"></div>
|
||||
|
||||
Reference in New Issue
Block a user