mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-07 12:27:37 +02:00
bug fix: select control
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user