From c107738625fb1c65b656f2e6fecbf7d46c5bae3d Mon Sep 17 00:00:00 2001 From: ISA Date: Mon, 11 Aug 2025 11:35:03 +0200 Subject: [PATCH] fix: KVZ Button style wie die anderen (ISO, RSL, TDR) und mit eigene Modal --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 15 ++ .../kue705FO/Charts/KVZChart/KVZChartView.tsx | 146 ++++++++++++++++++ .../kabelueberwachung/kue705FO/Kue705FO.tsx | 35 +++-- package-lock.json | 4 +- package.json | 2 +- 7 files changed, 187 insertions(+), 19 deletions(-) create mode 100644 components/main/kabelueberwachung/kue705FO/Charts/KVZChart/KVZChartView.tsx diff --git a/.env.development b/.env.development index e5358fb..154c566 100644 --- a/.env.development +++ b/.env.development @@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_USE_CGI=false # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.682 +NEXT_PUBLIC_APP_VERSION=1.6.683 NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter) diff --git a/.env.production b/.env.production index e3dd9f8..ce9f21a 100644 --- a/.env.production +++ b/.env.production @@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_USE_CGI=true # App-Versionsnummer -NEXT_PUBLIC_APP_VERSION=1.6.682 +NEXT_PUBLIC_APP_VERSION=1.6.683 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d8f20c..04c0768 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +## [1.6.683] – 2025-08-11 + +- feat: migrate from Cypress to Playwright for E2E testing + +- Remove Cypress dependencies and configuration files +- Install @playwright/test with browser support +- Add playwright.config.ts with optimized settings for Next.js +- Migrate existing Cypress tests to Playwright format +- Add new E2E test scripts to package.json +- Configure GitHub Actions workflow for automated testing +- Update .gitignore for Playwright artifacts + +BREAKING CHANGE: E2E testing framework changed from Cypress to Playwright + +--- ## [1.6.682] – 2025-08-01 - git commit -m "feat: Enhance DetailModal with auto-loading and improved UX diff --git a/components/main/kabelueberwachung/kue705FO/Charts/KVZChart/KVZChartView.tsx b/components/main/kabelueberwachung/kue705FO/Charts/KVZChart/KVZChartView.tsx new file mode 100644 index 0000000..8a18414 --- /dev/null +++ b/components/main/kabelueberwachung/kue705FO/Charts/KVZChart/KVZChartView.tsx @@ -0,0 +1,146 @@ +"use client"; // KVZChartView.tsx + +import React, { useEffect } from "react"; +import ReactModal from "react-modal"; +import { useDispatch, useSelector } from "react-redux"; +import { AppDispatch, RootState } from "@/redux/store"; +import { + setChartOpen, + setFullScreen, + setSlotNumber, + setVonDatum, + setBisDatum, + setSelectedMode, + setSelectedSlotType, +} from "@/redux/slices/kabelueberwachungChartSlice"; +import { resetBrushRange } from "@/redux/slices/brushSlice"; +import FallSensors from "../../../../fall-detection-sensors/FallSensors"; +import Report from "../IsoMeasurementChart/Report"; + +interface KVZChartViewProps { + isOpen: boolean; + onClose: () => void; + slotIndex: number; +} + +// Modal zur Anzeige der KVz Zustände (Sturzsensoren / Fall Detection LEDs) +// Stil und Verhalten analog zu ISO / RSL / TDR Modals +const KVZChartView: React.FC = ({ + isOpen, + onClose, + slotIndex, +}) => { + const dispatch = useDispatch(); + const isFullScreen = useSelector( + (state: RootState) => state.kabelueberwachungChartSlice.isFullScreen + ); + + // Beim Öffnen Slot setzen (damit konsistent zu anderen Modals) + useEffect(() => { + if (isOpen) { + dispatch(setSlotNumber(slotIndex)); + } + }, [isOpen, slotIndex, dispatch]); + + const handleClose = () => { + const today = new Date(); + const thirtyDaysAgo = new Date(); + thirtyDaysAgo.setDate(today.getDate() - 30); + const toISO = (d: Date) => d.toLocaleDateString("sv-SE"); + + // Zurücksetzen – entspricht Verhalten der anderen Modals + dispatch(setVonDatum(toISO(thirtyDaysAgo))); + dispatch(setBisDatum(toISO(today))); + dispatch(setSelectedMode("DIA1")); + dispatch(setSelectedSlotType("isolationswiderstand")); + dispatch(setChartOpen(false)); + dispatch(setFullScreen(false)); + dispatch(resetBrushRange()); + + onClose(); + }; + + const toggleFullScreen = () => { + dispatch(setFullScreen(!isFullScreen)); + }; + + return ( + + {/* Action Buttons */} +
+ + +
+ + {/* Content */} +
+

KVz Zustände & Meldungen

+ + {/* LED Bereich */} +
+
+ +
+
+ {/* Meldungen Bereich */} +
+ +
+
+
+ ); +}; + +export default KVZChartView; diff --git a/components/main/kabelueberwachung/kue705FO/Kue705FO.tsx b/components/main/kabelueberwachung/kue705FO/Kue705FO.tsx index 62f0752..c1e5744 100644 --- a/components/main/kabelueberwachung/kue705FO/Kue705FO.tsx +++ b/components/main/kabelueberwachung/kue705FO/Kue705FO.tsx @@ -2,13 +2,14 @@ import React, { useState, useMemo } from "react"; import { useSelector } from "react-redux"; import KueModal from "./modals/SettingsModalWrapper"; -import FallSensors from "../../fall-detection-sensors/FallSensors"; +// import FallSensors from "../../fall-detection-sensors/FallSensors"; import "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons import { Kue705FOProps } from "../../../../types/Kue705FOProps"; // Import the new specialized ChartView components import IsoChartView from "./Charts/IsoMeasurementChart/IsoChartView"; import LoopChartView from "./Charts/LoopMeasurementChart/LoopChartView"; import TDRChartView from "./Charts/TDRChart/TDRChartView"; +import KVZChartView from "./Charts/KVZChart/KVZChartView"; // Keep ChartSwitcher import for backwards compatibility if needed // import ChartSwitcher from "./Charts/ChartSwitcher"; // Remove separate chart imports since we use ChartView components @@ -68,7 +69,7 @@ const Kue705FO: React.FC = ({ const [showIsoModal, setShowIsoModal] = useState(false); const [showRslModal, setShowRslModal] = useState(false); const [showTdrModal, setShowTdrModal] = useState(false); - const [showKvzPanel, setShowKvzPanel] = useState(false); + const [showKvzModal, setShowKvzModal] = useState(false); // Keep original showChartModal for backwards compatibility if needed // const [showChartModal, setShowChartModal] = useState(false); // Removed unused loopMeasurementCurveChartData state @@ -85,7 +86,7 @@ const Kue705FO: React.FC = ({ tdrActive, // <- TDR aktiv Status hinzugefügt kvzPresence, // <- KVz Presence Array hinzugefügt kvzActive, // <- KVz Active Array hinzugefügt - kvzStatus, // <- KVz LED Status Array hinzugefügt + // kvzStatus, // <- KVz LED Status Array (jetzt nur im KVZ Modal verwendet) } = useSelector((state: RootState) => state.kueDataSlice); //--------------------------------------------- @@ -174,8 +175,9 @@ const Kue705FO: React.FC = ({ }; const openKvzModal = () => { - setShowKvzPanel(!showKvzPanel); + setShowKvzModal(true); }; + const closeKvzModal = () => setShowKvzModal(false); //---------------------------------- //hooks einbinden const kueVersion = useKueVersion(slotIndex, reduxKueVersion); @@ -240,12 +242,6 @@ const Kue705FO: React.FC = ({ kvzActive?.[slotIndex] === 1 && isAdminLoggedIn; - // KVz LED Status abrufen (4 LEDs pro Slot) - const getKvzLedStatus = (ledIndex: number) => { - const arrayIndex = slotIndex * 4 + ledIndex; - return kvzStatus?.[arrayIndex] === 1; - }; - // Removed useChartData(loopMeasurementCurveChartData) as the state was unused //--------------------------------- @@ -431,8 +427,12 @@ const Kue705FO: React.FC = ({ ? "bg-littwin-blue text-white cursor-pointer" : "bg-gray-400 cursor-default" } text-[0.625rem] flex items-center justify-center p-2 min-w-[2.5rem]`} + disabled={!isKvzActiveForSlot} + title={ + isKvzActiveForSlot ? "KVZ öffnen" : "KVZ nicht verfügbar" + } > - {isKvzActiveForSlot ? "KVz" : "\u00A0\u00A0\u00A0"} + {isKvzActiveForSlot ? "KVZ" : "\u00A0\u00A0\u00A0"} @@ -467,15 +467,22 @@ const Kue705FO: React.FC = ({ slotIndex={slotIndex} /> )} + {isKvzActiveForSlot && ( + + )} )} - {/* KVz Panel - Anzeige ganz unten, nur wenn KVz aktiv ist */} - {showKvzPanel && isKvzActiveForSlot && ( + {/* Früher inline Panel – jetzt eigenes Modal (KVZChartView) */} + {/* {showKvzPanel && isKvzActiveForSlot && (
- )} + )} */} {/* Offline-View */} {kueOnline !== 1 && ( diff --git a/package-lock.json b/package-lock.json index 6dbeb60..e1fcc28 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.682", + "version": "1.6.683", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.682", + "version": "1.6.683", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index d3d7fb9..d5ed23f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.682", + "version": "1.6.683", "private": true, "scripts": { "dev": "next dev",