Skip to content

Commit ec2affa

Browse files
authored
Merge pull request #275 from aws-samples/v1.6.0_spy
add update_profile
2 parents 1fb959c + f4dbd94 commit ec2affa

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

application/pages/1_🌍_Generative_BI_Playground.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,20 @@ def main():
154154
if "update_profile" not in st.session_state:
155155
st.session_state.update_profile = False
156156

157+
if "profiles_list" not in st.session_state:
158+
st.session_state["profiles_list"] = []
159+
157160
if 'profiles' not in st.session_state:
158161
# get all user defined profiles with info (db_url, conn_name, tables_info, hints, search_samples)
159162
all_profiles = ProfileManagement.get_all_profiles_with_info()
160163
# all_profiles.update(demo_profile)
161164
st.session_state['profiles'] = all_profiles
165+
st.session_state["profiles_list"] = list(all_profiles.keys())
162166
else:
163167
if st.session_state.update_profile:
164168
logger.info("session_state update_profile get_all_profiles_with_info")
165169
all_profiles = ProfileManagement.get_all_profiles_with_info()
170+
st.session_state["profiles_list"] = list(all_profiles.keys())
166171
st.session_state['profiles'] = all_profiles
167172
st.session_state.update_profile = False
168173

application/pages/3_🪙_Data_Profile_Management.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,20 @@ def main():
2828
if 'current_profile' not in st.session_state:
2929
st.session_state['current_profile'] = ''
3030

31+
if "profiles_list" not in st.session_state:
32+
st.session_state["profiles_list"] = []
33+
34+
if st.session_state.update_profile:
35+
logger.info("session_state update_profile get_all_profiles_with_info")
36+
all_profiles = ProfileManagement.get_all_profiles_with_info()
37+
st.session_state["profiles_list"] = list(all_profiles.keys())
38+
st.session_state['profiles'] = all_profiles
39+
st.session_state.update_profile = False
40+
3141
with st.sidebar:
3242
st.title("Data Profile Management")
33-
st.selectbox("My Data Profiles", ProfileManagement.get_all_profiles(),
43+
all_profiles = st.session_state["profiles_list"]
44+
st.selectbox("My Data Profiles", all_profiles,
3445
index=None,
3546
placeholder="Please select data profile...", key='current_profile_name')
3647
if st.session_state.current_profile_name:

0 commit comments

Comments
 (0)