public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][RM-4230]: Resolved issues in Rename tab
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin][RM-4230]: Resolved issues in Rename tab
@ 2020-10-26 12:48 Nikhil Mohite <[email protected]>
2020-10-27 05:46 ` Re: [pgAdmin][RM-4230]: Resolved issues in Rename tab Akshay Joshi <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Nikhil Mohite @ 2020-10-26 12:48 UTC (permalink / raw)
To: pgadmin-hackers
Hi Team,
I am sending a common patch RM-4232 and RM-4230
Resolved the issues found in the testing.
*RM-4232:*
1. If the user adds a percentage (other than for placeholders) then it is
stripped off.
2. Backslash is getting removed in the connection string if we provide the
backslash(\) in placeholders or the database name contains it.
3. If the user added only spaces( )in placeholders it is not getting reset
to default values.
*RM-4230:*
1. Rename panel option is not working in the debugger.
2. Added Rename panel for schema diff.
--
*Thanks & Regards,*
*Nikhil Mohite*
*Software Engineer.*
*EDB Postgres* <https://www.enterprisedb.com/;
*Mob.No: +91-7798364578.*
Attachments:
[application/octet-stream] RM_4232_and_RM_4230.patch (12.2K, 3-RM_4232_and_RM_4230.patch)
download | inline diff:
diff --git a/web/pgadmin/preferences/__init__.py b/web/pgadmin/preferences/__init__.py
index d05c1c8..f008551 100644
--- a/web/pgadmin/preferences/__init__.py
+++ b/web/pgadmin/preferences/__init__.py
@@ -202,6 +202,12 @@ def save(pid):
"""
data = request.form if request.form else json.loads(request.data.decode())
+ if data['name'] in ['vw_edt_tab_title_placeholder',
+ 'qt_tab_title_placeholder',
+ 'debugger_tab_title_placeholder']:
+ if data['value'].isspace():
+ data['value'] = ''
+
res, msg = Preferences.save(
data['mid'], data['category_id'], data['id'], data['value'])
sgm.get_nodes(sgm)
diff --git a/web/pgadmin/static/js/sqleditor/new_connection_dialog.js b/web/pgadmin/static/js/sqleditor/new_connection_dialog.js
index b19a50a..19bdf7d 100644
--- a/web/pgadmin/static/js/sqleditor/new_connection_dialog.js
+++ b/web/pgadmin/static/js/sqleditor/new_connection_dialog.js
@@ -201,22 +201,17 @@ let NewConnectionDialog = {
let tab_title = '';
var qt_title_placeholder = preferences['qt_tab_title_placeholder'];
- var placeholders = qt_title_placeholder.split('%');
- placeholders.forEach(function(placeholder) {
- if(placeholder == 'DATABASE'){
- tab_title = tab_title.concat(selected_database_name);
- } else if(placeholder == 'USERNAME') {
- if(newConnCollectionModel['role']) {
- tab_title = tab_title.concat(newConnCollectionModel['role']);
- } else {
- tab_title = tab_title.concat(newConnCollectionModel['user']);
- }
- } else if(placeholder == 'SERVER') {
- tab_title = tab_title.concat(response.server_name);
- } else{
- tab_title = tab_title.concat(placeholder);
- }
- });
+ qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%DATABASE%'), selected_database_name);
+
+ if(newConnCollectionModel['role']) {
+ qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%USERNAME%'), newConnCollectionModel['role']);
+ } else {
+ qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%USERNAME%'), newConnCollectionModel['user']);
+ }
+
+ qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%SERVER%'), response.server_name);
+
+ tab_title = qt_title_placeholder;
if(!newConnCollectionModel['role']) {
newConnCollectionModel['role'] = null;
diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js
index 7ea5461..1f0c1b7 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js
@@ -224,10 +224,11 @@ define('pgadmin.datagrid', [
queryToolForm +=`<textarea name="sql_filter" hidden>${sql_filter}</textarea>`;
}
+ /* Escape backslashes as it is stripped by back end */
queryToolForm +=`
</form>
<script>
- document.getElementById("title").value = "${_.escape(panel_title)}";
+ document.getElementById("title").value = "${_.escape(panel_title.replace('\\', '\\\\'))}";
document.getElementById("queryToolForm").submit();
</script>
`;
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 3ddcfad..e40d0c4 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid_panel_title.js
@@ -39,20 +39,11 @@ export function getPanelTitle(pgBrowser, selected_item=null, custom_title=null)
qt_title_placeholder = preferences['qt_tab_title_placeholder'];
}
- var placeholders = qt_title_placeholder.split('%');
- var title = '';
- placeholders.forEach(function(placeholder) {
- if(placeholder == 'DATABASE'){
- title = title.concat(db_label);
- } else if(placeholder == 'USERNAME') {
- title = title.concat(parentData.server.user.name);
- } else if(placeholder == 'SERVER') {
- title = title.concat(parentData.server.label);
- } else{
- title = title.concat(placeholder);
- }
- });
- return _.escape(title);
+ qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%DATABASE%'), db_label);
+ qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%USERNAME%'), parentData.server.user.name);
+ qt_title_placeholder = qt_title_placeholder.replace(new RegExp('%SERVER%'), parentData.server.label);
+
+ return _.escape(qt_title_placeholder);
}
export function setQueryToolDockerTitle(panel, is_query_tool, panel_title, is_file) {
diff --git a/web/pgadmin/tools/datagrid/static/js/show_data.js b/web/pgadmin/tools/datagrid/static/js/show_data.js
index 75371f7..f9ec5a8 100644
--- a/web/pgadmin/tools/datagrid/static/js/show_data.js
+++ b/web/pgadmin/tools/datagrid/static/js/show_data.js
@@ -297,23 +297,11 @@ export function generateDatagridTitle(pgBrowser, aciTreeIdentifier, custom_title
dtg_title_placeholder = preferences['vw_edt_tab_title_placeholder'];
}
- var placeholders = dtg_title_placeholder.split('%');
- var title = '';
- placeholders.forEach(function(placeholder) {
- if(placeholder == 'DATABASE'){
- title = title.concat(db_label);
- } else if(placeholder == 'USERNAME') {
- title = title.concat(parentData.server.user.name);
- } else if(placeholder == 'SERVER') {
- title = title.concat(parentData.server.label);
- } else if(placeholder == 'SCHEMA') {
- title = title.concat(namespaceName);
- } else if(placeholder == 'TABLE') {
- title = title.concat(node.getData().label);
- } else{
- title = title.concat(placeholder);
- }
- });
+ dtg_title_placeholder = dtg_title_placeholder.replace(new RegExp('%DATABASE%'), db_label);
+ dtg_title_placeholder = dtg_title_placeholder.replace(new RegExp('%USERNAME%'), parentData.server.user.name);
+ dtg_title_placeholder = dtg_title_placeholder.replace(new RegExp('%SERVER%'), parentData.server.label);
+ dtg_title_placeholder = dtg_title_placeholder.replace(new RegExp('%SCHEMA%'), namespaceName);
+ dtg_title_placeholder = dtg_title_placeholder.replace(new RegExp('%TABLE%'), node.getData().label);
- return _.escape(title);
+ return _.escape(dtg_title_placeholder);
}
diff --git a/web/pgadmin/tools/debugger/static/js/debugger.js b/web/pgadmin/tools/debugger/static/js/debugger.js
index 61056f2..ec9250a 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger.js
@@ -579,6 +579,21 @@ define([
method: 'DELETE',
});
});
+
+ // Panel Rename event
+ panel.on(wcDocker.EVENT.RENAME, function(panel_data) {
+ Alertify.prompt('', 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')});
+ });
}
})
.fail(function(e) {
diff --git a/web/pgadmin/tools/debugger/static/js/debugger_utils.js b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
index 5525bfc..2451c60 100644
--- a/web/pgadmin/tools/debugger/static/js/debugger_utils.js
+++ b/web/pgadmin/tools/debugger/static/js/debugger_utils.js
@@ -50,33 +50,21 @@ function setDebuggerTitle(panel, preferences, function_name, schema_name, databa
debugger_title_placeholder = preferences['debugger_tab_title_placeholder'];
}
- var placeholders = debugger_title_placeholder.split('%');
+ var function_data = function_name.split('(');
+ function_name = get_function_name(function_name);
+
+ var args_list = function_data[function_data.length - 1].split(')');
+ var args = '';
+ if(args_list.length > 0) {
+ args = args.concat(args_list[0]);
+ }
- var title = '';
- placeholders.forEach(function(placeholder) {
- if(placeholder == 'FUNCTION'){
- var func_name = '';
- func_name = get_function_name(function_name);
+ debugger_title_placeholder = debugger_title_placeholder.replace(new RegExp('%FUNCTION%'), function_name);
+ debugger_title_placeholder = debugger_title_placeholder.replace(new RegExp('%ARGS%'), args);
+ debugger_title_placeholder = debugger_title_placeholder.replace(new RegExp('%SCHEMA%'), schema_name);
+ debugger_title_placeholder = debugger_title_placeholder.replace(new RegExp('%DATABASE%'), database_name);
- title = title.concat(func_name);
- } else if(placeholder == 'ARGS') {
- var args = '';
- var function_data = function_name.split('(');
- var args_list = function_data[function_data.length - 1].split(')');
- if(args_list.length > 0) {
- args = args.concat(args_list[0]);
- }
- function_name = get_function_name(function_name);
- title = title.concat(args);
- } else if(placeholder == 'SCHEMA'){
- title = title.concat(schema_name);
- } else if(placeholder == 'DATABASE'){
- title = title.concat(database_name);
- } else if (placeholder != 'ARGS' ){
- title = title.concat(placeholder);
- }
- });
- panel.title('<span>'+ _.escape(title) +'</span>');
+ panel.title('<span>'+ _.escape(debugger_title_placeholder) +'</span>');
}
function get_function_name(function_name) {
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 2099414..8865df6 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff.js
@@ -9,9 +9,9 @@
define('pgadmin.schemadiff', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
- 'sources/pgadmin', 'sources/csrf', 'pgadmin.browser.node',
+ 'sources/pgadmin', 'sources/csrf', 'pgadmin.alertifyjs', 'pgadmin.browser.node',
], function(
- gettext, url_for, $, _, pgAdmin, csrfToken
+ gettext, url_for, $, _, pgAdmin, csrfToken, Alertify,
) {
var wcDocker = window.wcDocker,
@@ -113,6 +113,21 @@ define('pgadmin.schemadiff', [
var propertiesPanel = pgBrowser.docker.findPanels('properties'),
schemaDiffPanel = pgBrowser.docker.addPanel('frm_schemadiff', wcDocker.DOCK.STACKED, propertiesPanel[0]);
+ // Rename schema diff tab
+ schemaDiffPanel.on(wcDocker.EVENT.RENAME, function(panel_data) {
+ Alertify.prompt('', panel_data.$titleText[0].textContent,
+ // We will execute this function when user clicks on the OK button
+ function(evt, value) {
+ if(value) {
+ schemaDiffPanel.title('<span>'+ _.escape(value) +'</span>');
+ }
+ },
+ // 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')});
+ });
+
// Set panel title and icon
schemaDiffPanel.title('<span title="'+panel_tooltip+'">'+panel_title+'</span>');
schemaDiffPanel.icon('pg-font-icon icon-schema-diff');
diff --git a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
index b3025aa..fad6485 100644
--- a/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
+++ b/web/pgadmin/tools/schema_diff/static/js/schema_diff_ui.js
@@ -108,7 +108,6 @@ export default class SchemaDiffUI {
this.resize_panels();
}.bind(self), 200);
});
-
}
raise_error_on_fail(alert_title, xhr) {
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin][RM-4230]: Resolved issues in Rename tab
2020-10-26 12:48 [pgAdmin][RM-4230]: Resolved issues in Rename tab Nikhil Mohite <[email protected]>
@ 2020-10-27 05:46 ` Akshay Joshi <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2020-10-27 05:46 UTC (permalink / raw)
To: Nikhil Mohite <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Mon, Oct 26, 2020 at 6:18 PM Nikhil Mohite <
[email protected]> wrote:
> Hi Team,
>
> I am sending a common patch RM-4232 and RM-4230
> Resolved the issues found in the testing.
>
> *RM-4232:*
> 1. If the user adds a percentage (other than for placeholders) then it is
> stripped off.
> 2. Backslash is getting removed in the connection string if we provide the
> backslash(\) in placeholders or the database name contains it.
> 3. If the user added only spaces( )in placeholders it is not getting reset
> to default values.
>
> *RM-4230:*
> 1. Rename panel option is not working in the debugger.
> 2. Added Rename panel for schema diff.
>
> --
> *Thanks & Regards,*
> *Nikhil Mohite*
> *Software Engineer.*
> *EDB Postgres* <https://www.enterprisedb.com/;
> *Mob.No: +91-7798364578.*
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Sr. Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-10-27 05:46 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 12:48 [pgAdmin][RM-4230]: Resolved issues in Rename tab Nikhil Mohite <[email protected]>
2020-10-27 05:46 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox