mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure that dirty indicator (*) should not be visible when renaming the tabs. Fixes #5991
This commit is contained in:
committed by
Akshay Joshi
parent
fb51ef569e
commit
abd0748a77
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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('<span>'+ _.escape(value) +'</span>');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user