fix: Debugging für Brush-Datenbereich hinzugefügt
- `console.log`-Ausgaben für `vonDatum`, `bisDatum` und `formatierteDaten` hinzugefügt - Fehleranalyse für `startIndex` und `endIndex` in `LoopMeasurementChart.tsx` - Falls `startIndex` oder `endIndex` nicht gefunden wird, wird die gesamte Datenreihe geloggt - Vorbereitung für Fallback-Lösung, falls Datum nicht exakt gefunden wird
This commit is contained in:
@@ -1,22 +1,16 @@
|
||||
// /components/modules/kue705FO/charts/DateRangePicker.tsx
|
||||
// /components/modules/kue705FO/charts/DateRangePicker.tsx
|
||||
import React from "react";
|
||||
import DatePicker from "react-datepicker";
|
||||
import { useSelector } from "react-redux";
|
||||
import { useSelector, useDispatch } from "react-redux";
|
||||
import { RootState } from "../../../../../redux/store";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
|
||||
// ✅ Props-Definition für die Komponente hinzugefügt
|
||||
interface DateRangePickerProps {
|
||||
setVonDatum: (date: Date) => void;
|
||||
setBisDatum: (date: Date) => void;
|
||||
}
|
||||
|
||||
const DateRangePicker: React.FC<DateRangePickerProps> = ({
|
||||
import {
|
||||
setVonDatum,
|
||||
setBisDatum,
|
||||
}) => {
|
||||
// Redux-Werte abrufen
|
||||
} from "../../../../../redux/slices/kabelueberwachungChartSlice";
|
||||
import "react-datepicker/dist/react-datepicker.css";
|
||||
|
||||
const DateRangePicker: React.FC = () => {
|
||||
const dispatch = useDispatch();
|
||||
|
||||
const reduxVonDatum = useSelector(
|
||||
(state: RootState) => state.kabelueberwachungChart.vonDatum
|
||||
);
|
||||
@@ -32,7 +26,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = ({
|
||||
selected={reduxVonDatum ? new Date(reduxVonDatum) : new Date()}
|
||||
onChange={(date) => {
|
||||
if (date) {
|
||||
setVonDatum(date);
|
||||
dispatch(setVonDatum(date.toISOString().split("T")[0]));
|
||||
}
|
||||
}}
|
||||
selectsStart
|
||||
@@ -49,7 +43,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = ({
|
||||
selected={reduxBisDatum ? new Date(reduxBisDatum) : new Date()}
|
||||
onChange={(date) => {
|
||||
if (date) {
|
||||
setBisDatum(date);
|
||||
dispatch(setBisDatum(date.toISOString().split("T")[0]));
|
||||
}
|
||||
}}
|
||||
selectsEnd
|
||||
|
||||
@@ -126,14 +126,28 @@ const LoopMeasurementChart = () => {
|
||||
},
|
||||
[dispatch, formatierteDaten]
|
||||
);
|
||||
//--------------------------------------------------------------------------------
|
||||
useEffect(() => {
|
||||
if (formatierteDaten.length) {
|
||||
console.log("🔍 Redux vonDatum:", vonDatum);
|
||||
console.log("🔍 Redux bisDatum:", bisDatum);
|
||||
|
||||
//console.log("🔍 Verfügbare Zeitpunkte in formatierteDaten:");
|
||||
/* formatierteDaten.forEach((d, index) => {
|
||||
console.log(
|
||||
`${index}: ${new Date(d.zeit).toISOString().split("T")[0]}`
|
||||
);
|
||||
});
|
||||
*/
|
||||
const startIndex = formatierteDaten.findIndex(
|
||||
(d) => new Date(d.zeit).toISOString().split("T")[0] === vonDatum
|
||||
);
|
||||
//console.log("startIndex in Brush ", startIndex);
|
||||
|
||||
const endIndex = formatierteDaten.findIndex(
|
||||
(d) => new Date(d.zeit).toISOString().split("T")[0] === bisDatum
|
||||
);
|
||||
//console.log("endIndex in Brush ", endIndex);
|
||||
|
||||
if (startIndex !== -1 && endIndex !== -1) {
|
||||
dispatch(
|
||||
@@ -147,6 +161,7 @@ const LoopMeasurementChart = () => {
|
||||
}
|
||||
}
|
||||
}, [vonDatum, bisDatum, formatierteDaten, dispatch]);
|
||||
//----------------------------------------------------------------
|
||||
|
||||
return (
|
||||
<div style={{ width: "100%", height: isFullScreen ? "90%" : "400px" }}>
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||
|
||||
*/
|
||||
const webVersion = "1.6.121";
|
||||
const webVersion = "1.6.122";
|
||||
export default webVersion;
|
||||
|
||||
Reference in New Issue
Block a user