Fix: corrigido JavaScript do dashboard para exibir dados do cluster-health

This commit is contained in:
2025-09-29 18:11:01 -03:00
parent bd3ab16f5d
commit 379ce69b66

View File

@@ -1662,6 +1662,10 @@
const data = await response.json(); const data = await response.json();
currentData = data; currentData = data;
updateStats(data); updateStats(data);
// Update cluster health dashboard
updateClusterHealthDisplay(data, data);
showSuccess('Cluster status loaded successfully. Loading analysis...'); showSuccess('Cluster status loaded successfully. Loading analysis...');
// Automatically load validations after initial scan // Automatically load validations after initial scan
@@ -3006,11 +3010,14 @@
document.getElementById('cpuOvercommitText').textContent = document.getElementById('cpuOvercommitText').textContent =
`${healthData.cpu_overcommit_percentage.toFixed(1)}% overcommit`; `${healthData.cpu_overcommit_percentage.toFixed(1)}% overcommit`;
// Memory // Memory - Convert bytes to GiB
const memoryUsagePercent = (healthData.cluster_memory_requests / healthData.cluster_memory_capacity) * 100; const memoryRequestsGiB = healthData.cluster_memory_requests / (1024 * 1024 * 1024);
const memoryCapacityGiB = healthData.cluster_memory_capacity / (1024 * 1024 * 1024);
const memoryUsagePercent = (memoryRequestsGiB / memoryCapacityGiB) * 100;
document.getElementById('memoryUsageBar').style.width = Math.min(memoryUsagePercent, 100) + '%'; document.getElementById('memoryUsageBar').style.width = Math.min(memoryUsagePercent, 100) + '%';
document.getElementById('memoryUsageText').textContent = document.getElementById('memoryUsageText').textContent =
`${healthData.cluster_memory_requests.toFixed(1)} / ${healthData.cluster_memory_capacity.toFixed(1)} GiB`; `${memoryRequestsGiB.toFixed(1)} / ${memoryCapacityGiB.toFixed(1)} GiB`;
document.getElementById('memoryOvercommitText').textContent = document.getElementById('memoryOvercommitText').textContent =
`${healthData.memory_overcommit_percentage.toFixed(1)}% overcommit`; `${healthData.memory_overcommit_percentage.toFixed(1)}% overcommit`;
} }
@@ -3035,7 +3042,7 @@
</div> </div>
<div class="consumer-resources"> <div class="consumer-resources">
<div>CPU: ${consumer.cpu_requests.toFixed(1)} cores</div> <div>CPU: ${consumer.cpu_requests.toFixed(1)} cores</div>
<div>Memory: ${consumer.memory_requests.toFixed(1)} GiB</div> <div>Memory: ${(consumer.memory_requests / (1024 * 1024 * 1024)).toFixed(1)} GiB</div>
<div class="qos-badge qos-${consumer.qos_class.toLowerCase()}">${consumer.qos_class}</div> <div class="qos-badge qos-${consumer.qos_class.toLowerCase()}">${consumer.qos_class}</div>
</div> </div>
`; `;