From eca52f35cbceba1d4ce42a3c6cc5f5b76e067288 Mon Sep 17 00:00:00 2001 From: ISA Date: Wed, 9 Jul 2025 09:45:49 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20Modus-Erkennung=20=C3=BCber=20window.lo?= =?UTF-8?q?cation.hostname=20implementiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- .env.development | 2 +- .env.production | 2 +- CHANGELOG.md | 12 ++++++++++++ package-lock.json | 4 ++-- package.json | 2 +- services/fetchDigitalInputsService.ts | 4 +++- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.env.development b/.env.development index f960b49..ec40335 100644 --- a/.env.development +++ b/.env.development @@ -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) diff --git a/.env.production b/.env.production index ba2eb40..7290d6c 100644 --- a/.env.production +++ b/.env.production @@ -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 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a03c3f5..f8de843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/package-lock.json b/package-lock.json index c3fbbfb..3b90954 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 2335bdf..c2ece63 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cpl-v4", - "version": "1.6.566", + "version": "1.6.567", "private": true, "scripts": { "dev": "next dev", diff --git a/services/fetchDigitalInputsService.ts b/services/fetchDigitalInputsService.ts index d47021e..c1c6643 100644 --- a/services/fetchDigitalInputsService.ts +++ b/services/fetchDigitalInputsService.ts @@ -22,7 +22,9 @@ const parseCsvLabels = (line: string): string[] => line.split(",").map((v) => v.trim().replace(/^'+|'+$/g, "")); export const fetchDigitalInputsService = async (): Promise => { - 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"