Fix JavaScript errors and auto-populate issues
- Fix loadProtocolMappings reference error in dashboard.js by calling loadAllSignals() - Add debugging to populateModalFields to identify field availability issues - Ensure protocol mapping tab is activated before auto-populating from discovery - Add delay to ensure tab content is loaded before attempting auto-population
This commit is contained in:
parent
ece4952330
commit
add4952e74
|
|
@ -24,7 +24,11 @@ function showTab(tabName) {
|
||||||
} else if (tabName === 'logs') {
|
} else if (tabName === 'logs') {
|
||||||
loadLogs();
|
loadLogs();
|
||||||
} else if (tabName === 'protocol-mapping') {
|
} else if (tabName === 'protocol-mapping') {
|
||||||
loadProtocolMappings();
|
if (typeof loadAllSignals === 'function') {
|
||||||
|
loadAllSignals();
|
||||||
|
} else {
|
||||||
|
console.warn('loadAllSignals function not available - protocol mapping tab may not work correctly');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,19 +119,26 @@ class SimplifiedProtocolDiscovery {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
autoPopulateSignalForm(signalData) {
|
autoPopulateSignalForm(signalData) {
|
||||||
console.log('Auto-populating signal form with:', signalData);
|
console.log('Auto-populating signal form with:', signalData);
|
||||||
|
|
||||||
|
// Ensure protocol mapping tab is active
|
||||||
|
if (typeof showTab === 'function') {
|
||||||
|
showTab('protocol-mapping');
|
||||||
|
}
|
||||||
|
|
||||||
// Use the simplified protocol mapping function
|
// Use the simplified protocol mapping function
|
||||||
if (typeof window.autoPopulateSignalForm === 'function') {
|
if (typeof window.autoPopulateSignalForm === 'function') {
|
||||||
|
// Add a small delay to ensure the tab is loaded
|
||||||
|
setTimeout(() => {
|
||||||
window.autoPopulateSignalForm(signalData);
|
window.autoPopulateSignalForm(signalData);
|
||||||
|
}, 100);
|
||||||
} else {
|
} else {
|
||||||
console.error('Simplified protocol mapping functions not loaded');
|
console.error('Simplified protocol mapping functions not loaded');
|
||||||
this.showNotification('Protocol mapping system not available', 'error');
|
this.showNotification('Protocol mapping system not available', 'error');
|
||||||
}
|
}
|
||||||
}
|
} // Start discovery scan
|
||||||
|
|
||||||
// Start discovery scan
|
|
||||||
async startDiscoveryScan() {
|
async startDiscoveryScan() {
|
||||||
console.log('Starting discovery scan...');
|
console.log('Starting discovery scan...');
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -316,10 +316,18 @@ function populateModalFields(discoveryData) {
|
||||||
|
|
||||||
if (signalModal && signalModal.style.display === 'none') {
|
if (signalModal && signalModal.style.display === 'none') {
|
||||||
signalModal.style.display = 'block';
|
signalModal.style.display = 'block';
|
||||||
|
console.log('✓ Opened signal modal');
|
||||||
} else if (mappingModal && mappingModal.style.display === 'none') {
|
} else if (mappingModal && mappingModal.style.display === 'none') {
|
||||||
mappingModal.style.display = 'block';
|
mappingModal.style.display = 'block';
|
||||||
|
console.log('✓ Opened mapping modal');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug: Check if fields exist
|
||||||
|
console.log('Available fields:');
|
||||||
|
console.log('- protocol_type:', document.getElementById('protocol_type'));
|
||||||
|
console.log('- protocol_address:', document.getElementById('protocol_address'));
|
||||||
|
console.log('- db_source:', document.getElementById('db_source'));
|
||||||
|
|
||||||
// Populate signal name (try different field names)
|
// Populate signal name (try different field names)
|
||||||
const signalNameField = document.getElementById('signal_name') || document.getElementById('mapping_id');
|
const signalNameField = document.getElementById('signal_name') || document.getElementById('mapping_id');
|
||||||
if (signalNameField && discoveryData.signal_name) {
|
if (signalNameField && discoveryData.signal_name) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue