From 531fa93b702d82ea8060939008d7625358bfbdcb Mon Sep 17 00:00:00 2001 From: ISA Date: Mon, 8 Sep 2025 11:48:23 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Beim=20Ausf=C3=BChren=20einer=20TDR-Mess?= =?UTF-8?q?ung=20(Klick=20auf=20blauen=20Button=20in=20der=20TDR-Detailsei?= =?UTF-8?q?te)=20erscheint=20keine=20R=C3=BCckmeldung.=20Dort=20m=C3=BCsst?= =?UTF-8?q?e=20ein=20Hinweis=20erscheinen=20=E2=80=9CTDR-Messung=20wird=20?= =?UTF-8?q?ausgef=C3=BChrt=20und=20kann=20bis=20zu=20zwei=20Minuten=20daue?= =?UTF-8?q?rn=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 5 + .../LoopChartActionBar.tsx | 3 +- .../Charts/TDRChart/TDRChartActionBar.tsx | 268 +++++++++++------- .../SERVICE/kabelueberwachungMockData.js | 2 +- package-lock.json | 4 +- package.json | 2 +- 8 files changed, 179 insertions(+), 109 deletions(-) diff --git a/.env.development b/.env.development index da52011..525c5c0 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.867 +NEXT_PUBLIC_APP_VERSION=1.6.868 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 56aaa90..a033e14 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.867 +NEXT_PUBLIC_APP_VERSION=1.6.868 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index bec5970..bdd3a3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [1.6.868] – 2025-09-08 + +- fix: Timer für jeder KÜ separate und nicht eine für alle, aktuell wird prozentzahl bei allen das gleiche angezeigt + +--- ## [1.6.867] – 2025-09-08 - WIP: Timer für jeder KÜ separate und nicht eine für alle, aktuell wird prozentzahl bei allen das gleiche angezeigt diff --git a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx index c804c9a..16719de 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/LoopMeasurementChart/LoopChartActionBar.tsx @@ -389,7 +389,8 @@ const LoopChartActionBar = forwardRef((_props, ref) => {

RSL Messung läuft

- Bitte warten… (noch {TOTAL_DURATION - rslProgress}s) + Bitte warten…{" "} + {Math.min(100, Math.round((rslProgress / TOTAL_DURATION) * 100))}%

diff --git a/components/main/kabelueberwachung/kue705FO/Charts/TDRChart/TDRChartActionBar.tsx b/components/main/kabelueberwachung/kue705FO/Charts/TDRChart/TDRChartActionBar.tsx index 42cb3bc..a855825 100644 --- a/components/main/kabelueberwachung/kue705FO/Charts/TDRChart/TDRChartActionBar.tsx +++ b/components/main/kabelueberwachung/kue705FO/Charts/TDRChart/TDRChartActionBar.tsx @@ -30,6 +30,36 @@ const TDRChartActionBar: React.FC = () => { const [selectedId, setSelectedId] = useState(null); const currentChartData = selectedId !== null ? tdrDataById[selectedId] : []; + // ▶ Fortschrittsanzeige für laufende TDR-Messung (max. 120s bzw. konfigurierbar) + const TDR_TOTAL_DURATION = parseInt( + process.env.NEXT_PUBLIC_TDR_DURATION_SECONDS || "120", + 10 + ); + const [tdrRunning, setTdrRunning] = useState(false); + const [tdrProgress, setTdrProgress] = useState(0); // Sekunden + + useEffect(() => { + if (!tdrRunning) return; + setTdrProgress(0); + const startedAt = Date.now(); + const interval = setInterval(() => { + const elapsed = Math.floor((Date.now() - startedAt) / 1000); + if (elapsed >= TDR_TOTAL_DURATION) { + setTdrProgress(TDR_TOTAL_DURATION); + setTdrRunning(false); + clearInterval(interval); + } else { + setTdrProgress(elapsed); + } + }, 1000); + return () => clearInterval(interval); + }, [tdrRunning, TDR_TOTAL_DURATION]); + + const startTdrProgress = () => { + setTdrRunning(true); + setTdrProgress(0); + }; + // 📌 Referenz setzen (nutzt Slotnummer + 1 für die API) const handleSetReference = async () => { if ( @@ -94,15 +124,19 @@ const TDRChartActionBar: React.FC = () => { try { console.log("🚀 Starte TDR Messung für Slot:", selectedSlot); console.log("📡 CGI URL:", cgiUrl); - - const response = await fetch(cgiUrl); - - if (!response.ok) { - throw new Error(`CGI-Fehler: ${response.status}`); + const isDev = process.env.NEXT_PUBLIC_NODE_ENV === "development"; + if (isDev) { + // Dev / Simulator: sofort starten & Progress anzeigen + await new Promise((r) => setTimeout(r, 150)); + console.log("✅ [DEV] TDR Mock-Start ok für Slot", selectedSlot); + startTdrProgress(); + return; } + const response = await fetch(cgiUrl); + if (!response.ok) throw new Error(`CGI-Fehler: ${response.status}`); console.log("✅ TDR Messung gestartet für Slot", selectedSlot); - //alert(`✅ TDR Messung für Slot ${selectedSlot + 1} gestartet`); + startTdrProgress(); } catch (err) { console.error("❌ Fehler beim Starten der TDR Messung:", err); //alert("❌ Fehler beim Starten der TDR Messung."); @@ -130,109 +164,139 @@ const TDRChartActionBar: React.FC = () => { }, [selectedSlot, dispatch]); return ( -
- {/* 🧩 Slot-Anzeige (1-basiert für Benutzer) */} -
- {selectedSlot !== null ? `KÜ ${selectedSlot + 1}` : "Kein KÜ gewählt"} -
+ <> +
+ {/* 🧩 Slot-Anzeige (1-basiert für Benutzer) */} +
+ {selectedSlot !== null ? `KÜ ${selectedSlot + 1}` : "Kein KÜ gewählt"} +
- {/* ✅ Referenz setzen */} - {selectedId !== null && ( + {/* ✅ Referenz setzen */} + {selectedId !== null && ( + + )} + + {/* 🚀 TDR starten */} - )} - {/* 🚀 TDR starten */} - - - {/* 🔽 Dropdown für Messungen */} -
- { - setSelectedId(id); - if (id !== null) { - dispatch(getTDRChartDataByIdThunk(id)); - } - }} - disabled={idsForSlot.length === 0} - > -
- - - {selectedId - ? (() => { - const selected = idsForSlot.find( - (e) => e.id === selectedId - ); - return selected - ? `${new Date(selected.t).toLocaleString("de-DE", { - day: "2-digit", - month: "2-digit", - year: "numeric", - hour: "2-digit", - minute: "2-digit", - second: "2-digit", - })} – Fehlerstelle: ${selected.d} m` - : "Wähle Messung"; - })() - : "Wähle Messung"} - - - - - {idsForSlot.map((entry) => ( - - `px-4 py-1 cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis ${ - selected - ? "bg-littwin-blue text-white" - : active - ? "bg-gray-200" - : "" - }` - } + {/* 🔽 Dropdown für Messungen */} +
+ { + setSelectedId(id); + if (id !== null) { + dispatch(getTDRChartDataByIdThunk(id)); + } + }} + disabled={idsForSlot.length === 0} + > +
+ + + {selectedId + ? (() => { + const selected = idsForSlot.find( + (e) => e.id === selectedId + ); + return selected + ? `${new Date(selected.t).toLocaleString("de-DE", { + day: "2-digit", + month: "2-digit", + year: "numeric", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + })} – Fehlerstelle: ${selected.d} m` + : "Wähle Messung"; + })() + : "Wähle Messung"} + +
-
+ + + + + {idsForSlot.map((entry) => ( + + `px-4 py-1 cursor-pointer whitespace-nowrap overflow-hidden text-ellipsis ${ + selected + ? "bg-littwin-blue text-white" + : active + ? "bg-gray-200" + : "" + }` + } + > + {new Date(entry.t).toLocaleString("de-DE", { + day: "2-digit", + month: "2-digit", + year: "numeric", + hour: "2-digit", + minute: "2-digit", + second: "2-digit", + })}{" "} + – Fehlerstelle: {entry.d} m + + ))} + +
+ +
-
+ {tdrRunning && ( +
+
+

TDR Messung läuft

+

+ Bitte warten…{" "} + {Math.min( + 100, + Math.round((tdrProgress / TDR_TOTAL_DURATION) * 100) + )} + % +

+
+
+
+
+
+ )} + ); }; diff --git a/mocks/device-cgi-simulator/SERVICE/kabelueberwachungMockData.js b/mocks/device-cgi-simulator/SERVICE/kabelueberwachungMockData.js index 8cf9573..dd4c925 100644 --- a/mocks/device-cgi-simulator/SERVICE/kabelueberwachungMockData.js +++ b/mocks/device-cgi-simulator/SERVICE/kabelueberwachungMockData.js @@ -271,7 +271,7 @@ var tdrMeasurementEvent = [ //Event Abgleich var comparisonEvent = [ // renamed from alignmentEvent - 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ]; // expose for browser simulation diff --git a/package-lock.json b/package-lock.json index d060224..62c46e8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.867", + "version": "1.6.868", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.867", + "version": "1.6.868", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index 9de98c1..57ed32a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.867", + "version": "1.6.868", "private": true, "scripts": { "dev": "next dev -p 3000",