feat: Display VDCs in region detail view
This commit is contained in:
@@ -86,8 +86,30 @@ def render_detail():
|
||||
else:
|
||||
st.info("No access entries found for this region.")
|
||||
|
||||
st.header("Virtual Data Centers in this Region")
|
||||
all_vdcs = st.session_state.client.get_virtual_data_centers()
|
||||
region_vdcs = [vdc for vdc in all_vdcs if vdc.get('region_id') == region['id']] if all_vdcs else []
|
||||
|
||||
if region_vdcs:
|
||||
# Fetch project names for better display
|
||||
projects = st.session_state.client.get_projects()
|
||||
project_map = {project['id']: project['name'] for project in projects} if projects else {}
|
||||
|
||||
for vdc in region_vdcs:
|
||||
vdc['project_name'] = project_map.get(vdc.get('project_id'), 'Unknown Project')
|
||||
vdc['created_at'] = format_timestamp(vdc.get('created_at')) # Format timestamp
|
||||
|
||||
# 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)
|
||||
else:
|
||||
st.info("No Virtual Data Centers found in this region.")
|
||||
|
||||
|
||||
if st.session_state.view_type == 'detail' and st.session_state.selected_resource_type=='region':
|
||||
render_detail()
|
||||
else:
|
||||
render_list()
|
||||
render_list()
|
||||
|
||||
Reference in New Issue
Block a user