Subject: [pgAdmin4][RM3294] User need to reset the layout to see the changed preferences parameters

From: Aditya Toshniwal <[email-masked]>
Date: Thu, 28 Jun 2018 20:04:33 +0530

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"

---

From: Akshay Joshi <[email-masked]>
Date: Fri, 29 Jun 2018 15:42:27 +0530

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
   - Set the preferences setting "Open in new browser tab" to True and open
   the query tool. Refer "Open_In_New_Broswer.png".

I haven't review the code.

-- 
*Akshay Joshi*

*Sr. Software Architect *

*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*

---

From: Aditya Toshniwal <[email-masked]>
Date: Fri, 29 Jun 2018 16:46:33 +0530

Hi Akshay,

On Fri, Jun 29, 2018 at 3:42 PM, Akshay Joshi <[email-masked]
> wrote:

> ​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.​

> On Thu, Jun 28, 2018 at 8:04 PM, Aditya Toshniwal <aditya.toshniwal@
> enterprisedb.com> 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

---

From: Aditya Toshniwal <[email-masked]>
Date: Fri, 29 Jun 2018 19:44:46 +0530

Hi Hackers,

Attached is the updated patch.

On Fri, Jun 29, 2018 at 4:46 PM, Aditya Toshniwal <
[email-masked]> wrote:

> Hi Akshay,
>
> On Fri, Jun 29, 2018 at 3:42 PM, Akshay Joshi <
> [email-masked]> wrote:
>
>> Hi Aditya
>>

---

From: Dave Page <[email-masked]>
Date: Fri, 29 Jun 2018 17:00:04 +0100

Hi

> 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?

(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 <aditya.toshniwal@
> enterprisedb.com> wrote:
>
>> Hi Akshay,
>>
>>>> - 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
>>>> - SQL editor will not refer template JS variables anymore, once all
>>>> the references are removed the template variables will also be removed.

-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

---

From: Aditya Toshniwal <[email-masked]>
Date: Fri, 29 Jun 2018 22:39:23 +0530

Hi Dave,

On Fri, Jun 29, 2018 at 9:30 PM, Dave Page <[email-masked]> wrote:

> Hi
>
> On Fri, Jun 29, 2018 at 3:14 PM, Aditya Toshniwal <aditya.toshniwal@
> enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
> - Changing a preference from a Query Tool does *not* update the other
> Query Tool.
>

​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.​

---

From: Aditya Toshniwal <[email-masked]>
Date: Wed, 4 Jul 2018 14:49:44 +0530

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-masked]> wrote:

>>>>>    - 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.​
>>>>
>>>>

---

From: Dave Page <[email-masked]>
Date: Thu, 5 Jul 2018 11:39:29 +0100

Thanks - patch applied!

On Wed, Jul 4, 2018 at 10:19 AM, Aditya Toshniwal <
[email-masked]> wrote:

> On Fri, Jun 29, 2018 at 10:39 PM, Aditya Toshniwal <aditya.toshniwal@
> enterprisedb.com> wrote:
>
>> Hi Dave,
>>
>>>>>> I have applied your patch and run pgAdmin4. I have found following
>>>>>> two issue in the browser:
>>>>>>

---

From: Aditya Toshniwal <[email-masked]>
Date: Tue, 24 Jul 2018 16:09:25 +0530

Hi Hackers,

Attached is the second part of the changes for making preferences realtime.
The patch includes dashboard and debugger modules.
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.
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-masked]> wrote:

> Thanks - patch applied!
>
> On Wed, Jul 4, 2018 at 10:19 AM, Aditya Toshniwal <aditya.toshniwal@
> enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
>>>> 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.
>>>>
>>>>>>>> - 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
>>>>>>>> - SQL editor will not refer template JS variables anymore, once
>>>>>>>> all the references are removed the template variables will also be removed.

---

From: Aditya Toshniwal <[email-masked]>
Date: Tue, 24 Jul 2018 16:13:57 +0530

Adding to previous mail,

I have removed shadow from graph lines and increased resolution for better
visibility and fixed few issues related to graphs.

On Tue, Jul 24, 2018 at 4:09 PM, Aditya Toshniwal <
[email-masked]> wrote:

> Hi Hackers,
>
> Attached is the second part of the changes for making preferences
> realtime. The patch includes dashboard and debugger modules.
>>>>> 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

---

From: Dave Page <[email-masked]>
Date: Tue, 24 Jul 2018 12:02:49 +0100

Hi

> 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 :-)

> and debugger modules as currently there is no setup for the test cases of

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.

---

From: Aditya Toshniwal <[email-masked]>
Date: Tue, 24 Jul 2018 18:41:34 +0530

Hi,

On Tue, Jul 24, 2018 at 4:32 PM, Dave Page <[email-masked]> wrote:

> Hi
>
> On Tue, Jul 24, 2018 at 11:39 AM, Aditya Toshniwal <aditya.toshniwal@
> enterprisedb.com> wrote:
>
>> Hi Hackers,
>>
> 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.
>>
>
>>>>> ​No this was not intentional. It should reflect in other query tools
>>>>> as well because changing the flags like Auto Commit changes the preferences
>>>>>>>>>    - 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.​
>>>>>>>>
>>>>>>>>
>>>>>>>>>> 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.
>>>>>>>>>>

---

From: Dave Page <[email-masked]>
Date: Tue, 24 Jul 2018 16:31:53 +0100

Thanks, applied.

On Tue, Jul 24, 2018 at 2:11 PM, Aditya Toshniwal <
[email-masked]> wrote:

>>>>> 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.
>>>>>
>>>>>>> - Changing a preference from a Query Tool does *not* update the
>>>>>>> other Query Tool.
>>>>>>>
>>>>>>>>>> I have applied your patch and run pgAdmin4. I have found
>>>>>>>>>> following two issue in the browser:
>>>>>>>>>>
>>>>>>>>>>> - 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.

---

From: Aditya Toshniwal <[email-masked]>
Date: Wed, 25 Jul 2018 15:02:33 +0530

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-masked]> wrote:

> Thanks, applied.
>
> On Tue, Jul 24, 2018 at 2:11 PM, Aditya Toshniwal <aditya.toshniwal@
> enterprisedb.com> wrote:
>
>> Hi,
>>
>>>>>>>> This seems to work for the most part, however I saw what seemed
>>>>>>>> like odd behaviour. If I have 2 query tool windows open;
>>>>>>>>
>>>>>>>>>>>> - SQL editor will not refer template JS variables anymore,
>>>>>>>>>>>> once all the references are removed the template variables will also be
>>>>>>>>>>>> removed.