mirror of
https://github.com/coollabsio/coolify.git
synced 2026-08-24 02:24:11 -05:00
fix(ui): release modal scroll lock before confirmation submission
Close the confirmation modal before submitting destructive actions and reopen it when submission fails or returns an error.
This commit is contained in:
@@ -334,12 +334,15 @@
|
||||
step++;
|
||||
} else {
|
||||
submitting = true;
|
||||
submitForm().then((result) => {
|
||||
submitting = false;
|
||||
modalOpen = false;
|
||||
resetModal();
|
||||
}).catch(() => {
|
||||
submitting = false;
|
||||
modalOpen = false;
|
||||
$nextTick(() => {
|
||||
submitForm().then((result) => {
|
||||
submitting = false;
|
||||
resetModal();
|
||||
}).catch(() => {
|
||||
submitting = false;
|
||||
modalOpen = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
">
|
||||
@@ -388,17 +391,21 @@
|
||||
$wire.dispatch(dispatchEventType, dispatchEventMessage);
|
||||
}
|
||||
submitting = true;
|
||||
submitForm().then((result) => {
|
||||
submitting = false;
|
||||
if (result === true) {
|
||||
modalOpen = false;
|
||||
resetModal();
|
||||
} else {
|
||||
passwordError = result;
|
||||
password = '';
|
||||
}
|
||||
}).catch(() => {
|
||||
submitting = false;
|
||||
modalOpen = false;
|
||||
$nextTick(() => {
|
||||
submitForm().then((result) => {
|
||||
submitting = false;
|
||||
if (result === true) {
|
||||
resetModal();
|
||||
} else {
|
||||
modalOpen = true;
|
||||
passwordError = result;
|
||||
password = '';
|
||||
}
|
||||
}).catch(() => {
|
||||
submitting = false;
|
||||
modalOpen = true;
|
||||
});
|
||||
});
|
||||
">
|
||||
<x-loading-on-button x-show="submitting" x-cloak />
|
||||
|
||||
@@ -7,3 +7,11 @@ test('confirmation modal closes before dispatching an event that can open anothe
|
||||
'/if \(dispatchEvent\) \{\s*modalOpen = false;\s*\$nextTick\(\(\) => \$wire\.dispatch\(dispatchEventType, dispatchEventMessage\)\);/s'
|
||||
);
|
||||
});
|
||||
|
||||
test('confirmation modal releases its scroll lock before submitting a destructive action', function () {
|
||||
$modal = file_get_contents(resource_path('views/components/modal-confirmation.blade.php'));
|
||||
|
||||
expect($modal)
|
||||
->toMatch('/submitting = true;\s*modalOpen = false;\s*\$nextTick\(\(\) => \{\s*submitForm\(\)/s')
|
||||
->toMatch('/if \(result === true\) \{\s*resetModal\(\);/s');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user