diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js index 4841eaf..20ed9da 100644 --- a/web/pgadmin/tools/datagrid/static/js/datagrid.js +++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js @@ -265,11 +265,15 @@ define('pgadmin.datagrid', [ // Listen on the panelRename event. 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 function(evt, value) { + // Remove the leading and trailing white spaces. + value = value.trim(); if(value) { - var is_file = false; if(panel_data.$titleText[0].innerHTML.includes('File - ')) { is_file = true; @@ -283,6 +287,9 @@ define('pgadmin.datagrid', [ panel_titles = showData.generateDatagridTitle(pgBrowser, selected_item, value); } // 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); } }, diff --git a/web/pgadmin/tools/debugger/static/js/debugger.js b/web/pgadmin/tools/debugger/static/js/debugger.js index 9d45f17..d9da30c 100644 --- a/web/pgadmin/tools/debugger/static/js/debugger.js +++ b/web/pgadmin/tools/debugger/static/js/debugger.js @@ -451,6 +451,8 @@ define([ // We will execute this function when user clicks on the OK button function(evt, value) { if(value) { + // Remove the leading and trailing white spaces. + value = value.trim(); let browser_preferences = pgBrowser.get_preferences_for_module('browser'); var label = treeInfo.function ? treeInfo.function.label : treeInfo.procedure.label; 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 function(evt, value) { if(value) { + // Remove the leading and trailing white spaces. + value = value.trim(); let browser_preferences = pgBrowser.get_preferences_for_module('browser'); var label = treeInfo.function ? treeInfo.function.label : treeInfo.procedure.label; debuggerUtils.setDebuggerTitle(panel, browser_preferences, label, treeInfo.schema.label, treeInfo.database.label, value, pgBrowser); diff --git a/web/pgadmin/tools/debugger/static/js/debugger_ui.js b/web/pgadmin/tools/debugger/static/js/debugger_ui.js index 4af58d8..1700b7a 100644 --- a/web/pgadmin/tools/debugger/static/js/debugger_ui.js +++ b/web/pgadmin/tools/debugger/static/js/debugger_ui.js @@ -799,6 +799,8 @@ define([ // We will execute this function when user clicks on the OK button function(evt, value) { if(value) { + // Remove the leading and trailing white spaces. + value = value.trim(); var label = treeInfo.function ? treeInfo.function.label : treeInfo.procedure.label; debuggerUtils.setDebuggerTitle(panel, self.preferences, label, treeInfo.schema.label, treeInfo.database.label, value, pgBrowser); } diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff.js index d90c435..85b1978 100644 --- a/web/pgadmin/tools/schema_diff/static/js/schema_diff.js +++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff.js @@ -121,6 +121,8 @@ define('pgadmin.schemadiff', [ // We will execute this function when user clicks on the OK button function(evt, value) { if(value) { + // Remove the leading and trailing white spaces. + value = value.trim(); schemaDiffPanel.title(''+ _.escape(value) +''); } }, diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 00791fb..c8d3cbc 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -3692,7 +3692,7 @@ define('tools.querytool', [ }, // Set panel title. - setTitle: function(title, is_file) { + setTitle: function(title, is_file, is_dirty_editor=false) { var self = this; var open_new_tab = self.browser_preferences.new_browser_tab_open; if(open_new_tab && open_new_tab.includes('qt')) { @@ -3700,6 +3700,9 @@ define('tools.querytool', [ } else { _.each(pgWindow.default.pgAdmin.Browser.docker.findPanels('frm_datagrid'), function(p) { if (p.isVisible()) { + if(is_dirty_editor) { + p.is_dirty_editor = true; + } panelTitleFunc.setQueryToolDockerTitle(p, self.is_query_tool, title, is_file); } }); @@ -3858,6 +3861,7 @@ define('tools.querytool', [ self.setTitle(title, true); } else { 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')) { title = window.document.title + ' *'; } else { @@ -3869,8 +3873,9 @@ define('tools.querytool', [ }); 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);