Skip to content

Commit c78b10e

Browse files
authored
Merge pull request OpenMS#159 from definitelynotchirag/feat/workspace_dir
Add workspaces directory configuration to settings and update workspa…
2 parents 7183499 + 84c6e29 commit c78b10e

3 files changed

Lines changed: 14 additions & 6 deletions

File tree

docs/user_guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ There are a few key differences between operating in online and local modes:
2323
- *Local Mode*: Multiple file uploads are supported, giving you flexibility when working with large datasets.
2424
- **Workspace Access**:
2525
- In online mode, workspaces are stored temporarily and will be cleared after seven days of inactivity.
26-
- In local mode, workspaces are saved on your local machine, allowing for persistent storage.
26+
- In local mode, workspaces are saved on your local machine, allowing for persistent storage. Workspace directory can be specified in the `settings.json`. Defaults to `..` (parent directory).
2727

2828
## Downloading Results
2929

settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
},
1616
"online_deployment": false,
1717
"enable_workspaces": true,
18-
"test": true
19-
}
18+
"test": true,
19+
"workspaces_dir": ".."
20+
}

src/common/common.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ def page_setup(page: str = "") -> dict[str, Any]:
208208
if "windows" in sys.argv:
209209
os.chdir("../streamlit-template")
210210
# Define the directory where all workspaces will be stored
211-
workspaces_dir = Path("..", "workspaces-" + st.session_state.settings["repository-name"])
211+
if st.session_state.settings["workspaces_dir"] and st.session_state.location == "local":
212+
workspaces_dir = Path(st.session_state.settings["workspaces_dir"], "workspaces-" + st.session_state.settings["repository-name"])
213+
else:
214+
workspace_dir = '..'
215+
212216
# Check if workspace logic is enabled
213217
if st.session_state.settings["enable_workspaces"]:
214218
if "workspace" in st.query_params:
@@ -279,8 +283,11 @@ def render_sidebar(page: str = "") -> None:
279283
# Display workspace switcher if workspace is enabled in local mode
280284
if st.session_state.settings["enable_workspaces"]:
281285
with st.expander("🖥️ **Workspaces**"):
282-
# Define workspaces directory outside of repository
283-
workspaces_dir = Path("..", "workspaces-" + st.session_state.settings["repository-name"])
286+
# Workspaces directory specified in the settings.json
287+
if st.session_state.settings["workspaces_dir"] and st.session_state.location == "local":
288+
workspaces_dir = Path(st.session_state.settings["workspaces_dir"], "workspaces-" + st.session_state.settings["repository-name"])
289+
else:
290+
workspaces_dir = '..'
284291
# Online: show current workspace name in info text and option to change to other existing workspace
285292
if st.session_state.location == "local":
286293
# Define callback function to change workspace

0 commit comments

Comments
 (0)