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:
@@ -2608,7 +2608,7 @@ function vvToggleContainer(name) {
|
||||
vvRenderDockerFolders(vvDfData);
|
||||
}
|
||||
|
||||
function vvDockerAction(action, name, webui) {
|
||||
async function vvDockerAction(action, name, webui) {
|
||||
// Filtered again at the point of use, not only where the button was built. This value originates
|
||||
// in a container's template XML, and window.open() on a javascript: URL runs it with this page's
|
||||
// origin — the one sink where an unchecked scheme is not merely a broken link.
|
||||
@@ -2625,7 +2625,7 @@ function vvDockerAction(action, name, webui) {
|
||||
// Stopping is confirmed; starting is not. The asymmetry is the point — start is recoverable by
|
||||
// clicking the other button, stop takes a service away from whoever is using it, and these
|
||||
// buttons sit inside a dense grid where the row under the cursor is easy to misjudge.
|
||||
if (action === 'stop' && !confirm('Stop ' + name + '?')) return;
|
||||
if (action === 'stop' && !await vvConfirm('Stop ' + name + '?')) return;
|
||||
|
||||
const fd = new URLSearchParams();
|
||||
fd.set('action', action);
|
||||
|
||||
Reference in New Issue
Block a user