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 React from "react";
|
||||||
import DatePicker from "react-datepicker";
|
import DatePicker from "react-datepicker";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { RootState } from "../../../../../redux/store";
|
import { RootState } from "../../../../../redux/store";
|
||||||
import "react-datepicker/dist/react-datepicker.css";
|
import {
|
||||||
|
|
||||||
// ✅ Props-Definition für die Komponente hinzugefügt
|
|
||||||
interface DateRangePickerProps {
|
|
||||||
setVonDatum: (date: Date) => void;
|
|
||||||
setBisDatum: (date: Date) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const DateRangePicker: React.FC<DateRangePickerProps> = ({
|
|
||||||
setVonDatum,
|
setVonDatum,
|
||||||
setBisDatum,
|
setBisDatum,
|
||||||
}) => {
|
} from "../../../../../redux/slices/kabelueberwachungChartSlice";
|
||||||
// Redux-Werte abrufen
|
import "react-datepicker/dist/react-datepicker.css";
|
||||||
|
|
||||||
|
const DateRangePicker: React.FC = () => {
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const reduxVonDatum = useSelector(
|
const reduxVonDatum = useSelector(
|
||||||
(state: RootState) => state.kabelueberwachungChart.vonDatum
|
(state: RootState) => state.kabelueberwachungChart.vonDatum
|
||||||
);
|
);
|
||||||
@@ -32,7 +26,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = ({
|
|||||||
selected={reduxVonDatum ? new Date(reduxVonDatum) : new Date()}
|
selected={reduxVonDatum ? new Date(reduxVonDatum) : new Date()}
|
||||||
onChange={(date) => {
|
onChange={(date) => {
|
||||||
if (date) {
|
if (date) {
|
||||||
setVonDatum(date);
|
dispatch(setVonDatum(date.toISOString().split("T")[0]));
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
selectsStart
|
selectsStart
|
||||||
@@ -49,7 +43,7 @@ const DateRangePicker: React.FC<DateRangePickerProps> = ({
|
|||||||
selected={reduxBisDatum ? new Date(reduxBisDatum) : new Date()}
|
selected={reduxBisDatum ? new Date(reduxBisDatum) : new Date()}
|
||||||
onChange={(date) => {
|
onChange={(date) => {
|
||||||
if (date) {
|
if (date) {
|
||||||
setBisDatum(date);
|
dispatch(setBisDatum(date.toISOString().split("T")[0]));
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
selectsEnd
|
selectsEnd
|
||||||
|
|||||||
@@ -126,14 +126,28 @@ const LoopMeasurementChart = () => {
|
|||||||
},
|
},
|
||||||
[dispatch, formatierteDaten]
|
[dispatch, formatierteDaten]
|
||||||
);
|
);
|
||||||
|
//--------------------------------------------------------------------------------
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (formatierteDaten.length) {
|
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(
|
const startIndex = formatierteDaten.findIndex(
|
||||||
(d) => new Date(d.zeit).toISOString().split("T")[0] === vonDatum
|
(d) => new Date(d.zeit).toISOString().split("T")[0] === vonDatum
|
||||||
);
|
);
|
||||||
|
//console.log("startIndex in Brush ", startIndex);
|
||||||
|
|
||||||
const endIndex = formatierteDaten.findIndex(
|
const endIndex = formatierteDaten.findIndex(
|
||||||
(d) => new Date(d.zeit).toISOString().split("T")[0] === bisDatum
|
(d) => new Date(d.zeit).toISOString().split("T")[0] === bisDatum
|
||||||
);
|
);
|
||||||
|
//console.log("endIndex in Brush ", endIndex);
|
||||||
|
|
||||||
if (startIndex !== -1 && endIndex !== -1) {
|
if (startIndex !== -1 && endIndex !== -1) {
|
||||||
dispatch(
|
dispatch(
|
||||||
@@ -147,6 +161,7 @@ const LoopMeasurementChart = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [vonDatum, bisDatum, formatierteDaten, dispatch]);
|
}, [vonDatum, bisDatum, formatierteDaten, dispatch]);
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: "100%", height: isFullScreen ? "90%" : "400px" }}>
|
<div style={{ width: "100%", height: isFullScreen ? "90%" : "400px" }}>
|
||||||
|
|||||||
@@ -6,5 +6,5 @@
|
|||||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
const webVersion = "1.6.121";
|
const webVersion = "1.6.122";
|
||||||
export default webVersion;
|
export default webVersion;
|
||||||
|
|||||||
Reference in New Issue
Block a user