diff --git a/docs/en_US/release_notes_4_3.rst b/docs/en_US/release_notes_4_3.rst index 158407fd7..1117b7144 100644 --- a/docs/en_US/release_notes_4_3.rst +++ b/docs/en_US/release_notes_4_3.rst @@ -17,6 +17,7 @@ Features Bug fixes ********* +| `Bug #3544 `_ - Make the Query Tool tab titles more concise and useful. | `Bug #3873 `_ - Fix context sub-menu alignment on Safari. | `Bug #3906 `_ - Fix alignment of Close and Maximize button of Grant Wizard. | `Bug #3942 `_ - Close connections gracefully when the user logs out of pgAdmin. diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js index df16d0bb9..0a795faba 100644 --- a/web/pgadmin/tools/datagrid/static/js/datagrid.js +++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js @@ -457,8 +457,31 @@ define('pgadmin.datagrid', [ var self = this, panel_title = trans_obj.panel_title, grid_title = self.get_panel_title(), + panel_icon = '', + panel_tooltip = ''; + + if (trans_obj.is_query_tool == 'false') { + // Edit grid titles + grid_title = panel_title + '/' + grid_title; + panel_tooltip = gettext('View/Edit Data - ') + grid_title; + panel_title = grid_title; + panel_icon = 'fa fa-table'; + } else { + if (panel_title) { + // Script titles + panel_tooltip = panel_title.toUpperCase() + ' ' + gettext('Script - ') + grid_title; + panel_title = grid_title; + panel_icon = 'fa fa-file-text-o'; + } else { + // Query tool titles + panel_tooltip = gettext('Query Tool - ') + grid_title; + panel_title = grid_title; + panel_icon = 'fa fa-bolt'; + } + } + // Open the panel if frame is initialized - url_params = { + var url_params = { 'trans_id': trans_obj.gridTransId, 'is_query_tool': trans_obj.is_query_tool, 'editor_title': encodeURIComponent(grid_title), @@ -466,18 +489,6 @@ define('pgadmin.datagrid', [ baseUrl = url_for('datagrid.panel', url_params) + '?' + 'query_url=' + encodeURI(trans_obj.sURL) + '&server_type=' + encodeURIComponent(trans_obj.server_type); - if(trans_obj.is_query_tool == 'false') { - panel_title = gettext('Edit Data - ') + grid_title; - } else { - // Create title for CREATE/DELETE scripts - if (panel_title) { - panel_title = - sqlEditorUtils.capitalizeFirstLetter(panel_title) + ' script'; - } else { - panel_title = gettext('Query - ') + grid_title; - } - } - if (self.preferences.new_browser_tab) { var newWin = window.open(baseUrl, '_blank'); @@ -500,8 +511,8 @@ define('pgadmin.datagrid', [ var queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid', wcDocker.DOCK.STACKED, propertiesPanel[0]); // Set panel title and icon - queryToolPanel.title(''+panel_title+''); - queryToolPanel.icon('fa fa-bolt'); + queryToolPanel.title(''+panel_title+''); + queryToolPanel.icon(panel_icon); queryToolPanel.focus(); // Listen on the panel closed event. diff --git a/web/pgadmin/tools/datagrid/static/js/get_panel_title.js b/web/pgadmin/tools/datagrid/static/js/get_panel_title.js index 0a26d7e77..635e3d82d 100644 --- a/web/pgadmin/tools/datagrid/static/js/get_panel_title.js +++ b/web/pgadmin/tools/datagrid/static/js/get_panel_title.js @@ -29,5 +29,5 @@ export function getPanelTitle(pgBrowser) { const db_label = getDatabaseLabel(parentData); - return `${db_label} on ${parentData.server.user.name}@${parentData.server.label}`; + return `${db_label}/${parentData.server.user.name}@${parentData.server.label}`; } diff --git a/web/pgadmin/tools/datagrid/static/js/show_data.js b/web/pgadmin/tools/datagrid/static/js/show_data.js index 00ee70b37..33f0db1f0 100644 --- a/web/pgadmin/tools/datagrid/static/js/show_data.js +++ b/web/pgadmin/tools/datagrid/static/js/show_data.js @@ -88,5 +88,5 @@ function hasSchemaOrCatalogOrViewInformation(parentData) { } function generateDatagridTitle(parentData, namespaceName, nodeData) { - return `${parentData.server.label} - ${parentData.database.label} - ${namespaceName}.${nodeData.label}`; + return `${namespaceName}.${nodeData.label}`; } diff --git a/web/regression/javascript/datagrid/get_panel_title_spec.js b/web/regression/javascript/datagrid/get_panel_title_spec.js index 24e37584c..8c146bc96 100644 --- a/web/regression/javascript/datagrid/get_panel_title_spec.js +++ b/web/regression/javascript/datagrid/get_panel_title_spec.js @@ -54,7 +54,7 @@ describe('#getPanelTitle', () => { tree.selectNode([{id: 'level1'}]); expect(getPanelTitle(pgBrowser)) - .toBe('other db label on some user name@server label'); + .toBe('other db label/some user name@server label'); }); }); @@ -75,7 +75,7 @@ describe('#getPanelTitle', () => { new TreeNode('level1.1.1', {_type: 'table'})); tree.selectNode([{id: 'level1.1.1'}]); expect(getPanelTitle(pgBrowser)) - .toBe('db label on some user name@server label'); + .toBe('db label/some user name@server label'); }); }); }); diff --git a/web/regression/javascript/datagrid/show_data_spec.js b/web/regression/javascript/datagrid/show_data_spec.js index 716fe0746..c5c012562 100644 --- a/web/regression/javascript/datagrid/show_data_spec.js +++ b/web/regression/javascript/datagrid/show_data_spec.js @@ -133,7 +133,7 @@ describe('#show_data', () => { 'false', 'pg', '', - 'server1 - database1 - schema1.schema1', + 'schema1.schema1', '' ); }); @@ -148,7 +148,7 @@ describe('#show_data', () => { 'false', 'pg', '', - 'server1 - database1 - view1.view1', + 'view1.view1', '' ); }); @@ -163,7 +163,7 @@ describe('#show_data', () => { 'false', 'pg', '', - 'server1 - database1 - catalog1.catalog1', + 'catalog1.catalog1', '' ); });