diff --git a/.env.development b/.env.development index 36210b8..da52011 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.866 +NEXT_PUBLIC_APP_VERSION=1.6.867 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 0c3c00d..56aaa90 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.866 +NEXT_PUBLIC_APP_VERSION=1.6.867 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index d14af0b..bec5970 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [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 + +--- ## [1.6.866] – 2025-09-08 - Test: Jenkinsfile diff --git a/components/common/DeviceEventsBridge.tsx b/components/common/DeviceEventsBridge.tsx index 961c68c..5395223 100644 --- a/components/common/DeviceEventsBridge.tsx +++ b/components/common/DeviceEventsBridge.tsx @@ -1,7 +1,10 @@ "use client"; import React from "react"; import { useAppDispatch } from "@/redux/store"; -import { setEvents } from "@/redux/slices/deviceEventsSlice"; +import { + setEvents, + initPersistedTimings, +} from "@/redux/slices/deviceEventsSlice"; declare global { interface Window { @@ -18,6 +21,25 @@ export default function DeviceEventsBridge() { React.useEffect(() => { let lastSig = ""; + // Hydrate persisted timings once + try { + const raw = + typeof window !== "undefined" && + localStorage.getItem("deviceEventsTimingsV1"); + if (raw) { + const parsed = JSON.parse(raw); + dispatch( + initPersistedTimings({ + loop: parsed.loop, + tdr: parsed.tdr, + compare: parsed.compare || parsed.align, + }) + ); + } + } catch (e) { + // eslint-disable-next-line no-console + console.warn("DeviceEventsBridge hydration failed", e); + } const readAndDispatch = () => { const ksx = Array.isArray(window.loopMeasurementEvent) ? window.loopMeasurementEvent diff --git a/components/main/kabelueberwachung/kue705FO/SlotActivityOverlay.tsx b/components/main/kabelueberwachung/kue705FO/SlotActivityOverlay.tsx index f3f577d..6a7b679 100644 --- a/components/main/kabelueberwachung/kue705FO/SlotActivityOverlay.tsx +++ b/components/main/kabelueberwachung/kue705FO/SlotActivityOverlay.tsx @@ -1,7 +1,6 @@ "use client"; import React, { useEffect, useState } from "react"; -import { useAppSelector, useAppDispatch } from "@/redux/store"; -import { initPersistedTimings } from "@/redux/slices/deviceEventsSlice"; +import { useAppSelector } from "@/redux/store"; export default function SlotActivityOverlay({ slotIndex, @@ -25,32 +24,11 @@ export default function SlotActivityOverlay({ const comparisonStartedAtBySlot = useAppSelector( (s) => s.deviceEvents.comparisonStartedAtBySlot ); - const dispatch = useAppDispatch(); const loopActive = Array.isArray(ksx) && ksx[slotIndex] === 1; const tdrActive = Array.isArray(ksy) && ksy[slotIndex] === 1; const comparisonActive = Array.isArray(ksz) && ksz[slotIndex] === 1; - // Load persisted timings only once (on mount) - useEffect(() => { - try { - const raw = localStorage.getItem("deviceEventsTimingsV1"); - if (raw) { - const parsed = JSON.parse(raw); - dispatch( - initPersistedTimings({ - loop: parsed.loop, - tdr: parsed.tdr, - compare: parsed.align || parsed.compare, - }) - ); - } - } catch (e) { - // eslint-disable-next-line no-console - console.warn("Failed to load persisted timings", e); - } - }, [dispatch]); - // Persist whenever arrays change useEffect(() => { try { diff --git a/package-lock.json b/package-lock.json index 879db1f..d060224 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.866", + "version": "1.6.867", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.866", + "version": "1.6.867", "dependencies": { "@fontsource/roboto": "^5.1.0", "@headlessui/react": "^2.2.4", diff --git a/package.json b/package.json index 061c3d0..9de98c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.866", + "version": "1.6.867", "private": true, "scripts": { "dev": "next dev -p 3000", diff --git a/redux/slices/deviceEventsSlice.ts b/redux/slices/deviceEventsSlice.ts index c677fd0..c70dfcb 100644 --- a/redux/slices/deviceEventsSlice.ts +++ b/redux/slices/deviceEventsSlice.ts @@ -75,17 +75,24 @@ export const deviceEventsSlice = createSlice({ // Per-slot transition detection for (let i = 0; i < 32; i++) { if (prevKsx[i] === 0 && state.ksx[i] === 1) { - state.loopStartedAtBySlot[i] = Date.now(); + // Only set if no existing (hydrated) timestamp + if (!state.loopStartedAtBySlot[i]) { + state.loopStartedAtBySlot[i] = Date.now(); + } } else if (prevKsx[i] === 1 && state.ksx[i] === 0) { state.loopStartedAtBySlot[i] = null; } if (prevKsy[i] === 0 && state.ksy[i] === 1) { - state.tdrStartedAtBySlot[i] = Date.now(); + if (!state.tdrStartedAtBySlot[i]) { + state.tdrStartedAtBySlot[i] = Date.now(); + } } else if (prevKsy[i] === 1 && state.ksy[i] === 0) { state.tdrStartedAtBySlot[i] = null; } if (prevKsz[i] === 0 && state.ksz[i] === 1) { - state.comparisonStartedAtBySlot[i] = Date.now(); + if (!state.comparisonStartedAtBySlot[i]) { + state.comparisonStartedAtBySlot[i] = Date.now(); + } } else if (prevKsz[i] === 1 && state.ksz[i] === 0) { state.comparisonStartedAtBySlot[i] = null; }