bug fix: select control
This commit is contained in:
parent
912c9dcee3
commit
6ea4a65d9c
|
|
@ -124,11 +124,31 @@ def get_live_scan_progress(request, scan_id):
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
# Log the request
|
||||||
|
logging.writeToFile(f'[Status API] Live progress request for scan: {scan_id}')
|
||||||
|
|
||||||
# Get latest status update
|
# Get latest status update
|
||||||
try:
|
try:
|
||||||
status_update = ScanStatusUpdate.objects.get(scan_id=scan_id)
|
status_update = ScanStatusUpdate.objects.get(scan_id=scan_id)
|
||||||
except ScanStatusUpdate.DoesNotExist:
|
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)
|
return JsonResponse({'success': False, 'error': 'Scan not found'}, status=404)
|
||||||
|
|
||||||
response_data = {
|
response_data = {
|
||||||
|
|
|
||||||
|
|
@ -1029,9 +1029,18 @@ function fetchLiveProgress(scanId) {
|
||||||
fetchCompletedScanDetails(scanId);
|
fetchCompletedScanDetails(scanId);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log(`[AI Scanner] No live status found, falling back to completed results`);
|
// Check if scan exists but no status yet
|
||||||
// No live status found, try fetching completed scan details
|
if (data.scan_exists && data.scan_status === 'running') {
|
||||||
fetchCompletedScanDetails(scanId);
|
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 => {
|
.catch(error => {
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,45 @@
|
||||||
outline: none;
|
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 {
|
.btn-primary {
|
||||||
background: linear-gradient(135deg, #5b5fcf 0%, #7b7fd0 100%);
|
background: linear-gradient(135deg, #5b5fcf 0%, #7b7fd0 100%);
|
||||||
border: none;
|
border: none;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue