Improved VM launch by selecting machine type from capabilities list

This commit is contained in:
2025-03-12 16:31:42 +10:30
parent a0b11d3632
commit 1c1058e202
3 changed files with 111 additions and 14 deletions
+28 -1
View File
@@ -95,6 +95,33 @@ def render():
else:
filtered_VirtualMachines = VirtualMachines
# Add Delete All button with confirmation
if st.button("Delete All VMs", key="delete_all_vms", type="primary", help="This will delete all visible virtual machines"):
# Create a confirmation dialog
if 'delete_confirmation' not in st.session_state:
st.session_state.delete_confirmation = False
for vm in filtered_VirtualMachines:
# Call the delete API for each VM
result = st.session_state.client.delete_virtual_machine(vm['id'])
print("Deleted vm")
st.success(f"Successfully deleted {len(filtered_VirtualMachines)} virtual machines.")
st.warning("Are you sure you want to delete all virtual machines? This action cannot be undone.")
confirm_col1, confirm_col2 = st.columns([1, 1])
with confirm_col1:
print("adding button")
if st.button("Yes, Delete All", key="confirm_delete_all"):
print("Deleting all")
for vm in filtered_VirtualMachines:
# Call the delete API for each VM
result = st.session_state.client.delete_virtual_machine(vm['id'])
print("Deleted vm")
st.success(f"Successfully deleted {len(filtered_VirtualMachines)} virtual machines.")
st.rerun()
with confirm_col2:
if st.button("Cancel", key="cancel_delete_all"):
st.rerun()
for VirtualMachine in filtered_VirtualMachines:
with st.container():
col1, col2, col3 = st.columns([3, 1, 1])
@@ -127,4 +154,4 @@ def render():
st.rerun()
else:
st.info("No VirtualMachine workloads found.")
st.info("No VirtualMachine workloads found.")