Skip to content

fix(database): close confirmation modal after import/restore actions#8688

Closed
devrim-1283 wants to merge 1 commit intocoollabsio:v4.xfrom
devrim-1283:fix/database-import-modal-not-closing
Closed

fix(database): close confirmation modal after import/restore actions#8688
devrim-1283 wants to merge 1 commit intocoollabsio:v4.xfrom
devrim-1283:fix/database-import-modal-not-closing

Conversation

@devrim-1283
Copy link

Description

The password confirmation modal stays open after successful password verification when performing database import (both file-based and S3 restore). The restore process starts correctly and the activity monitor slide-over opens, but the modal remains visible on screen, blocking user interaction.

Root Cause

The modal-confirmation component's JavaScript (submitForm()) calls the Livewire method and checks the return value:

  • true → closes the modal
  • string → displays it as a password error message
  • undefined/null → modal stays open (the bug)

Both runImport() and restoreFromS3() in Import.php had three issues:

  1. Missing $password parameter — The modal passes the user's password to the Livewire method, but neither method accepted it as a parameter
  2. No password verification — Neither method called verifyPasswordConfirmation() to validate the password, meaning any password (even incorrect ones) would trigger the action
  3. No return value — Neither method returned true on success, so the modal's JavaScript never received the signal to close

Changes

File: app/Livewire/Project/Database/Import.php

  • Added string $password = '' parameter to both runImport() and restoreFromS3()
  • Added verifyPasswordConfirmation($password, $this) check at the start of both methods, returning 'The provided password is incorrect.' on failure (displayed in modal)
  • Added bool|string return type to both methods
  • Changed all early return; statements to return true; so the modal always closes after the action is dispatched
  • Changed return handleError() to handleError(); return true; so the modal closes even on errors (errors are shown via toast notifications)

How to Test

  1. Go to a running database resource → Import Backup
  2. Select "Restore from S3" and check a valid S3 file
  3. Click "Restore from S3" button
  4. Enter confirmation text → Continue
  5. Enter your password → Confirm
  6. Expected: Modal closes, activity monitor slide-over opens on the right
  7. Before fix: Modal stays open on top of the slide-over

Same test applies for "Restore from File" flow.

Additional test cases:

  • Enter wrong password → modal should show "The provided password is incorrect." and stay open
  • Enter correct password → modal should close immediately

Screenshots / Videos

N/A — UI behavior bug, no visual changes to components.

The password confirmation modal was not closing after successful
password verification in both `runImport()` and `restoreFromS3()`
methods. This happened because:

1. Neither method accepted the `$password` parameter passed by the
   modal-confirmation component
2. Neither method verified the password via `verifyPasswordConfirmation()`
3. Neither method returned `true` on success, which the modal's
   JavaScript checks to close the dialog

Added password verification using `verifyPasswordConfirmation()` and
ensured all code paths return `bool|string` so the modal correctly
closes on success or displays an error on invalid password.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions
Copy link
Contributor

This PR did not pass quality checks so it will be closed. If you believe this is a mistake please let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant