Ensure that dirty indicator (*) should not be visible when renaming the tabs. Fixes #5991

pull/37/head
Nikhil Mohite 2020-12-01 11:28:10 +05:30 committed by Akshay Joshi
parent fb51ef569e
commit abd0748a77
6 changed files with 25 additions and 4 deletions

View File

@ -25,4 +25,5 @@ Bug fixes
| `Issue #5978 <https://redmine.postgresql.org/issues/5978>`_ - Fixed an issue where dynamic tab title has not applied the first time for debugger panel. | `Issue #5978 <https://redmine.postgresql.org/issues/5978>`_ - Fixed an issue where dynamic tab title has not applied the first time for debugger panel.
| `Issue #5983 <https://redmine.postgresql.org/issues/5983>`_ - Added the appropriate server icon based on the server type in the new connection dialog. | `Issue #5983 <https://redmine.postgresql.org/issues/5983>`_ - Added the appropriate server icon based on the server type in the new connection dialog.
| `Issue #5985 <https://redmine.postgresql.org/issues/5985>`_ - Fixed an issue where the process watcher dialog throws an error for the database server which is already removed. | `Issue #5985 <https://redmine.postgresql.org/issues/5985>`_ - Fixed an issue where the process watcher dialog throws an error for the database server which is already removed.
| `Issue #5991 <https://redmine.postgresql.org/issues/5991>`_ - Ensure that dirty indicator (*) should not be visible when renaming the tabs.
| `Issue #5992 <https://redmine.postgresql.org/issues/5992>`_ - Fixed an issue where escape character is shown when the server/database name has some special characters. | `Issue #5992 <https://redmine.postgresql.org/issues/5992>`_ - Fixed an issue where escape character is shown when the server/database name has some special characters.

View File

@ -265,11 +265,15 @@ define('pgadmin.datagrid', [
// Listen on the panelRename event. // Listen on the panelRename event.
queryToolPanel.on(wcDocker.EVENT.RENAME, function(panel_data) { queryToolPanel.on(wcDocker.EVENT.RENAME, function(panel_data) {
alertify.prompt('', panel_data.$titleText[0].textContent, var temp_title = panel_data.$titleText[0].textContent;
var is_dirty_editor = queryToolPanel.is_dirty_editor ? queryToolPanel.is_dirty_editor : false;
var title = queryToolPanel.is_dirty_editor ? panel_data.$titleText[0].textContent.replace(/.$/, '') : temp_title;
alertify.prompt('', title,
// We will execute this function when user clicks on the OK button // We will execute this function when user clicks on the OK button
function(evt, value) { function(evt, value) {
// Remove the leading and trailing white spaces.
value = value.trim();
if(value) { if(value) {
var is_file = false; var is_file = false;
if(panel_data.$titleText[0].innerHTML.includes('File - ')) { if(panel_data.$titleText[0].innerHTML.includes('File - ')) {
is_file = true; is_file = true;
@ -283,6 +287,9 @@ define('pgadmin.datagrid', [
panel_titles = showData.generateDatagridTitle(pgBrowser, selected_item, value); panel_titles = showData.generateDatagridTitle(pgBrowser, selected_item, value);
} }
// Set title to the selected tab. // Set title to the selected tab.
if (is_dirty_editor) {
panel_titles = panel_titles + ' *';
}
panelTitleFunc.setQueryToolDockerTitle(queryToolPanel, is_query_tool, _.unescape(panel_titles), is_file); panelTitleFunc.setQueryToolDockerTitle(queryToolPanel, is_query_tool, _.unescape(panel_titles), is_file);
} }
}, },

View File

@ -451,6 +451,8 @@ define([
// We will execute this function when user clicks on the OK button // We will execute this function when user clicks on the OK button
function(evt, value) { function(evt, value) {
if(value) { if(value) {
// Remove the leading and trailing white spaces.
value = value.trim();
let browser_preferences = pgBrowser.get_preferences_for_module('browser'); let browser_preferences = pgBrowser.get_preferences_for_module('browser');
var label = treeInfo.function ? treeInfo.function.label : treeInfo.procedure.label; var label = treeInfo.function ? treeInfo.function.label : treeInfo.procedure.label;
debuggerUtils.setDebuggerTitle(panel, browser_preferences, label, treeInfo.schema.label, treeInfo.database.label, value, pgBrowser); debuggerUtils.setDebuggerTitle(panel, browser_preferences, label, treeInfo.schema.label, treeInfo.database.label, value, pgBrowser);
@ -593,6 +595,8 @@ define([
// We will execute this function when user clicks on the OK button // We will execute this function when user clicks on the OK button
function(evt, value) { function(evt, value) {
if(value) { if(value) {
// Remove the leading and trailing white spaces.
value = value.trim();
let browser_preferences = pgBrowser.get_preferences_for_module('browser'); let browser_preferences = pgBrowser.get_preferences_for_module('browser');
var label = treeInfo.function ? treeInfo.function.label : treeInfo.procedure.label; var label = treeInfo.function ? treeInfo.function.label : treeInfo.procedure.label;
debuggerUtils.setDebuggerTitle(panel, browser_preferences, label, treeInfo.schema.label, treeInfo.database.label, value, pgBrowser); debuggerUtils.setDebuggerTitle(panel, browser_preferences, label, treeInfo.schema.label, treeInfo.database.label, value, pgBrowser);

View File

@ -799,6 +799,8 @@ define([
// We will execute this function when user clicks on the OK button // We will execute this function when user clicks on the OK button
function(evt, value) { function(evt, value) {
if(value) { if(value) {
// Remove the leading and trailing white spaces.
value = value.trim();
var label = treeInfo.function ? treeInfo.function.label : treeInfo.procedure.label; var label = treeInfo.function ? treeInfo.function.label : treeInfo.procedure.label;
debuggerUtils.setDebuggerTitle(panel, self.preferences, label, treeInfo.schema.label, treeInfo.database.label, value, pgBrowser); debuggerUtils.setDebuggerTitle(panel, self.preferences, label, treeInfo.schema.label, treeInfo.database.label, value, pgBrowser);
} }

View File

@ -121,6 +121,8 @@ define('pgadmin.schemadiff', [
// We will execute this function when user clicks on the OK button // We will execute this function when user clicks on the OK button
function(evt, value) { function(evt, value) {
if(value) { if(value) {
// Remove the leading and trailing white spaces.
value = value.trim();
schemaDiffPanel.title('<span>'+ _.escape(value) +'</span>'); schemaDiffPanel.title('<span>'+ _.escape(value) +'</span>');
} }
}, },

View File

@ -3692,7 +3692,7 @@ define('tools.querytool', [
}, },
// Set panel title. // Set panel title.
setTitle: function(title, is_file) { setTitle: function(title, is_file, is_dirty_editor=false) {
var self = this; var self = this;
var open_new_tab = self.browser_preferences.new_browser_tab_open; var open_new_tab = self.browser_preferences.new_browser_tab_open;
if(open_new_tab && open_new_tab.includes('qt')) { if(open_new_tab && open_new_tab.includes('qt')) {
@ -3700,6 +3700,9 @@ define('tools.querytool', [
} else { } else {
_.each(pgWindow.default.pgAdmin.Browser.docker.findPanels('frm_datagrid'), function(p) { _.each(pgWindow.default.pgAdmin.Browser.docker.findPanels('frm_datagrid'), function(p) {
if (p.isVisible()) { if (p.isVisible()) {
if(is_dirty_editor) {
p.is_dirty_editor = true;
}
panelTitleFunc.setQueryToolDockerTitle(p, self.is_query_tool, title, is_file); panelTitleFunc.setQueryToolDockerTitle(p, self.is_query_tool, title, is_file);
} }
}); });
@ -3858,6 +3861,7 @@ define('tools.querytool', [
self.setTitle(title, true); self.setTitle(title, true);
} else { } else {
var open_new_tab = self.browser_preferences.new_browser_tab_open; var open_new_tab = self.browser_preferences.new_browser_tab_open;
var is_dirty_editor = false;
if(open_new_tab && open_new_tab.includes('qt')) { if(open_new_tab && open_new_tab.includes('qt')) {
title = window.document.title + ' *'; title = window.document.title + ' *';
} else { } else {
@ -3869,8 +3873,9 @@ define('tools.querytool', [
}); });
title = self.gridView.panel_title + ' *'; title = self.gridView.panel_title + ' *';
is_dirty_editor = true;
} }
self.setTitle(title); self.setTitle(title, false, is_dirty_editor);
} }
$('#btn-save-file').prop('disabled', false); $('#btn-save-file').prop('disabled', false);