it
This commit is contained in:
@@ -447,7 +447,7 @@ class DNSReconApp {
|
||||
// Handle status changes
|
||||
if (status.status !== this.scanStatus) {
|
||||
console.log(`*** STATUS CHANGED: ${this.scanStatus} -> ${status.status} ***`);
|
||||
this.handleStatusChange(status.status);
|
||||
this.handleStatusChange(status.status, status.task_queue_size);
|
||||
}
|
||||
|
||||
this.scanStatus = status.status;
|
||||
@@ -574,6 +574,8 @@ class DNSReconApp {
|
||||
this.elements.sessionId.textContent = 'Session: Loading...';
|
||||
}
|
||||
}
|
||||
|
||||
this.setUIState(status.status, status.task_queue_size);
|
||||
|
||||
console.log('Status display updated successfully');
|
||||
} catch (error) {
|
||||
@@ -585,12 +587,12 @@ class DNSReconApp {
|
||||
* Handle status changes with improved state synchronization
|
||||
* @param {string} newStatus - New scan status
|
||||
*/
|
||||
handleStatusChange(newStatus) {
|
||||
handleStatusChange(newStatus, task_queue_size) {
|
||||
console.log(`=== STATUS CHANGE: ${this.scanStatus} -> ${newStatus} ===`);
|
||||
|
||||
switch (newStatus) {
|
||||
case 'running':
|
||||
this.setUIState('scanning');
|
||||
this.setUIState('scanning', task_queue_size);
|
||||
this.showSuccess('Scan is running');
|
||||
// Increase polling frequency for active scans
|
||||
this.startPolling(1000); // Poll every 1 second for running scans
|
||||
@@ -598,7 +600,7 @@ class DNSReconApp {
|
||||
break;
|
||||
|
||||
case 'completed':
|
||||
this.setUIState('completed');
|
||||
this.setUIState('completed', task_queue_size);
|
||||
this.stopPolling();
|
||||
this.showSuccess('Scan completed successfully');
|
||||
this.updateConnectionStatus('completed');
|
||||
@@ -609,7 +611,7 @@ class DNSReconApp {
|
||||
break;
|
||||
|
||||
case 'failed':
|
||||
this.setUIState('failed');
|
||||
this.setUIState('failed', task_queue_size);
|
||||
this.stopPolling();
|
||||
this.showError('Scan failed');
|
||||
this.updateConnectionStatus('error');
|
||||
@@ -617,7 +619,7 @@ class DNSReconApp {
|
||||
break;
|
||||
|
||||
case 'stopped':
|
||||
this.setUIState('stopped');
|
||||
this.setUIState('stopped', task_queue_size);
|
||||
this.stopPolling();
|
||||
this.showSuccess('Scan stopped');
|
||||
this.updateConnectionStatus('stopped');
|
||||
@@ -625,7 +627,7 @@ class DNSReconApp {
|
||||
break;
|
||||
|
||||
case 'idle':
|
||||
this.setUIState('idle');
|
||||
this.setUIState('idle', task_queue_size);
|
||||
this.stopPolling();
|
||||
this.updateConnectionStatus('idle');
|
||||
break;
|
||||
@@ -670,9 +672,11 @@ class DNSReconApp {
|
||||
/**
|
||||
* UI state management with immediate button updates
|
||||
*/
|
||||
setUIState(state) {
|
||||
setUIState(state, task_queue_size) {
|
||||
console.log(`Setting UI state to: ${state}`);
|
||||
|
||||
const isQueueEmpty = task_queue_size === 0;
|
||||
|
||||
switch (state) {
|
||||
case 'scanning':
|
||||
this.isScanning = true;
|
||||
@@ -701,12 +705,12 @@ class DNSReconApp {
|
||||
case 'stopped':
|
||||
this.isScanning = false;
|
||||
if (this.elements.startScan) {
|
||||
this.elements.startScan.disabled = false;
|
||||
this.elements.startScan.disabled = !isQueueEmpty;
|
||||
this.elements.startScan.classList.remove('loading');
|
||||
this.elements.startScan.innerHTML = '<span class="btn-icon">[RUN]</span><span>Start Reconnaissance</span>';
|
||||
}
|
||||
if (this.elements.addToGraph) {
|
||||
this.elements.addToGraph.disabled = false;
|
||||
this.elements.addToGraph.disabled = !isQueueEmpty;
|
||||
this.elements.addToGraph.classList.remove('loading');
|
||||
}
|
||||
if (this.elements.stopScan) {
|
||||
|
||||
Reference in New Issue
Block a user