This commit is contained in:
@@ -118,8 +118,8 @@ async function loadDashboard() {
|
||||
updateDashboardStats();
|
||||
updateDashboardCharts();
|
||||
|
||||
// Check if there's an ongoing scan when dashboard loads
|
||||
await checkScanStatus();
|
||||
// Note: Scan status tracking not implemented yet
|
||||
// Real-time scan status would require core container modifications
|
||||
} catch (error) {
|
||||
console.error('Failed to load dashboard:', error);
|
||||
}
|
||||
@@ -1443,8 +1443,13 @@ async function handleManualScan(event) {
|
||||
|
||||
showToast(`✅ Manual scan initiated: ${result.message}`, 'success');
|
||||
|
||||
// Start polling for scan status
|
||||
startScanStatusPolling();
|
||||
// Show scan status banner temporarily
|
||||
updateScanStatus('Manual scan started - check core container logs for progress', true);
|
||||
|
||||
// Hide banner after 10 seconds since we don't have real-time tracking yet
|
||||
setTimeout(() => {
|
||||
updateScanStatus('Scan status tracking not available - check core container logs', false);
|
||||
}, 10000);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Manual scan failed:', error);
|
||||
@@ -1486,8 +1491,13 @@ async function handleCustomScan(event) {
|
||||
|
||||
showToast(`✅ Custom scan initiated: ${result.message}`, 'success');
|
||||
|
||||
// Start polling for scan status
|
||||
startScanStatusPolling();
|
||||
// Show scan status banner temporarily
|
||||
updateScanStatus('Custom directory scan started - check core container logs for progress', true);
|
||||
|
||||
// Hide banner after 10 seconds since we don't have real-time tracking yet
|
||||
setTimeout(() => {
|
||||
updateScanStatus('Scan status tracking not available - check core container logs', false);
|
||||
}, 10000);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Custom scan failed:', error);
|
||||
@@ -1528,6 +1538,8 @@ function updateScanStatus(message, isActive = false) {
|
||||
const statusBanner = document.getElementById('dashboard-scan-status');
|
||||
const statusText = document.getElementById('dashboard-scan-text');
|
||||
|
||||
console.log('updateScanStatus called:', { message, isActive, statusBanner: !!statusBanner, statusText: !!statusText });
|
||||
|
||||
if (!statusBanner || !statusText) {
|
||||
console.log('Scan status elements not found, skipping update');
|
||||
return;
|
||||
@@ -1538,12 +1550,15 @@ function updateScanStatus(message, isActive = false) {
|
||||
if (isActive) {
|
||||
statusBanner.className = 'scan-status-banner active';
|
||||
statusBanner.style.display = 'block';
|
||||
console.log('Scan status banner activated:', message);
|
||||
} else {
|
||||
statusBanner.className = 'scan-status-banner';
|
||||
console.log('Scan status banner deactivated:', message);
|
||||
// Don't hide completely, just mark as inactive
|
||||
setTimeout(() => {
|
||||
if (statusBanner.className === 'scan-status-banner') {
|
||||
statusBanner.style.display = 'none';
|
||||
console.log('Scan status banner hidden after timeout');
|
||||
}
|
||||
}, 3000);
|
||||
}
|
||||
@@ -1551,13 +1566,16 @@ function updateScanStatus(message, isActive = false) {
|
||||
|
||||
async function checkScanStatus() {
|
||||
try {
|
||||
console.log('Checking scan status...');
|
||||
const status = await apiCall('/api/scan/status');
|
||||
console.log('Scan status response:', status);
|
||||
|
||||
if (status.scanning) {
|
||||
updateScanStatus(status.message || 'Scan in progress...', true);
|
||||
|
||||
// Start polling if not already polling
|
||||
if (!scanStatusInterval) {
|
||||
console.log('Starting scan status polling from checkScanStatus');
|
||||
startScanStatusPolling();
|
||||
}
|
||||
return true; // Continue polling
|
||||
|
||||
Reference in New Issue
Block a user