-
Please wait while we analyze your cluster resources...
+
+ ${message}
+
+
+ ${submessage}
+
+
+
+
+ Connecting to OpenShift API...
+
+
+
+ Querying Prometheus metrics...
+
+
+
+ Analyzing resource usage patterns...
+
+
+
`;
- container.innerHTML = loadingHTML;
+
+ document.body.appendChild(loadingModal);
+
+ // Animate progress bar
+ let progress = 0;
+ const progressInterval = setInterval(() => {
+ progress += Math.random() * 15;
+ if (progress > 90) progress = 90;
+ document.getElementById('loading-progress').style.width = progress + '%';
+ }, 200);
+
+ return { modal: loadingModal, progressInterval };
+ }
+
+ function hideFullscreenLoading() {
+ const loadingModal = document.getElementById('fullscreen-loading');
+ if (loadingModal) {
+ loadingModal.remove();
+ }
}
function showChartLoading(containerId, message = 'Loading chart...') {
@@ -1787,6 +1843,10 @@
function updateLoadingProgress(loaded, total) {
const progress = Math.round((loaded / total) * 100);
+ const progressBar = document.getElementById('loading-progress');
+ if (progressBar) {
+ progressBar.style.width = progress + '%';
+ }
console.log(`Loading progress: ${progress}% (${loaded}/${total})`);
}
@@ -1857,24 +1917,43 @@
}
async function loadWorkloadScanner() {
+ let loadingModal = null;
try {
- // Show loading overlay for metrics
- showLoadingOverlay('metrics-grid', 'Analyzing Cluster Resources');
+ // Show fullscreen loading modal
+ loadingModal = showFullscreenLoading(
+ 'Analyzing Cluster Resources',
+ 'Please wait while we analyze your cluster resources and generate insights...'
+ );
// Load cluster status
const clusterResponse = await fetch('/api/v1/cluster/status');
const clusterData = await clusterResponse.json();
+ // Update progress
+ updateLoadingProgress(1, 3);
+
// Update metrics cards
updateMetricsCards(clusterData);
+ // Update progress
+ updateLoadingProgress(2, 3);
+
// Load dashboard charts with loading states
await loadDashboardCharts();
+ // Update progress
+ updateLoadingProgress(3, 3);
+
currentData = { cluster: clusterData };
+ // Hide loading modal after a short delay
+ setTimeout(() => {
+ hideFullscreenLoading();
+ }, 500);
+
} catch (error) {
console.error('Error loading workload scanner data:', error);
+ hideFullscreenLoading();
showError('metrics-grid', 'Failed to load cluster data');
}
}
@@ -2020,13 +2099,6 @@
// Dashboard Charts Functions
async function loadDashboardCharts() {
try {
- // Show loading for all charts
- showChartLoading('resource-utilization-chart', 'Loading Resource Trends...');
- showChartLoading('namespace-distribution-chart', 'Analyzing Namespace Distribution...');
- showChartLoading('issues-timeline-chart', 'Loading Issues Timeline...');
- showChartLoading('top-workloads-chart', 'Identifying Top Workloads...');
- showChartLoading('overcommit-chart', 'Calculating Overcommit Status...');
-
// Load all charts in parallel
await Promise.all([
loadResourceUtilizationTrend(),