[pgAdmin4][Patch#2902] To add ALT tags for images in pgAdmin4

2018-01-08 Thread Murtuza Zabuawala
Hi,

PFA patch to add ALT tags in all the images for accessibility.
RM#2902


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/about/templates/about/index.html 
b/web/pgadmin/about/templates/about/index.html
index eced428..61576cc 100644
--- a/web/pgadmin/about/templates/about/index.html
+++ b/web/pgadmin/about/templates/about/index.html
@@ -26,6 +26,7 @@
 
 
+alt="{{ config.APP_NAME }} {{ _('logo') }}"
+>
 
 
diff --git a/web/pgadmin/browser/static/js/wizard.js 
b/web/pgadmin/browser/static/js/wizard.js
index d088aa7..2f2209a 100644
--- a/web/pgadmin/browser/static/js/wizard.js
+++ b/web/pgadmin/browser/static/js/wizard.js
@@ -1,6 +1,6 @@
 define(
-['underscore', 'backbone', 'sources/pgadmin', 'pgadmin.browser'],
-function(_, Backbone, pgAdmin, pgBrowser) {
+['underscore', 'backbone', 'sources/pgadmin', 'pgadmin.browser', 
'sources/gettext'],
+function(_, Backbone, pgAdmin, pgBrowser, gettext) {
 
   pgBrowser = pgBrowser || pgAdmin.Browser || {};
 
@@ -61,9 +61,11 @@ function(_, Backbone, pgAdmin, pgBrowser) {
+ "  "
+ "  <% if (this.options.show_header_cancel_btn) { %>"
+ ""
-   + "  "
+   + "  "
+ "  <% if (this.options.show_header_maximize_btn) { %>"
-   + ""
+   + ""
+ "  <% } %>"
+ ""
+ "  <% } %>"
@@ -72,7 +74,8 @@ function(_, Backbone, pgAdmin, pgBrowser) {
+ "  "
+ "<% if (this.options.show_left_panel) { %>"
+ "  "
-   + "  "
+   + "  "
+ "<% } %>"
+ ""
@@ -105,19 +108,21 @@ function(_, Backbone, pgAdmin, pgBrowser) {
+ "  "
+ ""
+ "  "
-   + ">"
+   + ">"
+ "  "
+ "  "
+ "  "
+ ""
+ "  >"
-   + "Back"
-   + "  >Next"
+   + "" + gettext("Back") + 
""
+   + "  >"
+   +  gettext("Next")
+ ""
+ "  >"
-   + "Cancel"
+   + "" + 
gettext("Cancel") + ""
+ "  >"
-   + "Finish"
+   +  gettext("Finish") + ""
+ ""
+ "  "
+ ""
diff --git a/web/pgadmin/browser/templates/browser/index.html 
b/web/pgadmin/browser/templates/browser/index.html
index 88ea27f..f2ff744 100644
--- a/web/pgadmin/browser/templates/browser/index.html
+++ b/web/pgadmin/browser/templates/browser/index.html
@@ -124,7 +124,8 @@ window.onload = function(e){
 
 
 
-
+
 
  {{ config.APP_NAME }}
 
diff --git a/web/pgadmin/dashboard/templates/dashboard/welcome_dashboard.html 
b/web/pgadmin/dashboard/templates/dashboard/welcome_dashboard.html
index 08551fe..6a32d78 100644
--- a/web/pgadmin/dashboard/templates/dashboard/welcome_dashboard.html
+++ b/web/pgadmin/dashboard/templates/dashboard/welcome_dashboard.html
@@ -5,7 +5,8 @@
 {{ _('Welcome') }}
 
 
-
+
 {{ _('Feature rich') }} | {{ _('Maximises PostgreSQL') }} 
| {{ _('Open Source') }} 
 
 {{ _('pgAdmin is an Open Source administration and 
management tool for the PostgreSQL database. It includes a graphical 
administration interface, an SQL query tool, a procedural code debugger and 
much more. The tool is designed to answer the needs of developers, DBAs and 
system administrators alike.') }}
diff --git a/web/pgadmin/misc/file_manager/static/js/utility.js 
b/web/pgadmin/misc/file_manager/static/js/utility.js
index 95e57e1..d433b8e 100755
--- a/web/pgadmin/misc/file_manager/static/js/utility.js
+++ b/web/pgadmin/misc/file_manager/static/js/utility.js
@@ -534,7 +534,7 @@ var getFolderInfo = function(path, file_type) {
 
   // Display an activity indicator.
   $('.fileinfo').find('span.activity').html(
-''
+''
   );
 
   var post_data = {
diff --git a/web/pgadmin/misc/file_manager/templates/file_manager/index.html 
b/web/pgadmin/misc/file_manager/templates/file_manager/index.html
index 064a128..980f5af 100755
--- a/web/pgadmin/misc/file_manager/templates/file_manager/index.html
+++ b/web/pgadmin/misc/file_manager/templates/file_manager/index.html
@@ -37,7 +37,8 @@
 
 
 
-  
+  
 
 
 
diff --git a/web/pgadmin/templates/security/change_password.html 
b/web/pgadmin/templates/security/change_password.html
index 48cb8cd..e7b3945 10064

Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires

2018-01-08 Thread Dave Page
Hi

On Fri, Jan 5, 2018 at 7:50 AM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> Further details:
>
> 1. If session is expired and user performs any action from sqleditor that
> makes ajax call
> then in ajax error call back user can check and handle login related error
> using code snippet.
>
> if (pgAdmin.Browser.UserManagement.is_pga_login_required(xhr)) {
>   return pgAdmin.Browser.UserManagement.pga_login();
> }
>
> Where is xhr is standard xhr or jqxhr object.
>
> 2. Similarly for connection lost (only maintenance db connection as we can
> recover or reconnect other
> connections if maintenance db connection is alive). It will attempt to
> create/reconnect connection without
> asking password (to handle passwordless connection, or saveed password  or
> password from pgpass file)
> If connection to database still fails then it'll prompt for password.
>
> Code snippet:
> SqlEditorController.handle_connection_lost();
>  once connection lost is detected one can call handle_connection_lost() to
> reconnect.
>
> 3. We maintain some additional data in session to maintain affinity between
> each sqleditor/datagrid instance to backend database connection. However
> if session expires and user
> re-loggins then we need to first restore affinity between sqleditor to
> backend database before we can start
> using query tool.
>
> Code snippet:
>
> if(is_new_transaction_required(xhr)) {
>   SqlEditorController.init_transaction();
> }
>
> (note: I haven't looked at the code yet)

How does this handle re-establishment of the connection mid-transaction,
or, if the user has modified any session variables?

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

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


Re: [pgAdmin4][Patch]: Adding connection status in Query tool

2018-01-08 Thread Dave Page
Hi

On Fri, Jan 5, 2018 at 8:49 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Dave,
>
> PFA updated patch,
>
>
> On Wed, Jan 3, 2018 at 10:44 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Thu, Dec 28, 2017 at 9:38 AM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> PFA updated patch based on new design suggested by Chethana.
>>> The patch also includes some misc fixes related to object validation.
>>> RM#2475
>>>
>>
>> This seems much nicer, but I still think there are some tweaks to make:
>>
>> 1) If I open a query tool, and then stop the application server, the icon
>> is updated to show the broken connection. However, unless I execute a query
>> in the query tool before the server is shut down, the connection status
>> won't recover when the server is restarted. If I do run a query first
>> (SELECT 1; will do), then the connection status will recover.
>>
>
> I have logged​
> ​
> https://redmine.postgresql.org/issues/2983
>
>
>> 2) I think the "connected" icon should be in $primary-blue (#2c76b4). The
>> green is ugly and not overly easy to read. It's also distracting as it
>> catches the eye, which the default, non-error state should not do.
>>
> ​Fixed​
>
>

Much better.


>
>
>> 3) I'm not overly happy with the the status text popover. After some
>> thought, I think it's because there are no visual clues that you should
>> click on the icon to see it - and Karen seems to be of a similar opinion.
>> Can we put a small marker there, perhaps a triangle on the bottom-right,
>> like you get on a spreadsheet cell if you add a comment/note? We should
>> also have a hotkey and I guess a tooltip, e.g. "Connection status
>> Ctrl+Alt+S" or similar.
>>
> ​Fixed​
> , added accesskey *'T'* for TX status tooltip shortcut as 'S' is already
> taken for Save file option
>

Hmm - having seen it, I don't think the marker helps us.

Can you remove it, and fix the tooltip (which doesn't seem to work)? If we
always have the tooltip say "Connection status Ctrl+Alt+T" (or whatever is
appropriate for the platform/browser), then that should give the user
enough hint to click.

Thanks!


>
>
>> Thanks!
>>
>>
>>>
>>> Please review.
>>>
>>> --
>>> Regards,
>>> Murtuza Zabuawala
>>> EnterpriseDB: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>>
>>> On Fri, Dec 22, 2017 at 11:53 AM, Chethana Kumar <
>>> chethana.ku...@enterprisedb.com> wrote:
>>>
 Yes Dave.

 Now it is clearly differentiated, please check and confirm.

 Thanks,
 Chethana kumar

 On Fri, Dec 22, 2017 at 12:08 AM, Dave Page  wrote:

> Hi
>
> There are 2 icons that look the same except for colour. That’s not
> going to work for some users with colour blindness.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK:http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On 21 Dec 2017, at 15:32, Chethana Kumar <
> chethana.ku...@enterprisedb.com> wrote:
>
> Hi Team,
>
> I have refined the icon once again for database connection status in
> query tool itself.
>
> Below are the 5 different status that I have attached as screenshot -
>
> 1_busy
> 2_error_in_transaction
> 3_valid_transaction_in_idle
> 4_database_connected
> 5_database_disconnected
>
> Please provide your inputs.
>
> Regards,
> Chethana kumar
>
>
> On Tue, Dec 19, 2017 at 5:12 PM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA patch to add the connection status
>> 
>> in query tool, this feature will allow user to check the database
>> connection status in query tool itself, it will also provide the detailed
>> status as a tooltip when user hovers on it, the most benefit of the 
>> feature
>> will be when user open query tool in new Browser Tab where Browser tree 
>> is
>> not visible to user, user can also configure the status polling time 
>> using
>> preference dialog.
>> RM#2475
>>
>> Apart from that I have also removed the
>> ..sqleditor/static/css/sqleditor.css reference from
>> ../datagrid/templates/datagrid/index.html file because we are
>> already bundling the "sqleditor.css" file in main "style.css" file.
>>
>>
>> Thanks to Chethana for his UI related inputs and to Surinder for
>> helping me on html alignment issues.
>>
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>
>
> --
> Chethana Kumar
> Principal UI/UX Designer
> EnterpriseDB Corporation
>
>
> The Postgres Database Company
>
> P: +91 86981 57146 <+91%2086981%20571

Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires

2018-01-08 Thread Harshal Dhumal
On Mon, Jan 8, 2018 at 4:34 PM, Dave Page  wrote:

> Hi
>
> On Fri, Jan 5, 2018 at 7:50 AM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> Further details:
>>
>> 1. If session is expired and user performs any action from sqleditor that
>> makes ajax call
>> then in ajax error call back user can check and handle login related
>> error using code snippet.
>>
>> if (pgAdmin.Browser.UserManagement.is_pga_login_required(xhr)) {
>>   return pgAdmin.Browser.UserManagement.pga_login();
>> }
>>
>> Where is xhr is standard xhr or jqxhr object.
>>
>> 2. Similarly for connection lost (only maintenance db connection as we
>> can recover or reconnect other
>> connections if maintenance db connection is alive). It will attempt to
>> create/reconnect connection without
>> asking password (to handle passwordless connection, or saveed password
>>  or password from pgpass file)
>> If connection to database still fails then it'll prompt for password.
>>
>> Code snippet:
>> SqlEditorController.handle_connection_lost();
>>  once connection lost is detected one can call handle_connection_lost()
>> to reconnect.
>>
>> 3. We maintain some additional data in session to maintain affinity
>> between
>> each sqleditor/datagrid instance to backend database connection. However
>> if session expires and user
>> re-loggins then we need to first restore affinity between sqleditor to
>> backend database before we can start
>> using query tool.
>>
>> Code snippet:
>>
>> if(is_new_transaction_required(xhr)) {
>>   SqlEditorController.init_transaction();
>> }
>>
>> (note: I haven't looked at the code yet)
>
> How does this handle re-establishment of the connection mid-transaction,
> or, if the user has modified any session variables?
>
> ServeManager and Connection Manager are written in a such way that if any
connection is lost except maintenance db connection
then we can re-connect or create new connection without prompting for
database password and if maintenance db connection is lost
then It prompts for password.

Regarding session variables as long as flask session is not expired we uses
same session variables. But in case of user logout (due to
flask session expire) we create new transaction id and sets new session
variables for that particular Sql editor /datagrid instance.




> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires

2018-01-08 Thread Dave Page
HI

On Mon, Jan 8, 2018 at 11:41 AM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> On Mon, Jan 8, 2018 at 4:34 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Fri, Jan 5, 2018 at 7:50 AM, Harshal Dhumal <
>> harshal.dhu...@enterprisedb.com> wrote:
>>
>>> Further details:
>>>
>>> 1. If session is expired and user performs any action from sqleditor
>>> that makes ajax call
>>> then in ajax error call back user can check and handle login related
>>> error using code snippet.
>>>
>>> if (pgAdmin.Browser.UserManagement.is_pga_login_required(xhr)) {
>>>   return pgAdmin.Browser.UserManagement.pga_login();
>>> }
>>>
>>> Where is xhr is standard xhr or jqxhr object.
>>>
>>> 2. Similarly for connection lost (only maintenance db connection as we
>>> can recover or reconnect other
>>> connections if maintenance db connection is alive). It will attempt to
>>> create/reconnect connection without
>>> asking password (to handle passwordless connection, or saveed password
>>>  or password from pgpass file)
>>> If connection to database still fails then it'll prompt for password.
>>>
>>> Code snippet:
>>> SqlEditorController.handle_connection_lost();
>>>  once connection lost is detected one can call handle_connection_lost()
>>> to reconnect.
>>>
>>> 3. We maintain some additional data in session to maintain affinity
>>> between
>>> each sqleditor/datagrid instance to backend database connection. However
>>> if session expires and user
>>> re-loggins then we need to first restore affinity between sqleditor to
>>> backend database before we can start
>>> using query tool.
>>>
>>> Code snippet:
>>>
>>> if(is_new_transaction_required(xhr)) {
>>>   SqlEditorController.init_transaction();
>>> }
>>>
>>> (note: I haven't looked at the code yet)
>>
>> How does this handle re-establishment of the connection mid-transaction,
>> or, if the user has modified any session variables?
>>
>> ServeManager and Connection Manager are written in a such way that if any
> connection is lost except maintenance db connection
> then we can re-connect or create new connection without prompting for
> database password and if maintenance db connection is lost
> then It prompts for password.
>

Right.


>
> Regarding session variables as long as flask session is not expired we
> uses same session variables. But in case of user logout (due to
> flask session expire) we create new transaction id and sets new session
> variables for that particular Sql editor /datagrid instance.
>

I mean DB session variables (and related things). For example, if the user
executed queries such as the following, then they absolutely need to know
if the session got reset:

CREATE TEMPORARY TABLE 
SET ROLE ...
SET [various other options]

If the user has done any of those things (or similar things that I haven't
thought of), then we cannot just blindly reset the database connection.

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

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


Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires

2018-01-08 Thread Harshal Dhumal
On Mon, Jan 8, 2018 at 5:15 PM, Dave Page  wrote:

> HI
>
> On Mon, Jan 8, 2018 at 11:41 AM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> On Mon, Jan 8, 2018 at 4:34 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Fri, Jan 5, 2018 at 7:50 AM, Harshal Dhumal <
>>> harshal.dhu...@enterprisedb.com> wrote:
>>>
 Further details:

 1. If session is expired and user performs any action from sqleditor
 that makes ajax call
 then in ajax error call back user can check and handle login related
 error using code snippet.

 if (pgAdmin.Browser.UserManagement.is_pga_login_required(xhr)) {
   return pgAdmin.Browser.UserManagement.pga_login();
 }

 Where is xhr is standard xhr or jqxhr object.

 2. Similarly for connection lost (only maintenance db connection as we
 can recover or reconnect other
 connections if maintenance db connection is alive). It will attempt to
 create/reconnect connection without
 asking password (to handle passwordless connection, or saveed password
  or password from pgpass file)
 If connection to database still fails then it'll prompt for password.

 Code snippet:
 SqlEditorController.handle_connection_lost();
  once connection lost is detected one can call handle_connection_lost()
 to reconnect.

 3. We maintain some additional data in session to maintain affinity
 between
 each sqleditor/datagrid instance to backend database connection.
 However if session expires and user
 re-loggins then we need to first restore affinity between sqleditor to
 backend database before we can start
 using query tool.

 Code snippet:

 if(is_new_transaction_required(xhr)) {
   SqlEditorController.init_transaction();
 }

 (note: I haven't looked at the code yet)
>>>
>>> How does this handle re-establishment of the connection mid-transaction,
>>> or, if the user has modified any session variables?
>>>
>>> ServeManager and Connection Manager are written in a such way that if
>> any connection is lost except maintenance db connection
>> then we can re-connect or create new connection without prompting for
>> database password and if maintenance db connection is lost
>> then It prompts for password.
>>
>
> Right.
>
>
>>
>> Regarding session variables as long as flask session is not expired we
>> uses same session variables. But in case of user logout (due to
>> flask session expire) we create new transaction id and sets new session
>> variables for that particular Sql editor /datagrid instance.
>>
>
> I mean DB session variables (and related things). For example, if the user
> executed queries such as the following, then they absolutely need to know
> if the session got reset:
>

Ok.
Then in this case can we notify user about the same. That we're unable to
restore old database connection and created new one and therefore
any DB session variables were set/modified (like SET CLIENT_ENCODING...,
SET DATESTYLE...) are lost (or similar message).



> CREATE TEMPORARY TABLE 
> SET ROLE ...
> SET [various other options]
>
> If the user has done any of those things (or similar things that I haven't
> thought of), then we cannot just blindly reset the database connection.
>

We only create new connection if flask session was expired as we lost
transaction id associated with Sql editor/datagrid and therefore unique
connection id
given to connection which was associated to Sql editor/datagrid. In this
case we can notify about same (as stated above).


-- 
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires

2018-01-08 Thread Dave Page
On Mon, Jan 8, 2018 at 12:37 PM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> On Mon, Jan 8, 2018 at 5:15 PM, Dave Page  wrote:
>
>> HI
>>
>> On Mon, Jan 8, 2018 at 11:41 AM, Harshal Dhumal <
>> harshal.dhu...@enterprisedb.com> wrote:
>>
>>> On Mon, Jan 8, 2018 at 4:34 PM, Dave Page  wrote:
>>>
 Hi

 On Fri, Jan 5, 2018 at 7:50 AM, Harshal Dhumal <
 harshal.dhu...@enterprisedb.com> wrote:

> Further details:
>
> 1. If session is expired and user performs any action from sqleditor
> that makes ajax call
> then in ajax error call back user can check and handle login related
> error using code snippet.
>
> if (pgAdmin.Browser.UserManagement.is_pga_login_required(xhr)) {
>   return pgAdmin.Browser.UserManagement.pga_login();
> }
>
> Where is xhr is standard xhr or jqxhr object.
>
> 2. Similarly for connection lost (only maintenance db connection as we
> can recover or reconnect other
> connections if maintenance db connection is alive). It will attempt to
> create/reconnect connection without
> asking password (to handle passwordless connection, or saveed password
>  or password from pgpass file)
> If connection to database still fails then it'll prompt for password.
>
> Code snippet:
> SqlEditorController.handle_connection_lost();
>  once connection lost is detected one can call
> handle_connection_lost() to reconnect.
>
> 3. We maintain some additional data in session to maintain affinity
> between
> each sqleditor/datagrid instance to backend database connection.
> However if session expires and user
> re-loggins then we need to first restore affinity between sqleditor to
> backend database before we can start
> using query tool.
>
> Code snippet:
>
> if(is_new_transaction_required(xhr)) {
>   SqlEditorController.init_transaction();
> }
>
> (note: I haven't looked at the code yet)

 How does this handle re-establishment of the connection
 mid-transaction, or, if the user has modified any session variables?

 ServeManager and Connection Manager are written in a such way that if
>>> any connection is lost except maintenance db connection
>>> then we can re-connect or create new connection without prompting for
>>> database password and if maintenance db connection is lost
>>> then It prompts for password.
>>>
>>
>> Right.
>>
>>
>>>
>>> Regarding session variables as long as flask session is not expired we
>>> uses same session variables. But in case of user logout (due to
>>> flask session expire) we create new transaction id and sets new session
>>> variables for that particular Sql editor /datagrid instance.
>>>
>>
>> I mean DB session variables (and related things). For example, if the
>> user executed queries such as the following, then they absolutely need to
>> know if the session got reset:
>>
>
> Ok.
> Then in this case can we notify user about the same. That we're unable to
> restore old database connection and created new one and therefore
> any DB session variables were set/modified (like SET CLIENT_ENCODING...,
> SET DATESTYLE...) are lost (or similar message).
>
>
>
>> CREATE TEMPORARY TABLE 
>> SET ROLE ...
>> SET [various other options]
>>
>> If the user has done any of those things (or similar things that I
>> haven't thought of), then we cannot just blindly reset the database
>> connection.
>>
>
> We only create new connection if flask session was expired as we lost
> transaction id associated with Sql editor/datagrid and therefore unique
> connection id
> given to connection which was associated to Sql editor/datagrid. In this
> case we can notify about same (as stated above).
>

If it's only the flask session we're resetting, not the database
connection, we won't need to warn the user will we?

But... what if the database connection has also been lost in the meantime.
Would we handle that?

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

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


Re: [pgAdmin4][Patch#2902] To add ALT tags for images in pgAdmin4

2018-01-08 Thread Dave Page
Thanks, patch applied.

On Mon, Jan 8, 2018 at 9:54 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch to add ALT tags in all the images for accessibility.
> RM#2902
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>


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

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


pgAdmin 4 commit: Add ALT tags to images for accessibility. Fixes #2902

2018-01-08 Thread Dave Page
Add ALT tags to images for accessibility. Fixes #2902

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=aec86970f2620295a444d20958f53206fe1ec24d
Author: Murtuza Zabuawala 

Modified Files
--
web/pgadmin/about/templates/about/index.html   |  3 ++-
web/pgadmin/browser/static/js/wizard.js| 25 +-
web/pgadmin/browser/templates/browser/index.html   |  3 ++-
.../templates/dashboard/welcome_dashboard.html |  3 ++-
web/pgadmin/misc/file_manager/static/js/utility.js |  2 +-
.../file_manager/templates/file_manager/index.html |  3 ++-
.../templates/security/change_password.html|  3 ++-
.../templates/security/forgot_password.html|  3 ++-
web/pgadmin/templates/security/login_user.html |  3 ++-
web/pgadmin/templates/security/reset_password.html |  3 ++-
web/pgadmin/templates/security/watermark.html  |  4 +++-
11 files changed, 35 insertions(+), 20 deletions(-)



Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires

2018-01-08 Thread Harshal Dhumal
On Mon, Jan 8, 2018 at 6:11 PM, Dave Page  wrote:

>
>
> On Mon, Jan 8, 2018 at 12:37 PM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> On Mon, Jan 8, 2018 at 5:15 PM, Dave Page  wrote:
>>
>>> HI
>>>
>>> On Mon, Jan 8, 2018 at 11:41 AM, Harshal Dhumal <
>>> harshal.dhu...@enterprisedb.com> wrote:
>>>
 On Mon, Jan 8, 2018 at 4:34 PM, Dave Page  wrote:

> Hi
>
> On Fri, Jan 5, 2018 at 7:50 AM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> Further details:
>>
>> 1. If session is expired and user performs any action from sqleditor
>> that makes ajax call
>> then in ajax error call back user can check and handle login related
>> error using code snippet.
>>
>> if (pgAdmin.Browser.UserManagement.is_pga_login_required(xhr)) {
>>   return pgAdmin.Browser.UserManagement.pga_login();
>> }
>>
>> Where is xhr is standard xhr or jqxhr object.
>>
>> 2. Similarly for connection lost (only maintenance db connection as
>> we can recover or reconnect other
>> connections if maintenance db connection is alive). It will attempt
>> to create/reconnect connection without
>> asking password (to handle passwordless connection, or saveed
>> password  or password from pgpass file)
>> If connection to database still fails then it'll prompt for password.
>>
>> Code snippet:
>> SqlEditorController.handle_connection_lost();
>>  once connection lost is detected one can call
>> handle_connection_lost() to reconnect.
>>
>> 3. We maintain some additional data in session to maintain affinity
>> between
>> each sqleditor/datagrid instance to backend database connection.
>> However if session expires and user
>> re-loggins then we need to first restore affinity between sqleditor
>> to backend database before we can start
>> using query tool.
>>
>> Code snippet:
>>
>> if(is_new_transaction_required(xhr)) {
>>   SqlEditorController.init_transaction();
>> }
>>
>> (note: I haven't looked at the code yet)
>
> How does this handle re-establishment of the connection
> mid-transaction, or, if the user has modified any session variables?
>
> ServeManager and Connection Manager are written in a such way that if
 any connection is lost except maintenance db connection
 then we can re-connect or create new connection without prompting for
 database password and if maintenance db connection is lost
 then It prompts for password.

>>>
>>> Right.
>>>
>>>

 Regarding session variables as long as flask session is not expired we
 uses same session variables. But in case of user logout (due to
 flask session expire) we create new transaction id and sets new session
 variables for that particular Sql editor /datagrid instance.

>>>
>>> I mean DB session variables (and related things). For example, if the
>>> user executed queries such as the following, then they absolutely need to
>>> know if the session got reset:
>>>
>>
>> Ok.
>> Then in this case can we notify user about the same. That we're unable to
>> restore old database connection and created new one and therefore
>> any DB session variables were set/modified (like SET CLIENT_ENCODING...,
>> SET DATESTYLE...) are lost (or similar message).
>>
>>
>>
>>> CREATE TEMPORARY TABLE 
>>> SET ROLE ...
>>> SET [various other options]
>>>
>>> If the user has done any of those things (or similar things that I
>>> haven't thought of), then we cannot just blindly reset the database
>>> connection.
>>>
>>
>> We only create new connection if flask session was expired as we lost
>> transaction id associated with Sql editor/datagrid and therefore unique
>> connection id
>> given to connection which was associated to Sql editor/datagrid. In this
>> case we can notify about same (as stated above).
>>
>
> If it's only the flask session we're resetting, not the database
> connection, we won't need to warn the user will we?
>

The problem here is that if flask session is reset then we lose the
information about which connection was associate with which query
tool/datagrid.

lets say If user have opened 3 query tools with same database therefore
we'll have 3 separate connections
(each will have unique connection id). Now this information that which
connection is associate with which query
tool is lost and also unique connection id. So there is no way that we can
get that connection
from connection manager ( *manager.connection(did=,
conn_id=)* ).

So even database connection was not lost and only flask session was reset
we need to create new connection. So I think we'll need to warn user.

Also If we save connection id to client side (in browser in JS) still we
won't be able to get same connection
even though we know connection id in case of flask session reset. As for
each logged in user (pgAdmin user)
but for same database server we cr

Re: [pgAdmin4][Patch]: Adding connection status in Query tool

2018-01-08 Thread Murtuza Zabuawala
Hi Dave,

PFA updated patch.

On Mon, Jan 8, 2018 at 5:11 PM, Dave Page  wrote:

> Hi
>
> On Fri, Jan 5, 2018 at 8:49 AM, Murtuza Zabuawala  enterprisedb.com> wrote:
>
>> Hi Dave,
>>
>> PFA updated patch,
>>
>>
>> On Wed, Jan 3, 2018 at 10:44 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Thu, Dec 28, 2017 at 9:38 AM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
 Hi,

 PFA updated patch based on new design suggested by Chethana.
 The patch also includes some misc fixes related to object validation.
 RM#2475

>>>
>>> This seems much nicer, but I still think there are some tweaks to make:
>>>
>>> 1) If I open a query tool, and then stop the application server, the
>>> icon is updated to show the broken connection. However, unless I execute a
>>> query in the query tool before the server is shut down, the connection
>>> status won't recover when the server is restarted. If I do run a query
>>> first (SELECT 1; will do), then the connection status will recover.
>>>
>>
>> I have logged​
>> ​
>> https://redmine.postgresql.org/issues/2983
>>
>>
>>> 2) I think the "connected" icon should be in $primary-blue (#2c76b4).
>>> The green is ugly and not overly easy to read. It's also distracting as it
>>> catches the eye, which the default, non-error state should not do.
>>>
>> ​Fixed​
>>
>>
>
> Much better.
>
>
>>
>>
>>> 3) I'm not overly happy with the the status text popover. After some
>>> thought, I think it's because there are no visual clues that you should
>>> click on the icon to see it - and Karen seems to be of a similar opinion.
>>> Can we put a small marker there, perhaps a triangle on the bottom-right,
>>> like you get on a spreadsheet cell if you add a comment/note? We should
>>> also have a hotkey and I guess a tooltip, e.g. "Connection status
>>> Ctrl+Alt+S" or similar.
>>>
>> ​Fixed​
>> , added accesskey *'T'* for TX status tooltip shortcut as 'S' is already
>> taken for Save file option
>>
>
> Hmm - having seen it, I don't think the marker helps us.
>
> Can you remove it, and fix the tooltip (which doesn't seem to work)? If we
> always have the tooltip say "Connection status Ctrl+Alt+T" (or whatever is
> appropriate for the platform/browser), then that should give the user
> enough hint to click.
>
​
Fixed​.
I have removed the marker & added tooltip instead but it is not possible to
add specific shortcut keys in tooltip because accesskey may vary depending
on OS & browser.
​Ref: ​
https://www.w3schools.com/tags/att_global_accesskey.asp


>
> Thanks!
>
>
>>
>>
>>> Thanks!
>>>
>>>

 Please review.

 --
 Regards,
 Murtuza Zabuawala
 EnterpriseDB: http://www.enterprisedb.com
 The Enterprise PostgreSQL Company


 On Fri, Dec 22, 2017 at 11:53 AM, Chethana Kumar <
 chethana.ku...@enterprisedb.com> wrote:

> Yes Dave.
>
> Now it is clearly differentiated, please check and confirm.
>
> Thanks,
> Chethana kumar
>
> On Fri, Dec 22, 2017 at 12:08 AM, Dave Page  wrote:
>
>> Hi
>>
>> There are 2 icons that look the same except for colour. That’s not
>> going to work for some users with colour blindness.
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK:http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On 21 Dec 2017, at 15:32, Chethana Kumar <
>> chethana.ku...@enterprisedb.com> wrote:
>>
>> Hi Team,
>>
>> I have refined the icon once again for database connection status in
>> query tool itself.
>>
>> Below are the 5 different status that I have attached as screenshot -
>>
>> 1_busy
>> 2_error_in_transaction
>> 3_valid_transaction_in_idle
>> 4_database_connected
>> 5_database_disconnected
>>
>> Please provide your inputs.
>>
>> Regards,
>> Chethana kumar
>>
>>
>> On Tue, Dec 19, 2017 at 5:12 PM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> PFA patch to add the connection status
>>> 
>>> in query tool, this feature will allow user to check the database
>>> connection status in query tool itself, it will also provide the 
>>> detailed
>>> status as a tooltip when user hovers on it, the most benefit of the 
>>> feature
>>> will be when user open query tool in new Browser Tab where Browser tree 
>>> is
>>> not visible to user, user can also configure the status polling time 
>>> using
>>> preference dialog.
>>> RM#2475
>>>
>>> Apart from that I have also removed the
>>> ..sqleditor/static/css/sqleditor.css reference from
>>> ../datagrid/templates/datagrid/index.html file because we are
>>> already bundling the "sqleditor.css" file in main "style.css" file.
>>>
>>>
>

Re: [pgAdmin4][Patch]: Adding connection status in Query tool

2018-01-08 Thread Dave Page
On Mon, Jan 8, 2018 at 1:24 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Dave,
>
> PFA updated patch.
>
> On Mon, Jan 8, 2018 at 5:11 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Fri, Jan 5, 2018 at 8:49 AM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi Dave,
>>>
>>> PFA updated patch,
>>>
>>>
>>> On Wed, Jan 3, 2018 at 10:44 PM, Dave Page  wrote:
>>>
 Hi

 On Thu, Dec 28, 2017 at 9:38 AM, Murtuza Zabuawala <
 murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA updated patch based on new design suggested by Chethana.
> The patch also includes some misc fixes related to object validation.
> RM#2475
>

 This seems much nicer, but I still think there are some tweaks to make:

 1) If I open a query tool, and then stop the application server, the
 icon is updated to show the broken connection. However, unless I execute a
 query in the query tool before the server is shut down, the connection
 status won't recover when the server is restarted. If I do run a query
 first (SELECT 1; will do), then the connection status will recover.

>>>
>>> I have logged​
>>> ​
>>> https://redmine.postgresql.org/issues/2983
>>>
>>>
 2) I think the "connected" icon should be in $primary-blue (#2c76b4).
 The green is ugly and not overly easy to read. It's also distracting as it
 catches the eye, which the default, non-error state should not do.

>>> ​Fixed​
>>>
>>>
>>
>> Much better.
>>
>>
>>>
>>>
 3) I'm not overly happy with the the status text popover. After some
 thought, I think it's because there are no visual clues that you should
 click on the icon to see it - and Karen seems to be of a similar opinion.
 Can we put a small marker there, perhaps a triangle on the bottom-right,
 like you get on a spreadsheet cell if you add a comment/note? We should
 also have a hotkey and I guess a tooltip, e.g. "Connection status
 Ctrl+Alt+S" or similar.

>>> ​Fixed​
>>> , added accesskey *'T'* for TX status tooltip shortcut as 'S' is
>>> already taken for Save file option
>>>
>>
>> Hmm - having seen it, I don't think the marker helps us.
>>
>> Can you remove it, and fix the tooltip (which doesn't seem to work)? If
>> we always have the tooltip say "Connection status Ctrl+Alt+T" (or whatever
>> is appropriate for the platform/browser), then that should give the user
>> enough hint to click.
>>
> ​
> Fixed​.
> I have removed the marker & added tooltip instead but it is not possible
> to add specific shortcut keys in tooltip because accesskey may vary
> depending on OS & browser.
> ​Ref: ​
> https://www.w3schools.com/tags/att_global_accesskey.asp
>

That's better - though I think the tool tip is better as something like:

Connection status (click for details) (+T)

I'm still not overly happy with all the polling that's going on though.
It's a lot of requests, especially with multiple QTs open. I think we need
to be able to disable the feature entirely through a switch in the
Preferences. In that case, no icon would be shown, and polling would be
disabled - i.e. everything would be as it is now.

What do you think?

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

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


Re: [pgAdmin4][Patch]: Adding connection status in Query tool

2018-01-08 Thread Ashesh Vashi
On Mon, Jan 8, 2018 at 7:21 PM, Dave Page  wrote:

>
>
> On Mon, Jan 8, 2018 at 1:24 PM, Murtuza Zabuawala  enterprisedb.com> wrote:
>
>> Hi Dave,
>>
>> PFA updated patch.
>>
>> On Mon, Jan 8, 2018 at 5:11 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Fri, Jan 5, 2018 at 8:49 AM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
 Hi Dave,

 PFA updated patch,


 On Wed, Jan 3, 2018 at 10:44 PM, Dave Page  wrote:

> Hi
>
> On Thu, Dec 28, 2017 at 9:38 AM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA updated patch based on new design suggested by Chethana.
>> The patch also includes some misc fixes related to object validation.
>> RM#2475
>>
>
> This seems much nicer, but I still think there are some tweaks to make:
>
> 1) If I open a query tool, and then stop the application server, the
> icon is updated to show the broken connection. However, unless I execute a
> query in the query tool before the server is shut down, the connection
> status won't recover when the server is restarted. If I do run a query
> first (SELECT 1; will do), then the connection status will recover.
>

 I have logged​
 ​
 https://redmine.postgresql.org/issues/2983


> 2) I think the "connected" icon should be in $primary-blue (#2c76b4).
> The green is ugly and not overly easy to read. It's also distracting as it
> catches the eye, which the default, non-error state should not do.
>
 ​Fixed​


>>>
>>> Much better.
>>>
>>>


> 3) I'm not overly happy with the the status text popover. After some
> thought, I think it's because there are no visual clues that you should
> click on the icon to see it - and Karen seems to be of a similar opinion.
> Can we put a small marker there, perhaps a triangle on the bottom-right,
> like you get on a spreadsheet cell if you add a comment/note? We should
> also have a hotkey and I guess a tooltip, e.g. "Connection status
> Ctrl+Alt+S" or similar.
>
 ​Fixed​
 , added accesskey *'T'* for TX status tooltip shortcut as 'S' is
 already taken for Save file option

>>>
>>> Hmm - having seen it, I don't think the marker helps us.
>>>
>>> Can you remove it, and fix the tooltip (which doesn't seem to work)? If
>>> we always have the tooltip say "Connection status Ctrl+Alt+T" (or whatever
>>> is appropriate for the platform/browser), then that should give the user
>>> enough hint to click.
>>>
>> ​
>> Fixed​.
>> I have removed the marker & added tooltip instead but it is not possible
>> to add specific shortcut keys in tooltip because accesskey may vary
>> depending on OS & browser.
>> ​Ref: ​
>> https://www.w3schools.com/tags/att_global_accesskey.asp
>>
>
> That's better - though I think the tool tip is better as something like:
>
> Connection status (click for details) (+T)
>
> I'm still not overly happy with all the polling that's going on though.
> It's a lot of requests, especially with multiple QTs open. I think we need
> to be able to disable the feature entirely through a switch in the
> Preferences. In that case, no icon would be shown, and polling would be
> disabled - i.e. everything would be as it is now.
>
> What do you think?
>
+1

-- Thanks, Ashesh

>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires

2018-01-08 Thread Dave Page
On Mon, Jan 8, 2018 at 1:18 PM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

>
> On Mon, Jan 8, 2018 at 6:11 PM, Dave Page  wrote:
>
>>
>>
>> On Mon, Jan 8, 2018 at 12:37 PM, Harshal Dhumal <
>> harshal.dhu...@enterprisedb.com> wrote:
>>
>>> On Mon, Jan 8, 2018 at 5:15 PM, Dave Page  wrote:
>>>
 HI

 On Mon, Jan 8, 2018 at 11:41 AM, Harshal Dhumal <
 harshal.dhu...@enterprisedb.com> wrote:

> On Mon, Jan 8, 2018 at 4:34 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Fri, Jan 5, 2018 at 7:50 AM, Harshal Dhumal <
>> harshal.dhu...@enterprisedb.com> wrote:
>>
>>> Further details:
>>>
>>> 1. If session is expired and user performs any action from sqleditor
>>> that makes ajax call
>>> then in ajax error call back user can check and handle login related
>>> error using code snippet.
>>>
>>> if (pgAdmin.Browser.UserManagement.is_pga_login_required(xhr)) {
>>>   return pgAdmin.Browser.UserManagement.pga_login();
>>> }
>>>
>>> Where is xhr is standard xhr or jqxhr object.
>>>
>>> 2. Similarly for connection lost (only maintenance db connection as
>>> we can recover or reconnect other
>>> connections if maintenance db connection is alive). It will attempt
>>> to create/reconnect connection without
>>> asking password (to handle passwordless connection, or saveed
>>> password  or password from pgpass file)
>>> If connection to database still fails then it'll prompt for password.
>>>
>>> Code snippet:
>>> SqlEditorController.handle_connection_lost();
>>>  once connection lost is detected one can call
>>> handle_connection_lost() to reconnect.
>>>
>>> 3. We maintain some additional data in session to maintain affinity
>>> between
>>> each sqleditor/datagrid instance to backend database connection.
>>> However if session expires and user
>>> re-loggins then we need to first restore affinity between sqleditor
>>> to backend database before we can start
>>> using query tool.
>>>
>>> Code snippet:
>>>
>>> if(is_new_transaction_required(xhr)) {
>>>   SqlEditorController.init_transaction();
>>> }
>>>
>>> (note: I haven't looked at the code yet)
>>
>> How does this handle re-establishment of the connection
>> mid-transaction, or, if the user has modified any session variables?
>>
>> ServeManager and Connection Manager are written in a such way that if
> any connection is lost except maintenance db connection
> then we can re-connect or create new connection without prompting for
> database password and if maintenance db connection is lost
> then It prompts for password.
>

 Right.


>
> Regarding session variables as long as flask session is not expired we
> uses same session variables. But in case of user logout (due to
> flask session expire) we create new transaction id and sets new
> session variables for that particular Sql editor /datagrid instance.
>

 I mean DB session variables (and related things). For example, if the
 user executed queries such as the following, then they absolutely need to
 know if the session got reset:

>>>
>>> Ok.
>>> Then in this case can we notify user about the same. That we're unable
>>> to restore old database connection and created new one and therefore
>>> any DB session variables were set/modified (like SET CLIENT_ENCODING...,
>>> SET DATESTYLE...) are lost (or similar message).
>>>
>>>
>>>
 CREATE TEMPORARY TABLE 
 SET ROLE ...
 SET [various other options]

 If the user has done any of those things (or similar things that I
 haven't thought of), then we cannot just blindly reset the database
 connection.

>>>
>>> We only create new connection if flask session was expired as we lost
>>> transaction id associated with Sql editor/datagrid and therefore unique
>>> connection id
>>> given to connection which was associated to Sql editor/datagrid. In this
>>> case we can notify about same (as stated above).
>>>
>>
>> If it's only the flask session we're resetting, not the database
>> connection, we won't need to warn the user will we?
>>
>
> The problem here is that if flask session is reset then we lose the
> information about which connection was associate with which query
> tool/datagrid.
>
> lets say If user have opened 3 query tools with same database therefore
> we'll have 3 separate connections
> (each will have unique connection id). Now this information that which
> connection is associate with which query
> tool is lost and also unique connection id. So there is no way that we can
> get that connection
> from connection manager ( *manager.connection(did=,
> conn_id=)* ).
>
> So even database connection was not lost and only flask session was reset
> we need to create new connection. So I think we'll need to warn user.
>

Agreed... and

Re: [pgAdmin4][Patch]: Adding connection status in Query tool

2018-01-08 Thread Murtuza Zabuawala
Yes, I agree, it's a good idea to have it optional, I'll work on it and
send updated patch.
by the way what should be default behaviour? Should we make it disabled by
default?


On Mon, Jan 8, 2018 at 7:26 PM, Ashesh Vashi 
wrote:

> On Mon, Jan 8, 2018 at 7:21 PM, Dave Page  wrote:
>
>>
>>
>> On Mon, Jan 8, 2018 at 1:24 PM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi Dave,
>>>
>>> PFA updated patch.
>>>
>>> On Mon, Jan 8, 2018 at 5:11 PM, Dave Page  wrote:
>>>
 Hi

 On Fri, Jan 5, 2018 at 8:49 AM, Murtuza Zabuawala <
 murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Dave,
>
> PFA updated patch,
>
>
> On Wed, Jan 3, 2018 at 10:44 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Thu, Dec 28, 2017 at 9:38 AM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> PFA updated patch based on new design suggested by Chethana.
>>> The patch also includes some misc fixes related to object validation.
>>> RM#2475
>>>
>>
>> This seems much nicer, but I still think there are some tweaks to
>> make:
>>
>> 1) If I open a query tool, and then stop the application server, the
>> icon is updated to show the broken connection. However, unless I execute 
>> a
>> query in the query tool before the server is shut down, the connection
>> status won't recover when the server is restarted. If I do run a query
>> first (SELECT 1; will do), then the connection status will recover.
>>
>
> I have logged​
> ​
> https://redmine.postgresql.org/issues/2983
>
>
>> 2) I think the "connected" icon should be in $primary-blue (#2c76b4).
>> The green is ugly and not overly easy to read. It's also distracting as 
>> it
>> catches the eye, which the default, non-error state should not do.
>>
> ​Fixed​
>
>

 Much better.


>
>
>> 3) I'm not overly happy with the the status text popover. After some
>> thought, I think it's because there are no visual clues that you should
>> click on the icon to see it - and Karen seems to be of a similar opinion.
>> Can we put a small marker there, perhaps a triangle on the bottom-right,
>> like you get on a spreadsheet cell if you add a comment/note? We should
>> also have a hotkey and I guess a tooltip, e.g. "Connection status
>> Ctrl+Alt+S" or similar.
>>
> ​Fixed​
> , added accesskey *'T'* for TX status tooltip shortcut as 'S' is
> already taken for Save file option
>

 Hmm - having seen it, I don't think the marker helps us.

 Can you remove it, and fix the tooltip (which doesn't seem to work)? If
 we always have the tooltip say "Connection status Ctrl+Alt+T" (or whatever
 is appropriate for the platform/browser), then that should give the user
 enough hint to click.

>>> ​
>>> Fixed​.
>>> I have removed the marker & added tooltip instead but it is not possible
>>> to add specific shortcut keys in tooltip because accesskey may vary
>>> depending on OS & browser.
>>> ​Ref: ​
>>> https://www.w3schools.com/tags/att_global_accesskey.asp
>>>
>>
>> That's better - though I think the tool tip is better as something like:
>>
>> Connection status (click for details) (+T)
>>
>> I'm still not overly happy with all the polling that's going on though.
>> It's a lot of requests, especially with multiple QTs open. I think we need
>> to be able to disable the feature entirely through a switch in the
>> Preferences. In that case, no icon would be shown, and polling would be
>> disabled - i.e. everything would be as it is now.
>>
>> What do you think?
>>
> +1
>
> -- Thanks, Ashesh
>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>


Re: [pgAdmin4][Patch]: Adding connection status in Query tool

2018-01-08 Thread Dave Page
On Mon, Jan 8, 2018 at 2:04 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Yes, I agree, it's a good idea to have it optional, I'll work on it and
> send updated patch.
> by the way what should be default behaviour? Should we make it disabled by
> default?
>

No - users probably won't find it then. I wonder if we should make the
default poll interval a couple of seconds (or more) though.


>
>
> On Mon, Jan 8, 2018 at 7:26 PM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>> On Mon, Jan 8, 2018 at 7:21 PM, Dave Page  wrote:
>>
>>>
>>>
>>> On Mon, Jan 8, 2018 at 1:24 PM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
 Hi Dave,

 PFA updated patch.

 On Mon, Jan 8, 2018 at 5:11 PM, Dave Page  wrote:

> Hi
>
> On Fri, Jan 5, 2018 at 8:49 AM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi Dave,
>>
>> PFA updated patch,
>>
>>
>> On Wed, Jan 3, 2018 at 10:44 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Thu, Dec 28, 2017 at 9:38 AM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
 Hi,

 PFA updated patch based on new design suggested by Chethana.
 The patch also includes some misc fixes related to object
 validation.
 RM#2475

>>>
>>> This seems much nicer, but I still think there are some tweaks to
>>> make:
>>>
>>> 1) If I open a query tool, and then stop the application server, the
>>> icon is updated to show the broken connection. However, unless I 
>>> execute a
>>> query in the query tool before the server is shut down, the connection
>>> status won't recover when the server is restarted. If I do run a query
>>> first (SELECT 1; will do), then the connection status will recover.
>>>
>>
>> I have logged​
>> ​
>> https://redmine.postgresql.org/issues/2983
>>
>>
>>> 2) I think the "connected" icon should be in $primary-blue
>>> (#2c76b4). The green is ugly and not overly easy to read. It's also
>>> distracting as it catches the eye, which the default, non-error state
>>> should not do.
>>>
>> ​Fixed​
>>
>>
>
> Much better.
>
>
>>
>>
>>> 3) I'm not overly happy with the the status text popover. After some
>>> thought, I think it's because there are no visual clues that you should
>>> click on the icon to see it - and Karen seems to be of a similar 
>>> opinion.
>>> Can we put a small marker there, perhaps a triangle on the bottom-right,
>>> like you get on a spreadsheet cell if you add a comment/note? We should
>>> also have a hotkey and I guess a tooltip, e.g. "Connection status
>>> Ctrl+Alt+S" or similar.
>>>
>> ​Fixed​
>> , added accesskey *'T'* for TX status tooltip shortcut as 'S' is
>> already taken for Save file option
>>
>
> Hmm - having seen it, I don't think the marker helps us.
>
> Can you remove it, and fix the tooltip (which doesn't seem to work)?
> If we always have the tooltip say "Connection status Ctrl+Alt+T" (or
> whatever is appropriate for the platform/browser), then that should give
> the user enough hint to click.
>
 ​
 Fixed​.
 I have removed the marker & added tooltip instead but it is not
 possible to add specific shortcut keys in tooltip because accesskey may
 vary depending on OS & browser.
 ​Ref: ​
 https://www.w3schools.com/tags/att_global_accesskey.asp

>>>
>>> That's better - though I think the tool tip is better as something like:
>>>
>>> Connection status (click for details) (+T)
>>>
>>> I'm still not overly happy with all the polling that's going on though.
>>> It's a lot of requests, especially with multiple QTs open. I think we need
>>> to be able to disable the feature entirely through a switch in the
>>> Preferences. In that case, no icon would be shown, and polling would be
>>> disabled - i.e. everything would be as it is now.
>>>
>>> What do you think?
>>>
>> +1
>>
>> -- Thanks, Ashesh
>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>


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

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


Re: RM2815: Relogin to pgAdmin from sqleditor/datadrid if session exprires

2018-01-08 Thread Harshal Dhumal
On Mon, Jan 8, 2018 at 7:26 PM, Dave Page  wrote:

>
>
> On Mon, Jan 8, 2018 at 1:18 PM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>>
>> On Mon, Jan 8, 2018 at 6:11 PM, Dave Page  wrote:
>>
>>>
>>>
>>> On Mon, Jan 8, 2018 at 12:37 PM, Harshal Dhumal <
>>> harshal.dhu...@enterprisedb.com> wrote:
>>>
 On Mon, Jan 8, 2018 at 5:15 PM, Dave Page  wrote:

> HI
>
> On Mon, Jan 8, 2018 at 11:41 AM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> On Mon, Jan 8, 2018 at 4:34 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Fri, Jan 5, 2018 at 7:50 AM, Harshal Dhumal <
>>> harshal.dhu...@enterprisedb.com> wrote:
>>>
 Further details:

 1. If session is expired and user performs any action from
 sqleditor that makes ajax call
 then in ajax error call back user can check and handle login
 related error using code snippet.

 if (pgAdmin.Browser.UserManagement.is_pga_login_required(xhr)) {
   return pgAdmin.Browser.UserManagement.pga_login();
 }

 Where is xhr is standard xhr or jqxhr object.

 2. Similarly for connection lost (only maintenance db connection as
 we can recover or reconnect other
 connections if maintenance db connection is alive). It will attempt
 to create/reconnect connection without
 asking password (to handle passwordless connection, or saveed
 password  or password from pgpass file)
 If connection to database still fails then it'll prompt for
 password.

 Code snippet:
 SqlEditorController.handle_connection_lost();
  once connection lost is detected one can call
 handle_connection_lost() to reconnect.

 3. We maintain some additional data in session to maintain affinity
 between
 each sqleditor/datagrid instance to backend database connection.
 However if session expires and user
 re-loggins then we need to first restore affinity between sqleditor
 to backend database before we can start
 using query tool.

 Code snippet:

 if(is_new_transaction_required(xhr)) {
   SqlEditorController.init_transaction();
 }

 (note: I haven't looked at the code yet)
>>>
>>> How does this handle re-establishment of the connection
>>> mid-transaction, or, if the user has modified any session variables?
>>>
>>> ServeManager and Connection Manager are written in a such way that
>> if any connection is lost except maintenance db connection
>> then we can re-connect or create new connection without prompting for
>> database password and if maintenance db connection is lost
>> then It prompts for password.
>>
>
> Right.
>
>
>>
>> Regarding session variables as long as flask session is not expired
>> we uses same session variables. But in case of user logout (due to
>> flask session expire) we create new transaction id and sets new
>> session variables for that particular Sql editor /datagrid instance.
>>
>
> I mean DB session variables (and related things). For example, if the
> user executed queries such as the following, then they absolutely need to
> know if the session got reset:
>

 Ok.
 Then in this case can we notify user about the same. That we're unable
 to restore old database connection and created new one and therefore
 any DB session variables were set/modified (like SET
 CLIENT_ENCODING..., SET DATESTYLE...) are lost (or similar message).



> CREATE TEMPORARY TABLE 
> SET ROLE ...
> SET [various other options]
>
> If the user has done any of those things (or similar things that I
> haven't thought of), then we cannot just blindly reset the database
> connection.
>

 We only create new connection if flask session was expired as we lost
 transaction id associated with Sql editor/datagrid and therefore unique
 connection id
 given to connection which was associated to Sql editor/datagrid. In
 this case we can notify about same (as stated above).

>>>
>>> If it's only the flask session we're resetting, not the database
>>> connection, we won't need to warn the user will we?
>>>
>>
>> The problem here is that if flask session is reset then we lose the
>> information about which connection was associate with which query
>> tool/datagrid.
>>
>> lets say If user have opened 3 query tools with same database therefore
>> we'll have 3 separate connections
>> (each will have unique connection id). Now this information that which
>> connection is associate with which query
>> tool is lost and also unique connection id. So there is no way that we
>> can get that connection
>> from connection manager ( *manager.co

Re: ESLINT: On pgAdmin static javascripts

2018-01-08 Thread Dave Page
Hi

I think these are impossibly big to properly review by hand, especially
where much of them are whitespace changes.

I think the best option is to check the regression tests all pass, do some
manual testing yourself, and then commit.

On Mon, Jan 8, 2018 at 1:55 PM, Ashesh Vashi 
wrote:

> Hi Dave/Team,
>
> I found many problems while 'eslint' utility on all the static javascript
> files of pgAdmin 4.
> i.e. /web/node_module/.bin/eslint 
>
> I had fixed all errors reported by eslint for those files.
>
> I have created six patches for ease of maintenance, as possibilities of
> conflicting with other patches.
> * Browser nodes javascript files
> * Browser specific javascript files
> * pgAdmin common javascript files
> * SQLEditor/DataGrid javascript files
> * Tools javascript files
> * Miscellaneous modules javascript files
>
> All patches are independent of each other.
>
> Please review it, and share your opinion.
>
>
> --
>
> Thanks & Regards,
>
> Ashesh Vashi
> EnterpriseDB INDIA: Enterprise PostgreSQL Company
> 
>
>
> *http://www.linkedin.com/in/asheshvashi*
> 
>



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

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


Re: ESLINT: On pgAdmin static javascripts

2018-01-08 Thread Ashesh Vashi
On Mon, Jan 8, 2018 at 8:31 PM, Dave Page  wrote:

> Hi
>
> I think these are impossibly big to properly review by hand, especially
> where much of them are whitespace changes.
>
I ran both jasmine test framework, and feature tests.
Both are running fine.

>
> I think the best option is to check the regression tests all pass, do some
> manual testing yourself, and then commit.
>
Done some manual testing.
It would be helpful, If somebody can help with some more testing, which I
may have missed.

-- Thanks, Ashesh


>
> On Mon, Jan 8, 2018 at 1:55 PM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>> Hi Dave/Team,
>>
>> I found many problems while 'eslint' utility on all the static javascript
>> files of pgAdmin 4.
>> i.e. /web/node_module/.bin/eslint 
>>
>> I had fixed all errors reported by eslint for those files.
>>
>> I have created six patches for ease of maintenance, as possibilities of
>> conflicting with other patches.
>> * Browser nodes javascript files
>> * Browser specific javascript files
>> * pgAdmin common javascript files
>> * SQLEditor/DataGrid javascript files
>> * Tools javascript files
>> * Miscellaneous modules javascript files
>>
>> All patches are independent of each other.
>>
>> Please review it, and share your opinion.
>>
>>
>> --
>>
>> Thanks & Regards,
>>
>> Ashesh Vashi
>> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>> 
>>
>>
>> *http://www.linkedin.com/in/asheshvashi*
>> 
>>
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: ESLINT: On pgAdmin static javascripts

2018-01-08 Thread Dave Page
Hi

On Mon, Jan 8, 2018 at 3:18 PM, Ashesh Vashi 
wrote:

> On Mon, Jan 8, 2018 at 8:31 PM, Dave Page  wrote:
>
>> Hi
>>
>> I think these are impossibly big to properly review by hand, especially
>> where much of them are whitespace changes.
>>
> I ran both jasmine test framework, and feature tests.
> Both are running fine.
>
>>
>> I think the best option is to check the regression tests all pass, do
>> some manual testing yourself, and then commit.
>>
> Done some manual testing.
> It would be helpful, If somebody can help with some more testing, which I
> may have missed.
>

Please ask one of the team (other than me) :-)


>
> -- Thanks, Ashesh
>
>
>>
>> On Mon, Jan 8, 2018 at 1:55 PM, Ashesh Vashi <
>> ashesh.va...@enterprisedb.com> wrote:
>>
>>> Hi Dave/Team,
>>>
>>> I found many problems while 'eslint' utility on all the static
>>> javascript files of pgAdmin 4.
>>> i.e. /web/node_module/.bin/eslint 
>>>
>>> I had fixed all errors reported by eslint for those files.
>>>
>>> I have created six patches for ease of maintenance, as possibilities of
>>> conflicting with other patches.
>>> * Browser nodes javascript files
>>> * Browser specific javascript files
>>> * pgAdmin common javascript files
>>> * SQLEditor/DataGrid javascript files
>>> * Tools javascript files
>>> * Miscellaneous modules javascript files
>>>
>>> All patches are independent of each other.
>>>
>>> Please review it, and share your opinion.
>>>
>>>
>>> --
>>>
>>> Thanks & Regards,
>>>
>>> Ashesh Vashi
>>> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>>> 
>>>
>>>
>>> *http://www.linkedin.com/in/asheshvashi*
>>> 
>>>
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>


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

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


Re: ESLINT: On pgAdmin static javascripts

2018-01-08 Thread Ashesh Vashi
On Mon, Jan 8, 2018 at 8:52 PM, Dave Page  wrote:

> Hi
>
> On Mon, Jan 8, 2018 at 3:18 PM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>> On Mon, Jan 8, 2018 at 8:31 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> I think these are impossibly big to properly review by hand, especially
>>> where much of them are whitespace changes.
>>>
>> I ran both jasmine test framework, and feature tests.
>> Both are running fine.
>>
>>>
>>> I think the best option is to check the regression tests all pass, do
>>> some manual testing yourself, and then commit.
>>>
>> Done some manual testing.
>> It would be helpful, If somebody can help with some more testing, which I
>> may have missed.
>>
>
> Please ask one of the team (other than me) :-)
>
:-)

-- Thanks, Ashesh

>
>
>>
>> -- Thanks, Ashesh
>>
>>
>>>
>>> On Mon, Jan 8, 2018 at 1:55 PM, Ashesh Vashi <
>>> ashesh.va...@enterprisedb.com> wrote:
>>>
 Hi Dave/Team,

 I found many problems while 'eslint' utility on all the static
 javascript files of pgAdmin 4.
 i.e. /web/node_module/.bin/eslint 

 I had fixed all errors reported by eslint for those files.

 I have created six patches for ease of maintenance, as possibilities of
 conflicting with other patches.
 * Browser nodes javascript files
 * Browser specific javascript files
 * pgAdmin common javascript files
 * SQLEditor/DataGrid javascript files
 * Tools javascript files
 * Miscellaneous modules javascript files

 All patches are independent of each other.

 Please review it, and share your opinion.


 --

 Thanks & Regards,

 Ashesh Vashi
 EnterpriseDB INDIA: Enterprise PostgreSQL Company
 


 *http://www.linkedin.com/in/asheshvashi*
 

>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: ESLINT: On pgAdmin static javascripts

2018-01-08 Thread Murtuza Zabuawala
​Hi Ashesh,

I'm not able to apply patch :(

murtuza@debian:~/projects/pgadmin4$ git apply ~/Desktop/*.patch
error: patch failed: web/pgadmin/misc/file_manager/static/js/utility.js:10
error: web/pgadmin/misc/file_manager/static/js/utility.js: patch does not
apply

 murtuza@debain:~/projects/pgadmin4$ git status | grep '\.rej' | wc -l
  55

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


On Mon, Jan 8, 2018 at 9:11 PM, Ashesh Vashi 
wrote:

>
> On Mon, Jan 8, 2018 at 8:52 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Mon, Jan 8, 2018 at 3:18 PM, Ashesh Vashi <
>> ashesh.va...@enterprisedb.com> wrote:
>>
>>> On Mon, Jan 8, 2018 at 8:31 PM, Dave Page  wrote:
>>>
 Hi

 I think these are impossibly big to properly review by hand, especially
 where much of them are whitespace changes.

>>> I ran both jasmine test framework, and feature tests.
>>> Both are running fine.
>>>

 I think the best option is to check the regression tests all pass, do
 some manual testing yourself, and then commit.

>>> Done some manual testing.
>>> It would be helpful, If somebody can help with some more testing, which
>>> I may have missed.
>>>
>>
>> Please ask one of the team (other than me) :-)
>>
> :-)
>
> -- Thanks, Ashesh
>
>>
>>
>>>
>>> -- Thanks, Ashesh
>>>
>>>

 On Mon, Jan 8, 2018 at 1:55 PM, Ashesh Vashi <
 ashesh.va...@enterprisedb.com> wrote:

> Hi Dave/Team,
>
> I found many problems while 'eslint' utility on all the static
> javascript files of pgAdmin 4.
> i.e. /web/node_module/.bin/eslint 
>
> I had fixed all errors reported by eslint for those files.
>
> I have created six patches for ease of maintenance, as
> possibilities of conflicting with other patches.
> * Browser nodes javascript files
> * Browser specific javascript files
> * pgAdmin common javascript files
> * SQLEditor/DataGrid javascript files
> * Tools javascript files
> * Miscellaneous modules javascript files
>
> All patches are independent of each other.
>
> Please review it, and share your opinion.
>
>
> --
>
> Thanks & Regards,
>
> Ashesh Vashi
> EnterpriseDB INDIA: Enterprise PostgreSQL Company
> 
>
>
> *http://www.linkedin.com/in/asheshvashi*
> 
>



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

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

>>>
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>


Re: ESLINT: On pgAdmin static javascripts

2018-01-08 Thread Ashesh Vashi
Please try rest of the patches...
They are independent of each other.

-- Thanks, Ashesh

On Jan 8, 2018 23:45, "Murtuza Zabuawala" <
murtuza.zabuaw...@enterprisedb.com> wrote:

> ​Hi Ashesh,
>
> I'm not able to apply patch :(
>
> murtuza@debian:~/projects/pgadmin4$ git apply ~/Desktop/*.patch
> error: patch failed: web/pgadmin/misc/file_manager/static/js/utility.js:10
> error: web/pgadmin/misc/file_manager/static/js/utility.js: patch does not
> apply
>
>  murtuza@debain:~/projects/pgadmin4$ git status | grep '\.rej' | wc -l
>   55
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> On Mon, Jan 8, 2018 at 9:11 PM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>>
>> On Mon, Jan 8, 2018 at 8:52 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Mon, Jan 8, 2018 at 3:18 PM, Ashesh Vashi <
>>> ashesh.va...@enterprisedb.com> wrote:
>>>
 On Mon, Jan 8, 2018 at 8:31 PM, Dave Page  wrote:

> Hi
>
> I think these are impossibly big to properly review by hand,
> especially where much of them are whitespace changes.
>
 I ran both jasmine test framework, and feature tests.
 Both are running fine.

>
> I think the best option is to check the regression tests all pass, do
> some manual testing yourself, and then commit.
>
 Done some manual testing.
 It would be helpful, If somebody can help with some more testing, which
 I may have missed.

>>>
>>> Please ask one of the team (other than me) :-)
>>>
>> :-)
>>
>> -- Thanks, Ashesh
>>
>>>
>>>

 -- Thanks, Ashesh


>
> On Mon, Jan 8, 2018 at 1:55 PM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>> Hi Dave/Team,
>>
>> I found many problems while 'eslint' utility on all the static
>> javascript files of pgAdmin 4.
>> i.e. /web/node_module/.bin/eslint 
>>
>> I had fixed all errors reported by eslint for those files.
>>
>> I have created six patches for ease of maintenance, as
>> possibilities of conflicting with other patches.
>> * Browser nodes javascript files
>> * Browser specific javascript files
>> * pgAdmin common javascript files
>> * SQLEditor/DataGrid javascript files
>> * Tools javascript files
>> * Miscellaneous modules javascript files
>>
>> All patches are independent of each other.
>>
>> Please review it, and share your opinion.
>>
>>
>> --
>>
>> Thanks & Regards,
>>
>> Ashesh Vashi
>> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>> 
>>
>>
>> *http://www.linkedin.com/in/asheshvashi*
>> 
>>
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>>
>


Re: [pgAdmin4][Patch]: Adding connection status in Query tool

2018-01-08 Thread Murtuza Zabuawala
Hi Dave,

Please find updated patch.

On Mon, Jan 8, 2018 at 7:21 PM, Dave Page  wrote:

>
>
> On Mon, Jan 8, 2018 at 1:24 PM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi Dave,
>>
>> PFA updated patch.
>>
>> On Mon, Jan 8, 2018 at 5:11 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Fri, Jan 5, 2018 at 8:49 AM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
 Hi Dave,

 PFA updated patch,


 On Wed, Jan 3, 2018 at 10:44 PM, Dave Page  wrote:

> Hi
>
> On Thu, Dec 28, 2017 at 9:38 AM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA updated patch based on new design suggested by Chethana.
>> The patch also includes some misc fixes related to object validation.
>> RM#2475
>>
>
> This seems much nicer, but I still think there are some tweaks to make:
>
> 1) If I open a query tool, and then stop the application server, the
> icon is updated to show the broken connection. However, unless I execute a
> query in the query tool before the server is shut down, the connection
> status won't recover when the server is restarted. If I do run a query
> first (SELECT 1; will do), then the connection status will recover.
>

 I have logged​
 ​
 https://redmine.postgresql.org/issues/2983


> 2) I think the "connected" icon should be in $primary-blue (#2c76b4).
> The green is ugly and not overly easy to read. It's also distracting as it
> catches the eye, which the default, non-error state should not do.
>
 ​Fixed​


>>>
>>> Much better.
>>>
>>>


> 3) I'm not overly happy with the the status text popover. After some
> thought, I think it's because there are no visual clues that you should
> click on the icon to see it - and Karen seems to be of a similar opinion.
> Can we put a small marker there, perhaps a triangle on the bottom-right,
> like you get on a spreadsheet cell if you add a comment/note? We should
> also have a hotkey and I guess a tooltip, e.g. "Connection status
> Ctrl+Alt+S" or similar.
>
 ​Fixed​
 , added accesskey *'T'* for TX status tooltip shortcut as 'S' is
 already taken for Save file option

>>>
>>> Hmm - having seen it, I don't think the marker helps us.
>>>
>>> Can you remove it, and fix the tooltip (which doesn't seem to work)? If
>>> we always have the tooltip say "Connection status Ctrl+Alt+T" (or whatever
>>> is appropriate for the platform/browser), then that should give the user
>>> enough hint to click.
>>>
>> ​
>> Fixed​.
>> I have removed the marker & added tooltip instead but it is not possible
>> to add specific shortcut keys in tooltip because accesskey may vary
>> depending on OS & browser.
>> ​Ref: ​
>> https://www.w3schools.com/tags/att_global_accesskey.asp
>>
>
> That's better - though I think the tool tip is better as something like:
>
> Connection status (click for details) (+T)
>
> I'm still not overly happy with all the polling that's going on though.
> It's a lot of requests, especially with multiple QTs open. I think we need
> to be able to disable the feature entirely through a switch in the
> Preferences. In that case, no icon would be shown, and polling would be
> disabled - i.e. everything would be as it is now.
>
> What do you think?
>
​Fixed
Made it configurable & set default polling time to 10sec.​


​Please review.​


> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py 
b/web/pgadmin/browser/server_groups/servers/__init__.py
index b2cca09..89ae779 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -886,9 +886,12 @@ class ServerNode(PGChildNodeView):
 if server is None:
 return bad_request(gettext("Server not found."))
 
-# Fetch User Details.
-user = User.query.filter_by(id=current_user.id).first()
-if user is None:
+if current_user and hasattr(current_user, 'id'):
+# Fetch User Details.
+user = User.query.filter_by(id=current_user.id).first()
+if user is None:
+return unauthorized(gettext("Unauthorized request."))
+else:
 return unauthorized(gettext("Unauthorized request."))
 
 data = request.form if request.form else json.loads(
diff --git 
a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/css/database.css
 
b/web/pgadmin/browser/server_groups/servers/databases/templates/databases/css/database.css
index 5300189..f0b12e3 100644
--- 
a/web/pgadmin/browser/server_groups/servers/databases/templates/databases/css/database.css
+++ 
b/web/pgadmin/browser/server_groups/servers/data