feat: Umstellung von CGI-Daten für analoge Eingänge von JS auf JSON

- CGI-Platzhalter in `analogInputs.json` eingeführt (z. B. <%=AAV01%>)
- Alte JS-Datei ersetzt durch reine JSON-Struktur
- Anpassung des Service-Handlers (`getAnalogInputsHandler.ts`) auf JSON-Parsing
- Reduziert Ladezeit, vereinfacht Code und entfernt unnötige Script-Einbindung
- Mock-Daten weiterhin in `analogInputsMockData.json` für Entwicklungsmodus verfügbar
This commit is contained in:
ISA
2025-07-08 14:44:44 +02:00
parent 93c3bc612d
commit 7797549baa
10 changed files with 32 additions and 195 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.564
NEXT_PUBLIC_APP_VERSION=1.6.565
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.564
NEXT_PUBLIC_APP_VERSION=1.6.565
NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,12 @@
## [1.6.565] 2025-07-08
- Bei den Kabelüberwachung kann neben den Button “Firmware Update” noch zwei Button “Konfiguration sichern” und “Konfiguration zurücksichern” im Admin-Modus hinzukommen.
Store: Befehl KSB%i=%i z.B. KSB03=1 sichert die Konfiguration der KÜ 4
Restore: Befehl KSR%i=%i z.B. KSR03=1 sichert die Konfiguration der KÜ 4 zurück
---
## [1.6.564] 2025-07-08
- refactor: extract Kabelueberwachung logic into KabelueberwachungView for better structure

View File

@@ -1,72 +0,0 @@
{
"win_analogInputsValues": [
4.771072,
5.665244,
0.005467,
-0.007468,
0.000002,
0.000001,
0.000001,
0.000007
],
"win_analogInputsLabels": [
"AE 1",
"AE 2",
"AE 3",
"AE 4",
"AE 5",
"AE 6",
"AE 7",
"AE 8"
],
"win_analogInputsOffset": [
10.988,
0,
0,
0,
0,
0,
0,
0
],
"win_analogInputsFactor": [
11.988,
1,
1,
1,
1,
1,
1,
1
],
"win_analogInputsUnits": [
"V",
"V",
"V",
"V",
"mA",
"mA",
"mA",
"mA"
],
"win_analogInputsLoggerIntervall": [
7,
10,
10,
10,
10,
10,
10,
10
],
"win_analogInputsWeighting": [
0,
0,
0,
0,
0,
0,
0,
0
]
}

View File

@@ -1,22 +0,0 @@
// /mocks/device-cgi-simulator/SERVICE/analogInputsMockData.js
var win_analogInputsValues = [
4.771072, 5.665244, 0.005467, -0.007468, 0.000002, 0.000001, 0.000001,
0.070007,
];
var win_analogInputsLabels = ["AE 11", "AE 2", "AE 3", "AE 4", "AE 5", "AE 6", "AE 7", "AE 8", ];
var win_analogInputsOffset = [21.999, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0];
var win_analogInputsFactor = [21.999, 1.0, 1.0, 1, 1.0, 1.0, 1.0, 1.0];
var win_analogInputsLoggerIntervall = [21, 10, 10, 10, 10, 10, 10, 10];
var win_analogInputsUnits = ["V", "V", "V", "V", "mA", "mA", "mA", "mA"];
var win_analogInputsWeighting = [0, 0, 0, 0, 0, 0, 0, 0];
/*
ID (z. B. 1, 2, ... 8) → Identifikation des Eingangs
Wert (z. B. 0, 22.91, 21) → Der analoge Wert
Bezeichnung (z. B. "----", "Feuchtigkeit", "Temperatur") → Name des Sensors
uW (Unterer Warnwert) → 1 = grün, 0 = grau
uG (Unterer Grenzwert) → 1 = grün, 0 = grau
oW (Oberer Warnwert) → 1 = orange, 0 = grau
oG (Oberer Grenzwert) → 1 = grün, 0 = grau
*/

View File

@@ -1,63 +1,21 @@
{
"win_analogInputsValues": [
"126.812080",
"5.680176",
"-0.015003",
"0.009538",
"-0.000002",
"0.000003",
"-0.000005",
"0.000000"
4.771072, 5.665244, 0.005467, -0.007468, 0.000002, 0.000001, 0.000001,
0.000007
],
"win_analogInputsLabels": [
"'AE 1'",
"'AE 2'",
"'AE 3'",
"'AE 4'",
"'AE 5'",
"'AE 6'",
"'AE 7'",
"'AE 8'"
"AE 1",
"AE 2",
"AE 3",
"AE 4",
"AE 5",
"AE 6",
"AE 7",
"AE 8"
],
"win_analogInputsUnits": [
"'V'",
"'V'",
"'V'",
"'V'",
"'mA'",
"'mA'",
"'mA'",
"'mA'"
],
"win_analogInputsFactor": [
"21.999",
"1.000",
"1.000",
"1.000",
"1.000",
"1.000",
"1.000",
"1.000"
],
"win_analogInputsOffset": [
"21.999",
"0.000",
"0.000",
"0.000",
"0.000",
"0.000",
"0.000",
"0.000"
],
"win_analogInputsWeighting": ["0", "0", "0", "0", "0", "0", "0", "0"],
"win_analogInputsLoggerIntervall": [
"21",
"10",
"10",
"10",
"10",
"10",
"10",
"10"
]
"win_analogInputsOffset": [10.988, 0, 0, 0, 0, 0, 0, 0],
"win_analogInputsFactor": [11.988, 1, 1, 1, 1, 1, 1, 1],
"win_analogInputsUnits": ["V", "V", "V", "V", "mA", "mA", "mA", "mA"],
"win_analogInputsLoggerIntervall": [7, 10, 10, 10, 10, 10, 10, 10],
"win_analogInputsWeighting": [0, 0, 0, 0, 0, 0, 0, 0]
}

4
package-lock.json generated
View File

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

View File

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

View File

@@ -8,7 +8,7 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const mode = process.env.NEXT_PUBLIC_CPL_MODE;
try {
if (mode === "json") {
/* if (mode === "json") {
const filePath = path.join(
process.cwd(),
"mocks/api/SERVICE/analogInputsMockData.json"
@@ -16,9 +16,9 @@ export default function handler(req: NextApiRequest, res: NextApiResponse) {
const content = fs.readFileSync(filePath, "utf-8");
const data = JSON.parse(content);
return res.status(200).json(data);
}
} */
if (mode === "jsSimulatedProd") {
if (mode === "json") {
const filePath = path.join(
process.cwd(),
"mocks/device-cgi-simulator/SERVICE/analogInputsMockData.json"

View File

@@ -1,36 +0,0 @@
// /public/CPL/SERVICE/analogInputs.js
//CGI-Variablen
var win_analogInputsValues = [<%=AAV01%>,<%=AAV02%>,<%=AAV03%>,<%=AAV04%>,<%=AAV05%>,<%=AAV06%>,<%=AAV07%>,<%=AAV08%>];
var win_analogInputsLabels=[<%=ACN01%>,<%=ACN02%>,<%=ACN03%>,<%=ACN04%>,<%=ACN05%>,<%=ACN06%>,<%=ACN07%>,<%=ACN08%>];
var win_analogInputsUnits=[<%=ACU01%>,<%=ACU02%>,<%=ACU03%>,<%=ACU04%>,<%=ACU05%>,<%=ACU06%>,<%=ACU07%>,<%=ACU08%>];
var win_analogInputsFactor=[<%=ACF01%>,<%=ACF02%>,<%=ACF03%>,<%=ACF04%>,<%=ACF05%>,<%=ACF06%>,<%=ACF07%>,<%=ACF08%>];
var win_analogInputsOffset=[<%=ACO01%>,<%=ACO02%>,<%=ACO03%>,<%=ACO04%>,<%=ACO05%>,<%=ACO06%>,<%=ACO07%>,<%=ACO08%>];
var win_analogInputsWeighting=[<%=ACS01%>,<%=ACS02%>,<%=ACS03%>,<%=ACS04%>,<%=ACS05%>,<%=ACS06%>,<%=ACS07%>,<%=ACS08%>];
var win_analogInputsLoggerIntervall =[<%=ACL01%>,<%=ACL02%>,<%=ACL03%>,<%=ACL04%>,<%=ACL05%>,<%=ACL06%>,<%=ACL07%>,<%=ACL08%>];
// CGI responsive Variablen
/*
var win_analogInputsValues = [4.771072,5.665244,0.005467,-0.007468,0.000002,0.000001,0.000001,0.000007];
var win_analogInputsLabels=['AE 1','AE 2','AE 3','AE 4','AE 5','AE 6','AE 7','AE 8'];
var win_analogInputsUnits=['V','V','V','V','mA','mA','mA','mA'];
var win_analogInputsFactor=[1.000,1.000,1.000,1.000,1.000,1.000,1.000,1.000];
var win_analogInputsOffset=[0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000];
var win_analogInputsWeighting=[0,0,0,0,0,0,0,0];
var win_analogInputsLoggerIntervall =[10,10,10,10,10,10,10,10];
/*
Kontext:
Messwert
Hinweis: AE16 (-96V)
benötigt die aktuelle
Backplane
Platzhalter:
AAVxx
xx = Nr. 1-8
oder 9-16 für
Systemspannungen
Ausgabeformat:
%0.6f
*/
// var system=[<%=AAV09%>,<%=AAV11%>,<%=AAV15%>,<%=AAV16%>,<%=AAV17%>,<%=AAV18%>];