From 57660d131f2ec6356f9d5bee2add91886d9329be Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Tue, 21 Aug 2018 13:05:40 +0530 Subject: [PATCH] 1) Fix sort/filter dialog editing issue. Fixes #3558. 2) Fix sort/filter dialog issue where it incorrectly requires ASC/DESC. Fixes #3325. --- docs/en_US/release_notes_3_3.rst | 2 ++ web/pgadmin/static/css/codemirror.overrides.css | 4 ---- web/pgadmin/static/js/backform.pgadmin.js | 4 +++- web/pgadmin/static/js/sqleditor/filter_dialog.js | 6 +++--- web/pgadmin/tools/datagrid/static/js/datagrid.js | 4 ++++ web/pgadmin/tools/sqleditor/command.py | 6 ++---- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/docs/en_US/release_notes_3_3.rst b/docs/en_US/release_notes_3_3.rst index d64bed324..b173d613a 100644 --- a/docs/en_US/release_notes_3_3.rst +++ b/docs/en_US/release_notes_3_3.rst @@ -15,7 +15,9 @@ Features Bug fixes ********* +| `Bug #3325 `_ - Fix sort/filter dialog issue where it incorrectly requires ASC/DESC. | `Bug #3407 `_ - Fix keyboard shortcuts layout in the preferences panel. | `Bug #3461 `_ - Ensure that refreshing a node also updates the Property list. | `Bug #3528 `_ - Handle connection errors properly in the query tool. +| `Bug #3558 `_ - Fix sort/filter dialog editing issue. | `Bug #3578 `_ - Ensure sql for Role should be visible in SQL panel for GPDB. diff --git a/web/pgadmin/static/css/codemirror.overrides.css b/web/pgadmin/static/css/codemirror.overrides.css index 6bffbcee0..cdfbc8623 100644 --- a/web/pgadmin/static/css/codemirror.overrides.css +++ b/web/pgadmin/static/css/codemirror.overrides.css @@ -42,10 +42,6 @@ color: #964; } -.pgadmin-controls.sql_field_layout .CodeMirror { - line-height: 22px; -} - /* Codemirror buttons */ .CodeMirror-dialog button { font-family: 'Open Sans'; diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js index 0916e2bb6..e0575cc8c 100644 --- a/web/pgadmin/static/js/backform.pgadmin.js +++ b/web/pgadmin/static/js/backform.pgadmin.js @@ -2099,7 +2099,9 @@ define([ self.sqlCtrl.setOption('lineWrapping', sqlEditPreferences.wrap_code); self.sqlCtrl.setOption('autoCloseBrackets', sqlEditPreferences.insert_pair_brackets); self.sqlCtrl.setOption('matchBrackets', sqlEditPreferences.brace_matching); - self.sqlCtrl.refresh(); + setTimeout(function() { + self.sqlCtrl.refresh(); + }, 500); } }, diff --git a/web/pgadmin/static/js/sqleditor/filter_dialog.js b/web/pgadmin/static/js/sqleditor/filter_dialog.js index 8a48c867a..48862924c 100644 --- a/web/pgadmin/static/js/sqleditor/filter_dialog.js +++ b/web/pgadmin/static/js/sqleditor/filter_dialog.js @@ -51,13 +51,13 @@ let FilterDialog = { }), }, }, { - text: gettext('Ok'), - className: 'btn btn-primary fa fa-lg fa-save pg-alertify-button', + text: gettext('OK'), + className: 'btn btn-primary pg-alertify-button', 'data-btn-name': 'ok', }, { text: gettext('Cancel'), key: 27, - className: 'btn btn-danger fa fa-lg fa-times pg-alertify-button', + className: 'btn btn-danger pg-alertify-button', 'data-btn-name': 'cancel', }], // Set options for dialog diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js index 2884db46d..28d42b1c7 100644 --- a/web/pgadmin/tools/datagrid/static/js/datagrid.js +++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js @@ -304,8 +304,12 @@ define('pgadmin.datagrid', [ matchBrackets: self.preferences.brace_matching, }); + let sql_font_size = sqlEditorUtils.calcFontSize(self.preferences.sql_font_size); + $(this.filter_obj.getWrapperElement()).css('font-size', sql_font_size); + setTimeout(function() { // Set focus on editor + that.filter_obj.refresh(); that.filter_obj.focus(); }, 500); }, diff --git a/web/pgadmin/tools/sqleditor/command.py b/web/pgadmin/tools/sqleditor/command.py index fbe37df69..aa9f3c651 100644 --- a/web/pgadmin/tools/sqleditor/command.py +++ b/web/pgadmin/tools/sqleditor/command.py @@ -425,12 +425,10 @@ class GridCommand(BaseCommand, SQLFilter, FetchedRowTracker): """ This function gets the order required for primary keys """ - if self.cmd_type in (VIEW_FIRST_100_ROWS, VIEW_ALL_ROWS): - return 'asc' - elif self.cmd_type == VIEW_LAST_100_ROWS: + if self.cmd_type == VIEW_LAST_100_ROWS: return 'desc' else: - return None + return 'asc' class TableCommand(GridCommand):