bug fix: select control

This commit is contained in:
usmannasir 2025-06-27 18:02:01 +05:00
parent 912c9dcee3
commit 6ea4a65d9c
3 changed files with 72 additions and 4 deletions

View File

@ -124,11 +124,31 @@ def get_live_scan_progress(request, scan_id):
}
"""
try:
# Log the request
logging.writeToFile(f'[Status API] Live progress request for scan: {scan_id}')
# Get latest status update
try:
status_update = ScanStatusUpdate.objects.get(scan_id=scan_id)
except ScanStatusUpdate.DoesNotExist:
logging.writeToFile(f'[Status API] Status not found for scan {scan_id}')
logging.writeToFile(f'[Status API] Status not found for scan {scan_id} - checking if scan exists in history')
# Check if scan exists in ScanHistory
from .models import ScanHistory
try:
scan_history = ScanHistory.objects.get(scan_id=scan_id)
logging.writeToFile(f'[Status API] Scan {scan_id} exists in history with status: {scan_history.status}')
# If scan exists but no status update, it might not have started yet
return JsonResponse({
'success': False,
'error': 'No live status available yet',
'scan_exists': True,
'scan_status': scan_history.status
}, status=404)
except ScanHistory.DoesNotExist:
logging.writeToFile(f'[Status API] Scan {scan_id} not found in history either')
return JsonResponse({'success': False, 'error': 'Scan not found'}, status=404)
response_data = {

View File

@ -1029,9 +1029,18 @@ function fetchLiveProgress(scanId) {
fetchCompletedScanDetails(scanId);
}
} else {
console.log(`[AI Scanner] No live status found, falling back to completed results`);
// No live status found, try fetching completed scan details
fetchCompletedScanDetails(scanId);
// Check if scan exists but no status yet
if (data.scan_exists && data.scan_status === 'running') {
console.log(`[AI Scanner] Scan is running but no status updates yet, retrying...`);
// Show loading state and retry in a few seconds
setTimeout(() => {
fetchLiveProgress(scanId);
}, 3000);
} else {
console.log(`[AI Scanner] No live status found, falling back to completed results`);
// No live status found, try fetching completed scan details
fetchCompletedScanDetails(scanId);
}
}
})
.catch(error => {

View File

@ -80,6 +80,45 @@
outline: none;
}
/* Select dropdown styles for Windows compatibility */
select.form-control {
cursor: pointer;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232f3640' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
background-repeat: no-repeat;
background-position: right 12px center;
background-size: 20px;
padding-right: 40px;
line-height: 1.5;
min-height: 44px;
}
/* Windows-specific fixes */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
select.form-control {
color: #2f3640 !important;
background-color: white !important;
}
}
/* Fix for Windows Edge and Chrome */
select.form-control::-ms-expand {
display: none;
}
select.form-control option {
color: #2f3640;
background-color: white;
padding: 8px;
}
select.form-control:focus {
color: #2f3640;
background-color: white;
}
.btn-primary {
background: linear-gradient(135deg, #5b5fcf 0%, #7b7fd0 100%);
border: none;