feat: Make VDCs in region view clickable to view details
This commit is contained in:
@@ -101,10 +101,34 @@ def render_detail():
|
||||
|
||||
# Select and rename columns for display
|
||||
vdc_df = pd.DataFrame(region_vdcs)
|
||||
vdc_display_df = vdc_df[['id', 'name', 'project_name', 'status', 'created_at']]
|
||||
vdc_display_df.rename(columns={'id': 'VDC ID', 'name': 'VDC Name', 'project_name': 'Project', 'status': 'Status', 'created_at': 'Created At'}, inplace=True)
|
||||
|
||||
st.dataframe(vdc_display_df, use_container_width=True)
|
||||
# Display VDCs with clickable links
|
||||
st.markdown("---") # Add a separator
|
||||
cols = st.columns([2, 3, 3, 2, 2, 2]) # Adjust column ratios as needed
|
||||
headers = ["VDC ID", "VDC Name", "Project", "Status", "Created At", "Actions"]
|
||||
for col, header in zip(cols, headers):
|
||||
col.markdown(f"**{header}**")
|
||||
|
||||
for vdc in region_vdcs:
|
||||
col1, col2, col3, col4, col5, col6 = st.columns([2, 3, 3, 2, 2, 2])
|
||||
with col1:
|
||||
st.caption(f"{vdc['id'][:8]}...")
|
||||
with col2:
|
||||
st.write(vdc['name'])
|
||||
with col3:
|
||||
st.write(vdc['project_name'])
|
||||
with col4:
|
||||
st.write(vdc.get('status', 'N/A'))
|
||||
with col5:
|
||||
st.write(vdc['created_at'])
|
||||
with col6:
|
||||
if st.button("View Details", key=f"view_vdc_{vdc['id']}"):
|
||||
st.session_state.selected_resource = vdc
|
||||
st.session_state.selected_resource_type = 'vdc'
|
||||
# Assuming the main app handles switching views based on these states
|
||||
# No need to set view_type to 'detail' here if the main app does it
|
||||
st.rerun()
|
||||
st.markdown("---") # Separator between VDC entries
|
||||
|
||||
else:
|
||||
st.info("No Virtual Data Centers found in this region.")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user