corrected label error

This commit is contained in:
2025-04-06 03:41:55 +09:30
parent 1ae5b14185
commit 89b0c85dc7
+5 -5
View File
@@ -22,7 +22,7 @@ def render_list():
if 'labels' in host and host['labels']:
capabilities = []
for label in host['labels']:
if label['label_key'] in ['libvirt-capable', 'docker-enabled']:
if label['label_key'] in ['libvirt-capable', 'docker-capable']:
status = "✅" if label['label_value'].lower() in ['true', 'yes', '1'] else "❌"
capabilities.append(f"{label['label_key']}:{status}")
if capabilities:
@@ -48,7 +48,7 @@ def render_detail():
# Get labels for this host
labels = st.session_state.client.get_labels_for_host(host_id) or []
libvirt_label = next((l for l in labels if l['label_key'] == 'libvirt-capable'), None)
docker_label = next((l for l in labels if l['label_key'] == 'docker-enabled'), None)
docker_label = next((l for l in labels if l['label_key'] == 'docker-capable'), None)
# Capability management section
st.header("Capability Management")
@@ -78,9 +78,9 @@ def render_detail():
with cap_col2:
st.subheader("Docker Capability")
if docker_label:
st.success("✅ This host is docker-enabled")
st.success("✅ This host is docker-capable")
if st.button("Remove Docker Capability", key="remove_docker"):
result = st.session_state.client.remove_label(host_id, 'docker-enabled')
result = st.session_state.client.remove_label(host_id, 'docker-capable')
if result and result.get('success'):
st.rerun()
else:
@@ -88,7 +88,7 @@ def render_detail():
if st.button("Add Docker Capability", key="add_docker"):
result = st.session_state.client.add_label(
host_id,
'docker-enabled',
'docker-capable',
'true',
admin_only_view=False,
admin_only_set=False