public inbox for [email protected]
help / color / mirror / Atom feedPATCH: To fix the issue where AJAX request do not get fired second time (pgAdmin4)
2+ messages / 2 participants
[nested] [flat]
* PATCH: To fix the issue where AJAX request do not get fired second time (pgAdmin4)
@ 2016-07-20 12:11 Murtuza Zabuawala <[email protected]>
2016-07-21 12:28 ` Re: PATCH: To fix the issue where AJAX request do not get fired second time (pgAdmin4) Dave Page <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Murtuza Zabuawala @ 2016-07-20 12:11 UTC (permalink / raw)
To: pgadmin-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.
*/
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: PATCH: To fix the issue where AJAX request do not get fired second time (pgAdmin4)
2016-07-20 12:11 PATCH: To fix the issue where AJAX request do not get fired second time (pgAdmin4) Murtuza Zabuawala <[email protected]>
@ 2016-07-21 12:28 ` Dave Page <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Page @ 2016-07-21 12:28 UTC (permalink / raw)
To: Murtuza Zabuawala <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Wed, Jul 20, 2016 at 1:11 PM, Murtuza Zabuawala
<[email protected]> wrote:
> 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
>
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2016-07-21 12:28 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-07-20 12:11 PATCH: To fix the issue where AJAX request do not get fired second time (pgAdmin4) Murtuza Zabuawala <[email protected]>
2016-07-21 12:28 ` Dave Page <[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