public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][Patch]: RM#1462- AJAX request do not get fired second time
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4][Patch]: RM#1462- AJAX request do not get fired second time
@ 2016-07-18 07:34 Surinder Kumar <[email protected]>
  2016-07-18 08:50 ` Re: [pgAdmin4][Patch]: RM#1462- AJAX request do not get fired second time Dave Page <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Surinder Kumar @ 2016-07-18 07:34 UTC (permalink / raw)
  To: pgadmin-hackers

Hi

Please find attached patch for the fix:
*Issue:*
This issue is regression of one of the flickering issue of RM#1242.
"Aside from displaying/hiding the spinner, panes should have their content
refreshed until and unless the new data differs from the previous, to
reduce flicker"

*Solution:*
Along with caching the node node, we should also keep track of the previous
node clicked.
Fetch new data iff previous node and current node clicked differs.

Please review.

Thanks,
Surinder Kumar


-- 
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 (4.0K, 3-RM%231462.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/templates/browser/js/collection.js b/web/pgadmin/browser/templates/browser/js/collection.js
index 771cc07..9603ed0 100644
--- a/web/pgadmin/browser/templates/browser/js/collection.js
+++ b/web/pgadmin/browser/templates/browser/js/collection.js
@@ -103,12 +103,14 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) {
           n_value = treeHierarchy[n_type]._id;
         }

-        if (n_value == $(panel).data(n_type)) {
+        if (n_value == $(panel).data(n_type) &&
+            n_type == $(panel).data('uniq_id')) {
           return;
         }

         // Cache the current IDs for next time
         $(panel).data(n_type, n_value);
+        $(panel).data('uniq_id', n_type);

         // Reset the data object
         j.data('obj-view', null);
diff --git a/web/pgadmin/browser/templates/browser/js/node.js b/web/pgadmin/browser/templates/browser/js/node.js
index e5a96c4..38c7116 100644
--- a/web/pgadmin/browser/templates/browser/js/node.js
+++ b/web/pgadmin/browser/templates/browser/js/node.js
@@ -804,12 +804,14 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
             n_value = treeHierarchy[n_type]._id;
           }

-          if (n_value == $(panel).data(n_type)) {
+          if (n_value == $(panel).data(n_type) &&
+              n_type == $(panel).data('uniq_id')) {
             return;
           }

           // Cache the current IDs for next time
           $(panel).data(n_type, n_value);
+          $(panel).data('uniq_id', n_type);

           if (!content.hasClass('has-pg-prop-btn-group'))
             content.addClass('has-pg-prop-btn-group');
diff --git a/web/pgadmin/misc/depends/static/js/depends.js b/web/pgadmin/misc/depends/static/js/depends.js
index 6883aa3..a72cf89 100644
--- a/web/pgadmin/misc/depends/static/js/depends.js
+++ b/web/pgadmin/misc/depends/static/js/depends.js
@@ -192,12 +192,14 @@ define(
         n_value = treeHierarchy[n_type]._id;
       }

-      if (n_value == $(panel[0]).data(n_type)) {
+      if (n_value == $(panel[0]).data(n_type) &&
+          n_type == $(panel).data('uniq_id')) {
         return;
       }

       // Cache the current IDs for next time
       $(panel[0]).data(n_type, n_value);
+      $(panel).data('uniq_id', n_type);


       // Hide the grid container and show the default message container
diff --git a/web/pgadmin/misc/sql/static/js/sql.js b/web/pgadmin/misc/sql/static/js/sql.js
index 9c06c65..56b1673 100644
--- a/web/pgadmin/misc/sql/static/js/sql.js
+++ b/web/pgadmin/misc/sql/static/js/sql.js
@@ -74,12 +74,14 @@ function(_, $, pgBrowser) {
                   n_value = treeHierarchy[n_type]._id;
               }

-              if (n_value == $(sqlPanels[0]).data(n_type)) {
+              if (n_value == $(sqlPanels[0]).data(n_type) &&
+                  n_type == $(sqlPanels).data('uniq_id')) {
                 return;
               }

               // Cache the current IDs for next time
-              $(this.sqlPanels[0]).data(n_type, n_value);
+              $(sqlPanels[0]).data(n_type, n_value);
+              $(sqlPanels).data('uniq_id', n_type);

               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..87a0c23 100644
--- a/web/pgadmin/misc/statistics/static/js/statistics.js
+++ b/web/pgadmin/misc/statistics/static/js/statistics.js
@@ -166,12 +166,14 @@ function(_, $, pgBrowser, Backgrid) {
             n_value = treeHierarchy[n_type]._id;
           }

-          if (n_value == $(this.panel[0]).data(n_type)) {
+          if (n_value == $(this.panel[0]).data(n_type) &&
+              n_type == $(panel).data('uniq_id')) {
             return;
           }

           // Cache the current IDs for next time
           $(this.panel[0]).data(n_type, n_value);
+          $(panel).data('uniq_id', n_type);

           /* 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: [pgAdmin4][Patch]: RM#1462- AJAX request do not get fired second time
  2016-07-18 07:34 [pgAdmin4][Patch]: RM#1462- AJAX request do not get fired second time Surinder Kumar <[email protected]>
@ 2016-07-18 08:50 ` Dave Page <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2016-07-18 08:50 UTC (permalink / raw)
  To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers

Hi

On Mon, Jul 18, 2016 at 8:34 AM, Surinder Kumar
<[email protected]> wrote:
> Hi
>
> Please find attached patch for the fix:
> Issue:
> This issue is regression of one of the flickering issue of RM#1242.
> "Aside from displaying/hiding the spinner, panes should have their content
> refreshed until and unless the new data differs from the previous, to reduce
> flicker"
>
> Solution:
> Along with caching the node node, we should also keep track of the previous
> node clicked.
> Fetch new data iff previous node and current node clicked differs.

This doesn't fix the issue for me. My test case:

1) Select the SQL tab
2) Click a schema, and the SQL is displayed.
3) Click Schemas, and "-- No SQL could be generated for the selected
object." is displayed.
4) Click the same schema as in step 2 again, and "-- No SQL could be
generated for the selected object." remains displayed.

Note that clicking any other schema in step 4 works fine.

-- 
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-18 08:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-07-18 07:34 [pgAdmin4][Patch]: RM#1462- AJAX request do not get fired second time Surinder Kumar <[email protected]>
2016-07-18 08:50 ` 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