public inbox for [email protected]
help / color / mirror / Atom feedFrom: Nikhil Mohite <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin][RM-4230]: Rename tab.
Date: Fri, 23 Oct 2020 15:15:28 +0530
Message-ID: <CAOBg0APfOgQbVfpN=a8vyB5u0ovE87ND0AZug7-qRiL91odNBw@mail.gmail.com> (raw)
Hi Team,
Please Find the patch for RM-4230
<https://redmine.postgresql.org/issues/4230;: Rename tab.
also fixed the issue RM-5923 <https://redmine.postgresql.org/issues/5923;
with this patch.
--
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*
Attachments:
[application/octet-stream] RM_4230.patch (9.7K, 3-RM_4230.patch)
download | inline diff:
diff --git a/web/package.json b/web/package.json
index 2602d07..b777765 100644
--- a/web/package.json
+++ b/web/package.json
@@ -107,7 +107,7 @@
"tempusdominus-core": "^5.0.3",
"underscore": "^1.9.1",
"watchify": "~3.11.1",
- "webcabin-docker": "git+https://github.com/EnterpriseDB/wcDocker/#8298a57d875dce51a4d3707c68a1a2b82f2e6c03",
+ "webcabin-docker": "git+https://github.com/EnterpriseDB/wcDocker/#c4a3398b89588408dc705895675bce7bd7660d36",
"wkx": "^0.4.6"
},
"scripts": {
diff --git a/web/pgadmin/browser/static/js/frame.js b/web/pgadmin/browser/static/js/frame.js
index 2ced098..82d9939 100644
--- a/web/pgadmin/browser/static/js/frame.js
+++ b/web/pgadmin/browser/static/js/frame.js
@@ -30,6 +30,7 @@ define([
height: 600,
showTitle: true,
isClosable: true,
+ isRenamable: true,
isPrivate: false,
url: '',
icon: '',
@@ -52,6 +53,7 @@ define([
myPanel.icon(that.icon);
myPanel.closeable(!!that.isCloseable);
+ myPanel.renamable(that.isRenamable);
var $frameArea = $('<div style="position:absolute;top:0 !important;width:100%;height:100%;display:table;z-index:0;">');
myPanel.layout().addItem($frameArea);
diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js
index bb4d333..5a413e5 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js
@@ -6,7 +6,6 @@
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
-
define('pgadmin.datagrid', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'pgadmin.alertifyjs', 'sources/pgadmin', 'bundled_codemirror',
@@ -181,6 +180,7 @@ define('pgadmin.datagrid', [
name: 'frm_datagrid',
showTitle: true,
isCloseable: true,
+ isRenameable: true,
isPrivate: true,
url: 'about:blank',
});
@@ -259,6 +259,36 @@ define('pgadmin.datagrid', [
});
});
+ // Listen on the panelRename event.
+ queryToolPanel.on(wcDocker.EVENT.RENAME, function(panel_data) {
+ alertify.prompt(
+ gettext('Title'), panel_data.$titleText[0].textContent,
+ // We will execute this function when user clicks on the OK button
+ function(evt, value) {
+ if(value) {
+
+ var is_file = false;
+ if(panel_data.$titleText[0].innerHTML.includes('File - ')) {
+ is_file = true;
+ }
+ var selected_item = pgBrowser.treeMenu.selected();
+ var panel_titles = '';
+
+ if(is_query_tool) {
+ panel_titles = panelTitleFunc.getPanelTitle(pgBrowser, selected_item, value);
+ } else {
+ panel_titles = showData.generateDatagridTitle(pgBrowser, selected_item, value);
+ }
+ // Set title to the selected tab.
+ panelTitleFunc.setQueryToolDockerTitle(queryToolPanel, is_query_tool, _.unescape(panel_titles), is_file);
+ }
+ },
+ // We will execute this function when user clicks on the Cancel
+ // button. Do nothing just close it.
+ function(evt) { evt.cancel = false; }
+ ).set({'title': gettext('Rename Panel Title')});
+ });
+
var openQueryToolURL = function(j) {
// add spinner element
let $spinner_el =
diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js b/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js
index f92c64a..3ddcfad 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js
@@ -19,7 +19,7 @@ function isServerInformationAvailable(parentData) {
return parentData.server === undefined;
}
-export function getPanelTitle(pgBrowser, selected_item=null) {
+export function getPanelTitle(pgBrowser, selected_item=null, custom_title=null) {
var preferences = pgBrowser.get_preferences_for_module('sqleditor');
if(selected_item == null) {
selected_item = pgBrowser.treeMenu.selected();
@@ -32,8 +32,13 @@ export function getPanelTitle(pgBrowser, selected_item=null) {
}
const db_label = getDatabaseLabel(parentData);
+ var qt_title_placeholder = '';
+ if (custom_title) {
+ qt_title_placeholder = custom_title;
+ } else {
+ qt_title_placeholder = preferences['qt_tab_title_placeholder'];
+ }
- var qt_title_placeholder = preferences['qt_tab_title_placeholder'];
var placeholders = qt_title_placeholder.split('%');
var title = '';
placeholders.forEach(function(placeholder) {
diff --git a/web/pgadmin/tools/datagrid/static/js/show_data.js b/web/pgadmin/tools/datagrid/static/js/show_data.js
index 401af2b..75371f7 100644
--- a/web/pgadmin/tools/datagrid/static/js/show_data.js
+++ b/web/pgadmin/tools/datagrid/static/js/show_data.js
@@ -278,7 +278,7 @@ function hasSchemaOrCatalogOrViewInformation(parentData) {
parentData.catalog !== undefined;
}
-export function generateDatagridTitle(pgBrowser, aciTreeIdentifier) {
+export function generateDatagridTitle(pgBrowser, aciTreeIdentifier, custom_title=null) {
//const baseTitle = getPanelTitle(pgBrowser, aciTreeIdentifier);
var preferences = pgBrowser.get_preferences_for_module('sqleditor');
const parentData = getTreeNodeHierarchyFromIdentifier.call(
@@ -290,7 +290,13 @@ export function generateDatagridTitle(pgBrowser, aciTreeIdentifier) {
const db_label = getDatabaseLabel(parentData);
const node = pgBrowser.treeMenu.findNodeByDomElement(aciTreeIdentifier);
- var dtg_title_placeholder = preferences['vw_edt_tab_title_placeholder'];
+ var dtg_title_placeholder = '';
+ if(custom_title) {
+ dtg_title_placeholder = custom_title;
+ } else {
+ dtg_title_placeholder = preferences['vw_edt_tab_title_placeholder'];
+ }
+
var placeholders = dtg_title_placeholder.split('%');
var title = '';
placeholders.forEach(function(placeholder) {
diff --git a/web/pgadmin/tools/debugger/static/js/debugger.js b/web/pgadmin/tools/debugger/static/js/debugger.js
index b638347..950c4d5 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger.js
@@ -441,6 +441,22 @@ define([
method: 'DELETE',
});
});
+
+ // Panel Rename event
+ panel.on(wcDocker.EVENT.RENAME, function(panel_data) {
+ Alertify.prompt(
+ gettext('Title'), panel_data.$titleText[0].textContent,
+ // We will execute this function when user clicks on the OK button
+ function(evt, value) {
+ if(value) {
+ debuggerUtils.setDebuggerTitle(panel, self.preferences, treeInfo.function.label, treeInfo.schema.label, treeInfo.database.label, value);
+ }
+ },
+ // We will execute this function when user clicks on the Cancel
+ // button. Do nothing just close it.
+ function(evt) { evt.cancel = false; }
+ ).set({'title': gettext('Rename Panel Title')});
+ });
}
})
.fail(function(xhr) {
diff --git a/web/pgadmin/tools/debugger/static/js/debugger_ui.js b/web/pgadmin/tools/debugger/static/js/debugger_ui.js
index 2caf387..6dae56d 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger_ui.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger_ui.js
@@ -787,6 +787,22 @@ define([
method: 'DELETE',
});
});
+
+ // Panel Rename event
+ panel.on(wcDocker.EVENT.RENAME, function(panel_data) {
+ Alertify.prompt(
+ gettext('Title'), panel_data.$titleText[0].textContent,
+ // We will execute this function when user clicks on the OK button
+ function(evt, value) {
+ if(value) {
+ debuggerUtils.setDebuggerTitle(panel, self.preferences, treeInfo.function.label, treeInfo.schema.label, treeInfo.database.label, value);
+ }
+ },
+ // We will execute this function when user clicks on the Cancel
+ // button. Do nothing just close it.
+ function(evt) { evt.cancel = false; }
+ ).set({'title': gettext('Rename Panel Title')});
+ });
}
var _url;
diff --git a/web/pgadmin/tools/debugger/static/js/debugger_utils.js b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
index 718c439..5525bfc 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger_utils.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
@@ -42,8 +42,14 @@ function getProcedureId(treeInfoObject) {
return objectId;
}
-function setDebuggerTitle(panel, preferences, function_name, schema_name, database_name) {
- var debugger_title_placeholder = preferences['debugger_tab_title_placeholder'];
+function setDebuggerTitle(panel, preferences, function_name, schema_name, database_name, custom_title) {
+ var debugger_title_placeholder = '';
+ if(custom_title) {
+ debugger_title_placeholder = custom_title;
+ } else {
+ debugger_title_placeholder = preferences['debugger_tab_title_placeholder'];
+ }
+
var placeholders = debugger_title_placeholder.split('%');
var title = '';
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-4230]: Rename tab.
In-Reply-To: <CAOBg0APfOgQbVfpN=a8vyB5u0ovE87ND0AZug7-qRiL91odNBw@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