feat: Implement configurable pump control preprocessing logic #5
|
|
@ -124,7 +124,6 @@ async function applyFilters() {
|
|||
|
||||
// Modal Functions
|
||||
function showAddSignalModal() {
|
||||
console.log('showAddSignalModal called');
|
||||
window.editingSignalId = null;
|
||||
|
||||
// Safely update modal elements if they exist
|
||||
|
|
@ -144,13 +143,8 @@ function showAddSignalModal() {
|
|||
}
|
||||
|
||||
const signalModal = document.getElementById('signal-modal');
|
||||
console.log('Modal element found:', signalModal);
|
||||
if (signalModal) {
|
||||
console.log('Setting modal display to block');
|
||||
signalModal.style.display = 'block';
|
||||
console.log('Modal display after setting:', signalModal.style.display);
|
||||
} else {
|
||||
console.error('signal-modal element not found!');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -294,32 +288,21 @@ function autoPopulateSignalForm(discoveryData) {
|
|||
// First, open the "Add New Signal" modal
|
||||
showAddSignalModal();
|
||||
|
||||
// Wait for modal to be fully loaded and visible
|
||||
const waitForModal = setInterval(() => {
|
||||
const modal = document.getElementById('signal-modal');
|
||||
const isModalVisible = modal && modal.style.display !== 'none';
|
||||
|
||||
if (isModalVisible) {
|
||||
clearInterval(waitForModal);
|
||||
console.log('Modal is visible, populating fields...');
|
||||
populateModalFields(discoveryData);
|
||||
}
|
||||
}, 50);
|
||||
|
||||
// Timeout after 3 seconds (increased from 2)
|
||||
// Use a simpler approach - just populate after a short delay
|
||||
// This avoids complex timeout logic that can be unreliable
|
||||
setTimeout(() => {
|
||||
clearInterval(waitForModal);
|
||||
const modal = document.getElementById('signal-modal');
|
||||
if (modal && modal.style.display !== 'none') {
|
||||
console.log('Modal opened within timeout, populating fields...');
|
||||
console.log('Modal is visible, populating fields...');
|
||||
populateModalFields(discoveryData);
|
||||
} else {
|
||||
console.error('Modal did not open within timeout period');
|
||||
console.log('Modal element:', modal);
|
||||
console.log('Modal display style:', modal ? modal.style.display : 'no modal found');
|
||||
showSimplifiedAlert('Could not open signal form. Please try opening it manually.', 'error');
|
||||
console.log('Modal not immediately visible, trying again...');
|
||||
// Try one more time after another short delay
|
||||
setTimeout(() => {
|
||||
populateModalFields(discoveryData);
|
||||
}, 100);
|
||||
}
|
||||
}, 3000);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
function populateModalFields(discoveryData) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue