web: status bug fix
This commit is contained in:
@@ -1443,7 +1443,14 @@ async function handleManualScan(event) {
|
||||
|
||||
showToast(`✅ Manual scan initiated: ${result.message}`, 'success');
|
||||
|
||||
// Start polling for scan status with log-based detection
|
||||
// Track scan start time for status monitoring
|
||||
try {
|
||||
await apiCall('/api/scan/track', { method: 'POST' });
|
||||
} catch (e) {
|
||||
console.log('Failed to track scan start:', e);
|
||||
}
|
||||
|
||||
// Start polling for scan status
|
||||
startScanStatusPolling();
|
||||
|
||||
} catch (error) {
|
||||
@@ -1486,7 +1493,14 @@ async function handleCustomScan(event) {
|
||||
|
||||
showToast(`✅ Custom scan initiated: ${result.message}`, 'success');
|
||||
|
||||
// Start polling for scan status with log-based detection
|
||||
// Track scan start time for status monitoring
|
||||
try {
|
||||
await apiCall('/api/scan/track', { method: 'POST' });
|
||||
} catch (e) {
|
||||
console.log('Failed to track scan start:', e);
|
||||
}
|
||||
|
||||
// Start polling for scan status
|
||||
startScanStatusPolling();
|
||||
|
||||
} catch (error) {
|
||||
@@ -1528,10 +1542,7 @@ 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;
|
||||
}
|
||||
|
||||
@@ -1540,15 +1551,12 @@ 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);
|
||||
}
|
||||
@@ -1556,16 +1564,13 @@ 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
|
||||
@@ -1602,7 +1607,6 @@ function startScanStatusPolling() {
|
||||
}
|
||||
}, 2000);
|
||||
|
||||
console.log('Started scan status polling');
|
||||
}
|
||||
|
||||
function stopScanStatusPolling() {
|
||||
|
||||
Reference in New Issue
Block a user