VM status updates when booted

This commit is contained in:
2025-03-18 00:01:27 +10:30
parent a59f20b74c
commit abcc4f306c
5 changed files with 234 additions and 37 deletions
+23 -3
View File
@@ -132,7 +132,7 @@ def render():
st.session_state.delete_confirmation_shown = False
st.session_state.delete_confirmed = False
filtered_VirtualMachines=[]
# Display the VMs
for VirtualMachine in filtered_VirtualMachines:
with st.container():
@@ -144,13 +144,33 @@ def render():
try:
VirtualMachine_name = json.loads(launch_params).get('docker_image')
except json.JSONDecodeError:
print("LP not vald json")
print("LP not valid json")
VirtualMachine_name = None
else:
print("lp empty")
VirtualMachine_name = None
st.markdown(f"### {VirtualMachine['name']}")
st.text(f"Status: {VirtualMachine['status']}")
# Create a grey box for the status
status = VirtualMachine['status']
if status == "error":
status_color = "red"
elif status == "started":
status_color = "green"
elif status == "pending-allocated":
status_color = "orange"
else:
status_color = "blue"
st.markdown(
f"""
<div style="background-color: #f0f0f0; padding: 10px; border-radius: 5px;">
<strong>Status:</strong> <span style="color: {status_color}; font-weight: bold;">{status}</span>
</div>
""",
unsafe_allow_html=True
)
st.text(f"VDC ID: {VirtualMachine['vdc_id']}")
st.text(f"Image: {VirtualMachine_name}")
with col2: