fix: KVZ Button style wie die anderen (ISO, RSL, TDR) und mit eigene Modal

This commit is contained in:
ISA
2025-08-11 11:35:03 +02:00
parent 9b05f21ccc
commit c107738625
7 changed files with 187 additions and 19 deletions

View File

@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
NEXT_PUBLIC_EXPORT_STATIC=false NEXT_PUBLIC_EXPORT_STATIC=false
NEXT_PUBLIC_USE_CGI=false NEXT_PUBLIC_USE_CGI=false
# App-Versionsnummer # 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) NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)

View File

@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_EXPORT_STATIC=true NEXT_PUBLIC_EXPORT_STATIC=true
NEXT_PUBLIC_USE_CGI=true NEXT_PUBLIC_USE_CGI=true
# App-Versionsnummer # App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.682 NEXT_PUBLIC_APP_VERSION=1.6.683
NEXT_PUBLIC_CPL_MODE=production NEXT_PUBLIC_CPL_MODE=production

View File

@@ -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 ## [1.6.682] 2025-08-01
- git commit -m "feat: Enhance DetailModal with auto-loading and improved UX - git commit -m "feat: Enhance DetailModal with auto-loading and improved UX

View File

@@ -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<KVZChartViewProps> = ({
isOpen,
onClose,
slotIndex,
}) => {
const dispatch = useDispatch<AppDispatch>();
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 (
<ReactModal
isOpen={isOpen}
onRequestClose={handleClose}
ariaHideApp={false}
style={{
overlay: { backgroundColor: "rgba(0, 0, 0, 0.5)" },
content: {
top: "50%",
left: "50%",
bottom: "auto",
marginRight: "-50%",
transform: "translate(-50%, -50%)",
width: isFullScreen ? "90vw" : "50rem",
height: isFullScreen ? "90vh" : "28rem",
padding: "1rem",
transition: "all 0.3s ease-in-out",
display: "flex",
flexDirection: "column",
},
}}
>
{/* Action Buttons */}
<div
style={{
position: "absolute",
top: "0.625rem",
right: "0.625rem",
display: "flex",
gap: "0.75rem",
}}
>
<button
onClick={toggleFullScreen}
style={{
background: "transparent",
border: "none",
fontSize: "1.5rem",
cursor: "pointer",
}}
>
<i
className={
isFullScreen ? "bi bi-fullscreen-exit" : "bi bi-arrows-fullscreen"
}
></i>
</button>
<button
onClick={handleClose}
style={{
background: "transparent",
border: "none",
fontSize: "1.5rem",
cursor: "pointer",
}}
>
<i className="bi bi-x-circle-fill"></i>
</button>
</div>
{/* Content */}
<div className="flex flex-col h-full">
<h3 className="text-lg font-semibold mb-1">KVz Zustände & Meldungen</h3>
{/* LED Bereich */}
<div className="w-full flex justify-start mb-4">
<div style={{ width: "12rem" }}>
<FallSensors slotIndex={slotIndex} />
</div>
</div>
{/* Meldungen Bereich */}
<div className="flex-1 border rounded bg-white overflow-hidden">
<Report />
</div>
</div>
</ReactModal>
);
};
export default KVZChartView;

View File

@@ -2,13 +2,14 @@
import React, { useState, useMemo } from "react"; import React, { useState, useMemo } from "react";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import KueModal from "./modals/SettingsModalWrapper"; 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 "bootstrap-icons/font/bootstrap-icons.css"; // Import Bootstrap Icons
import { Kue705FOProps } from "../../../../types/Kue705FOProps"; import { Kue705FOProps } from "../../../../types/Kue705FOProps";
// Import the new specialized ChartView components // Import the new specialized ChartView components
import IsoChartView from "./Charts/IsoMeasurementChart/IsoChartView"; import IsoChartView from "./Charts/IsoMeasurementChart/IsoChartView";
import LoopChartView from "./Charts/LoopMeasurementChart/LoopChartView"; import LoopChartView from "./Charts/LoopMeasurementChart/LoopChartView";
import TDRChartView from "./Charts/TDRChart/TDRChartView"; import TDRChartView from "./Charts/TDRChart/TDRChartView";
import KVZChartView from "./Charts/KVZChart/KVZChartView";
// Keep ChartSwitcher import for backwards compatibility if needed // Keep ChartSwitcher import for backwards compatibility if needed
// import ChartSwitcher from "./Charts/ChartSwitcher"; // import ChartSwitcher from "./Charts/ChartSwitcher";
// Remove separate chart imports since we use ChartView components // Remove separate chart imports since we use ChartView components
@@ -68,7 +69,7 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
const [showIsoModal, setShowIsoModal] = useState(false); const [showIsoModal, setShowIsoModal] = useState(false);
const [showRslModal, setShowRslModal] = useState(false); const [showRslModal, setShowRslModal] = useState(false);
const [showTdrModal, setShowTdrModal] = 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 // Keep original showChartModal for backwards compatibility if needed
// const [showChartModal, setShowChartModal] = useState(false); // const [showChartModal, setShowChartModal] = useState(false);
// Removed unused loopMeasurementCurveChartData state // Removed unused loopMeasurementCurveChartData state
@@ -85,7 +86,7 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
tdrActive, // <- TDR aktiv Status hinzugefügt tdrActive, // <- TDR aktiv Status hinzugefügt
kvzPresence, // <- KVz Presence Array hinzugefügt kvzPresence, // <- KVz Presence Array hinzugefügt
kvzActive, // <- KVz Active 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); } = useSelector((state: RootState) => state.kueDataSlice);
//--------------------------------------------- //---------------------------------------------
@@ -174,8 +175,9 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
}; };
const openKvzModal = () => { const openKvzModal = () => {
setShowKvzPanel(!showKvzPanel); setShowKvzModal(true);
}; };
const closeKvzModal = () => setShowKvzModal(false);
//---------------------------------- //----------------------------------
//hooks einbinden //hooks einbinden
const kueVersion = useKueVersion(slotIndex, reduxKueVersion); const kueVersion = useKueVersion(slotIndex, reduxKueVersion);
@@ -240,12 +242,6 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
kvzActive?.[slotIndex] === 1 && kvzActive?.[slotIndex] === 1 &&
isAdminLoggedIn; 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 // Removed useChartData(loopMeasurementCurveChartData) as the state was unused
//--------------------------------- //---------------------------------
@@ -431,8 +427,12 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
? "bg-littwin-blue text-white cursor-pointer" ? "bg-littwin-blue text-white cursor-pointer"
: "bg-gray-400 cursor-default" : "bg-gray-400 cursor-default"
} text-[0.625rem] flex items-center justify-center p-2 min-w-[2.5rem]`} } 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"}
</button> </button>
</div> </div>
@@ -467,15 +467,22 @@ const Kue705FO: React.FC<Kue705FOProps> = ({
slotIndex={slotIndex} slotIndex={slotIndex}
/> />
)} )}
{isKvzActiveForSlot && (
<KVZChartView
isOpen={showKvzModal}
onClose={closeKvzModal}
slotIndex={slotIndex}
/>
)}
</> </>
)} )}
{/* KVz Panel - Anzeige ganz unten, nur wenn KVz aktiv ist */} {/* Früher inline Panel jetzt eigenes Modal (KVZChartView) */}
{showKvzPanel && isKvzActiveForSlot && ( {/* {showKvzPanel && isKvzActiveForSlot && (
<div className="flex flex-col items-center "> <div className="flex flex-col items-center ">
<FallSensors slotIndex={slotIndex} /> <FallSensors slotIndex={slotIndex} />
</div> </div>
)} )} */}
{/* Offline-View */} {/* Offline-View */}
{kueOnline !== 1 && ( {kueOnline !== 1 && (

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.682", "version": "1.6.683",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.682", "version": "1.6.683",
"dependencies": { "dependencies": {
"@fontsource/roboto": "^5.1.0", "@fontsource/roboto": "^5.1.0",
"@headlessui/react": "^2.2.4", "@headlessui/react": "^2.2.4",

View File

@@ -1,6 +1,6 @@
{ {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.682", "version": "1.6.683",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",