public inbox for [email protected]  
help / color / mirror / Atom feed
From: Aditya Toshniwal <[email protected]>
To: Dave Page <[email protected]>
Cc: Akshay Joshi <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][RM3294] User need to reset the layout to see the changed preferences parameters
Date: Wed, 25 Jul 2018 15:02:33 +0530
Message-ID: <CAM9w-_nB=34mi5Ekk-JZfZcg=NpLwh4Xiy3ViJrW8tFs-tAQEg@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxowp0WcEpzOAN22QtZEzn5W5AzCuer-vyXWSUX_6eXDgRw@mail.gmail.com>
References: <CAM9w-_nZikTmx0JkrDyev3Z8qk26MskoEF2=N1T2-Ji-mK8Q-Q@mail.gmail.com>
	<CANxoLDfCm1Y=Z_8Z4uM8FT3eWfvni+kgcQNMfzyRdJfLcQTb6Q@mail.gmail.com>
	<CAM9w-_kDJSvVFf84Ery7FsW31hsx+Ch_yNzsMoFQX1kYOs-qbw@mail.gmail.com>
	<CAM9w-_=wmMOF7dsMGh6rTQJModYFcd18Z8UuGi-qXEhDedZsBw@mail.gmail.com>
	<CA+OCxowKQaG4e5H8cfyj8_uKDh-T_cfmb_byKO1RTYB2T0P8tw@mail.gmail.com>
	<CAM9w-_kYgd1RWCWtVV0uvJa3T_As1Rfj4icp3sOa_4bTKa8ftQ@mail.gmail.com>
	<CAM9w-_nMfrLP1xn89hvD+ss0cMBKsYOyPVgQBqWAPEKr9FsDWg@mail.gmail.com>
	<CA+OCxoz3rU1Wix3+9N0dZFLjyYfCjHJ3ehmYZ3WcLHZMsRyzPQ@mail.gmail.com>
	<CAM9w-_=2no8AKkgo8AjnhW3RdysEArkWy02uBJ3SQtPEWAvUiQ@mail.gmail.com>
	<CA+OCxowgZSAsWXvqP+Yd8aXJoGQp+iNObrGXbst4X+3AgRQyCg@mail.gmail.com>
	<CAM9w-_nr7citW3=6T+aOcEeqcWhVrqbQ0EBdz9WYzDujrWT8tA@mail.gmail.com>
	<CA+OCxowp0WcEpzOAN22QtZEzn5W5AzCuer-vyXWSUX_6eXDgRw@mail.gmail.com>

Hi Hackers,

Attached is the updated patch with few more fixes of existing dashboard. Fixed
dashboard reloading even if subnodes under a dashboard or server selected.

On Tue, Jul 24, 2018 at 9:01 PM, Dave Page <[email protected]> wrote:

> Thanks, applied.
>
> On Tue, Jul 24, 2018 at 2:11 PM, Aditya Toshniwal <aditya.toshniwal@
> enterprisedb.com> wrote:
>
>> Hi,
>>
>> Attached is the updated patch.
>>
>> On Tue, Jul 24, 2018 at 4:32 PM, Dave Page <[email protected]> wrote:
>>
>>> Hi
>>>
>>> On Tue, Jul 24, 2018 at 11:39 AM, Aditya Toshniwal <
>>> [email protected]> wrote:
>>>
>>>> Hi Hackers,
>>>>
>>>> Attached is the second part of the changes for making preferences
>>>> realtime. The patch includes dashboard and debugger modules.
>>>>
>>>
>>> All my dashboard graphs now seem to be straight lines. I'm guessing
>>> there's a bug somewhere, as I've never seen one PG server sustain it's I/O
>>> levels so perfectly, let alone the three I tested with :-)
>>>
>> ​Fixed. :P ​
>>
>>
>>>
>>>
>>>> I would also request to create RMs for javascript test cases for
>>>> dashboard and debugger modules as currently there is no setup for the test
>>>> cases of these two modules.
>>>>
>>>
>>> Please do. As well as that I'd also like to see a Python test to ensure
>>> that the invocation SQL for various different types of function/procedure
>>> is correct. We've messed that up a few times over the years.
>>>
>>> Thanks.
>>>
>>> The changes are on the JS side and so patch does not have any test cases
>>>> included.
>>>>
>>>
>>>> Kindly review.
>>>>
>>>>
>>>> On Thu, Jul 5, 2018 at 4:09 PM, Dave Page <[email protected]> wrote:
>>>>
>>>>> Thanks - patch applied!
>>>>>
>>>>> On Wed, Jul 4, 2018 at 10:19 AM, Aditya Toshniwal <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi Hackers,
>>>>>>
>>>>>> Attached is the updated patch for the RM. Change of the flags like
>>>>>> auto commit, explain->verbose, etc. will reflect in all other open sql
>>>>>> editors.
>>>>>> Kindly review.
>>>>>>
>>>>>> On Fri, Jun 29, 2018 at 10:39 PM, Aditya Toshniwal <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi Dave,
>>>>>>>
>>>>>>> On Fri, Jun 29, 2018 at 9:30 PM, Dave Page <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi
>>>>>>>>
>>>>>>>> On Fri, Jun 29, 2018 at 3:14 PM, Aditya Toshniwal <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Hi Hackers,
>>>>>>>>>
>>>>>>>>> Attached is the updated patch.
>>>>>>>>>
>>>>>>>>
>>>>>>>> This seems to work for the most part, however I saw what seemed
>>>>>>>> like odd behaviour. If I have 2 query tool windows open;
>>>>>>>>
>>>>>>>> - Changing a preference from the Preferences dialogue updates both
>>>>>>>> query tools.
>>>>>>>>
>>>>>>>> - Changing a preference from a Query Tool updates the Preferences
>>>>>>>> dialogue.
>>>>>>>>
>>>>>>>> - Changing a preference from a Query Tool does *not* update the
>>>>>>>> other Query Tool.
>>>>>>>>
>>>>>>>> The last point seems odd to me, though it also kinda makes sense to
>>>>>>>> not have one query tool affect the other. The problem with that is that it
>>>>>>>> could get quite confusing when they get out of sync. I think it would be
>>>>>>>> better for a change in one Query Tool to update the other(s).
>>>>>>>>
>>>>>>>> What do you think? Was this behaviour intentional?
>>>>>>>>
>>>>>>>
>>>>>>> ​No this was not intentional. It should reflect in other query tools
>>>>>>> as well because changing the flags like Auto Commit changes the preferences
>>>>>>> config and is not local to a Query tool. I missed the fact that some
>>>>>>> preferences can be changed from other than preference dialog.​
>>>>>>>
>>>>>>> ​Will send the updated patch with the fix.​
>>>>>>>
>>>>>>>>
>>>>>>>> (FYI, in case this was a one-off bug, I was testing using "Auto
>>>>>>>> Commit?")
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Fri, Jun 29, 2018 at 4:46 PM, Aditya Toshniwal <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Akshay,
>>>>>>>>>>
>>>>>>>>>> On Fri, Jun 29, 2018 at 3:42 PM, Akshay Joshi <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi Aditya
>>>>>>>>>>>
>>>>>>>>>>> I have applied your patch and run pgAdmin4. I have found
>>>>>>>>>>> following two issue in the browser:
>>>>>>>>>>>
>>>>>>>>>>>    - Found error while open Preferences dialog. Refer
>>>>>>>>>>>    Open_Preferences_Dialog.png
>>>>>>>>>>>
>>>>>>>>>>> ​This error occurs even with the latest pull without changes.​
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>    - Set the preferences setting "Open in new browser tab" to
>>>>>>>>>>>    True and open the query tool. Refer "Open_In_New_Broswer.png".
>>>>>>>>>>>
>>>>>>>>>>> ​Will look into this.​
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>> I haven't review the code.
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Jun 28, 2018 at 8:04 PM, Aditya Toshniwal <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Hackers,
>>>>>>>>>>>>
>>>>>>>>>>>> Attached is the patch for making preferences realtime and
>>>>>>>>>>>> applying without reseting the layout. Please note, the patch is only for
>>>>>>>>>>>> one module - SQL Editor and is the first part for the RM. There are lot of
>>>>>>>>>>>> changes to be done to cover all and hence sending in parts. This will not
>>>>>>>>>>>> affect/break existing code. Further patches will cover other modules.
>>>>>>>>>>>>
>>>>>>>>>>>> Highlights of this patch include:
>>>>>>>>>>>> - Changes will affect SQL Editors in Create dialog boxes, SQL
>>>>>>>>>>>> tab of the main screen, Query tool, History entries in the query tool,
>>>>>>>>>>>> Query tool opened in New Tab/Window
>>>>>>>>>>>> - All the components of SQL editor will refer to single source
>>>>>>>>>>>> of preferences which is cached in the Browser object. All other redundant
>>>>>>>>>>>> ajax get preference calls are removed.
>>>>>>>>>>>> - SQL editor will not refer template JS variables anymore,
>>>>>>>>>>>> once all the references are removed the template variables will also be
>>>>>>>>>>>> removed.
>>>>>>>>>>>> - Code refactoring wherever possible.
>>>>>>>>>>>> - Covered JS test cases wherever possible.
>>>>>>>>>>>>
>>>>>>>>>>>> Request you to kindly review.
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Thanks and Regards,
>>>>>>>>>>>> Aditya Toshniwal
>>>>>>>>>>>> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>>>>>>>>> "Don't Complain about Heat, Plant a tree"
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> *Akshay Joshi*
>>>>>>>>>>>
>>>>>>>>>>> *Sr. Software Architect *
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Thanks and Regards,
>>>>>>>>>> Aditya Toshniwal
>>>>>>>>>> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>>>>>>> "Don't Complain about Heat, Plant a tree"
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Thanks and Regards,
>>>>>>>>> Aditya Toshniwal
>>>>>>>>> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>>>>>> "Don't Complain about Heat, Plant a tree"
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Dave Page
>>>>>>>> Blog: http://pgsnake.blogspot.com
>>>>>>>> Twitter: @pgsnake
>>>>>>>>
>>>>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>>>>> The Enterprise PostgreSQL Company
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Thanks and Regards,
>>>>>>> Aditya Toshniwal
>>>>>>> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>>>> "Don't Complain about Heat, Plant a tree"
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Thanks and Regards,
>>>>>> Aditya Toshniwal
>>>>>> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>>> "Don't Complain about Heat, Plant a tree"
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dave Page
>>>>> Blog: http://pgsnake.blogspot.com
>>>>> Twitter: @pgsnake
>>>>>
>>>>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>> The Enterprise PostgreSQL Company
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Thanks and Regards,
>>>> Aditya Toshniwal
>>>> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>> "Don't Complain about Heat, Plant a tree"
>>>>
>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>>
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
>> Software Engineer | EnterpriseDB Software Solutions | Pune
>> "Don't Complain about Heat, Plant a tree"
>>
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>



-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


Attachments:

  [application/octet-stream] 0003-RM3294.patch (8.5K, 3-0003-RM3294.patch)
  download | inline diff:
diff --git a/web/pgadmin/dashboard/static/js/dashboard.js b/web/pgadmin/dashboard/static/js/dashboard.js
index b888b6d5..09d885d7 100644
--- a/web/pgadmin/dashboard/static/js/dashboard.js
+++ b/web/pgadmin/dashboard/static/js/dashboard.js
@@ -249,8 +249,6 @@ define('pgadmin.dashboard', [
     // Handle treeview clicks
     object_selected: function(item, itemData, node) {
       let self = this;
-      /* Clear all the interval functions of previous dashboards */
-      self.clearIntervalId();
 
       if (itemData && itemData._type && dashboardVisible) {
         var treeHierarchy = node.getTreeNodeHierarchy(item),
@@ -291,6 +289,8 @@ define('pgadmin.dashboard', [
             url += self.sid;
             cancel_query_url += self.sid + '/';
             terminate_session_url += self.sid + '/';
+          } else {
+            is_server_dashboard = is_database_dashboard = false;
           }
         }
 
@@ -306,8 +306,10 @@ define('pgadmin.dashboard', [
               if (url !== $(dashboardPanel).data('dashboard_url') || (
                 url === $(dashboardPanel).data('dashboard_url') &&
                   $(dashboardPanel).data('server_status') == false)) {
-                // Clear out everything so any existing timers die off
                 $(div).empty();
+                /* Clear all the interval functions of previous dashboards */
+                self.clearIntervalId();
+
 
                 $.ajax({
                   url: url,
@@ -325,9 +327,6 @@ define('pgadmin.dashboard', [
                 });
                 $(dashboardPanel).data('server_status', true);
               }
-              else {
-                self.init_dashboard();
-              }
             } else {
               $(div).empty();
               $(div).html(
@@ -655,10 +654,6 @@ define('pgadmin.dashboard', [
     init_dashboard: function() {
       let self = this;
 
-      if(self.sid === -1 && self.did === -1) {
-        return;
-      }
-
       /* Cache may take time to load for the first time
        * Keep trying till available
        */
@@ -683,30 +678,7 @@ define('pgadmin.dashboard', [
     },
 
     reflectPreferences: function() {
-      /* Common things can come here */
       var self = this;
-      var div_sessions = $('.dashboard-container').find('#graph-sessions')[0];
-      var div_tps = $('.dashboard-container').find('#graph-tps')[0];
-      var div_ti = $('.dashboard-container').find('#graph-ti')[0];
-      var div_to = $('.dashboard-container').find('#graph-to')[0];
-      var div_bio = $('.dashboard-container').find('#graph-bio')[0];
-      var options_line = {
-        parseFloat: false,
-        xaxis: {
-          min: 100,
-          max: 0,
-          autoscale: 0,
-        },
-        yaxis: {
-          autoscale: 1,
-        },
-        legend: {
-          position: 'nw',
-          backgroundColor: '#D2E8FF',
-        },
-        shadowSize: 0,
-        resolution : 5,
-      };
 
       /* We will use old preferences for selective graph updates on preference change */
       if(self.preferences) {
@@ -718,60 +690,86 @@ define('pgadmin.dashboard', [
         self.old_preferences = self.preferences;
       }
 
-      if(self.preferences.show_graphs && $('#dashboard-graphs').hasClass('dashboard-hidden')) {
-        $('#dashboard-graphs').removeClass('dashboard-hidden');
-      }
-      else if(!self.preferences.show_graphs) {
-        $('#dashboard-graphs').addClass('dashboard-hidden');
-        self.clearIntervalId();
-      }
+      if(is_server_dashboard || is_database_dashboard) {
+        /* Common things can come here */
+        var div_sessions = $('.dashboard-container').find('#graph-sessions')[0];
+        var div_tps = $('.dashboard-container').find('#graph-tps')[0];
+        var div_ti = $('.dashboard-container').find('#graph-ti')[0];
+        var div_to = $('.dashboard-container').find('#graph-to')[0];
+        var div_bio = $('.dashboard-container').find('#graph-bio')[0];
+        var options_line = {
+          parseFloat: false,
+          xaxis: {
+            min: 100,
+            max: 0,
+            autoscale: 0,
+          },
+          yaxis: {
+            autoscale: 1,
+          },
+          legend: {
+            position: 'nw',
+            backgroundColor: '#D2E8FF',
+          },
+          shadowSize: 0,
+          resolution : 5,
+        };
+
+        if(self.preferences.show_graphs && $('#dashboard-graphs').hasClass('dashboard-hidden')) {
+          $('#dashboard-graphs').removeClass('dashboard-hidden');
+        }
+        else if(!self.preferences.show_graphs) {
+          $('#dashboard-graphs').addClass('dashboard-hidden');
+          self.clearIntervalId();
+        }
 
-      if (self.preferences.show_activity && $('#dashboard-activity').hasClass('dashboard-hidden')) {
-        $('#dashboard-activity').removeClass('dashboard-hidden');
-      }
-      else if(!self.preferences.show_activity) {
-        $('#dashboard-activity').addClass('dashboard-hidden');
-      }
+        if (self.preferences.show_activity && $('#dashboard-activity').hasClass('dashboard-hidden')) {
+          $('#dashboard-activity').removeClass('dashboard-hidden');
+        }
+        else if(!self.preferences.show_activity) {
+          $('#dashboard-activity').addClass('dashboard-hidden');
+        }
 
-      if(self.preferences.show_graphs) {
-        // Render the graphs
-        pgAdmin.Dashboard.render_chart(
-          div_sessions, url_for('dashboard.session_stats'), options_line, false,
-          'session_stats', 'session_stats_refresh'
-        );
-        pgAdmin.Dashboard.render_chart(
-          div_tps, url_for('dashboard.tps_stats'), options_line, true,
-          'tps_stats','tps_stats_refresh'
-        );
-        pgAdmin.Dashboard.render_chart(
-          div_ti, url_for('dashboard.ti_stats'), options_line, true,
-          'ti_stats', 'ti_stats_refresh'
-        );
-        pgAdmin.Dashboard.render_chart(
-          div_to, url_for('dashboard.to_stats'), options_line, true,
-          'to_stats','to_stats_refresh'
-        );
-        pgAdmin.Dashboard.render_chart(
-          div_bio, url_for('dashboard.bio_stats'), options_line, true,
-          'bio_stats','bio_stats_refresh'
-        );
-      }
+        if(self.preferences.show_graphs) {
+          // Render the graphs
+          pgAdmin.Dashboard.render_chart(
+            div_sessions, url_for('dashboard.session_stats'), options_line, false,
+            'session_stats', 'session_stats_refresh'
+          );
+          pgAdmin.Dashboard.render_chart(
+            div_tps, url_for('dashboard.tps_stats'), options_line, true,
+            'tps_stats','tps_stats_refresh'
+          );
+          pgAdmin.Dashboard.render_chart(
+            div_ti, url_for('dashboard.ti_stats'), options_line, true,
+            'ti_stats', 'ti_stats_refresh'
+          );
+          pgAdmin.Dashboard.render_chart(
+            div_to, url_for('dashboard.to_stats'), options_line, true,
+            'to_stats','to_stats_refresh'
+          );
+          pgAdmin.Dashboard.render_chart(
+            div_bio, url_for('dashboard.bio_stats'), options_line, true,
+            'bio_stats','bio_stats_refresh'
+          );
+        }
 
-      /* Dashboard specific preferences can be updated in the
-       * appropriate functions
-       */
-      if(is_server_dashboard) {
-        self.reflectPreferencesServer();
-      }
-      else if(is_database_dashboard) {
-        self.reflectPreferencesDatabase();
-      }
+        if(!self.preferences.show_graphs && !self.preferences.show_activity) {
+          $('#dashboard-none-show').removeClass('dashboard-hidden');
+        }
+        else {
+          $('#dashboard-none-show').addClass('dashboard-hidden');
+        }
 
-      if(!self.preferences.show_graphs && !self.preferences.show_activity) {
-        $('#dashboard-none-show').removeClass('dashboard-hidden');
-      }
-      else {
-        $('#dashboard-none-show').addClass('dashboard-hidden');
+        /* Dashboard specific preferences can be updated in the
+         * appropriate functions
+         */
+        if(is_server_dashboard) {
+          self.reflectPreferencesServer();
+        }
+        else if(is_database_dashboard) {
+          self.reflectPreferencesDatabase();
+        }
       }
     },
     reflectPreferencesServer: function() {
@@ -1313,12 +1311,7 @@ define('pgadmin.dashboard', [
       }
     },
     toggleVisibility: function(flag) {
-//      let self = this;
       dashboardVisible = flag;
-
-//      if(dashboardVisible) {
-//        self.init_dashboard();
-//      }
     },
     can_take_action: function(m) {
       // We will validate if user is allowed to cancel the active query


view thread (14+ messages)

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], [email protected], [email protected]
  Subject: Re: [pgAdmin4][RM3294] User need to reset the layout to see the changed preferences parameters
  In-Reply-To: <CAM9w-_nB=34mi5Ekk-JZfZcg=NpLwh4Xiy3ViJrW8tFs-tAQEg@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