Skip to content

Commit 7f94ab5

Browse files
added version
1 parent 262bd18 commit 7f94ab5

File tree

2 files changed

+64
-4
lines changed

2 files changed

+64
-4
lines changed

src/App.jsx

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ const DnDFlow = () => {
5858
const [dockOpen, setDockOpen] = useState(false);
5959
const [logLines, setLogLines] = useState([]);
6060
const sseRef = useRef(null);
61-
const append = (line) => setLogLines((prev) => [...prev, line]);
61+
62+
// for version information
63+
const [versionInfo, setVersionInfo] = useState(null);
6264

6365
// const onConnect = useCallback((params) => setEdges((eds) => addEdge(params, eds)), []);
6466

@@ -127,6 +129,24 @@ const DnDFlow = () => {
127129
}
128130
};
129131

132+
// Function to fetch version information
133+
const fetchVersionInfo = async () => {
134+
try {
135+
const response = await fetch(getApiEndpoint('/version'));
136+
if (response.ok) {
137+
const versionData = await response.json();
138+
setVersionInfo(versionData);
139+
return versionData;
140+
} else {
141+
console.error('Failed to fetch version information');
142+
return null;
143+
}
144+
} catch (error) {
145+
console.error('Error fetching version information:', error);
146+
return null;
147+
}
148+
};
149+
130150
// Function to fetch documentation for a node type
131151
const fetchNodeDocumentation = async (nodeType) => {
132152
try {
@@ -224,6 +244,7 @@ const DnDFlow = () => {
224244
useEffect(() => {
225245
preloadDefaultValues();
226246
preloadAllDocumentation();
247+
fetchVersionInfo(); // Fetch version information on component mount
227248
}, []);
228249

229250
const onDrop = useCallback(
@@ -1129,10 +1150,18 @@ const DnDFlow = () => {
11291150
e.target.style.boxShadow = '0 2px 6px rgba(74, 144, 226, 0.3)';
11301151
}}
11311152
onClick={() => {
1132-
// TODO - open modal, navigate to help page, etc.
1133-
alert('Help documentation coming soon! Check the README.md file in the repository for current documentation.');
1153+
// Display version information and help
1154+
const pathsimVersion = versionInfo?.pathsim_version || 'Loading...';
1155+
const fcsVersion = versionInfo?.fuel_cycle_sim_version || 'Loading...';
1156+
1157+
const message = `Help documentation coming soon!\n\n` +
1158+
`Version Information:\n` +
1159+
`• PathSim: ${pathsimVersion}\n` +
1160+
`• Fuel Cycle Sim: ${fcsVersion}\n\n`;
1161+
1162+
alert(message);
11341163
}}
1135-
title="Get help and documentation"
1164+
title="Get help, documentation, and version information"
11361165
>
11371166
?
11381167
</button>

src/backend.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,37 @@ def health_check():
142142
), 200
143143

144144

145+
# Version information endpoint
146+
@app.route("/version", methods=["GET"])
147+
def get_version():
148+
try:
149+
# Get pathsim version
150+
import pathsim
151+
152+
pathsim_version = getattr(pathsim, "__version__", "Unknown")
153+
154+
import fuel_cycle_sim
155+
156+
fcs_version = getattr(fuel_cycle_sim, "__version__", "Unknown")
157+
158+
return jsonify(
159+
{
160+
"pathsim_version": pathsim_version,
161+
"fuel_cycle_sim_version": fcs_version,
162+
"status": "success",
163+
}
164+
), 200
165+
except Exception as e:
166+
return jsonify(
167+
{
168+
"pathsim_version": "Unknown",
169+
"fuel_cycle_sim_version": "Unknown",
170+
"status": "error",
171+
"error": str(e),
172+
}
173+
), 200
174+
175+
145176
@app.route("/default-values-all", methods=["GET"])
146177
def get_all_default_values():
147178
try:

0 commit comments

Comments
 (0)