From 488dc1849d6a76785a61593a3c60eeef9b44bc09 Mon Sep 17 00:00:00 2001 From: Rahul Shirsat Date: Thu, 29 Apr 2021 13:13:52 +0530 Subject: [PATCH] Fixed an issue where data is displayed in the wrong order when executing the query repeatedly. Fixes #5555 --- docs/en_US/release_notes_5_3.rst | 1 + web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/en_US/release_notes_5_3.rst b/docs/en_US/release_notes_5_3.rst index 45fdf72de..9bf431010 100644 --- a/docs/en_US/release_notes_5_3.rst +++ b/docs/en_US/release_notes_5_3.rst @@ -17,6 +17,7 @@ Housekeeping Bug fixes ********* +| `Issue #5555 `_ - Fixed an issue where data is displayed in the wrong order when executing the query repeatedly. | `Issue #6329 `_ - Fixed an issue where the wrong SQL is showing for the child partition tables. | `Issue #6341 `_ - Fixed an issue where CSV download quotes the numeric columns. | `Issue #6355 `_ - Ensure that pgAdmin should not allow opening external files that are dragged into it. diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 28d989f47..d44d4ea47 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -1427,7 +1427,9 @@ define('tools.querytool', [ }) .done(function(res) { self.handler.has_more_rows = res.data.has_more_rows; - $('#btn-flash').prop('disabled', false); + setTimeout(() => { + $('#btn-flash').prop('disabled', false); + }, 700); $('#btn-save-results-to-file').prop('disabled', false); self.handler.trigger('pgadmin-sqleditor:loading-icon:hide'); self.update_grid_data(res.data.result); @@ -1823,6 +1825,7 @@ define('tools.querytool', [ // Callback function for the flash button click. on_flash: function() { + $('#btn-flash').prop('disabled', true); let data_click_counter = $('#btn-flash').attr('data-click-counter'); data_click_counter = (parseInt(data_click_counter) + 1)%10; $('#btn-flash').attr('data-click-counter', data_click_counter); @@ -3109,7 +3112,8 @@ define('tools.querytool', [ // Hide the loading icon self_col.trigger('pgadmin-sqleditor:loading-icon:hide'); - $('#btn-flash').prop('disabled', false); + + // Enable/Disable download button based on query result if (!_.isUndefined(data) && Array.isArray(data.result) && data.result.length > 0) { self.enable_disable_download_btn(false); } @@ -3295,7 +3299,10 @@ define('tools.querytool', [ } if (status != 'Busy') { - $('#btn-flash').prop('disabled', false); + setTimeout(() => { + $('#btn-flash').prop('disabled', false); + }, 400); + self.trigger('pgadmin-sqleditor:loading-icon:hide'); if(!self.total_time) {