diff --git a/.gitignore b/.gitignore index 61a9253..1c58ba2 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,7 @@ ipython_config.py /work /log /results + +# Node.js (client) +node_modules/ +client/dist/ diff --git a/bin/client.bat b/bin/client.bat new file mode 100644 index 0000000..4065004 --- /dev/null +++ b/bin/client.bat @@ -0,0 +1,74 @@ +@echo off + +REM ================================================================ +REM PLANTPLAN - Client (Vite Dev-Server) verwalten +REM Verwendung: client.bat [start|stop|reload|status] +REM ================================================================ + +call "%~dp0setenv.bat" + +if "%1"=="" goto usage + +if /i "%1"=="start" goto start +if /i "%1"=="stop" goto stop +if /i "%1"=="reload" goto reload +if /i "%1"=="status" goto status +goto usage + +:start +echo Starting PlantPlan Client (Vite) ... + +REM Pruefen ob Client bereits laeuft +tasklist /FI "WINDOWTITLE eq PlantPlan-Client" 2>nul | find /i "cmd.exe" >nul +if not errorlevel 1 ( + echo Client laeuft bereits! + goto end +) + +REM Pruefen ob node_modules existiert +if not exist "%PV_CLIENT%\node_modules" ( + echo FEHLER: node_modules nicht gefunden! Bitte zuerst install_npm.bat ausfuehren. + goto end +) + +start "PlantPlan-Client" cmd /k "cd /d "%PV_CLIENT%" && npm run dev" +echo Client gestartet auf %PV_CLIENT_URL% +goto end + +:stop +echo Stopping PlantPlan Client ... +taskkill /FI "WINDOWTITLE eq PlantPlan-Client" /T /F >nul 2>&1 +if errorlevel 1 ( + echo Client war nicht gestartet. +) else ( + echo Client gestoppt. +) +goto end + +:reload +echo Reloading PlantPlan Client ... +call :stop +timeout /t 2 /nobreak >nul +call :start +goto end + +:status +tasklist /FI "WINDOWTITLE eq PlantPlan-Client" 2>nul | find /i "cmd.exe" >nul +if not errorlevel 1 ( + echo Client: LAEUFT +) else ( + echo Client: GESTOPPT +) +goto end + +:usage +echo. +echo Verwendung: client.bat [start^|stop^|reload^|status] +echo. +echo start - Client starten (Vite Dev-Server) +echo stop - Client stoppen +echo reload - Client neu starten +echo status - Pruefen ob Client laeuft +echo. + +:end diff --git a/bin/install_npm.bat b/bin/install_npm.bat new file mode 100644 index 0000000..fc74a36 --- /dev/null +++ b/bin/install_npm.bat @@ -0,0 +1,18 @@ +@echo off +REM ================================================================ +REM PLANTPLAN - Node.js Packages fuer Client installieren +REM ================================================================ +REM Fuehrt npm install im client/ Verzeichnis aus +REM ================================================================ + +call "%~dp0setenv.bat" + +if not exist "%PV_CLIENT%\node_modules" ( + echo Installiere Node.js Packages fuer Client... + cd /d "%PV_CLIENT%" + npm install + echo Erfolgreich. +) else ( + echo Node.js Packages bereits installiert! + echo Zum Aktualisieren: cd client ^& npm install +) diff --git a/bin/install_npm.sh b/bin/install_npm.sh new file mode 100644 index 0000000..cd0df0d --- /dev/null +++ b/bin/install_npm.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# ================================================================ +# PLANTPLAN - Node.js Packages fuer Client installieren +# ================================================================ +# Fuehrt npm install im client/ Verzeichnis aus +# ================================================================ + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "$SCRIPT_DIR/setenv.sh" + +if [ ! -d "$PV_CLIENT/node_modules" ]; then + echo "Installiere Node.js Packages fuer Client..." + cd "$PV_CLIENT" + npm install + echo "Erfolgreich." +else + echo "Node.js Packages bereits installiert!" + echo "Zum Aktualisieren: cd client && npm install" +fi diff --git a/bin/server.bat b/bin/server.bat new file mode 100644 index 0000000..7796877 --- /dev/null +++ b/bin/server.bat @@ -0,0 +1,74 @@ +@echo off + +REM ================================================================ +REM PLANTPLAN - Server (FastAPI/Uvicorn) verwalten +REM Verwendung: server.bat [start|stop|reload|status] +REM ================================================================ + +call "%~dp0setenv.bat" + +if "%1"=="" goto usage + +if /i "%1"=="start" goto start +if /i "%1"=="stop" goto stop +if /i "%1"=="reload" goto reload +if /i "%1"=="status" goto status +goto usage + +:start +echo Starting PlantPlan Server (uvicorn) ... + +REM Pruefen ob Server bereits laeuft +tasklist /FI "WINDOWTITLE eq PlantPlan-Server" 2>nul | find /i "cmd.exe" >nul +if not errorlevel 1 ( + echo Server laeuft bereits! + goto end +) + +REM Pruefen ob venv existiert +if not exist "%PROJECT%\.venv\Scripts\activate.bat" ( + echo FEHLER: .venv nicht gefunden! Bitte zuerst install_py.bat ausfuehren. + goto end +) + +start "PlantPlan-Server" cmd /k "cd /d "%PV_SERVER%" && "%PROJECT%\.venv\Scripts\activate.bat" && uvicorn main:app --reload --host %PV_SERVER_HOST% --port %PV_SERVER_PORT%" +echo Server gestartet auf %PV_SERVER_URL% +goto end + +:stop +echo Stopping PlantPlan Server ... +taskkill /FI "WINDOWTITLE eq PlantPlan-Server" /T /F >nul 2>&1 +if errorlevel 1 ( + echo Server war nicht gestartet. +) else ( + echo Server gestoppt. +) +goto end + +:reload +echo Reloading PlantPlan Server ... +call :stop +timeout /t 2 /nobreak >nul +call :start +goto end + +:status +tasklist /FI "WINDOWTITLE eq PlantPlan-Server" 2>nul | find /i "cmd.exe" >nul +if not errorlevel 1 ( + echo Server: LAEUFT +) else ( + echo Server: GESTOPPT +) +goto end + +:usage +echo. +echo Verwendung: server.bat [start^|stop^|reload^|status] +echo. +echo start - Server starten (uvicorn mit --reload) +echo stop - Server stoppen +echo reload - Server neu starten +echo status - Pruefen ob Server laeuft +echo. + +:end diff --git a/bin/setenv.bat b/bin/setenv.bat index f3f3207..6640f9d 100644 --- a/bin/setenv.bat +++ b/bin/setenv.bat @@ -20,6 +20,15 @@ set "PV_LOG=%PROJECT%\log" set "PV_TESTS=%PROJECT%\tests" set "PV_RESULTS=%PROJECT%\results" set "PV_EXAMPLES=%PROJECT%\examples" +set "PV_CLIENT=%PROJECT%\client" +set "PV_SERVER=%PROJECT%\server" + +REM Netzwerk-Konfiguration +set "PV_SERVER_HOST=127.0.0.1" +set "PV_SERVER_PORT=8000" +set "PV_CLIENT_PORT=5173" +set "PV_SERVER_URL=http://%PV_SERVER_HOST%:%PV_SERVER_PORT%" +set "PV_CLIENT_URL=http://localhost:%PV_CLIENT_PORT%" REM Python-Pfad erweitern (nur wenn noch nicht vorhanden) echo %PYTHONPATH% | find /i "%PV_LIB%" >nul @@ -35,6 +44,8 @@ if not exist "%PV_DATA%" mkdir "%PV_DATA%" if not exist "%PV_LOG%" mkdir "%PV_LOG%" if not exist "%PV_RESULTS%" mkdir "%PV_RESULTS%" if not exist "%PV_EXAMPLES%" mkdir "%PV_EXAMPLES%" +if not exist "%PV_CLIENT%" mkdir "%PV_CLIENT%" +if not exist "%PV_SERVER%" mkdir "%PV_SERVER%" REM Umgebungsvariablen anzeigen echo. @@ -47,6 +58,10 @@ echo PV_DATA = %PV_DATA% echo PV_RESULTS = %PV_RESULTS% echo PV_LOG = %PV_LOG% echo PV_EXAMPLES = %PV_EXAMPLES% +echo PV_CLIENT = %PV_CLIENT% +echo PV_SERVER = %PV_SERVER% +echo PV_SERVER_URL = %PV_SERVER_URL% +echo PV_CLIENT_URL = %PV_CLIENT_URL% echo PYTHONPATH = %PYTHONPATH% echo ================================================================ echo. diff --git a/bin/setenv.sh b/bin/setenv.sh index a946a2d..3294dda 100644 --- a/bin/setenv.sh +++ b/bin/setenv.sh @@ -19,8 +19,17 @@ export PV_CFG="$PROJECT/cfg" export PV_LOG="$PROJECT/log" export PV_TESTS="$PROJECT/tests" export PV_RESULTS="$PROJECT/results" +export PV_CLIENT="$PROJECT/client" +export PV_SERVER="$PROJECT/server" export PV_EXAMPLES="$PROJECT/examples" +# Netzwerk-Konfiguration +export PV_SERVER_HOST="127.0.0.1" +export PV_SERVER_PORT="8000" +export PV_CLIENT_PORT="5173" +export PV_SERVER_URL="http://$PV_SERVER_HOST:$PV_SERVER_PORT" +export PV_CLIENT_URL="http://localhost:$PV_CLIENT_PORT" + # Python-Pfad erweitern (nur wenn noch nicht vorhanden) if [[ ":$PYTHONPATH:" != *":$PV_LIB:"* ]]; then export PYTHONPATH="$PV_LIB:$PYTHONPATH" @@ -40,7 +49,11 @@ echo "PV_LIB = $PV_LIB" echo "PV_DATA = $PV_DATA" echo "PV_RESULTS = $PV_RESULTS" echo "PV_LOG = $PV_LOG" +echo "PV_CLIENT = $PV_CLIENT" +echo "PV_SERVER = $PV_SERVER" echo "PV_EXAMPLES = $PV_EXAMPLES" +echo "PV_SERVER_URL = $PV_SERVER_URL" +echo "PV_CLIENT_URL = $PV_CLIENT_URL" echo "PYTHONPATH = $PYTHONPATH" echo "================================================================" echo "" diff --git a/bin/start.bat b/bin/start.bat new file mode 100644 index 0000000..c2e7cc0 --- /dev/null +++ b/bin/start.bat @@ -0,0 +1,21 @@ +@echo off + +REM ================================================================ +REM PLANTPLAN - Server und Client gemeinsam starten +REM ================================================================ + +call "%~dp0setenv.bat" + +echo ================================================================ +echo PlantPlan - Starte Server und Client ... +echo ================================================================ +echo. + +call "%~dp0server.bat" start +call "%~dp0client.bat" start + +echo. +echo ================================================================ +echo Server: %PV_SERVER_URL% +echo Client: %PV_CLIENT_URL% +echo ================================================================ diff --git a/bin/stop.bat b/bin/stop.bat new file mode 100644 index 0000000..d602b55 --- /dev/null +++ b/bin/stop.bat @@ -0,0 +1,17 @@ +@echo off + +REM ================================================================ +REM PLANTPLAN - Server und Client gemeinsam stoppen +REM ================================================================ + +echo ================================================================ +echo PlantPlan - Stoppe Server und Client ... +echo ================================================================ +echo. + +call "%~dp0server.bat" stop +call "%~dp0client.bat" stop + +echo. +echo Alle Prozesse gestoppt. +echo ================================================================ diff --git a/client/index.html b/client/index.html new file mode 100644 index 0000000..f0db3b7 --- /dev/null +++ b/client/index.html @@ -0,0 +1,12 @@ + + +
+ + +