Ask with Unraid's own dialog, not the browser's

Every confirm() and prompt() in the plugin could be switched off from inside itself — one tick of
"prevent this page from creating additional dialogs" and all 32 of them returned false while
drawing nothing, across every tab, until a full reload. swal is already global on every webGUI
page and core uses it 370 times without a single confirm(), so this costs no new dependency.

vvConfirmRun() is the one that mattered: it returned a boolean to three callers testing !it, and
an unawaited promise is always truthy, so leaving those alone would have run every job without
asking. The wrapper's callback is a classic function expression on purpose — SweetAlert only
calls back on cancel when the callback's own source declares a parameter, and an arrow would
have hung the promise forever.
This commit is contained in:
Gmer4Lfe
2026-08-09 21:44:43 -04:00
parent 5b48561f36
commit 7d865b0a09
8 changed files with 144 additions and 68 deletions
+2 -2
View File
@@ -300,7 +300,7 @@ function _vvStorRender(d) {
}
}
function vvStorMigrate() {
async function vvStorMigrate() {
const btn = document.getElementById('vv-stor-migrate-btn');
const out = document.getElementById('vv-stor-out');
const fb = document.getElementById('vv-stor-fb');
@@ -315,7 +315,7 @@ function vvStorMigrate() {
}
const label = to === 'flash' ? 'Flash (appdata)' : 'Internal (/boot)';
if (!confirm(`Migrate Varaverk storage to ${label}?\n\nThis will:\n• Copy all scripts, conf, and git repo to the new location\n• Update varaverk.cfg and master.conf\n• Delete the old location\n\nThe page will need a reload after migration.`)) return;
if (!await vvConfirm(`Migrate Varaverk storage to ${label}?\n\nThis will:\n• Copy all scripts, conf, and git repo to the new location\n• Update varaverk.cfg and master.conf\n• Delete the old location\n\nThe page will need a reload after migration.`)) return;
btn.disabled = true;
btn.textContent = 'Migrating…';