From f2cc897f2fc4ddcde322267b30ff00469c357e17 Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Mon, 22 Aug 2022 14:33:38 +0530 Subject: [PATCH] 1. Fixed an issue where copy and pasting a row in the results grid doesn't set the default for boolean. Fixes #7579 2. Fixed an issue where the History tab is getting blank and showing an error after some queries are executed. Fixes #7468 3. Fixed query tool view data crash. --- docs/en_US/release_notes_6_13.rst | 2 ++ web/pgadmin/tools/sqleditor/__init__.py | 3 ++- .../js/components/sections/QueryHistory.jsx | 2 +- .../static/js/components/sections/ResultSet.jsx | 15 ++++++++++----- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/en_US/release_notes_6_13.rst b/docs/en_US/release_notes_6_13.rst index 6b31c4583..c0bad2e36 100644 --- a/docs/en_US/release_notes_6_13.rst +++ b/docs/en_US/release_notes_6_13.rst @@ -29,6 +29,7 @@ Bug fixes ********* | `Issue #7452 `_ - Ensure that an error is thrown if clipboard access is not provided and change the copy rows shortcut. + | `Issue #7468 `_ - Fixed an issue where the History tab is getting blank and showing an error after some queries are executed. | `Issue #7497 `_ - Fixed an issue with the error message being displayed at the right place for Azure deployments. | `Issue #7521 `_ - Fixed an issue where the Query Editor loses focus when saving a query (Alt+s). | `Issue #7527 `_ - Fixed API test cases for Postgres 14.4. @@ -36,6 +37,7 @@ Bug fixes | `Issue #7563 `_ - Fixed an issue where autocomplete is not working after clearing the query editor. | `Issue #7573 `_ - Ensure that autocomplete does not appear when navigating code using arrow keys. | `Issue #7575 `_ - Fixed an issue where Alt-Shift-Q didn't work after creating a new query. + | `Issue #7579 `_ - Fixed an issue where copy and pasting a row in the results grid doesn't set the default for boolean. | `Issue #7586 `_ - Fixed an issue with rendering geometry when selecting a complete column. | `Issue #7587 `_ - Ensure that the children of information_schema and pg_catalog node should be displayed. | `Issue #7591 `_ - Fixed column "none" does not exist issue, while comparing schema objects. diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py index a7a2e71c7..673d76eb2 100644 --- a/web/pgadmin/tools/sqleditor/__init__.py +++ b/web/pgadmin/tools/sqleditor/__init__.py @@ -322,7 +322,8 @@ def panel(trans_id): params['layout'] = get_setting('SQLEditor/Layout') params['macros'] = get_user_macros() params['is_desktop_mode'] = current_app.PGADMIN_RUNTIME - params['database_name'] = underscore_escape(params['database_name']) + if 'database_name' in params: + params['database_name'] = underscore_escape(params['database_name']) return render_template( "sqleditor/index.html", diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx index f8faa2dfb..b480bbd6e 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx @@ -351,7 +351,7 @@ function QueryHistoryDetails({entry}) { {gettext('Messages')} - {entry.message} + {_.isObject(entry.message) ? JSON.stringify(entry.message) : entry.message} diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx index b0d11c8fb..54476d41a 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx @@ -303,6 +303,7 @@ export class ResultSetUtils { this.eventBus.fireEvent(QUERY_TOOL_EVENTS.PUSH_NOTICE, httpMessage.data.data.notifies); } if (ResultSetUtils.isQueryFinished(httpMessage)) { + this.setEndTime(new Date()); msg = this.queryFinished(httpMessage, onResultsAvailable, onExplain); } else if (ResultSetUtils.isQueryStillRunning(httpMessage)) { this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_CONNECTION_STATUS, httpMessage.data.data.transaction_status); @@ -311,13 +312,17 @@ export class ResultSetUtils { } return Promise.resolve(this.pollForResult(onResultsAvailable, onExplain, onPollError)); } else if (ResultSetUtils.isConnectionToServerLostWhilePolling(httpMessage)) { + this.setEndTime(new Date()); msg = httpMessage.data.data.result; this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, msg, true); this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END); + this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Connection Error'), this.endTime); } else if (ResultSetUtils.isQueryCancelled(httpMessage)) { - msg = httpMessage.data.data.result || 'Execution Cancelled!'; - this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, httpMessage.data.data.result || 'Execution Cancelled!', true); + this.setEndTime(new Date()); + msg = httpMessage.data.data.result || gettext('Execution Cancelled!'); + this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_MESSAGE, httpMessage.data.data.result || gettext('Execution Cancelled!'), true); this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END); + this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Execution Cancelled'), this.endTime); } if(this.qtPref?.query_success_notification) { Notifier.success(msg); @@ -567,6 +572,8 @@ export class ResultSetUtils { columnVal = true; } else if(columnVal == 'false') { columnVal = false; + } else if(col.has_default_val) { + columnVal = undefined; } else { columnVal = null; } @@ -619,11 +626,9 @@ export class ResultSetUtils { } queryFinished(httpMessage, onResultsAvailable, onExplain) { - let endTime = new Date(); this.eventBus.fireEvent(QUERY_TOOL_EVENTS.EXECUTION_END, true); this.eventBus.fireEvent(QUERY_TOOL_EVENTS.SET_CONNECTION_STATUS, httpMessage.data.data.transaction_status); - this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Query complete'), endTime); - this.setEndTime(endTime); + this.eventBus.fireEvent(QUERY_TOOL_EVENTS.TASK_END, gettext('Query complete'), this.endTime); let retMsg, tabMsg; retMsg = tabMsg = gettext('Query returned successfully in %s.', this.queryRunTime());