From 26cdda090ef501c5f56095073cb55ec028086cb8 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Wed, 5 Feb 2020 14:36:05 +0530 Subject: [PATCH] 1) Source/Target database and schema should be selected by default when the user selects any server in the schema diff tool. 2) Added line break for the generated script if select multiple objects. 3) Remove reactivated RM from the release notes. --- docs/en_US/release_notes_4_18.rst | 1 - web/pgadmin/tools/schema_diff/__init__.py | 6 +- .../schema_diff/static/js/schema_diff_ui.js | 56 +++++++++++++++++-- 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/docs/en_US/release_notes_4_18.rst b/docs/en_US/release_notes_4_18.rst index 7e396be3e..0a9e0e7de 100644 --- a/docs/en_US/release_notes_4_18.rst +++ b/docs/en_US/release_notes_4_18.rst @@ -40,5 +40,4 @@ Bug fixes | `Issue #5066 `_ - Fix an issue where refreshing a package results in the change in the object completely. | `Issue #5074 `_ - Fix an issue where select, insert and update scripts on tables throwing an error. | `Issue #5076 `_ - Ensure Postfix starts in the container, now it runs as non-root by default. -| `Issue #5107 `_ - Set proper focus on tab navigation for file manager dialog. | `Issue #5116 `_ - Fixed an issue where Save Password controlĀ disappears after clicking on it while creating a server. \ No newline at end of file diff --git a/web/pgadmin/tools/schema_diff/__init__.py b/web/pgadmin/tools/schema_diff/__init__.py index c71b33297..a8ca5749c 100644 --- a/web/pgadmin/tools/schema_diff/__init__.py +++ b/web/pgadmin/tools/schema_diff/__init__.py @@ -555,7 +555,7 @@ def generate_script(trans_id): comp_status=comp_status, generate_script=True) - diff_ddl += sql['diff_ddl'] + diff_ddl += sql['diff_ddl'] + '\n\n' return ajax_response( status=200, @@ -585,10 +585,6 @@ def ddl_compare(trans_id, source_sid, source_did, source_scid, if error_msg == gettext('Transaction ID not found in the session.'): return make_json_response(success=0, errormsg=error_msg, status=404) - source_ddl = '' - target_ddl = '' - diff_ddl = '' - view = SchemaDiffRegistry.get_node_view(node_type) if view and hasattr(view, 'ddl_compare'): sql = view.ddl_compare(source_sid=source_sid, source_did=source_did, diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js index 71840403b..6ccc34d6d 100644 --- a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js +++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js @@ -600,8 +600,20 @@ export default class SchemaDiffUI { placeholder: gettext('Select database...'), }, disabled: function(m) { - if (!_.isUndefined(m.get('source_sid')) && !_.isNull(m.get('source_sid'))) + let self = this; + if (!_.isUndefined(m.get('source_sid')) && !_.isNull(m.get('source_sid')) + && m.get('source_sid') !== '') { + setTimeout(function() { + if (self.options.length > 0) { + m.set('source_did', self.options[0].value); + } + }, 10); return false; + } + + setTimeout(function() { + m.set('source_did', undefined); + }, 10); return true; }, connect: function() { @@ -622,8 +634,20 @@ export default class SchemaDiffUI { placeholder: gettext('Select schema...'), }, disabled: function(m) { - if (!_.isUndefined(m.get('source_did')) && !_.isNull(m.get('source_did'))) + let self = this; + if (!_.isUndefined(m.get('source_did')) && !_.isNull(m.get('source_did')) + && m.get('source_did') !== '') { + setTimeout(function() { + if (self.options.length > 0) { + m.set('source_scid', self.options[0].value); + } + }, 10); return false; + } + + setTimeout(function() { + m.set('source_scid', undefined); + }, 10); return true; }, }, { @@ -656,8 +680,20 @@ export default class SchemaDiffUI { placeholder: gettext('Select database...'), }, disabled: function(m) { - if (!_.isUndefined(m.get('target_sid')) && !_.isNull(m.get('target_sid'))) + let self = this; + if (!_.isUndefined(m.get('target_sid')) && !_.isNull(m.get('target_sid')) + && m.get('target_sid') !== '') { + setTimeout(function() { + if (self.options.length > 0) { + m.set('target_did', self.options[0].value); + } + }, 10); return false; + } + + setTimeout(function() { + m.set('target_did', undefined); + }, 10); return true; }, connect: function() { @@ -678,8 +714,20 @@ export default class SchemaDiffUI { placeholder: gettext('Select schema...'), }, disabled: function(m) { - if (!_.isUndefined(m.get('target_did')) && !_.isNull(m.get('target_did'))) + let self = this; + if (!_.isUndefined(m.get('target_did')) && !_.isNull(m.get('target_did')) + && m.get('target_did') !== '') { + setTimeout(function() { + if (self.options.length > 0) { + m.set('target_scid', self.options[0].value); + } + }, 10); return false; + } + + setTimeout(function() { + m.set('target_scid', undefined); + }, 10); return true; }, }],