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:
@@ -1481,10 +1481,10 @@ function vvRpSave() {
|
||||
.catch(() => { btn.disabled = false; btn.textContent = 'Save Profile'; fb.style.color='#ef5350'; fb.textContent='Request failed'; });
|
||||
}
|
||||
|
||||
function vvRpDelete() {
|
||||
async function vvRpDelete() {
|
||||
const name = document.getElementById('vv-rp-name').value.trim();
|
||||
if (!name) return;
|
||||
if (!confirm(`Delete profile "${name}"?\n\nThis removes it from all PROFILE_* arrays in master.conf.`)) return;
|
||||
if (!await vvConfirm(`Delete profile "${name}"?\n\nThis removes it from all PROFILE_* arrays in master.conf.`)) return;
|
||||
|
||||
const fb = document.getElementById('vv-rp-fb');
|
||||
const del = document.getElementById('vv-rp-del-btn');
|
||||
|
||||
Reference in New Issue
Block a user