Fix: Messkurven-Modal (ISO/RSL) lädt Kurve automatisch, setzt Dropdown & DateRangePicker korrekt zurück

- Dropdown für Messkurven (ISO/RSL) wird beim Öffnen auf 'Alle Messwerte' (DIA0) gesetzt
- Messkurve wird beim Öffnen des Modals automatisch geladen
- Beim Schließen werden vonDatum, bisDatum, Dropdown und DateRangePicker zurückgesetzt
- Gleiches Verhalten für ISO- und RSL/Loop-Modal
This commit is contained in:
ISA
2025-08-15 11:22:32 +02:00
parent d75d9ce578
commit 4e8221c892
9 changed files with 58 additions and 25 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.729 NEXT_PUBLIC_APP_VERSION=1.6.730
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.729 NEXT_PUBLIC_APP_VERSION=1.6.730
NEXT_PUBLIC_CPL_MODE=production NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,13 @@
## [1.6.730] 2025-08-15
- Fix: Messkurven-Modal (ISO/RSL) lädt Kurve automatisch, setzt Dropdown & DateRangePicker korrekt zurück
- Dropdown für Messkurven (ISO/RSL) wird beim Öffnen auf 'Alle Messwerte' (DIA0) gesetzt
- Messkurve wird beim Öffnen des Modals automatisch geladen
- Beim Schließen werden vonDatum, bisDatum, Dropdown und DateRangePicker zurückgesetzt
- Gleiches Verhalten für ISO- und RSL/Loop-Modal
---
## [1.6.729] 2025-08-15 ## [1.6.729] 2025-08-15
- playwright: Einstellungen Seite - playwright: Einstellungen Seite

View File

@@ -1,6 +1,6 @@
"use client"; "use client";
// /components/main/kabelueberwachung/kue705FO/Charts/IsoMeasurementChart/IsoChartActionBar.tsx // /components/main/kabelueberwachung/kue705FO/Charts/IsoMeasurementChart/IsoChartActionBar.tsx
import React from "react"; import React, { forwardRef, useImperativeHandle } from "react";
import DateRangePicker from "@/components/common/DateRangePicker"; import DateRangePicker from "@/components/common/DateRangePicker";
import { useSelector } from "react-redux"; import { useSelector } from "react-redux";
import { RootState, useAppDispatch } from "@/redux/store"; import { RootState, useAppDispatch } from "@/redux/store";
@@ -170,7 +170,10 @@ export const useIsoDataLoader = () => {
}; };
//-----------------------------------------------------------------------------------IsoChartActionBar //-----------------------------------------------------------------------------------IsoChartActionBar
const IsoChartActionBar: React.FC = () => { // ...existing code...
const IsoChartActionBar = forwardRef((_props, ref) => {
IsoChartActionBar.displayName = "IsoChartActionBar";
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { vonDatum, bisDatum, selectedMode, slotNumber, chartTitle } = const { vonDatum, bisDatum, selectedMode, slotNumber, chartTitle } =
@@ -278,6 +281,10 @@ const IsoChartActionBar: React.FC = () => {
} }
}; };
useImperativeHandle(ref, () => ({
handleFetchData,
}));
return ( return (
<div className="flex justify-between items-center p-2 bg-gray-100 rounded-lg space-x-2"> <div className="flex justify-between items-center p-2 bg-gray-100 rounded-lg space-x-2">
<div className="flex items-center"> <div className="flex items-center">
@@ -377,6 +384,6 @@ const IsoChartActionBar: React.FC = () => {
</div> </div>
</div> </div>
); );
}; });
export default IsoChartActionBar; export default IsoChartActionBar;

View File

@@ -1,10 +1,10 @@
"use client"; // IsoChartView.tsx "use client"; // IsoChartView.tsx
import React, { useEffect } from "react"; import React, { useEffect, useRef } from "react";
import { Listbox } from "@headlessui/react"; import { Listbox } from "@headlessui/react";
import ReactModal from "react-modal"; import ReactModal from "react-modal";
import IsoMeasurementChart from "./IsoMeasurementChart"; import IsoMeasurementChart from "./IsoMeasurementChart";
import IsoChartActionBar, { useIsoDataLoader } from "./IsoChartActionBar"; import IsoChartActionBar from "./IsoChartActionBar";
import Report from "./Report"; import Report from "./Report";
import { useSelector, useDispatch } from "react-redux"; import { useSelector, useDispatch } from "react-redux";
import { AppDispatch } from "@/redux/store"; import { AppDispatch } from "@/redux/store";
@@ -38,7 +38,7 @@ const IsoChartView: React.FC<IsoChartViewProps> = ({
slotIndex, slotIndex,
}) => { }) => {
const dispatch = useDispatch<AppDispatch>(); const dispatch = useDispatch<AppDispatch>();
const { loadData } = useIsoDataLoader(); // removed unused loadData
const { isFullScreen, chartTitle } = useSelector( const { isFullScreen, chartTitle } = useSelector(
(state: RootState) => state.kabelueberwachungChartSlice (state: RootState) => state.kabelueberwachungChartSlice
@@ -78,6 +78,8 @@ const IsoChartView: React.FC<IsoChartViewProps> = ({
}; };
// Modal öffnen - ISO spezifische Einstellungen // Modal öffnen - ISO spezifische Einstellungen
type ActionBarRefType = { handleFetchData: () => void };
const actionBarRef = useRef<ActionBarRefType>(null);
useEffect(() => { useEffect(() => {
if (isOpen) { if (isOpen) {
const today = new Date(); const today = new Date();
@@ -100,17 +102,16 @@ const IsoChartView: React.FC<IsoChartViewProps> = ({
// Set default to Messkurve // Set default to Messkurve
dispatch(setChartTitle("Messkurve")); dispatch(setChartTitle("Messkurve"));
// Automatisch Daten laden nach kurzer Verzögerung // Automatisch Daten laden wie Button-Klick
// um sicherzustellen, dass alle Redux-States gesetzt sind
const timer = setTimeout(() => { const timer = setTimeout(() => {
loadData(); actionBarRef.current?.handleFetchData();
}, 100); }, 120);
// Cleanup timer // Cleanup timer
return () => clearTimeout(timer); return () => clearTimeout(timer);
} }
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [isOpen, slotIndex, dispatch]); // loadData bewusst ausgelassen um Endlosschleife zu vermeiden }, [isOpen, slotIndex, dispatch]);
return ( return (
<ReactModal <ReactModal
@@ -237,7 +238,7 @@ const IsoChartView: React.FC<IsoChartViewProps> = ({
</div> </div>
</Listbox> </Listbox>
</div> </div>
<IsoChartActionBar /> <IsoChartActionBar ref={actionBarRef} />
<div style={{ flex: 1, height: "90%" }}> <div style={{ flex: 1, height: "90%" }}>
{chartTitle === "Messkurve" ? ( {chartTitle === "Messkurve" ? (
<IsoMeasurementChart /> <IsoMeasurementChart />

View File

@@ -1,6 +1,11 @@
"use client"; "use client";
// /components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx // /components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx
import React, { useEffect, useState } from "react"; import React, {
useEffect,
useState,
forwardRef,
useImperativeHandle,
} from "react";
import { useAppDispatch } from "@/redux/store"; import { useAppDispatch } from "@/redux/store";
import { getMessagesThunk } from "@/redux/thunks/getMessagesThunk"; import { getMessagesThunk } from "@/redux/thunks/getMessagesThunk";
import { RSL_DURATION_SECONDS, NODE_ENV } from "@/utils/env"; import { RSL_DURATION_SECONDS, NODE_ENV } from "@/utils/env";
@@ -94,7 +99,7 @@ export const useLoopChartLoader = () => {
}; };
//-----------------------------------------------------------------------------------LoopChartActionBar //-----------------------------------------------------------------------------------LoopChartActionBar
const LoopChartActionBar: React.FC = () => { const LoopChartActionBar = forwardRef((_props, ref) => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
// RSL Progress State Dauer konfigurierbar über NEXT_PUBLIC_RSL_DURATION_SECONDS // RSL Progress State Dauer konfigurierbar über NEXT_PUBLIC_RSL_DURATION_SECONDS
const TOTAL_DURATION = RSL_DURATION_SECONDS; const TOTAL_DURATION = RSL_DURATION_SECONDS;
@@ -272,6 +277,10 @@ const LoopChartActionBar: React.FC = () => {
} }
}; };
useImperativeHandle(ref, () => ({
handleFetchData,
}));
return ( return (
<div className="flex justify-between p-1 bg-gray-100 rounded-lg "> <div className="flex justify-between p-1 bg-gray-100 rounded-lg ">
<div className="flex items-center"> <div className="flex items-center">
@@ -393,6 +402,7 @@ const LoopChartActionBar: React.FC = () => {
)} )}
</div> </div>
); );
}; });
LoopChartActionBar.displayName = "LoopChartActionBar";
export default LoopChartActionBar; export default LoopChartActionBar;

View File

@@ -6,6 +6,7 @@ import ReactModal from "react-modal";
import LoopMeasurementChart from "./LoopMeasurementChart"; import LoopMeasurementChart from "./LoopMeasurementChart";
import Report from "../IsoMeasurementChart/Report"; import Report from "../IsoMeasurementChart/Report";
import LoopChartActionBar from "./LoopChartActionBar"; import LoopChartActionBar from "./LoopChartActionBar";
import { useRef } from "react";
import { useSelector, useDispatch } from "react-redux"; import { useSelector, useDispatch } from "react-redux";
import { AppDispatch } from "@/redux/store"; import { AppDispatch } from "@/redux/store";
import { RootState } from "@/redux/store"; import { RootState } from "@/redux/store";
@@ -85,6 +86,7 @@ const LoopChartView: React.FC<LoopChartViewProps> = ({
}; };
// Modal öffnen - RSL spezifische Einstellungen // Modal öffnen - RSL spezifische Einstellungen
const actionBarRef = useRef<{ handleFetchData: () => void }>(null);
useEffect(() => { useEffect(() => {
if (isOpen) { if (isOpen) {
const today = new Date(); const today = new Date();
@@ -104,10 +106,13 @@ const LoopChartView: React.FC<LoopChartViewProps> = ({
dispatch(setSelectedSlotType("schleifenwiderstand")); dispatch(setSelectedSlotType("schleifenwiderstand"));
dispatch(setSelectedMode("DIA0")); // Set to Alle Messwerte on open dispatch(setSelectedMode("DIA0")); // Set to Alle Messwerte on open
// Load data for Schleife mode after a small delay to ensure Redux state is updated // Automatisch Daten laden wie Button-Klick
setTimeout(() => { const timer = setTimeout(() => {
loadLoopChartData.loadLoopChartData(); actionBarRef.current?.handleFetchData();
}, 10); }, 120);
// Cleanup timer
return () => clearTimeout(timer);
} }
//ESLint ignore //ESLint ignore
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -238,7 +243,7 @@ const LoopChartView: React.FC<LoopChartViewProps> = ({
</div> </div>
</Listbox> </Listbox>
</div> </div>
<LoopChartActionBar /> <LoopChartActionBar ref={actionBarRef} />
<div style={{ flex: 1, height: "90%" }}> <div style={{ flex: 1, height: "90%" }}>
{chartTitle === "Messkurve" ? ( {chartTitle === "Messkurve" ? (
<LoopMeasurementChart /> <LoopMeasurementChart />

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.729", "version": "1.6.730",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "cpl-v4", "name": "cpl-v4",
"version": "1.6.729", "version": "1.6.730",
"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.729", "version": "1.6.730",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",