feat: local-cpl-sim.mjs kabelueberwachung

This commit is contained in:
ISA
2025-09-04 11:16:06 +02:00
parent b62c477d50
commit 47e0efeb80
6 changed files with 52 additions and 5 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.834
NEXT_PUBLIC_APP_VERSION=1.6.835
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.834
NEXT_PUBLIC_APP_VERSION=1.6.835
NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,8 @@
## [1.6.835] 2025-09-04
- feat: local-cpl-sim.mjs Einstellungen done
---
## [1.6.834] 2025-09-04
- feat: local-cpl-sim.mjs

4
package-lock.json generated
View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "cpl-v4",
"version": "1.6.834",
"version": "1.6.835",
"private": true,
"scripts": {
"dev": "next dev -p 3000",

View File

@@ -69,6 +69,38 @@ function getRelFromRoot(filePath) {
function tryServeSpecialMocks(res, relPath) {
const rp = relPath.replace(/^\/+/, "");
// Serve ready JS/JSON mocks for some routes
// Digital Inputs JSON
if (rp === "CPL/SERVICE/digitalInputs.json") {
const mockPath = path.join(
process.cwd(),
"mocks",
"device-cgi-simulator",
"SERVICE",
"digitalInputsMockData.json"
);
if (exists(mockPath)) return streamRaw(res, mockPath);
}
// Kabelüberwachung main JS (kueData.js)
if (rp === "CPL/SERVICE/kueData.js") {
const mockPath = path.join(
process.cwd(),
"mocks",
"device-cgi-simulator",
"SERVICE",
"kabelueberwachungMockData.js"
);
if (exists(mockPath)) return streamRaw(res, mockPath);
}
// Kabelüberwachung Knotenpunkte slot JS files
if (rp.startsWith("CPL/SERVICE/knotenpunkte/") && rp.endsWith(".js")) {
const mockPath = path.join(
process.cwd(),
"mocks",
"device-cgi-simulator",
rp.replace(/^CPL\//, "")
);
if (exists(mockPath)) return streamRaw(res, mockPath);
}
if (rp === "CPL/SERVICE/systemVoltTemp.js") {
const mockPath = path.join(
process.cwd(),
@@ -108,6 +140,16 @@ function tryServeSpecialMocks(res, relPath) {
);
if (exists(mockPath)) return streamRaw(res, mockPath);
}
// TDR reference curves (if mocks exist)
if (rp.startsWith("CPL/tdr-reference-curves/")) {
const mockPath = path.join(
process.cwd(),
"mocks",
"device-cgi-simulator",
rp.replace(/^CPL\//, "")
);
if (exists(mockPath)) return streamRaw(res, mockPath);
}
return false;
}