fix: block empty import confirmations

Disable and guard host selection confirmation whenever the current preflight produces zero jobs, preserving pending files and plan state for empty destination and fully size-limited selections.
This commit is contained in:
Sucukdeluxe
2026-08-16 22:16:57 +02:00
parent 3da1b08514
commit 287363aee7
2 changed files with 12 additions and 2 deletions
+6 -2
View File
@@ -1285,7 +1285,7 @@ function closeHosterModal() {
}
async function applyHosterSelection() {
if (_pendingImportInspections > 0) return false;
if (isImportConfirmationBlocked()) return false;
selectedUploadHosters = Array.from(document.querySelectorAll('input[data-hoster-modal]:checked'))
.map(input => input.dataset.hosterModal);
// Move pending files to selectedFiles on confirm
@@ -1613,9 +1613,13 @@ function getImportPlanSummary() {
});
}
function isImportConfirmationBlocked() {
return _pendingImportInspections > 0 || getImportPlanSummary()?.jobCount === 0;
}
function syncImportConfirmationState() {
const confirmButton = document.getElementById('confirmHosterModalBtn');
if (confirmButton) confirmButton.disabled = _pendingImportInspections > 0;
if (confirmButton) confirmButton.disabled = isImportConfirmationBlocked();
}
function renderImportPlanSummary() {