From 14036b7aeb608a5a23bf40fc3b0465526ccb7b36 Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Thu, 4 Feb 2021 11:45:16 +0530 Subject: [PATCH] Fixed an issue where the focus is not properly set on the filter text editor after closing the error dialog. Fixes #5809 --- docs/en_US/release_notes_5_0.rst | 1 + .../tools/datagrid/static/js/show_data.js | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/en_US/release_notes_5_0.rst b/docs/en_US/release_notes_5_0.rst index c3b120052..dc231d714 100644 --- a/docs/en_US/release_notes_5_0.rst +++ b/docs/en_US/release_notes_5_0.rst @@ -23,6 +23,7 @@ Housekeeping Bug fixes ********* +| `Issue #5809 `_ - Fixed an issue where the focus is not properly set on the filter text editor after closing the error dialog. | `Issue #5871 `_ - Ensure that username should be visible in the 'Connect to Server' popup when service and user name both specified. | `Issue #6045 `_ - Fixed autocomplete issue where it is not showing any suggestions if the schema name contains escape characters. | `Issue #6087 `_ - Fixed an issue where the dependencies tab showing multiple owners for the objects having shared dependencies. diff --git a/web/pgadmin/tools/datagrid/static/js/show_data.js b/web/pgadmin/tools/datagrid/static/js/show_data.js index 741ecad06..19d4e5f92 100644 --- a/web/pgadmin/tools/datagrid/static/js/show_data.js +++ b/web/pgadmin/tools/datagrid/static/js/show_data.js @@ -109,6 +109,7 @@ function generateFilterValidateUrl(nodeData, parentData) { function initFilterDialog(alertify, pgBrowser) { // Create filter dialog using alertify + let filter_editor = null; if (!alertify.filterDialog) { alertify.dialog('filterDialog', function factory() { return { @@ -183,7 +184,7 @@ function initFilterDialog(alertify, pgBrowser) { that.__internal.buttons[2].element.disabled = true; // Apply CodeMirror to filter text area. - this.filter_obj = CodeMirror.fromTextArea($sql_filter.get(0), { + filter_editor = this.filter_obj = CodeMirror.fromTextArea($sql_filter.get(0), { lineNumbers: true, mode: 'text/x-pgsql', extraKeys: pgBrowser.editor_shortcut_keys, @@ -235,10 +236,15 @@ function initFilterDialog(alertify, pgBrowser) { that.close(); // Close the dialog } else { - alertify.alert( - gettext('Validation Error'), - res.data.result - ); + alertify.alert() + .setting({ + 'title': gettext('Validation Error'), + 'label':gettext('Ok'), + 'message': gettext(res.data.result), + 'onok': function(){ + filter_editor.focus(); + }, + }).show(); } }) .fail(function(e) {