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