feat: Modus-Erkennung über window.location.hostname implementiert

- Automatische Umschaltung zwischen Entwicklungs- und Produktionsmodus
- Hostname-basierte Erkennung: localhost/127.0.0.1 → "dev", sonst → "production"
- fetchDigitalInputsService.ts entsprechend angepasst
- Erleichtert Entwicklung und reduziert manuelle .env-Konfiguration
This commit is contained in:
ISA
2025-07-09 09:45:49 +02:00
parent 14bd72756a
commit eca52f35cb
6 changed files with 20 additions and 6 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.566
NEXT_PUBLIC_APP_VERSION=1.6.567
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.566
NEXT_PUBLIC_APP_VERSION=1.6.567
NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,15 @@
## [1.6.567] 2025-07-09
- feat: CGI-kompatiblen CSV-Parser für digitale Eingänge implementiert
- digitaleInputsMockData.json angepasst: CGI-nahe Simulation mit CSV-Strings und Stringwerten
- fetchDigitalInputsService.ts erweitert:
- CSV-Zeilen werden automatisch in Arrays umgewandelt
- Labels wie "'DE1','DE2'" werden korrekt aufgeteilt
- Daten aus 4 CGI-Blöcken zu 32 Eingängen gemappt
- ermöglicht realitätsnahe Tests in Entwicklungsumgebung ohne Produktion
---
## [1.6.566] 2025-07-09
- feat: Umstellung von CGI-Daten für analoge Eingänge von JS auf JSON

4
package-lock.json generated
View File

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

View File

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

View File

@@ -22,7 +22,9 @@ const parseCsvLabels = (line: string): string[] =>
line.split(",").map((v) => v.trim().replace(/^'+|'+$/g, ""));
export const fetchDigitalInputsService = async (): Promise<DigitalInput[]> => {
const mode = "production"; // ⛳ production oder json
const hostname = window.location.hostname;
const mode =
hostname === "localhost" || hostname === "127.0.0.1" ? "dev" : "production";
const url =
mode === "production"