diff --git a/.env.development b/.env.development index cec5f9f..871a01f 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.695 +NEXT_PUBLIC_APP_VERSION=1.6.696 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 b3e6f05..2a78731 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.695 +NEXT_PUBLIC_APP_VERSION=1.6.696 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 124e7fe..25ee2b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.6.696] – 2025-08-12 + +- feat(iso): DateRangePicker-Zeitraum bei "Daten laden" anwenden und fix debug für build + +--- ## [1.6.695] – 2025-08-12 - feat(iso): DateRangePicker-Zeitraum bei "Daten laden" anwenden diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx index e6978cc..642d2f9 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx @@ -1,9 +1,11 @@ "use client"; // /components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx import React, { useEffect, useState } from "react"; +import { useAppDispatch } from "@/redux/store"; +import { getMessagesThunk } from "@/redux/thunks/getMessagesThunk"; import { RSL_DURATION_SECONDS, NODE_ENV } from "@/utils/env"; import DateRangePicker from "@/components/common/DateRangePicker"; -import { useDispatch, useSelector } from "react-redux"; +import { useSelector } from "react-redux"; import { RootState } from "@/redux/store"; import { setLoopMeasurementCurveChartData, @@ -16,7 +18,7 @@ import { Listbox } from "@headlessui/react"; //-----------------------------------------------------------------------------------useLoopChartLoader export const useLoopChartLoader = () => { - const dispatch = useDispatch(); + const dispatch = useAppDispatch(); const { vonDatum, bisDatum, selectedMode, selectedSlotType, slotNumber } = useSelector((state: RootState) => state.kabelueberwachungChartSlice); const hasShownNoDataAlert = React.useRef(false); @@ -93,7 +95,7 @@ export const useLoopChartLoader = () => { //-----------------------------------------------------------------------------------LoopChartActionBar const LoopChartActionBar: React.FC = () => { - const dispatch = useDispatch(); + const dispatch = useAppDispatch(); // RSL Progress State – Dauer konfigurierbar über NEXT_PUBLIC_RSL_DURATION_SECONDS const TOTAL_DURATION = RSL_DURATION_SECONDS; const [rslRunning, setRslRunning] = useState(false); @@ -133,20 +135,26 @@ const LoopChartActionBar: React.FC = () => { } = useSelector((state: RootState) => state.kabelueberwachungChartSlice); const { chartTitle } = useSelector((state: RootState) => state.loopChartType); + // Vom DateRangePicker-Slice (vom UI gewählte Werte) + const { vonDatum: pickerVonDatum, bisDatum: pickerBisDatum } = useSelector( + (state: RootState) => state.dateRangePicker + ); const getApiUrl = ( mode: "DIA0" | "DIA1" | "DIA2", type: number, - slotNumber: number + slotNumber: number, + fromDate: string, + toDate: string ) => { const typeFolder = "schleifenwiderstand"; const baseUrl = process.env.NODE_ENV === "development" - ? `/api/cpl/slotDataAPIHandler?slot=${slotNumber}&messart=${typeFolder}&dia=${mode}&vonDatum=${vonDatum}&bisDatum=${bisDatum}` + ? `/api/cpl/slotDataAPIHandler?slot=${slotNumber}&messart=${typeFolder}&dia=${mode}&vonDatum=${fromDate}&bisDatum=${toDate}` : `${window.location.origin}/CPL?seite.ACP&${mode}=${formatDate( - vonDatum - )};${formatDate(bisDatum)};${slotNumber};${type};`; + fromDate + )};${formatDate(toDate)};${slotNumber};${type};`; console.log("baseUrl", baseUrl); return baseUrl; @@ -195,7 +203,26 @@ const LoopChartActionBar: React.FC = () => { return; } - const apiUrl = getApiUrl(selectedMode, type, slotNumber); + // Meldungen laden, wenn Meldungen-Ansicht aktiv ist + if (chartTitle === "Meldungen") { + try { + dispatch(setLoading(true)); + const fromDate = pickerVonDatum ?? vonDatum; + const toDate = pickerBisDatum ?? bisDatum; + await dispatch(getMessagesThunk({ fromDate, toDate })).unwrap(); + } catch (err) { + const message = err instanceof Error ? err.message : String(err); + console.error("❌ Fehler beim Laden der Meldungen:", message); + alert("❌ Fehler beim Laden der Meldungen."); + } finally { + dispatch(setLoading(false)); + } + return; + } + + const fromDate = pickerVonDatum ?? vonDatum; + const toDate = pickerBisDatum ?? bisDatum; + const apiUrl = getApiUrl(selectedMode, type, slotNumber, fromDate, toDate); if (!apiUrl) return; dispatch(setLoading(true)); @@ -222,8 +249,8 @@ const LoopChartActionBar: React.FC = () => { console.log(" Slot:", slotNumber); console.log(" Typ:", selectedSlotType, "→", type); console.log(" Modus:", selectedMode); - console.log(" Von:", vonDatum); - console.log(" Bis:", bisDatum); + console.log(" Von:", fromDate); + console.log(" Bis:", toDate); console.log(" URL:", apiUrl); console.log(" Daten:", jsonData); @@ -254,12 +281,8 @@ const LoopChartActionBar: React.FC = () => {