public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nikhil Mohite <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM-5991]: Renaming tabs doesn't account for the dirty editor indicator.
Date: Tue, 1 Dec 2020 10:03:43 +0530
Message-ID: <CAOBg0AOudTT5deKh9jmRJP+Pc8vtpHBars8BtqY49G6gJ6ATJg@mail.gmail.com> (raw)
Hi Team,
Please refer patch for RM-5991
<https://redmine.postgresql.org/issues/5991?issue_count=22&issue_position=4&next_issue_id=598...;:
Renaming
tabs doesn't account for the dirty editor indicator.
also added changes for not allow a user to add empty spaces while renaming
the panel title.
--
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*
Attachments:
[application/octet-stream] RM_5991.patch (6.6K, 3-RM_5991.patch)
download | inline diff:
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('<span>'+ _.escape(value) +'</span>');
}
},
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);
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin][RM-5991]: Renaming tabs doesn't account for the dirty editor indicator.
In-Reply-To: <CAOBg0AOudTT5deKh9jmRJP+Pc8vtpHBars8BtqY49G6gJ6ATJg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox