Fix #19761 - Show loading message when copying table#20311
Open
roadhero wants to merge 1 commit into
Open
Conversation
Add ajaxShowMessage call before the $.post in the #copyTable AJAX submit handler, mirroring the pattern used by the copy-database operation. Also adds the strCopyingTable JS message key. Fixes phpmyadmin#19761 Signed-off-by: Dennis Vorobyov <roadhero@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The "Copy table to" form on the Table → Operations page submits its AJAX request silently — no visual feedback while the copy is in progress. Every comparable operation on the same page (Move table, Drop table, Truncate table, etc.) already shows a loading notification via
Functions.ajaxShowMessage. The copy-table handler was the only one missing this call.What this changes
resources/js/table/operations.ts— adds a singleajaxShowMessage(window.Messages.strCopyingTable, false)call inside the#copyTable.ajaxsubmit handler, immediately before the$.post(...)invocation. The second argumentfalsemakes the notification persist (no auto-dismiss) until it is replaced by the success or error message that the existing response handlers display.src/Controllers/JavaScriptMessagesController.php— adds thestrCopyingTablemessage key ('strCopyingTable' => __('Copying table')) under a new/* For table/operations.js */comment block, placed adjacent to the existing/* For database/operations.js */block for discoverability.The pattern mirrors the equivalent copy-database operation in
resources/js/database/operations.ts, which usesajaxShowMessage(window.Messages.strCopyingDatabase, false)immediately before its own$.post(...)call. No new UI pattern is introduced.Behaviour after the fix
ajaxShowMessage(data.message)call replaces the loading notification with the server's success message.ajaxShowMessage(data.error, false)call replaces it with the error message.ajaxShowMessageremoves any priorspan.ajax_notification[id^=ajax_message_num]element before rendering the new one (seeresources/js/modules/ajax-message.ts), so no notification stacking occurs.How this was tested
Manual reproduction in a Docker dev environment against MariaDB:
Static analysis:
composer run phpstanandcomposer run psalmpass against the changed files. Existing PHPUnit and Selenium suites unaffected by the change.No new automated test was added. The change is a one-line addition to an existing AJAX handler, mirroring an established precedent, and is exercised by the existing end-to-end coverage in
tests/end-to-end/Table/OperationsTest.php. If a regression test is expected for this kind of change, please advise on the preferred location (PHPUnit unit, Jest, or Selenium) and I will add it.Out of scope
moveTableFormsubmit handler on the same Operations page has the identical missing-spinner gap. This PR scopes to#copyTableonly, per issue [Bug]: No load mask when copying table #19761. Happy to track the Move-table parity as a follow-up issue if that's preferred.resources/po/phpmyadmin.potis not updated in this commit. The project regenerates the.potvia its CI/release tooling rather than per-PR, so"Copying table"will be picked up on the next regen cycle.Fixes #19761.
Before submitting pull request, please review the following checklist:
Signed-off-byline as described in our [DCO](https://github.com/phpmyadmin/phpmyadmin/blob/master/DCO). This ensures that the work you're submitting is your own creation.