feat: Redux-Struktur für LoopChart vereinheitlicht (DIA0–2 + Typ 3/4)
- Alle Schleifen- und Isolationswiderstandsdaten werden zentral in loopChart.data gespeichert - Redux State unterstützt nun strukturierte Speicherung nach mode (DIA0–DIA2) und type (3/4) - Bestehender Thunk fetchLoopChartDataThunk wurde angepasst zur Wiederverwendung - Zugriff aus Komponente via loopData["DIAx"][type] möglich
This commit is contained in:
@@ -3,12 +3,14 @@ import React, { useState, useEffect } from "react";
|
||||
import { useRouter, useSearchParams } from "next/navigation";
|
||||
import Kue705FO from "../components/main/kabelueberwachung/kue705FO/Kue705FO";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { AppDispatch } from "../redux/store"; // Adjust the path to your Redux store file
|
||||
import { RootState } from "../redux/store"; // Adjust the path to your Redux store file
|
||||
import { fetchAllTDRChartData } from "../redux/thunks/fetchAllTDRChartThunk";
|
||||
import { fetchAllTDRReferenceChartThunk } from "../redux/thunks/fetchAllTDRReferenceChartThunk";
|
||||
import { fetchLoopChartDataThunk } from "../redux/thunks/fetchLoopChartDataThunk";
|
||||
|
||||
function Kabelueberwachung() {
|
||||
const router = useRouter();
|
||||
const dispatch = useDispatch();
|
||||
const dispatch: AppDispatch = useDispatch();
|
||||
const searchParams = useSearchParams(); // URL-Parameter holen
|
||||
const initialRack = parseInt(searchParams.get("rack")) || 1; // Rack-Nummer aus URL oder 1
|
||||
|
||||
@@ -112,6 +114,36 @@ function Kabelueberwachung() {
|
||||
); */
|
||||
}, [activeRack, racks]);
|
||||
|
||||
//-----------------------------------------------------------
|
||||
const {
|
||||
data: loopData,
|
||||
loading: loopLoading,
|
||||
error: loopError,
|
||||
} = useSelector((state: RootState) => state.loopChart);
|
||||
|
||||
// Daten für alle Kombinationen laden (z. B. Slot 1 als Beispiel)
|
||||
useEffect(() => {
|
||||
["DIA0", "DIA1", "DIA2"].forEach((mode) => {
|
||||
[3, 4].forEach((type) => {
|
||||
dispatch(
|
||||
fetchLoopChartDataThunk({
|
||||
mode: mode as "DIA0" | "DIA1" | "DIA2",
|
||||
type,
|
||||
slotNumber: 1,
|
||||
vonDatum: "2025-03-20",
|
||||
bisDatum: "2025-03-23",
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
}, [dispatch]);
|
||||
|
||||
// Zugriff z. B. auf Schleifenwiderstand von DIA1
|
||||
const dia1Schleifen = loopData["DIA1"]?.[4];
|
||||
const dia0Iso = loopData["DIA0"]?.[3];
|
||||
|
||||
//------------------------------------------------------------
|
||||
|
||||
return (
|
||||
<div className="bg-gray-100 flex-1 p-6 text-black xl:p-4 2xl:p-6 h-[calc(100vh-13vh-8vh)]">
|
||||
<h1 className="text-2xl xl:text-xl mb-4">Kabelüberwachung</h1>
|
||||
|
||||
Reference in New Issue
Block a user