From 6ea4a65d9c17a1d3987b54f31f1c9c9578d43948 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 27 Jun 2025 18:02:01 +0500 Subject: [PATCH] bug fix: select control --- aiScanner/status_api.py | 22 ++++++++++- aiScanner/templates/aiScanner/scanner.html | 15 +++++-- .../templates/userManagment/createUser.html | 39 +++++++++++++++++++ 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/aiScanner/status_api.py b/aiScanner/status_api.py index a9cf07c21..715ff17f0 100644 --- a/aiScanner/status_api.py +++ b/aiScanner/status_api.py @@ -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 = { diff --git a/aiScanner/templates/aiScanner/scanner.html b/aiScanner/templates/aiScanner/scanner.html index 685ae83d8..a2ab60495 100644 --- a/aiScanner/templates/aiScanner/scanner.html +++ b/aiScanner/templates/aiScanner/scanner.html @@ -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 => { diff --git a/userManagment/templates/userManagment/createUser.html b/userManagment/templates/userManagment/createUser.html index 36442e63f..10a93aa4c 100644 --- a/userManagment/templates/userManagment/createUser.html +++ b/userManagment/templates/userManagment/createUser.html @@ -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;