From 912c9dcee36ef2224202fbbfa34fefd731575d28 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 27 Jun 2025 17:36:52 +0500 Subject: [PATCH] bug fix: select control --- aiScanner/status_api.py | 17 ++++++++ aiScanner/templates/aiScanner/scanner.html | 5 ++- .../websiteFunctions/createDomain.html | 39 +++++++++++++++++++ .../websiteFunctions/createWebsite.html | 39 +++++++++++++++++++ 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/aiScanner/status_api.py b/aiScanner/status_api.py index 8b3e61193..a9cf07c21 100644 --- a/aiScanner/status_api.py +++ b/aiScanner/status_api.py @@ -60,6 +60,13 @@ def receive_status_update(request): # Extended logging for debugging logging.writeToFile(f'[Status API] ✅ {action} status update for scan {scan_id}') + + # Track phase transitions + old_phase = status_update.phase if not created else 'none' + new_phase = data.get("phase") + if old_phase != new_phase: + logging.writeToFile(f'[Status API] 📊 Phase transition: {old_phase} → {new_phase}') + logging.writeToFile(f'[Status API] Phase: {data.get("phase")} → Progress: {data.get("progress", 0)}%') logging.writeToFile(f'[Status API] Files: {data.get("files_scanned", 0)}/{data.get("files_discovered", 0)} ({data.get("files_remaining", 0)} remaining)') logging.writeToFile(f'[Status API] Threats: {data.get("threats_found", 0)} total (Critical: {data.get("critical_threats", 0)}, High: {data.get("high_threats", 0)})') @@ -68,6 +75,16 @@ def receive_status_update(request): if data.get('activity_description'): logging.writeToFile(f'[Status API] Activity: {data.get("activity_description")}') + # Log specific phase milestones + phase = data.get('phase', '') + if phase == 'discovering_files' and data.get('files_discovered', 0) > 0: + logging.writeToFile(f'[Status API] ✅ File discovery complete: {data.get("files_discovered")} files found') + elif phase == 'scanning_files' and data.get('files_scanned', 0) > 0: + percentage = (data.get('files_scanned', 0) / data.get('files_discovered', 1)) * 100 + logging.writeToFile(f'[Status API] 📈 Scan progress: {percentage:.1f}% of files scanned') + elif phase == 'ai_analysis': + logging.writeToFile(f'[Status API] 🤖 AI Analysis phase - suspicious files being analyzed') + return JsonResponse({'success': True}) except json.JSONDecodeError: diff --git a/aiScanner/templates/aiScanner/scanner.html b/aiScanner/templates/aiScanner/scanner.html index 4152ca890..685ae83d8 100644 --- a/aiScanner/templates/aiScanner/scanner.html +++ b/aiScanner/templates/aiScanner/scanner.html @@ -1091,7 +1091,7 @@ function startProgressMonitoring(scanId) { .then(data => { if (data.success) { if (data.is_active) { - console.log(`[AI Scanner] Progress update: ${data.phase} - ${data.progress}%`); + console.log(`[AI Scanner] Progress update: Phase="${data.phase}" Progress=${data.progress}% Activity="${data.activity_description || 'N/A'}" Files=${data.files_scanned}/${data.files_discovered}`); updateProgressUI(data); } else { console.log(`[AI Scanner] Scan completed, stopping monitoring`); @@ -1238,6 +1238,7 @@ function formatPhase(phase) { 'starting': 'Starting Scan', 'discovering_files': 'Discovering Files', 'scanning_files': 'Scanning Files', + 'ai_analysis': 'AI Analysis', 'completing': 'Finalizing', 'completed': 'Completed', 'failed': 'Failed', @@ -1251,6 +1252,7 @@ function getPhaseColor(phase) { 'starting': 'info', 'discovering_files': 'warning', 'scanning_files': 'primary', + 'ai_analysis': 'warning', 'completing': 'success', 'completed': 'success', 'failed': 'danger', @@ -1365,6 +1367,7 @@ function getStatusClass(phase) { 'starting': 'info', 'discovering_files': 'warning', 'scanning_files': 'warning', + 'ai_analysis': 'info', 'completing': 'warning', 'completed': 'success', 'failed': 'danger', diff --git a/websiteFunctions/templates/websiteFunctions/createDomain.html b/websiteFunctions/templates/websiteFunctions/createDomain.html index 190958c49..db0838383 100644 --- a/websiteFunctions/templates/websiteFunctions/createDomain.html +++ b/websiteFunctions/templates/websiteFunctions/createDomain.html @@ -120,6 +120,45 @@ box-shadow: 0 0 0 3px rgba(91,95,207,0.1); } + /* 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; + } + /* Path input group */ .input-group { display: flex; diff --git a/websiteFunctions/templates/websiteFunctions/createWebsite.html b/websiteFunctions/templates/websiteFunctions/createWebsite.html index c35ca35f4..3b1fd1dc6 100644 --- a/websiteFunctions/templates/websiteFunctions/createWebsite.html +++ b/websiteFunctions/templates/websiteFunctions/createWebsite.html @@ -95,6 +95,45 @@ box-shadow: 0 0 0 3px rgba(91,95,207,0.1); } + /* 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; + } + /* Checkbox styles */ .checkbox-group { margin-bottom: 15px;