Improve overcommit UI with info icons and modals

- Replace tooltips with info icons (ℹ️) next to CPU/Memory Overcommit
- Add modal dialogs showing detailed overcommit calculations
- Change Resource Quota Coverage to Resource Utilization
- Add CSS styling for overcommit details modals
- Improve UX with clickable info icons instead of hover tooltips
- Show capacity, requests, overcommit percentage, and available resources
This commit is contained in:
2025-10-01 15:41:43 -03:00
parent 8984701bf3
commit 2bb5266753
2 changed files with 126 additions and 36 deletions

View File

@@ -180,9 +180,13 @@ async def get_cluster_status(
# Count namespaces in overcommit (simplified - any namespace with requests > 0)
namespaces_in_overcommit = len([ns for ns in namespaces_list if ns['total_validations'] > 0])
# Calculate resource quota coverage (simplified)
if cpu_capacity > 0 and memory_capacity > 0:
resource_quota_coverage = round(((cpu_requests + memory_requests) / (cpu_capacity + memory_capacity)) * 100, 1)
# Calculate resource utilization (usage vs requests) - simplified
# This would ideally use actual usage data from Prometheus
resource_utilization = 0
if cpu_requests > 0 and memory_requests > 0:
# For now, we'll use a simplified calculation
# In a real implementation, this would compare actual usage vs requests
resource_utilization = 75 # Placeholder - would be calculated from real usage data
return {
"timestamp": datetime.now().isoformat(),
@@ -196,7 +200,7 @@ async def get_cluster_status(
"cpu_overcommit_percent": cpu_overcommit_percent,
"memory_overcommit_percent": memory_overcommit_percent,
"namespaces_in_overcommit": namespaces_in_overcommit,
"resource_quota_coverage": resource_quota_coverage,
"resource_utilization": resource_utilization,
"cpu_capacity": cpu_capacity if 'cpu_capacity' in locals() else 0,
"cpu_requests": cpu_requests if 'cpu_requests' in locals() else 0,
"memory_capacity": memory_capacity if 'memory_capacity' in locals() else 0,