Skip to content

Commit d65c9c9

Browse files
authored
Merge pull request #150 from asterisk-ragavan/main
Fix: Display WebApp Versioning
2 parents 9d816ec + 21c82ff commit d65c9c9

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

app.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import streamlit as st
22
from pathlib import Path
3+
import json
34
# For some reason the windows version only works if this is imported here
45
import pyopenms
56

7+
if "settings" not in st.session_state:
8+
with open("settings.json", "r") as f:
9+
st.session_state.settings = json.load(f)
10+
611
if __name__ == '__main__':
712
pages = {
8-
"OpenMS Web App" : [
13+
str(st.session_state.settings["app-name"]) : [
914
st.Page(Path("content", "quickstart.py"), title="Quickstart", icon="👋"),
1015
st.Page(Path("content", "documentation.py"), title="Documentation", icon="📖"),
1116
],

settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"app-name": "OpenMS WebApp Template",
33
"github-user": "OpenMS",
4+
"version": "1.0.2",
45
"repository-name": "streamlit-template",
56
"analytics": {
67
"google-analytics": {

src/common/common.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,28 @@ def change_workspace():
341341
)
342342
else:
343343
st.session_state["spectrum_num_bins"] = 50
344+
345+
# Display OpenMS WebApp Template Version from settings.json
346+
with st.container():
347+
st.markdown(
348+
"""
349+
<style>
350+
.version-box {
351+
border: 1px solid #a4a5ad;
352+
padding: 10px;
353+
border-radius: 0.5rem;
354+
text-align: center;
355+
display: flex;
356+
justify-content: center;
357+
align-items: center;
358+
}
359+
</style>
360+
""",
361+
unsafe_allow_html=True
362+
)
363+
version_info = st.session_state.settings["version"]
364+
app_name = st.session_state.settings["app-name"]
365+
st.markdown(f'<div class="version-box">{app_name}<br>Version: {version_info}</div>', unsafe_allow_html=True)
344366
return params
345367

346368

0 commit comments

Comments
 (0)