public inbox for [email protected]
help / color / mirror / Atom feedFrom: Murtuza Zabuawala <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: PATCH: To fix the issue where AJAX request do not get fired second time (pgAdmin4)
Date: Wed, 20 Jul 2016 17:41:53 +0530
Message-ID: <CAKKotZSNeNGvzaRineojFC5SYcE-6a1rkV-Hkp+-xupn9Ja7Ag@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgadmin-hackers>
Hi,
PFA patch to fix the issue where AJAX request do not get fired second time.
(RM#1462)
--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers
Attachments:
[application/octet-stream] RM_1462.patch (5.6K, 3-RM_1462.patch)
download | inline diff:
diff --git a/web/pgadmin/browser/templates/browser/js/node.js b/web/pgadmin/browser/templates/browser/js/node.js
index efe6413..955ad95 100644
--- a/web/pgadmin/browser/templates/browser/js/node.js
+++ b/web/pgadmin/browser/templates/browser/js/node.js
@@ -1034,6 +1034,24 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
cache: false,
success: function() {
onSaveFunc.call();
+ // Removing the node-prop property of panel
+ // so that we show updated data on panel
+ var pnlProperties = pgBrowser.docker.findPanels('properties')[0],
+ pnlSql = pgBrowser.docker.findPanels('sql')[0],
+ pnlStats = pgBrowser.docker.findPanels('statistics')[0],
+ pnlDependencies = pgBrowser.docker.findPanels('dependencies')[0],
+ pnlDependents = pgBrowser.docker.findPanels('dependents')[0];
+
+ if(pnlProperties)
+ $(pnlProperties).removeData('node-prop');
+ if(pnlSql)
+ $(pnlSql).removeData('node-prop');
+ if(pnlStats)
+ $(pnlStats).removeData('node-prop');
+ if(pnlDependencies)
+ $(pnlDependencies).removeData('node-prop');
+ if(pnlDependents)
+ $(pnlDependents).removeData('node-prop');
},
error: function(m, jqxhr) {
Alertify.pgNotifier(
diff --git a/web/pgadmin/misc/depends/static/js/depends.js b/web/pgadmin/misc/depends/static/js/depends.js
index 6883aa3..3acd309 100644
--- a/web/pgadmin/misc/depends/static/js/depends.js
+++ b/web/pgadmin/misc/depends/static/js/depends.js
@@ -185,20 +185,12 @@ define(
n_type = type;
// Avoid unnecessary reloads
- if (_.isUndefined(treeHierarchy[n_type]) ||
- _.isUndefined(treeHierarchy[n_type]._id)) {
- n_value = -1;
- } else {
- n_value = treeHierarchy[n_type]._id;
- }
-
- if (n_value == $(panel[0]).data(n_type)) {
+ if (_.isEqual($(panel[0]).data('node-prop'), treeHierarchy)) {
return;
}
// Cache the current IDs for next time
- $(panel[0]).data(n_type, n_value);
-
+ $(panel[0]).data('node-prop', treeHierarchy);
// Hide the grid container and show the default message container
if (!$gridContainer.hasClass('hidden'))
diff --git a/web/pgadmin/misc/sql/static/js/sql.js b/web/pgadmin/misc/sql/static/js/sql.js
index 9c06c65..a6db150 100644
--- a/web/pgadmin/misc/sql/static/js/sql.js
+++ b/web/pgadmin/misc/sql/static/js/sql.js
@@ -59,27 +59,19 @@ function(_, $, pgBrowser) {
var sql = '';
if (node) {
sql = '-- ' + pgBrowser.messages.NODE_HAS_NO_SQL;
- if (node.hasSQL) {
-
- var self = this,
- n_type = data._type,
- n_value = -1,
- treeHierarchy = node.getTreeNodeHierarchy(item);
-
- // Avoid unnecessary reloads
- if (_.isUndefined(treeHierarchy[n_type]) ||
- _.isUndefined(treeHierarchy[n_type]._id)) {
- n_value = -1;
- } else {
- n_value = treeHierarchy[n_type]._id;
- }
-
- if (n_value == $(sqlPanels[0]).data(n_type)) {
- return;
- }
+ var self = this,
+ n_type = data._type,
+ n_value = -1,
+ treeHierarchy = node.getTreeNodeHierarchy(item);
+
+ // Avoid unnecessary reloads
+ if (_.isEqual($(this.sqlPanels[0]).data('node-prop'), treeHierarchy)) {
+ return;
+ }
+ // Cache the current IDs for next time
+ $(this.sqlPanels[0]).data('node-prop', treeHierarchy);
- // Cache the current IDs for next time
- $(this.sqlPanels[0]).data(n_type, n_value);
+ if (node.hasSQL) {
sql = '';
var url = node.generate_url(item, 'sql', data, true);
diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js
index f1217ae..c1a0327 100644
--- a/web/pgadmin/misc/statistics/static/js/statistics.js
+++ b/web/pgadmin/misc/statistics/static/js/statistics.js
@@ -154,25 +154,16 @@ function(_, $, pgBrowser, Backgrid) {
/* We fetch the statistics only for those node who set the parameter
* showStatistics function.
*/
- if (node.hasStatistics) {
// Avoid unnecessary reloads
var treeHierarchy = node.getTreeNodeHierarchy(item);
- if (_.isUndefined(treeHierarchy[n_type]) ||
- _.isUndefined(treeHierarchy[n_type]._id)) {
- n_value = undefined,
- n_value = -1;
- } else {
- n_value = treeHierarchy[n_type]._id;
- }
-
- if (n_value == $(this.panel[0]).data(n_type)) {
+ if (_.isEqual($(panel[0]).data('node-prop'), treeHierarchy)) {
return;
}
-
// Cache the current IDs for next time
- $(this.panel[0]).data(n_type, n_value);
+ $(panel[0]).data('node-prop', treeHierarchy);
+ if (node.hasStatistics) {
/* Set the message because ajax request may take time to
* fetch the information from the server.
*/
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: PATCH: To fix the issue where AJAX request do not get fired second time (pgAdmin4)
In-Reply-To: <CAKKotZSNeNGvzaRineojFC5SYcE-6a1rkV-Hkp+-xupn9Ja7Ag@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