diff --git a/app/static/index.html b/app/static/index.html index 6a63f2b..d8aa176 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -1745,22 +1745,78 @@ } // Loading Functions - function showLoadingOverlay(containerId, message = 'Loading...') { - const container = document.getElementById(containerId); - if (!container) return; + function showFullscreenLoading(message = 'Analyzing Cluster Resources', submessage = 'Please wait while we analyze your cluster resources...') { + // Create fullscreen loading modal + const loadingModal = document.createElement('div'); + loadingModal.id = 'fullscreen-loading'; + loadingModal.style.cssText = ` + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background: rgba(21, 21, 21, 0.95); + backdrop-filter: blur(10px); + z-index: 9999; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + color: var(--pf-global--Color--100); + font-family: var(--pf-global--FontFamily--sans-serif); + `; - const loadingHTML = ` -
-
- + loadingModal.innerHTML = ` +
+
+
-

${message}

-
-

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(),