fix: richtige Link in system fetch service

This commit is contained in:
ISA
2025-08-01 11:30:11 +02:00
parent 0a20f91ba6
commit 3098ce67f0
12 changed files with 94 additions and 23 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.674
NEXT_PUBLIC_APP_VERSION=1.6.675
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.674
NEXT_PUBLIC_APP_VERSION=1.6.675
NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,13 @@
## [1.6.675] 2025-08-01
- feat: fetchSystemData.mjs erweitert und optimiert
Analoge Eingänge und Systemdaten werden jetzt gemeinsam abgerufen und gespeichert
Einheitliche Benennung (input statt eingang) für analoge Eingänge
Datumssplittung als Hilfsfunktion ausgelagert
Kommentare und Beschreibung verbessert
---
## [1.6.674] 2025-08-01
- refactor: mMeldungen angepasst

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "cpl-v4",
"version": "1.6.674",
"version": "1.6.675",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cpl-v4",
"version": "1.6.674",
"version": "1.6.675",
"dependencies": {
"@fontsource/roboto": "^5.1.0",
"@headlessui/react": "^2.2.4",

View File

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

View File

@@ -9,12 +9,22 @@ export const fetchSystemspannung15VminusService = async (
const isDev = process.env.NODE_ENV === "development";
const channel = 114; // 114 = -15V laut Spezifikation
const from = "2025;01;01";
const to = "2025;07;31";
// Dynamisch: to = heute, from = 30 Tage zurück
const getDateParts = (date: Date) => {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
return { y, m, d };
};
const today = new Date();
const toParts = getDateParts(today);
const fromDateObj = new Date(today);
fromDateObj.setDate(today.getDate() - 30);
const fromParts = getDateParts(fromDateObj);
const path = isDev
? `/api/cpl/getSystemspannung15VminusHandler?typ=${type}`
: `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`;
: `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`;
const res = await fetch(path);
if (!res.ok) throw new Error("❌ Fehler beim Abrufen der -15V-Daten");

View File

@@ -9,12 +9,23 @@ export const fetchSystemspannung15VplusService = async (
const isDev = process.env.NODE_ENV === "development";
const channel = 108; // 108 = +15V laut Spezifikation
const from = "2025;01;01";
const to = "2025;07;31";
// Dynamisch: to = heute, from = 30 Tage zurück
// Hilfsfunktion für Datumsteile
const getDateParts = (date: Date) => {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
return { y, m, d };
};
const today = new Date();
const toParts = getDateParts(today);
const fromDateObj = new Date(today);
fromDateObj.setDate(today.getDate() - 30);
const fromParts = getDateParts(fromDateObj);
const path = isDev
? `/api/cpl/getSystemspannung15VplusHandler?typ=${type}`
: `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`;
: `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`;
const res = await fetch(path);
if (!res.ok) throw new Error("❌ Fehler beim Abrufen der +15V-Daten");

View File

@@ -11,12 +11,22 @@ export const fetchSystemspannung5VplusService = async (
const isDev = process.env.NODE_ENV === "development";
const channel = 110; // 110 = +5V
const from = "2025;01;01";
const to = "2025;07;31";
// Dynamisch: to = heute, from = 30 Tage zurück
const getDateParts = (date: Date) => {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
return { y, m, d };
};
const today = new Date();
const toParts = getDateParts(today);
const fromDateObj = new Date(today);
fromDateObj.setDate(today.getDate() - 30);
const fromParts = getDateParts(fromDateObj);
const path = isDev
? `/api/cpl/getSystemspannung5VplusHandler?typ=${type}`
: `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`;
: `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`;
const res = await fetch(path);
if (!res.ok) throw new Error("❌ Fehler beim Abrufen der +5V-Daten");

View File

@@ -9,12 +9,22 @@ export const fetchSystemspannung98VminusService = async (
const isDev = process.env.NODE_ENV === "development";
const channel = 115; // 115 = -98V laut Spezifikation
const from = "2025;01;01";
const to = "2025;07;31";
// Dynamisch: to = heute, from = 30 Tage zurück
const getDateParts = (date: Date) => {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
return { y, m, d };
};
const today = new Date();
const toParts = getDateParts(today);
const fromDateObj = new Date(today);
fromDateObj.setDate(today.getDate() - 30);
const fromParts = getDateParts(fromDateObj);
const path = isDev
? `/api/cpl/getSystemspannung98VminusHandler?typ=${type}`
: `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`;
: `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`;
const res = await fetch(path);
if (!res.ok) throw new Error("❌ Fehler beim Abrufen der -98V-Daten");

View File

@@ -9,12 +9,22 @@ export const fetchTemperaturAdWandlerService = async (
const isDev = process.env.NODE_ENV === "development";
const channel = 116; // 116 = Temperatur AD-Wandler laut Spezifikation
const from = "2025;01;01";
const to = "2025;07;31";
// Dynamisch: to = heute, from = 30 Tage zurück
const getDateParts = (date: Date) => {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
return { y, m, d };
};
const today = new Date();
const toParts = getDateParts(today);
const fromDateObj = new Date(today);
fromDateObj.setDate(today.getDate() - 30);
const fromParts = getDateParts(fromDateObj);
const path = isDev
? `/api/cpl/getTemperaturAdWandlerHandler?typ=${type}`
: `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`;
: `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`;
const res = await fetch(path);
if (!res.ok)

View File

@@ -9,12 +9,22 @@ export const fetchTemperaturProzessorService = async (
const isDev = process.env.NODE_ENV === "development";
const channel = 117; // 117 = Temperatur Prozessor laut Spezifikation
const from = "2025;01;01";
const to = "2025;07;31";
// Dynamisch: to = heute, from = 30 Tage zurück
const getDateParts = (date: Date) => {
const y = date.getFullYear();
const m = String(date.getMonth() + 1).padStart(2, "0");
const d = String(date.getDate()).padStart(2, "0");
return { y, m, d };
};
const today = new Date();
const toParts = getDateParts(today);
const fromDateObj = new Date(today);
fromDateObj.setDate(today.getDate() - 30);
const fromParts = getDateParts(fromDateObj);
const path = isDev
? `/api/cpl/getTemperaturProzessorHandler?typ=${type}`
: `/cpl?/dashboard.html&${type}=${from};${to};${channel};1;`;
: `/CPL?seite.ACP&${type}=${fromParts.y};${fromParts.m};${fromParts.d};${toParts.y};${toParts.m};${toParts.d};${channel};1`;
const res = await fetch(path);
if (!res.ok)