- Dramatically Cleaned up Launch Script Output
- Disabled Debug Mode for Flask Server
This commit is contained in:
parent
5af92778e9
commit
25812d9202
@ -1,6 +1,19 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import FlowEditor from "./components/FlowEditor";
|
import FlowEditor from "./components/FlowEditor";
|
||||||
import { AppBar, Toolbar, Typography, Box, Menu, MenuItem, Button, CssBaseline, ThemeProvider, createTheme } from "@mui/material";
|
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
|
||||||
|
|
||||||
|
import {
|
||||||
|
AppBar,
|
||||||
|
Toolbar,
|
||||||
|
Typography,
|
||||||
|
Box,
|
||||||
|
Menu,
|
||||||
|
MenuItem,
|
||||||
|
Button,
|
||||||
|
CssBaseline,
|
||||||
|
ThemeProvider,
|
||||||
|
createTheme
|
||||||
|
} from "@mui/material";
|
||||||
|
|
||||||
const darkTheme = createTheme({
|
const darkTheme = createTheme({
|
||||||
palette: {
|
palette: {
|
||||||
@ -16,14 +29,24 @@ const darkTheme = createTheme({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const [anchorEl, setAnchorEl] = React.useState(null);
|
// Separate menu state for each dropdown
|
||||||
|
const [workflowsAnchorEl, setWorkflowsAnchorEl] = React.useState(null);
|
||||||
|
const [aboutAnchorEl, setAboutAnchorEl] = React.useState(null);
|
||||||
|
|
||||||
const handleMenuOpen = (event) => {
|
const handleWorkflowsMenuOpen = (event) => {
|
||||||
setAnchorEl(event.currentTarget);
|
setWorkflowsAnchorEl(event.currentTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleMenuClose = () => {
|
const handleAboutMenuOpen = (event) => {
|
||||||
setAnchorEl(null);
|
setAboutAnchorEl(event.currentTarget);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleWorkflowsMenuClose = () => {
|
||||||
|
setWorkflowsAnchorEl(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleAboutMenuClose = () => {
|
||||||
|
setAboutAnchorEl(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -36,15 +59,40 @@ export default function App() {
|
|||||||
<Typography variant="h6" sx={{ flexGrow: 1 }}>
|
<Typography variant="h6" sx={{ flexGrow: 1 }}>
|
||||||
Borealis - Workflow Automation Tool
|
Borealis - Workflow Automation Tool
|
||||||
</Typography>
|
</Typography>
|
||||||
<Button color="inherit" onClick={handleMenuOpen}>Workflows</Button>
|
|
||||||
<Menu
|
{/* Workflows Menu */}
|
||||||
anchorEl={anchorEl}
|
<Button
|
||||||
open={Boolean(anchorEl)}
|
color="inherit"
|
||||||
onClose={handleMenuClose}
|
onClick={handleWorkflowsMenuOpen}
|
||||||
|
endIcon={<KeyboardArrowDownIcon />}
|
||||||
>
|
>
|
||||||
<MenuItem onClick={handleMenuClose}>Save Workflow</MenuItem>
|
Workflows
|
||||||
<MenuItem onClick={handleMenuClose}>Load Workflow</MenuItem>
|
</Button>
|
||||||
<MenuItem onClick={handleMenuClose}>Close Workflow</MenuItem>
|
<Menu
|
||||||
|
anchorEl={workflowsAnchorEl}
|
||||||
|
open={Boolean(workflowsAnchorEl)}
|
||||||
|
onClose={handleWorkflowsMenuClose}
|
||||||
|
>
|
||||||
|
<MenuItem onClick={handleWorkflowsMenuClose}>Save Workflow</MenuItem>
|
||||||
|
<MenuItem onClick={handleWorkflowsMenuClose}>Load Workflow</MenuItem>
|
||||||
|
<MenuItem onClick={handleWorkflowsMenuClose}>Close Workflow</MenuItem>
|
||||||
|
</Menu>
|
||||||
|
|
||||||
|
{/* About Menu */}
|
||||||
|
<Button
|
||||||
|
color="inherit"
|
||||||
|
onClick={handleAboutMenuOpen}
|
||||||
|
endIcon={<KeyboardArrowDownIcon />}
|
||||||
|
>
|
||||||
|
About
|
||||||
|
</Button>
|
||||||
|
<Menu
|
||||||
|
anchorEl={aboutAnchorEl}
|
||||||
|
open={Boolean(aboutAnchorEl)}
|
||||||
|
onClose={handleAboutMenuClose}
|
||||||
|
>
|
||||||
|
<MenuItem onClick={handleAboutMenuClose}>Gitea Project</MenuItem>
|
||||||
|
<MenuItem onClick={handleAboutMenuClose}>Credits</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
|
23
Data/WebUI/src/components/FlowEditor.css
Normal file
23
Data/WebUI/src/components/FlowEditor.css
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/* FlowEditor background container */
|
||||||
|
.flow-editor-container {
|
||||||
|
position: relative;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gradient Overlay */
|
||||||
|
.flow-editor-container::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
pointer-events: none; /* Ensures grid and nodes remain fully interactive */
|
||||||
|
background: linear-gradient( to bottom, rgba(9, 44, 68, 0.8) 0%, /* Deep blue at the top */
|
||||||
|
rgba(30, 30, 30, 0) 25%, /* Fade out towards center */
|
||||||
|
rgba(30, 30, 30, 0) 75%, /* No gradient in the middle */
|
||||||
|
rgba(9, 44, 68, 0.8) 100% /* Deep blue at the bottom */
|
||||||
|
);
|
||||||
|
z-index: -1; /* Ensures it stays behind the React Flow elements */
|
||||||
|
}
|
@ -5,6 +5,7 @@ import ReactFlow, {
|
|||||||
Background,
|
Background,
|
||||||
} from "reactflow";
|
} from "reactflow";
|
||||||
import "reactflow/dist/style.css";
|
import "reactflow/dist/style.css";
|
||||||
|
import "./FlowEditor.css";
|
||||||
|
|
||||||
const fetchNodes = async () => {
|
const fetchNodes = async () => {
|
||||||
const response = await fetch("/api/workflow");
|
const response = await fetch("/api/workflow");
|
||||||
@ -36,10 +37,15 @@ export default function FlowEditor() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ width: "100vw", height: "100vh" }}>
|
<div className="flow-editor-container">
|
||||||
<ReactFlow elements={elements} onConnect={onConnect}>
|
<ReactFlow elements={elements} onConnect={onConnect}>
|
||||||
<Controls />
|
<Controls />
|
||||||
<Background />
|
<Background
|
||||||
|
variant="lines"
|
||||||
|
gap={100}
|
||||||
|
size={1}
|
||||||
|
color="rgba(255, 255, 255, 0.2)" // White grid with 20% opacity
|
||||||
|
/>
|
||||||
</ReactFlow>
|
</ReactFlow>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -53,7 +53,7 @@ def serve_frontend():
|
|||||||
index_path = os.path.join(build_folder, "index.html")
|
index_path = os.path.join(build_folder, "index.html")
|
||||||
if os.path.exists(index_path):
|
if os.path.exists(index_path):
|
||||||
return send_from_directory(app.static_folder, "index.html")
|
return send_from_directory(app.static_folder, "index.html")
|
||||||
return "<h1>React App Not Found</h1><p>Please build the web-interface application.</p>", 404
|
return "<h1>Borealis React App Code Not Found</h1><p>Please re-deploy Borealis Workflow Automation Tool</p>", 404
|
||||||
|
|
||||||
@app.route("/api/nodes", methods=["GET"])
|
@app.route("/api/nodes", methods=["GET"])
|
||||||
def get_available_nodes():
|
def get_available_nodes():
|
||||||
@ -128,4 +128,4 @@ def delete_edge(edge_id):
|
|||||||
return jsonify({"status": "success", "deletedEdge": edge_id})
|
return jsonify({"status": "success", "deletedEdge": edge_id})
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(host="0.0.0.0", port=5000, debug=True)
|
app.run(host="0.0.0.0", port=5000, debug=False)
|
||||||
|
@ -2,113 +2,148 @@
|
|||||||
# Run this script with:
|
# Run this script with:
|
||||||
# Set-ExecutionPolicy Unrestricted -Scope Process; .\Start_Windows -WebServer.ps1
|
# Set-ExecutionPolicy Unrestricted -Scope Process; .\Start_Windows -WebServer.ps1
|
||||||
|
|
||||||
Write-Output " =============================== "
|
# ---------------------- Initialization & Visuals ----------------------
|
||||||
Write-Output " Deploying Borealis "
|
$symbols = @{
|
||||||
Write-Output " =============================== "
|
Success = [char]0x2705
|
||||||
|
Running = [char]0x23F3
|
||||||
|
Fail = [char]0x274C
|
||||||
|
Info = [char]0x2139
|
||||||
|
}
|
||||||
|
|
||||||
# --- Check for Node.js ---
|
function Write-ProgressStep {
|
||||||
|
param (
|
||||||
|
[string]$Message,
|
||||||
|
[string]$Status = $symbols["Info"] # Ensure proper lookup
|
||||||
|
)
|
||||||
|
Write-Host "`r$Status $Message... " -NoNewline
|
||||||
|
}
|
||||||
|
|
||||||
|
function Run-Step {
|
||||||
|
param (
|
||||||
|
[string]$Message,
|
||||||
|
[scriptblock]$Script
|
||||||
|
)
|
||||||
|
Write-ProgressStep -Message $Message -Status "$($symbols.Running)"
|
||||||
|
try {
|
||||||
|
& $Script
|
||||||
|
if ($LASTEXITCODE -eq 0 -or $?) {
|
||||||
|
Write-Host "`r$($symbols.Success) $Message " # Fix symbol lookup
|
||||||
|
} else {
|
||||||
|
throw "Non-zero exit code"
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host "`r$($symbols.Fail) $Message - Failed: $_ " -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Clear-Host
|
||||||
|
Write-Host "Deploying Borealis - Workflow Automation Tool..." -ForegroundColor Green
|
||||||
|
Write-Host "===================================================================================="
|
||||||
|
|
||||||
|
# ---------------------- Node.js Check ----------------------
|
||||||
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
|
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
|
||||||
Write-Error "Node.js is not installed. Please install Node.js and try again."
|
Write-Host "`r$($symbols.Fail) Node.js is not installed. Please install Node.js and try again." -ForegroundColor Red
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Define paths ---
|
# ---------------------- Path Definitions ----------------------
|
||||||
$venvFolder = "Borealis-Workflow-Automation-Tool" # Virtual environment root.
|
$venvFolder = "Borealis-Workflow-Automation-Tool"
|
||||||
$dataSource = "Data" # Contains server.py and optionally WebUI.
|
$dataSource = "Data"
|
||||||
$dataDestination = "$venvFolder\Borealis" # Data folder copy destination in the venv.
|
$dataDestination = "$venvFolder\Borealis"
|
||||||
$customUIPath = "$dataSource\WebUI" # Custom UI folder source in the project root.
|
$customUIPath = "$dataSource\WebUI"
|
||||||
$webUIDestination = "$venvFolder\web-interface" # Destination for the React UI in the venv.
|
$webUIDestination = "$venvFolder\web-interface"
|
||||||
|
|
||||||
# --- Create virtual environment if needed ---
|
# ---------------------- Create Python Virtual Environment ----------------------
|
||||||
if (!(Test-Path "$venvFolder\Scripts\Activate")) {
|
Run-Step "Create Virtual Python Environment" {
|
||||||
Write-Output "Creating Virtual Python Environment in '$venvFolder'..."
|
if (!(Test-Path "$venvFolder\Scripts\Activate")) {
|
||||||
python -m venv $venvFolder
|
python -m venv $venvFolder | Out-Null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Copy Data folder (includes server.py) ---
|
# ---------------------- Copy Server Data ----------------------
|
||||||
if (Test-Path $dataSource) {
|
Run-Step "Copy Borealis Server Data into Virtual Python Environment" {
|
||||||
Write-Output "Copying Borealis Server Data into Virtual Environment..."
|
if (Test-Path $dataSource) {
|
||||||
if (Test-Path $dataDestination) {
|
if (Test-Path $dataDestination) {
|
||||||
Remove-Item -Recurse -Force $dataDestination
|
Remove-Item -Recurse -Force $dataDestination | Out-Null
|
||||||
}
|
}
|
||||||
New-Item -Path $dataDestination -ItemType Directory -Force | Out-Null
|
New-Item -Path $dataDestination -ItemType Directory -Force | Out-Null
|
||||||
Copy-Item -Path "$dataSource\*" -Destination $dataDestination -Recurse
|
Copy-Item -Path "$dataSource\*" -Destination $dataDestination -Recurse
|
||||||
} else {
|
} else {
|
||||||
Write-Output "Warning: Data folder not found, skipping copy. Fix whatever you broke."
|
Write-Host "`r$($symbols.Info) Warning: Data folder not found, skipping copy." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- React UI Deployment ---
|
# ---------------------- React UI Deployment ----------------------
|
||||||
# Check if the React UI folder exists in the virtual environment root.
|
Run-Step "Create a new ReactJS App in $webUIDestination" {
|
||||||
if (-not (Test-Path $webUIDestination)) {
|
if (-not (Test-Path $webUIDestination)) {
|
||||||
Write-Output "ReactJS App Not Found. Generating Default ReactJS App..."
|
npx create-react-app $webUIDestination | Out-Null
|
||||||
npx create-react-app $webUIDestination
|
}
|
||||||
} else {
|
|
||||||
Write-Output "React UI folder '$webUIDestination' already exists."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# If a custom UI folder exists at <ProjectRoot>\Data\WebUI, copy its contents over (overwrite defaults).
|
Run-Step "Overwrite ReactJS App Files with Borealis ReactJS Files" {
|
||||||
if (Test-Path $customUIPath) {
|
if (Test-Path $customUIPath) {
|
||||||
Write-Output "Borealis ReactJS Data Found at '$customUIPath'. Overwriting ReactJS App Files..."
|
|
||||||
Copy-Item -Path "$customUIPath\*" -Destination $webUIDestination -Recurse -Force
|
Copy-Item -Path "$customUIPath\*" -Destination $webUIDestination -Recurse -Force
|
||||||
} else {
|
} else {
|
||||||
Write-Output "No custom UI folder found at '$customUIPath'. Using default ReactJS app."
|
Write-Host "`r$($symbols.Info) No custom UI found, using default React app." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Activate virtual environment ---
|
Run-Step "Remove Existing ReactJS Build Folder (If Exists)" {
|
||||||
Write-Output "Activating Virtual Python Environment..."
|
if (Test-Path "$webUIDestination\build") {
|
||||||
. "$venvFolder\Scripts\Activate"
|
Remove-Item -Path "$webUIDestination\build" -Recurse -Force
|
||||||
|
}
|
||||||
# --- Install Python dependencies ---
|
|
||||||
if (Test-Path "requirements.txt") {
|
|
||||||
Write-Output "Installing Python Dependencies..."
|
|
||||||
pip install -q -r requirements.txt
|
|
||||||
} else {
|
|
||||||
Write-Output "No requirements.txt found, skipping Python dependency installation."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Build the React (UI) app in the web-interface folder if needed ---
|
# ---------------------- Activate Python Virtual Environment ----------------------
|
||||||
$packageJsonPath = Join-Path $webUIDestination "package.json"
|
Run-Step "Activate Virtual Python Environment" {
|
||||||
$buildFolder = Join-Path $webUIDestination "build"
|
. "$venvFolder\Scripts\Activate"
|
||||||
if (-not (Test-Path $buildFolder)) {
|
}
|
||||||
|
|
||||||
|
# ---------------------- Install Python Dependencies ----------------------
|
||||||
|
Run-Step "Install Python Dependencies into Virtual Python Environment" {
|
||||||
|
if (Test-Path "requirements.txt") {
|
||||||
|
pip install -q -r requirements.txt 2>&1 | Out-Null
|
||||||
|
} else {
|
||||||
|
Write-Host "`r$($symbols.Info) No requirements.txt found, skipping Python packages." -ForegroundColor Yellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------------------- Build React App ----------------------
|
||||||
|
Run-Step "Install NPM into ReactJS App" {
|
||||||
|
$packageJsonPath = Join-Path $webUIDestination "package.json"
|
||||||
if (Test-Path $packageJsonPath) {
|
if (Test-Path $packageJsonPath) {
|
||||||
Write-Output "React UI build not found in '$webUIDestination'. Installing dependencies and building the React app..."
|
|
||||||
Push-Location $webUIDestination
|
Push-Location $webUIDestination
|
||||||
Write-Output " =============================== "
|
$env:npm_config_loglevel = "silent"
|
||||||
Write-Output " Installing NPM Packages "
|
npm install --silent --no-fund --audit=false 2>&1 | Out-Null
|
||||||
Write-Output " =============================== "
|
|
||||||
npm install --no-fund --audit=false
|
|
||||||
|
|
||||||
# Ensure react-flow-renderer is installed
|
|
||||||
Write-Output "Installing React Flow..."
|
|
||||||
npm install reactflow --no-fund --audit=false
|
|
||||||
|
|
||||||
# Install Material UI Library
|
|
||||||
Write-Output "Installing Material UI Library..."
|
|
||||||
npm install @mui/material @emotion/react @emotion/styled --no-fund --audit=false
|
|
||||||
|
|
||||||
npm run build
|
|
||||||
Pop-Location
|
Pop-Location
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
Write-Output "No package.json found in '$webUIDestination'; skipping npm install/build."
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Write-Output "React UI build found. Skipping npm install/build."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Change directory to the virtual environment root ---
|
Run-Step "Install React Flow into ReactJS App" {
|
||||||
|
Push-Location $webUIDestination
|
||||||
|
npm install reactflow --no-fund --audit=false | Out-Null
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
|
Run-Step "Install Material UI Libraries into ReactJS App" {
|
||||||
|
Push-Location $webUIDestination
|
||||||
|
$env:npm_config_loglevel = "silent" # Force NPM to be completely silent
|
||||||
|
npm install --silent @mui/material @mui/icons-material @emotion/react @emotion/styled --no-fund --audit=false 2>&1 | Out-Null
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
|
Run-Step "Build ReactJS App" {
|
||||||
|
Push-Location $webUIDestination
|
||||||
|
npm run build | Out-Null
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
|
# ---------------------- Launch Flask Server ----------------------
|
||||||
Push-Location $venvFolder
|
Push-Location $venvFolder
|
||||||
Write-Output "Current working directory: $(Get-Location)"
|
Write-Host "`nLaunching Borealis..." -ForegroundColor Green
|
||||||
$expectedBuildPath = Join-Path (Get-Location) "web-interface\build"
|
Write-Host "===================================================================================="
|
||||||
Write-Output "Looking for build folder at: $expectedBuildPath"
|
Write-Host "$($symbols.Running) Starting the Python Flask server..." -NoNewline
|
||||||
|
|
||||||
# --- Start the Flask server (server.py is inside Borealis folder) ---
|
|
||||||
Write-Output " =============================== "
|
|
||||||
Write-Output " Launching Borealis "
|
|
||||||
Write-Output " =============================== "
|
|
||||||
Write-Output "Starting the Flask server..."
|
|
||||||
python "Borealis\server.py"
|
python "Borealis\server.py"
|
||||||
|
Write-Host "`r$($symbols.Success) Borealis Launched Successfully!"
|
||||||
# --- Return to original directory and deactivate virtual environment ---
|
|
||||||
Pop-Location
|
Pop-Location
|
||||||
deactivate
|
|
||||||
|
@ -1,78 +0,0 @@
|
|||||||
# Start_Windows - WebServer.ps1
|
|
||||||
# Run this script with:
|
|
||||||
# Set-ExecutionPolicy Unrestricted -Scope Process; .\Start_Windows -WebServer.ps1
|
|
||||||
|
|
||||||
Write-Output " =============================== "
|
|
||||||
Write-Output " Re-Building ReactJS App "
|
|
||||||
Write-Output " =============================== "
|
|
||||||
|
|
||||||
# --- Define paths ---
|
|
||||||
$venvFolder = "Borealis-Workflow-Automation-Tool" # Virtual environment root.
|
|
||||||
$dataSource = "Data" # Contains server.py and optionally WebUI.
|
|
||||||
$dataDestination = "$venvFolder\Borealis" # Data folder copy destination in the venv.
|
|
||||||
$customUIPath = "$dataSource\WebUI" # Custom UI folder source in the project root.
|
|
||||||
$webUIDestination = "$venvFolder\web-interface" # Destination for the React UI in the venv.
|
|
||||||
|
|
||||||
# If a custom UI folder exists at <ProjectRoot>\Data\WebUI, copy its contents over (overwrite defaults).
|
|
||||||
if (Test-Path $customUIPath) {
|
|
||||||
Write-Output "Borealis ReactJS Data Found at '$customUIPath'. Overwriting ReactJS App Files..."
|
|
||||||
Copy-Item -Path "$customUIPath\*" -Destination $webUIDestination -Recurse -Force
|
|
||||||
} else {
|
|
||||||
Write-Output "No custom UI folder found at '$customUIPath'. Using default ReactJS app."
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- Activate virtual environment ---
|
|
||||||
Write-Output "Activating Virtual Python Environment..."
|
|
||||||
. "$venvFolder\Scripts\Activate"
|
|
||||||
|
|
||||||
# --- Remove Existing / Previous ReactJS App Build folder ---
|
|
||||||
if (Test-Path $dataDestination) {
|
|
||||||
Remove-Item -Recurse -Force $venvFolder\web-interface\build
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- Build the React (UI) app in the web-interface folder if needed ---
|
|
||||||
$packageJsonPath = Join-Path $webUIDestination "package.json"
|
|
||||||
$buildFolder = Join-Path $webUIDestination "build"
|
|
||||||
if (-not (Test-Path $buildFolder)) {
|
|
||||||
if (Test-Path $packageJsonPath) {
|
|
||||||
Write-Output "React UI build not found in '$webUIDestination'. Installing dependencies and building the React app..."
|
|
||||||
Push-Location $webUIDestination
|
|
||||||
Write-Output " =============================== "
|
|
||||||
Write-Output " Installing NPM Packages "
|
|
||||||
Write-Output " =============================== "
|
|
||||||
npm install --no-fund --audit=false
|
|
||||||
|
|
||||||
# Ensure react-flow-renderer is installed
|
|
||||||
Write-Output "Installing React Flow..."
|
|
||||||
npm install reactflow --no-fund --audit=false
|
|
||||||
|
|
||||||
# Install Material UI Library
|
|
||||||
Write-Output "Installing Material UI Library..."
|
|
||||||
npm install @mui/material @emotion/react @emotion/styled --no-fund --audit=false
|
|
||||||
|
|
||||||
npm run build
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Output "No package.json found in '$webUIDestination'; skipping npm install/build."
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Write-Output "React UI build found. Skipping npm install/build."
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- Change directory to the virtual environment root ---
|
|
||||||
Push-Location $venvFolder
|
|
||||||
Write-Output "Current working directory: $(Get-Location)"
|
|
||||||
$expectedBuildPath = Join-Path (Get-Location) "web-interface\build"
|
|
||||||
Write-Output "Looking for build folder at: $expectedBuildPath"
|
|
||||||
|
|
||||||
# --- Start the Flask server (server.py is inside Borealis folder) ---
|
|
||||||
Write-Output " =============================== "
|
|
||||||
Write-Output " Launching Borealis "
|
|
||||||
Write-Output " =============================== "
|
|
||||||
Write-Output "Starting the Flask server..."
|
|
||||||
python "Borealis\server.py"
|
|
||||||
|
|
||||||
# --- Return to original directory and deactivate virtual environment ---
|
|
||||||
Pop-Location
|
|
||||||
deactivate
|
|
Loading…
x
Reference in New Issue
Block a user