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) =>
|
||||
|
||||
Reference in New Issue
Block a user