Skip to content

Commit e771d39

Browse files
author
Pinyu Su
committed
add profile select
1 parent 82644df commit e771d39

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

application/pages/1_🌍_Generative_BI_Playground.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,17 @@ def main():
156156
# all_profiles.update(demo_profile)
157157
st.session_state['profiles'] = all_profiles
158158
else:
159-
all_profiles = ProfileManagement.get_all_profiles_with_info()
160-
st.session_state['profiles'] = all_profiles
159+
if st.session_state.update_profile:
160+
all_profiles = ProfileManagement.get_all_profiles_with_info()
161+
st.session_state['profiles'] = all_profiles
162+
st.session_state.update_profile = False
161163

162164
if "vision_change" not in st.session_state:
163165
st.session_state["vision_change"] = False
164166

167+
if "update_profile" not in st.session_state:
168+
st.session_state.update_profile = False
169+
165170
if 'selected_sample' not in st.session_state:
166171
st.session_state['selected_sample'] = ''
167172

application/pages/3_🪙_Data_Profile_Management.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ def main():
1919
st.set_page_config(page_title="Data Profile Management", )
2020
make_sidebar()
2121

22+
if "update_profile" not in st.session_state:
23+
st.session_state.update_profile = False
24+
2225
if 'profile_page_mode' not in st.session_state:
2326
st.session_state['profile_page_mode'] = 'default'
2427

@@ -49,6 +52,7 @@ def main():
4952
comments = st.text_input("Comments")
5053

5154
if st.button('Create Profile', type='primary'):
55+
st.session_state.update_profile = True
5256
if not selected_tables:
5357
st.error('Please select at least one table.')
5458
return
@@ -89,6 +93,7 @@ def main():
8993
"Your sample question 2")
9094

9195
if st.button('Update Profile', type='primary'):
96+
st.session_state.update_profile = True
9297
if not selected_tables:
9398
st.error('Please select at least one table.')
9499
return
@@ -99,6 +104,7 @@ def main():
99104
st.success('Profile updated. Please click "Fetch table definition" button to continue.')
100105

101106
if st.button('Fetch table definition'):
107+
st.session_state.update_profile = True
102108
if not selected_tables:
103109
st.error('Please select at least one table.')
104110
with st.spinner('fetching...'):
@@ -109,6 +115,7 @@ def main():
109115
st.session_state.profile_page_mode = 'default'
110116

111117
if st.button('Delete Profile'):
118+
st.session_state.update_profile = True
112119
ProfileManagement.delete_profile(profile_name)
113120
st.success(f"{profile_name} deleted successfully!")
114121
st.session_state.profile_page_mode = 'default'

0 commit comments

Comments
 (0)