File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 < title > WFC Reports</ title >
88 </ head >
99 < body >
10- < div id ="root "> </ div >
10+ < div id ="root ">
11+ < h2 > WARNING</ h2 >
12+ < p >
13+ If you see this message, it means the web app was not properly started.
14+ For example, if you opened the index.html file directly, that would be loaded with file:// protocol
15+ in your browser.
16+ By default, modern browsers block loading local files due to CORS issues.
17+ You need to open the web app via an HTTP server.
18+ </ p >
19+
20+ < p >
21+ To simplify the visualization of the web report, we provide a webreport.py script to start a HTTP server,
22+ and automatically open your browser on the starting page of the report.
23+ To simplify its use, we also provide a webreport.command (for Mac) and webreport.bat (for Windows) to easily start the
24+ Python script with a simple mouse double-click.
25+ </ p >
26+
27+ </ div >
1128 < script type ="module " src ="/src/main.tsx "> </ script >
1229 </ body >
1330</ html >
Original file line number Diff line number Diff line change 1+ @ echo off
2+ setlocal
3+
4+ :: Get the directory where this batch file is located
5+ set " SCRIPT_DIR = %~dp0 "
6+
7+ :: Navigate to the script directory
8+ cd /d " %SCRIPT_DIR% "
9+
10+ :: Check if Python is installed
11+ where python > nul 2 >& 1
12+ if %ERRORLEVEL% neq 0 (
13+ echo Error: Python not found in PATH.
14+ echo Install Python from https://www.python.org/downloads/
15+ pause
16+ exit /b 1
17+ )
18+
19+ python " webreport.py"
20+
21+ pause
Original file line number Diff line number Diff line change 1+ #! /bin/zsh
2+ cd " $( dirname " $0 " ) " # Navigates to the script's folder
3+ python3 webreport.py || {
4+ echo " Error: Failed to run the Python script."
5+ echo " Possible fixes:"
6+ echo " 1. Ensure 'python3' is installed (run 'python3 --version')."
7+ echo " 2. Check if 'webreport.py' exists in the same folder."
8+ }
9+ read -r " ?Press Enter to close..."
Original file line number Diff line number Diff line change 1+ import http .server
2+ import socketserver
3+ import webbrowser
4+ import os
5+ from threading import Timer
6+
7+ PORT = 8000
8+ HOST = "localhost"
9+
10+ class Handler (http .server .SimpleHTTPRequestHandler ):
11+ def __init__ (self , * args , ** kwargs ):
12+ super ().__init__ (* args , directory = os .getcwd (), ** kwargs )
13+
14+ def start_server ():
15+ with socketserver .TCPServer ((HOST , PORT ), Handler ) as httpd :
16+ print (f"Serving at http://{ HOST } :{ PORT } " )
17+ webbrowser .open_new_tab (f"http://{ HOST } :{ PORT } " )
18+ httpd .serve_forever ()
19+
20+ if __name__ == "__main__" :
21+ start_server ()
You can’t perform that action at this time.
0 commit comments