From 5839e7cda87b0b40d188e71c199308f501e69a19 Mon Sep 17 00:00:00 2001 From: Murtuza Zabuawala Date: Thu, 12 Nov 2020 18:08:40 +0530 Subject: [PATCH] =?UTF-8?q?Added=C2=A0validation=20in=20schema=20diff=20wh?= =?UTF-8?q?ich=20will=20not=20allow=20the=20user=20to=20compare=20the=20sa?= =?UTF-8?q?me=20objects.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/schema_diff/static/js/schema_diff_ui.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 6d06f438f..1f499e5cd 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 @@ -156,6 +156,20 @@ export default class SchemaDiffUI { return false; } + // Check if user has selected the same options for comparison on the GUI + let opts = [['source_sid', 'target_sid'], ['source_did', 'target_did'], ['source_scid', 'target_scid']]; + let isSameOptsSelected = true; + for (let opt of opts) { + if (url_params[opt[0]] && url_params[opt[1]] && + (parseInt(url_params[opt[0]]) !== parseInt(url_params[opt[1]]))) { + isSameOptsSelected = false; + } + } + if (isSameOptsSelected) { + Alertify.alert(gettext('Selection Error'), gettext('Please select the different source and target.')); + return false; + } + this.selection = JSON.parse(JSON.stringify(url_params)); url_params['trans_id'] = self.trans_id;