diff --git a/src/App.jsx b/src/App.jsx index 03dfbe26..2b074522 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -58,7 +58,9 @@ const DnDFlow = () => { const [dockOpen, setDockOpen] = useState(false); const [logLines, setLogLines] = useState([]); const sseRef = useRef(null); - const append = (line) => setLogLines((prev) => [...prev, line]); + + // for version information + const [versionInfo, setVersionInfo] = useState(null); // const onConnect = useCallback((params) => setEdges((eds) => addEdge(params, eds)), []); @@ -127,6 +129,24 @@ const DnDFlow = () => { } }; + // Function to fetch version information + const fetchVersionInfo = async () => { + try { + const response = await fetch(getApiEndpoint('/version')); + if (response.ok) { + const versionData = await response.json(); + setVersionInfo(versionData); + return versionData; + } else { + console.error('Failed to fetch version information'); + return null; + } + } catch (error) { + console.error('Error fetching version information:', error); + return null; + } + }; + // Function to fetch documentation for a node type const fetchNodeDocumentation = async (nodeType) => { try { @@ -224,6 +244,7 @@ const DnDFlow = () => { useEffect(() => { preloadDefaultValues(); preloadAllDocumentation(); + fetchVersionInfo(); // Fetch version information on component mount }, []); const onDrop = useCallback( @@ -1021,78 +1042,128 @@ const DnDFlow = () => { backgroundColor: '#2c2c2c', display: 'flex', alignItems: 'center', + justifyContent: 'space-between', zIndex: 15, borderBottom: '1px solid #ccc' }}> +
+ + + + + +
+ + {/* Help Button */} - - - - diff --git a/src/backend.py b/src/backend.py index 07dde98e..a5aee07d 100644 --- a/src/backend.py +++ b/src/backend.py @@ -142,6 +142,37 @@ def health_check(): ), 200 +# Version information endpoint +@app.route("/version", methods=["GET"]) +def get_version(): + try: + # Get pathsim version + import pathsim + + pathsim_version = getattr(pathsim, "__version__", "Unknown") + + import fuel_cycle_sim + + fcs_version = getattr(fuel_cycle_sim, "__version__", "Unknown") + + return jsonify( + { + "pathsim_version": pathsim_version, + "fuel_cycle_sim_version": fcs_version, + "status": "success", + } + ), 200 + except Exception as e: + return jsonify( + { + "pathsim_version": "Unknown", + "fuel_cycle_sim_version": "Unknown", + "status": "error", + "error": str(e), + } + ), 200 + + @app.route("/default-values-all", methods=["GET"]) def get_all_default_values(): try: