Extended NSController to handle networks and ports

This commit is contained in:
2025-05-04 14:16:06 +09:30
parent e86d948667
commit 72ce82c208
4 changed files with 198 additions and 65 deletions
+18 -4
View File
@@ -49,6 +49,11 @@ def render_list():
{
"docker_image": docker_image,
"container_name": container_name,
"ports": [
{"internal": 80, "external": 8080},
{"internal": 443, "external": 8443}
],
"networks": "bridge"
}
]
})
@@ -168,11 +173,22 @@ def render_detail():
st.markdown(f"**Last Updated:** {format_timestamp(container['updated_at'])}")
st.markdown(f"**Status:** {container['status']}")
st.markdown(f"**Launch Parameters:** {container.get('launch_params', 'N/A')}")
# Define container states once
CONTAINER_STATES = [
"running", "stopped", "pending",
"failed-deleted", "pending-deleted",
"pending-allocation", "failed-allocation",
"pending-allocated", "dead"
]
# Edit Container Workload Form
with st.expander("Edit Container Workload"):
with st.form("edit_container"):
new_status = st.selectbox("Status", ["running", "stopped", "pending","failed-deleted","pending-deleted","pending-allocation","failed-allocation","pending-allocated","dead"], index=["running", "stopped", "pending","failed-deleted","pending-deleted","pending-allocation","failed-allocation","pending-allocated","dead"].index(container['status']))
new_status = st.selectbox(
"Status",
CONTAINER_STATES,
index=CONTAINER_STATES.index(container['status'])
)
new_launch_params = st.text_input("Launch Parameters", value=container.get('launch_params', ''))
submit = st.form_submit_button("Update Container Workload")
@@ -187,8 +203,6 @@ def render_detail():
st.session_state.view_type = 'detail'
st.session_state.selected_resource_type = 'container'
st.rerun()
# Delete functionality
if not st.session_state.container_delete_confirmation_shown: