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`
This commit is contained in:
ISA
2025-07-03 10:23:39 +02:00
parent cee3ee0581
commit 09bc64e771
9 changed files with 30 additions and 16 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -23,7 +23,7 @@ ChartJS.register(
Legend
);
type HistoryEntry = {
export type HistoryEntry = {
time: string | number | Date;
"+5V": number;
"+15V": number;

4
package-lock.json generated
View File

@@ -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",

View File

@@ -1,6 +1,6 @@
{
"name": "cpl-v4",
"version": "1.6.530",
"version": "1.6.531",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -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<AppDispatch>();
const voltages = useSelector(
(state: RootState) => state.systemVoltTemp.voltages
);
const history = useSelector(
(state: RootState) => state.systemVoltTemp.history
);
) as HistoryEntry[];
const [selectedKey, setSelectedKey] = useState<string | null>(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 = () => {
<DetailModal
isOpen={isModalOpen}
selectedKey={selectedKey}
history={history}
onClose={handleCloseDetail}
/>
</div>

View File

@@ -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;