diff --git a/.last-branch b/.last-branch index 9671641..d11047e 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260120-08-runchecks-link-existing-autotask-ticket +v20260120-09-runchecks-modal-sequence-fix diff --git a/containers/backupchecks/src/templates/main/run_checks.html b/containers/backupchecks/src/templates/main/run_checks.html index 7eada09..fe1a50f 100644 --- a/containers/backupchecks/src/templates/main/run_checks.html +++ b/containers/backupchecks/src/templates/main/run_checks.html @@ -1014,12 +1014,27 @@ table.addEventListener('change', function (e) { if (btnAutotaskLink) { var linkModalEl = document.getElementById('autotaskLinkModal'); var linkModal = linkModalEl ? bootstrap.Modal.getOrCreateInstance(linkModalEl) : null; + // Avoid stacked Bootstrap modals: temporarily hide the main Run Checks modal + // and re-open it when the Autotask link modal is closed. + var mainModalEl = document.getElementById('runChecksModal'); + var mainModal = mainModalEl ? bootstrap.Modal.getOrCreateInstance(mainModalEl) : null; + var reopenMainAfterLinkModal = false; var atlSearch = document.getElementById('atl_search'); var atlRefresh = document.getElementById('atl_refresh'); var atlStatus = document.getElementById('atl_status'); var atlTbody = document.getElementById('atl_tbody'); var atlEmpty = document.getElementById('atl_empty'); + if (linkModalEl) { + linkModalEl.addEventListener('hidden.bs.modal', function () { + if (reopenMainAfterLinkModal && mainModal) { + reopenMainAfterLinkModal = false; + // Re-open the main modal so the normal Run Checks workflow continues. + mainModal.show(); + } + }); + } + function renderAtlRows(items) { if (!atlTbody) return; atlTbody.innerHTML = ''; @@ -1114,6 +1129,12 @@ table.addEventListener('change', function (e) { if (!currentRunId) { alert('Select a run first.'); return; } if (atlStatus) atlStatus.textContent = ''; renderAtlRows([]); + // Show the existing Run Checks popup first, then switch to the Autotask popup. + // This prevents the main popup from breaking due to stacked modal backdrops. + if (mainModal) { + reopenMainAfterLinkModal = true; + mainModal.hide(); + } if (linkModal) linkModal.show(); loadExistingTickets(); }); diff --git a/docs/changelog.md b/docs/changelog.md index a075402..94a0181 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -434,6 +434,16 @@ Changes: - Improved internal ticket resolve handling: - Do not overwrite resolved_origin when already set; keep “psa” origin when resolved by PSA. +## v20260120-09-runchecks-modal-sequence-fix + +- Fixed Run Checks popup behavior by preventing stacked Bootstrap modals. +- Restored correct modal sequence: + - The standard Run Checks modal opens first as before. + - The Autotask popup is opened only after explicitly selecting an Autotask action. +- Ensured the Run Checks modal is temporarily hidden when the Autotask popup opens. +- Automatically reopens the Run Checks modal when the Autotask popup is closed. +- Prevented broken backdrops, focus loss, and non-responsive popups caused by multiple active modals. + *** ## v0.1.21