From 09bc64e7717e277e998094413e43dec71c657d00 Mon Sep 17 00:00:00 2001 From: ISA Date: Thu, 3 Jul 2025 10:23:39 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20API=20f=C3=BCr=20Systemspannung=20+5V?= =?UTF-8?q?=20erfolgreich=20implementiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - API-Handler `getSystemspannung5VplusHandler.ts` erstellt - JSON-Daten werden aus dem Verzeichnis `mocks/device-cgi-simulator/chartsData/systemspannung5Vplus/` geladen - unterstützt die Parameter DIA0, DIA1, DIA2 für unterschiedliche Datenfrequenzen - Fehlerbehandlung bei ungültigen Typen und fehlenden Dateien eingebaut - API getestet unter `/api/cpl/getSystemspannung5VplusHandler?typ=DIA0` --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 11 +++++++++++ components/main/system/DetailModal.tsx | 5 +++-- components/main/system/SystemCharts.tsx | 2 +- package-lock.json | 4 ++-- package.json | 2 +- pages/system.tsx | 7 +++---- redux/slices/systemspannung5VplusSlice.ts | 11 +++++++---- 9 files changed, 30 insertions(+), 16 deletions(-) diff --git a/.env.development b/.env.development index 6dc3e5a..29530d4 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.530 +NEXT_PUBLIC_APP_VERSION=1.6.531 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 60d0bd1..9cf6037 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.530 +NEXT_PUBLIC_APP_VERSION=1.6.531 NEXT_PUBLIC_CPL_MODE=production \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a731805..2a2b410 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [1.6.531] – 2025-07-03 + +- feat: API für Systemspannung +5V erfolgreich implementiert + +- API-Handler `getSystemspannung5VplusHandler.ts` erstellt +- JSON-Daten werden aus dem Verzeichnis `mocks/device-cgi-simulator/chartsData/systemspannung5Vplus/` geladen +- unterstützt die Parameter DIA0, DIA1, DIA2 für unterschiedliche Datenfrequenzen +- Fehlerbehandlung bei ungültigen Typen und fehlenden Dateien eingebaut +- API getestet unter `/api/cpl/getSystemspannung5VplusHandler?typ=DIA0` + +--- ## [1.6.530] – 2025-07-03 - fix: KÜ Firmwareupdate diff --git a/components/main/system/DetailModal.tsx b/components/main/system/DetailModal.tsx index a1ecd66..f7475d7 100644 --- a/components/main/system/DetailModal.tsx +++ b/components/main/system/DetailModal.tsx @@ -28,8 +28,9 @@ export const DetailModal = ({ isOpen, selectedKey, onClose }: Props) => { ); // Zeitstempel und Werte extrahieren - const labels = reduxData.map((e: any) => e.t); - const values = reduxData.map((e: any) => e.i); + type DataPoint = { t: string; i: number }; + const labels = reduxData.map((e: unknown) => (e as DataPoint).t); + const values = reduxData.map((e: unknown) => (e as DataPoint).i); const baseOptions = { responsive: true, diff --git a/components/main/system/SystemCharts.tsx b/components/main/system/SystemCharts.tsx index 7852e18..82d5029 100644 --- a/components/main/system/SystemCharts.tsx +++ b/components/main/system/SystemCharts.tsx @@ -23,7 +23,7 @@ ChartJS.register( Legend ); -type HistoryEntry = { +export type HistoryEntry = { time: string | number | Date; "+5V": number; "+15V": number; diff --git a/package-lock.json b/package-lock.json index 25b8e71..9eb825d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cpl-v4", - "version": "1.6.530", + "version": "1.6.531", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "cpl-v4", - "version": "1.6.530", + "version": "1.6.531", "dependencies": { "@fontsource/roboto": "^5.1.0", "@iconify-icons/ri": "^1.2.10", diff --git a/package.json b/package.json index a567b8b..30aef0f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.530", + "version": "1.6.531", "private": true, "scripts": { "dev": "next dev", diff --git a/pages/system.tsx b/pages/system.tsx index 023cf6a..6eb741c 100644 --- a/pages/system.tsx +++ b/pages/system.tsx @@ -7,15 +7,17 @@ import { getSystemVoltTempThunk } from "../redux/thunks/getSystemVoltTempThunk"; import { SystemOverviewGrid } from "@/components/main/system/SystemOverviewGrid"; import { SystemCharts } from "@/components/main/system/SystemCharts"; import { DetailModal } from "@/components/main/system/DetailModal"; +import type { HistoryEntry } from "@/components/main/system/SystemCharts"; const SystemPage = () => { const dispatch = useDispatch(); const voltages = useSelector( (state: RootState) => state.systemVoltTemp.voltages ); + const history = useSelector( (state: RootState) => state.systemVoltTemp.history - ); + ) as HistoryEntry[]; const [selectedKey, setSelectedKey] = useState(null); const [isModalOpen, setIsModalOpen] = useState(false); @@ -28,8 +30,6 @@ const SystemPage = () => { return () => clearInterval(interval); }, [dispatch]); - const labels = history.map((h) => new Date(h.time).toLocaleTimeString()); - const handleOpenDetail = (key: string) => { setSelectedKey(key); setIsModalOpen(true); @@ -50,7 +50,6 @@ const SystemPage = () => { diff --git a/redux/slices/systemspannung5VplusSlice.ts b/redux/slices/systemspannung5VplusSlice.ts index a3bb817..ee6a8ee 100644 --- a/redux/slices/systemspannung5VplusSlice.ts +++ b/redux/slices/systemspannung5VplusSlice.ts @@ -3,9 +3,9 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit"; import { getSystemspannung5VplusThunk } from "../thunks/getSystemspannung5VplusThunk"; type StateType = { - DIA0: any[]; // alle Werte - DIA1: any[]; // stündlich - DIA2: any[]; // täglich + DIA0: unknown[]; // alle Werte + DIA1: unknown[]; // stündlich + DIA2: unknown[]; // täglich isLoading: boolean; error: string | null; }; @@ -32,7 +32,10 @@ export const systemspannung5VplusSlice = createSlice({ getSystemspannung5VplusThunk.fulfilled, ( state, - action: PayloadAction<{ typ: "DIA0" | "DIA1" | "DIA2"; data: any[] }> + action: PayloadAction<{ + typ: "DIA0" | "DIA1" | "DIA2"; + data: unknown[]; + }> ) => { state.isLoading = false; state[action.payload.typ] = action.payload.data;