JSenkCC commited on
Commit
a523dc3
·
verified ·
1 Parent(s): b4b0807

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -116,6 +116,11 @@ def workspace_page():
116
  st.session_state.current_project = selected_project
117
  st.session_state.page = "project_view"
118
 
 
 
 
 
 
119
  # Main content area
120
  st.subheader("Workspace")
121
  st.write("You can create a new project by uploading files or folders, or by cloning a GitHub repository.")
@@ -154,10 +159,11 @@ def workspace_page():
154
  st.error(f"File {uploaded_file.name} is not a valid .zip file.")
155
  else:
156
  st.success(f"File {uploaded_file.name} saved successfully!")
157
- # Trigger a rerun to update the dropdown
158
- st.rerun()
159
- st.success(f"Project '{project_name}' uploaded successfully!")
160
 
 
 
 
 
161
 
162
  elif action == "Clone GitHub Repository":
163
  st.subheader("Clone GitHub Repository")
@@ -170,11 +176,10 @@ def workspace_page():
170
 
171
  try:
172
  Repo.clone_from(repo_url, project_folder)
173
- # Trigger a rerun to update the dropdown
 
 
174
  st.rerun()
175
- st.success(f"Project '{project_name}' cloned successfully!")
176
-
177
-
178
  except Exception as e:
179
  st.error(f"Failed to clone repository: {e}")
180
 
 
116
  st.session_state.current_project = selected_project
117
  st.session_state.page = "project_view"
118
 
119
+ # Display success message if a project was uploaded
120
+ if st.session_state.project_uploaded:
121
+ st.success(f"Project '{st.session_state.current_project}' uploaded successfully!")
122
+ st.session_state.project_uploaded = False # Reset after showing the message
123
+
124
  # Main content area
125
  st.subheader("Workspace")
126
  st.write("You can create a new project by uploading files or folders, or by cloning a GitHub repository.")
 
159
  st.error(f"File {uploaded_file.name} is not a valid .zip file.")
160
  else:
161
  st.success(f"File {uploaded_file.name} saved successfully!")
 
 
 
162
 
163
+ # Update session state and trigger a rerun
164
+ st.session_state.current_project = project_name
165
+ st.session_state.project_uploaded = True
166
+ st.rerun()
167
 
168
  elif action == "Clone GitHub Repository":
169
  st.subheader("Clone GitHub Repository")
 
176
 
177
  try:
178
  Repo.clone_from(repo_url, project_folder)
179
+ # Update session state and trigger a rerun
180
+ st.session_state.current_project = project_name
181
+ st.session_state.project_uploaded = True
182
  st.rerun()
 
 
 
183
  except Exception as e:
184
  st.error(f"Failed to clone repository: {e}")
185