From 191e2b624243651cd1e1cdec7719ef82993095c8 Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Tue, 28 Dec 2021 13:49:04 +0530 Subject: [PATCH] Fixed an issue where an operation error message pop up showing the database object's name incorrectly. Fixes #7078 --- docs/en_US/release_notes_6_4.rst | 1 + .../server_groups/servers/databases/static/js/database.js | 4 ++-- web/pgadmin/browser/static/js/error.js | 2 +- web/pgadmin/browser/static/js/node.js | 2 +- web/pgadmin/static/js/helpers/Notifier.jsx | 1 + web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 8 ++++---- 6 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/en_US/release_notes_6_4.rst b/docs/en_US/release_notes_6_4.rst index 992c0ff7d..e2d17093f 100644 --- a/docs/en_US/release_notes_6_4.rst +++ b/docs/en_US/release_notes_6_4.rst @@ -22,3 +22,4 @@ Bug fixes | `Issue #7003 `_ - Fixed an issue where Explain Analyze shows negative exclusive time. | `Issue #7034 `_ - Fixed an issue where Columns with default value not showing when adding a new row. | `Issue #7077 `_ - Fixed an issue where the Owner is not displayed in the reverse engineering SQL for Procedures. +| `Issue #7078 `_ - Fixed an issue where an operation error message pop up showing the database object's name incorrectly. diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js index b035994f7..1c48f355b 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js +++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js @@ -233,7 +233,7 @@ define('pgadmin.node.database', [ if(res.data.info_prefix) { res.info = `${_.escape(res.data.info_prefix)} - ${res.info}`; } - Notify.success(res.info); + Notify.success(_.unescape(res.info)); t.removeIcon(i); data.connected = false; data.icon = 'icon-database-not-connected'; @@ -467,7 +467,7 @@ define('pgadmin.node.database', [ res.info = gettext('Database already connected.'); } if(res.data.info_prefix) { - res.info = `${_.escape(res.data.info_prefix)} - ${res.info}`; + res.info = `${res.data.info_prefix} - ${res.info}`; } if(res.data.already_connected) { Notify.info(res.info); diff --git a/web/pgadmin/browser/static/js/error.js b/web/pgadmin/browser/static/js/error.js index 57e33fb43..db16d5083 100644 --- a/web/pgadmin/browser/static/js/error.js +++ b/web/pgadmin/browser/static/js/error.js @@ -47,7 +47,7 @@ define( text += ''; Notify.alert( - title, + _.unescape(title), text ) .set({'closable': true, diff --git a/web/pgadmin/browser/static/js/node.js b/web/pgadmin/browser/static/js/node.js index e801aebdf..5aa39fec1 100644 --- a/web/pgadmin/browser/static/js/node.js +++ b/web/pgadmin/browser/static/js/node.js @@ -862,7 +862,7 @@ define('pgadmin.browser.node', [ * Make sure - we're using the correct version of node */ obj = pgBrowser.Nodes[d._type]; - var objName = d.label; + var objName = _.unescape(d.label); var msg, title; diff --git a/web/pgadmin/static/js/helpers/Notifier.jsx b/web/pgadmin/static/js/helpers/Notifier.jsx index ef05eff0f..cf18d9d56 100644 --- a/web/pgadmin/static/js/helpers/Notifier.jsx +++ b/web/pgadmin/static/js/helpers/Notifier.jsx @@ -14,6 +14,7 @@ import Theme from 'sources/Theme'; import { NotifierMessage, MESSAGE_TYPE } from '../components/FormComponents'; import CustomPropTypes from '../custom_prop_types'; import gettext from 'sources/gettext'; +import _ from 'lodash'; import pgWindow from 'sources/window'; import ModalProvider, { useModal } from './ModalProvider'; import { DefaultButton, PrimaryButton } from '../components/Buttons'; diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index a0f12d53c..0f3a7df7d 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -111,7 +111,7 @@ define('tools.querytool', [ this.set_server_version(opts.server_ver); this.trigger('pgadmin-sqleditor:view:initialised'); this.connection_list = [ - {'server_group': null,'server': null, 'database': null, 'user': null, 'role': null, 'conn_title': '<' + gettext('New Connection') + '>'}, + {'server_group': null,'server': null, 'database': null, 'user': null, 'role': null, 'conn_title': '<' + gettext('New Connection') + '>'}, ]; }, @@ -185,9 +185,9 @@ define('tools.querytool', [ data_list.forEach((option, index) => { var opt = ''; if ('is_selected' in option && option['is_selected']) { - opt = '
  • '+ option.conn_title +'
  • '; + opt = '
  • '+ _.escape(option.conn_title) +'
  • '; } else { - opt = '
  • '+ option.conn_title +'
  • '; + opt = '
  • '+ _.escape(option.conn_title) +'
  • '; } $('#connections-list').append(opt); }); @@ -3848,7 +3848,7 @@ define('tools.querytool', [ var self = this; var open_new_tab = self.browser_preferences.new_browser_tab_open; if(open_new_tab && open_new_tab.includes('qt')) { - window.document.title = title; + window.document.title = _.escape(title); } else { _.each(pgWindow.default.pgAdmin.Browser.docker.findPanels('frm_datagrid'), function(p) { if (p.isVisible()) {