Make the Query Tool tab titles more concise and useful. Fixes #3544

This commit is contained in:
Dave Page 2019-02-15 15:09:49 +00:00
parent 622b67684d
commit c64373435b
6 changed files with 34 additions and 22 deletions

View File

@ -17,6 +17,7 @@ Features
Bug fixes
*********
| `Bug #3544 <https://redmine.postgresql.org/issues/3544>`_ - Make the Query Tool tab titles more concise and useful.
| `Bug #3873 <https://redmine.postgresql.org/issues/3873>`_ - Fix context sub-menu alignment on Safari.
| `Bug #3906 <https://redmine.postgresql.org/issues/3906>`_ - Fix alignment of Close and Maximize button of Grant Wizard.
| `Bug #3942 <https://redmine.postgresql.org/issues/3942>`_ - Close connections gracefully when the user logs out of pgAdmin.

View File

@ -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('<span title="'+panel_title+'">'+panel_title+'</span>');
queryToolPanel.icon('fa fa-bolt');
queryToolPanel.title('<span title="'+panel_tooltip+'">'+panel_title+'</span>');
queryToolPanel.icon(panel_icon);
queryToolPanel.focus();
// Listen on the panel closed event.

View File

@ -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}`;
}

View File

@ -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}`;
}

View File

@ -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');
});
});
});

View File

@ -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',
''
);
});