fix: prevent showError from removing the 4 first metric cards

This commit is contained in:
2025-10-06 15:48:33 -03:00
parent 16a0429cc6
commit 817478f4f9

View File

@@ -4365,6 +4365,26 @@
function showError(containerId, message) { function showError(containerId, message) {
const container = document.getElementById(containerId); const container = document.getElementById(containerId);
// If it's metrics-grid, show error above the cards, not replace them
if (containerId === 'metrics-grid') {
// Find the parent container to add error above
const parentContainer = container.parentElement;
const errorDiv = document.createElement('div');
errorDiv.className = 'pf-c-alert pf-m-danger';
errorDiv.style.marginBottom = '16px';
errorDiv.innerHTML = `
<div class="pf-c-alert__icon">
<i class="fas fa-exclamation-triangle"></i>
</div>
<div class="pf-c-alert__title">Error</div>
<div class="pf-c-alert__description">${message}</div>
`;
// Insert error before the metrics grid
parentContainer.insertBefore(errorDiv, container);
} else {
// For other containers, replace content as before
container.innerHTML = ` container.innerHTML = `
<div style="text-align: center; padding: 40px; color: var(--pf-global--danger-color--100);"> <div style="text-align: center; padding: 40px; color: var(--pf-global--danger-color--100);">
<i class="fas fa-exclamation-triangle" style="font-size: 48px; margin-bottom: 16px;"></i> <i class="fas fa-exclamation-triangle" style="font-size: 48px; margin-bottom: 16px;"></i>
@@ -4373,6 +4393,7 @@
</div> </div>
`; `;
} }
}
</script> </script>
<!-- React and Victory.js for PatternFly charts --> <!-- React and Victory.js for PatternFly charts -->