fix: confirmation dialog fires only once (remove duplicate listener), remove debug log
This commit is contained in:
parent
1a15ab80d6
commit
700b2246c7
@ -339,8 +339,9 @@
|
||||
updateSaveButton();
|
||||
};
|
||||
|
||||
// Confirmation dialog
|
||||
document.getElementById('console-save-btn').addEventListener('click', function() {
|
||||
// Confirmation dialog (one-shot listener using {once:true})
|
||||
var saveBtn = document.getElementById('console-save-btn');
|
||||
var confirmHandler = function() {
|
||||
if (!isDirty()) return;
|
||||
var summary = '';
|
||||
document.querySelectorAll('.console-device-row').forEach(function(row) {
|
||||
@ -356,7 +357,6 @@
|
||||
});
|
||||
});
|
||||
if (!summary) { alert('未选择任何检测功能或视频源'); return; }
|
||||
// Require at least one feature.
|
||||
var hasFeature = false;
|
||||
document.querySelectorAll('.console-device-row input[type=checkbox]:checked').forEach(function() { hasFeature = true; });
|
||||
if (!hasFeature) { alert('请至少选择一项检测功能'); return; }
|
||||
@ -376,8 +376,9 @@
|
||||
document.getElementById('confirm-deploy-btn').addEventListener('click', function() {
|
||||
overlay.remove();
|
||||
document.getElementById('console-form').submit();
|
||||
});
|
||||
});
|
||||
}, {once: true});
|
||||
};
|
||||
saveBtn.addEventListener('click', confirmHandler);
|
||||
|
||||
// Show status from URL param, then clear the param so refresh doesn't repeat it.
|
||||
(function() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user