From 703478c13dd88fa3bb847e2da3fbe4a455f628b0 Mon Sep 17 00:00:00 2001 From: Nikhil Mohite Date: Fri, 6 Aug 2021 19:09:39 +0530 Subject: [PATCH] Fixed an issue where the titles in query tabs are different. Fixes #6618 --- docs/en_US/release_notes_5_6.rst | 1 + .../tools/datagrid/static/js/datagrid_panel_title.js | 7 +++++-- web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/en_US/release_notes_5_6.rst b/docs/en_US/release_notes_5_6.rst index efdc61c71..b6f1689d6 100644 --- a/docs/en_US/release_notes_5_6.rst +++ b/docs/en_US/release_notes_5_6.rst @@ -25,6 +25,7 @@ Bug fixes | `Issue #6574 `_ - Fixed an issue where paste is not working through Right-Click option on PSQL. | `Issue #6580 `_ - Fixed TypeError 'NoneType' object is not sub scriptable. | `Issue #6586 `_ - Fixed incorrect tablespace options in the drop-down for move objects dialog. +| `Issue #6618 `_ - Fixed an issue where the titles in query tabs are different. | `Issue #6619 `_ - Fixed incorrect binary path issue when the user deletes the binary path from the preferences. | `Issue #6643 `_ - Ensure that all the required options should be loaded when the Range data type is selected while creating a custom data type. | `Issue #6650 `_ - Fixed dashboard server activity issue when active_since parameter is None. diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js b/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js index d2ebf5929..368da487c 100644 --- a/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js +++ b/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js @@ -23,7 +23,7 @@ function isServerInformationAvailable(parentData) { return parentData.server === undefined; } -export function getPanelTitle(pgBrowser, selected_item=null, custom_title=null, parentData=null, conn_title=false) { +export function getPanelTitle(pgBrowser, selected_item=null, custom_title=null, parentData=null, conn_title=false, db_label=null) { var preferences = pgBrowser.get_preferences_for_module('browser'); if(selected_item == null && parentData == null) { selected_item = pgBrowser.treeMenu.selected(); @@ -36,7 +36,10 @@ export function getPanelTitle(pgBrowser, selected_item=null, custom_title=null, } } - const db_label = getDatabaseLabel(parentData); + if(!db_label) { + db_label = getDatabaseLabel(parentData); + } + var qt_title_placeholder = ''; if (!conn_title) { if (custom_title) { diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 40c269d14..84fdafbb3 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -2711,7 +2711,10 @@ define('tools.querytool', [ var server_data = pgWindow.default.pgAdmin.Browser.treeMenu.findNode(tree_data.slice(0,2)); var database_data = pgWindow.default.pgAdmin.Browser.treeMenu.findNode(tree_data.slice(0,4)); - let conn_title = panelTitleFunc.getPanelTitle(pgWindow.default.pgAdmin.Browser, null, null, null, true); + var dbData = tree_data.slice(0,3); + dbData.push('database/' + url_params.did); + var dbName = pgWindow.default.pgAdmin.Browser.treeMenu.findNode(dbData).data.label; + let conn_title = panelTitleFunc.getPanelTitle(pgWindow.default.pgAdmin.Browser, null, null, null, true, dbName); self.gridView.set_editor_title(_.unescape(conn_title)); let connection_data = { 'server_group': self.gridView.handler.url_params.sgid,