pgAdmin 4 commit: Allow dashboard tables and charts to be enabled/disab

2018-02-26 Thread Dave Page
Allow dashboard tables and charts to be enabled/disabled. Fixes #2951

Branch
--
master

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

Modified Files
--
.../en_US/images/preferences_dashboard_display.png |  Bin 0 -> 333609 bytes
docs/en_US/preferences.rst |8 +
web/pgadmin/dashboard/__init__.py  |   28 +-
web/pgadmin/dashboard/static/js/dashboard.js   | 1130 ++--
.../templates/dashboard/database_dashboard.html|   32 +-
.../templates/dashboard/server_dashboard.html  |   31 +-
web/pgadmin/dashboard/tests/__init__.py|8 +
.../dashboard/tests/test_dashboard_templates.py|  279 +
8 files changed, 958 insertions(+), 558 deletions(-)



Re: [pgAdmin4][RM#2951] Allow user to disable graphs and activity grid

2018-02-26 Thread Dave Page
Thanks, patch applied with minor changes to the description strings for the
options.

Chethana, could you please send me an update of the appropriate image from
this patch (with my changed strings), and send a short howto on creating
the images properly, including the specs for them please? I'll incorporate
that into the docs, which should make it easier for us all to update the
screenshots in the future.

Thanks!

On Fri, Feb 23, 2018 at 10:21 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch which will add functionality to allow user to disable graphs
> and/or activity grids.
>
> Please review.
>
> --
> 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: Fix table statistics for Greenplum. Fixes #3059

2018-02-26 Thread Dave Page
Fix table statistics for Greenplum. Fixes #3059

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=5ebd9ee8d30a32bfbe9deb39fc3c6da224dfcff9
Author: Joao Pedro De Almeida Pereira 

Modified Files
--
.../tables/templates/table/sql/9.1_plus/stats.sql  | 57 ++
.../tables/templates/table/sql/9.2_plus/stats.sql  | 57 ++
.../tables/templates/table/sql/default/stats.sql   |  4 --
.../templates/table/sql/gpdb_5.0_plus/stats.sql| 16 ++
4 files changed, 130 insertions(+), 4 deletions(-)



Re: [pgadmin4][patch] Table Statistics in GreenPlum #3059

2018-02-26 Thread Dave Page
Thanks, patch applied.

On Fri, Feb 23, 2018 at 9:57 PM, Joao De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hi Hackers,
> The attached patch fixes the statistics retrieval of tables in GreenPlum
>
> Thanks
> Joao
>



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

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


Re: [pgAdmin4][RM#2900] Adding accessibility features in query tool

2018-02-26 Thread Dave Page
FYI, in an attempt not to be the one reviewing everything, I'm leaving this
for Joao to pick up again. Moving forwards, I'd like to make that the
default - if (better yet, when) someone reviews someone else's patch, we
should expect that person to review any followups as well, unless they
explicitly say otherwise. In such cases, those of us with commit-bits
should hold back until the initial reviewer is happy.

Thanks :-)

On Mon, Feb 26, 2018 at 9:40 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA updated patch.
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> On Wed, Feb 21, 2018 at 11:19 PM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi Joao,
>>
>> Thank you for your time in reviewing the patch.
>>
>>
>> On Wed, Feb 21, 2018 at 9:11 PM, Joao De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hello Murtuza,
>>> After reviewing the code I have some suggestions:
>>>  - We should split the PEP and the features into different patches, or
>>> else it becomes very hard to separate Feature code from Code Style change
>>>
>> ​I'll keep that in mind next time onwards.
>>
>>>  - The function: `getTextRepresentaionShortcut` has a typo
>>>
>> ​I'll fix​
>>
>> ​that.​
>>
>>>  - As a personal point I have a hard time reading multiple declarations
>>> of variables in javascript under a single `var`, I prefer 1 `let` per
>>> variable
>>>
>>  - I think we should use cameCase for our variables in Javascript code
>>>  - What is the reason behind the move of the key shortcuts back into the
>>> SQLEditorController? This look like something that could be extracted from
>>> SQLEditor file into its own
>>>
>> I'll try to move that code.​
>>
>>
>>>  - Looks like we are missing some test coverage on the new implemented
>>> parts
>>>
>> ​I didn't added any new code as such, I just moved out preferences code
>> out from main file.
>>
>>>  - The getKeyboardShortcuts function is retrieving information from
>>> window.top and window.opener I think that we can come up with a better
>>> pattern then this. Relying on window information doesn't look very good.
>>> That was the pattern for JQuery that the new frameworks are trying to avoid
>>> because polluting the global scope is almost always a Code Smell.
>>>
>> ​What do you suggest on this?​
>>
>>
>>>
>>>
>>> I see there was some refactoring on the backend with the creation of
>>> RegisterQueryToolPreferences and it is looking good, hope that we can do
>>> this in more places specially in the front-end.
>>>
>>> Using the patch that you sent I passed it through our CI and everything
>>> is Passing.
>>>
>>> Thanks
>>> Joao
>>>
>>> On Tue, Feb 20, 2018 at 1:13 PM Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
 Hi,

 PFA patch for adding accessibility features in query tool.
 RM#2900

 Please review.

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


Re: [pgAdmin4][RM#2900] Adding accessibility features in query tool

2018-02-26 Thread Murtuza Zabuawala
Hi Joao,

I tried the solution/patch you suggested but it is not working for me, I
always get *undefined* for preferences values.

Thanks,
Murtuza

On Thu, Feb 22, 2018 at 3:17 AM, Joao De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hello Murtuza,
> I created a small patch on the way I believe the function should work. Not
> 100% sure why we are piggybacking on the window.top, window.opener and so
> on to give us information. Nowadays I do not think that loading the JS
> files again costs that much in terms of time.
>
> The issue I came across was that cache_preferences/get_preference behave
> in a very strange way.
>
> Example:
> If the cache is populated no problem it returns a value and it is fine
> If the cache is not populated it sets a timeout that will check in 1
> second if is the cache is populated if it is not then does nothing, if it
> is then returns the value.
> The problem is that it returns the value to no place.
>
> This caching implementation works until this point because for some good
> fortune we never call get_preference before we have the cache full.
> Is my assessment correct?
>
> Nevertheless if the caching was using promises we could avoid the problem
> above.
>
> Thanks
> Joao
>
> On Wed, Feb 21, 2018 at 12:50 PM Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi Joao,
>>
>> Thank you for your time in reviewing the patch.
>>
>>
>> On Wed, Feb 21, 2018 at 9:11 PM, Joao De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hello Murtuza,
>>> After reviewing the code I have some suggestions:
>>>  - We should split the PEP and the features into different patches, or
>>> else it becomes very hard to separate Feature code from Code Style change
>>>
>> ​I'll keep that in mind next time onwards.
>>
>>>  - The function: `getTextRepresentaionShortcut` has a typo
>>>
>> ​I'll fix​
>>
>> ​that.​
>>
>>>  - As a personal point I have a hard time reading multiple declarations
>>> of variables in javascript under a single `var`, I prefer 1 `let` per
>>> variable
>>>
>>  - I think we should use cameCase for our variables in Javascript code
>>>  - What is the reason behind the move of the key shortcuts back into the
>>> SQLEditorController? This look like something that could be extracted from
>>> SQLEditor file into its own
>>>
>> I'll try to move that code.​
>>
>>
>>>  - Looks like we are missing some test coverage on the new implemented
>>> parts
>>>
>> ​I didn't added any new code as such, I just moved out preferences code
>> out from main file.
>>
>>>  - The getKeyboardShortcuts function is retrieving information from
>>> window.top and window.opener I think that we can come up with a better
>>> pattern then this. Relying on window information doesn't look very good.
>>> That was the pattern for JQuery that the new frameworks are trying to avoid
>>> because polluting the global scope is almost always a Code Smell.
>>>
>> ​What do you suggest on this?​
>>
>>
>>>
>>>
>>> I see there was some refactoring on the backend with the creation of
>>> RegisterQueryToolPreferences and it is looking good, hope that we can do
>>> this in more places specially in the front-end.
>>>
>>> Using the patch that you sent I passed it through our CI and everything
>>> is Passing.
>>>
>>> Thanks
>>> Joao
>>>
>>> On Tue, Feb 20, 2018 at 1:13 PM Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
 Hi,

 PFA patch for adding accessibility features in query tool.
 RM#2900

 Please review.

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




Re: Proposal for changes in official Docker image

2018-02-26 Thread Максим Кольцов
2018-02-25 20:59 GMT+03:00 Dave Page :
> Hi
>
> On Sat, Feb 24, 2018 at 9:04 PM, Максим Кольцов  wrote:
>>
>> Hi
>>
>> 2018-02-19 12:13 GMT+03:00 Dave Page :
>> > Hi
>> >
>> > On Sun, Feb 18, 2018 at 5:41 PM, Максим Кольцов 
>> > wrote:
>> >>
>> >> Hi!
>> >>
>> >> I accidentially sent this email to pgsql-hackers yesterday, sorry!
>> >>
>> >> First of all, thanks for the great app :)
>> >>
>> >> I started using PgAdmin with docker image (dpage/pgadmin4) a few weeks
>> >> ago, however I thought that it had some issues, so I decided to make
>> >> my own image. Some of the advantages:
>> >>
>> >> - Use alpine linux instead of centos to greatly reduce image size
>> >> (170MB vs 560MB)
>> >> - Use lightweight pure-python HTTP server waitress instead of heavy
>> >> apache/mod_wsgi
>> >> - Use python 3.6
>> >>
>> >> You can test the image at https://hub.docker.com/r/maksbotan/pgadmin4/
>> >> Readme contains more detailed explanation and usage instructions.
>> >>
>> >> The Dockerfile is hosted at github:
>> >> https://github.com/maksbotan/pgadmin4_docker
>> >>
>> >> If you find my work useful, I'd love to make a contribution with these
>> >> scripts, after some discussion with pgadmin developers and further
>> >> improvements.
>> >
>> >
>> > Please feel free to submit patches to the existing code. I have no
>> > objection
>> > to the any of the alternate design decisions you've made (in principal),
>> > except for the intentional lack of SSL support.
>> >
>> > Thanks, Dave.
>>
>> I updated my image to simplify installing of Python packages. I
>> decided I do not need a separate build step after all.
>> Can you point me at documentation on submitting patches to pgadmin?
>
>
> There are some docs on the git repo and mailing list at
> https://www.pgadmin.org/development/resources/. To submit a patch, send an
> email to the hackers list describing the patch and attaching the "git diff"
> formatted patch file.
>
>>
>>
>> What are your points in including SSL support into container? This can
>> be done by using, for example, gunicorn instead of waitress,
>> but I believe that this should be handled by reverse-proxy, like
>> nginx, in production environment. In non-production environment, i.e.
>> on developer's localhost, you do not need SSL at all.
>>
>> By the way, in my opinion, on production there is one more task to be
>> handled by reverse-proxy - static files. By that I mean that all
>> static, not-changing files accessible at '/static/' URL should be
>> extracted from the container and served by nginx from a local folder.
>> This does not mean we shouldn't keep them in the image -- it's very
>> convenient for localhost usage. I haven't found a way to extract
>> all Flask's static files yet.
>
>
> Well that additional complexity is a very good reason why using two
> containers for this is overkill. Having two containers to run pgAdmin makes
> things unnecessarily complex in my opinion, especially given that it can
> (and is in the current container) achieved with the simple addition of a
> config snippet for Apache and mod_ssl. The current trend for micro services
> can easily be taken too far - we should keep the KISS principle in mind.

I did not mean to run two containers. I mean that pgadmin image, as I
picture it, may serve two purposes:

- localhost deployment on developer's machine to ease interaction with
postgres DB, local or remote.
  In this mode container serves it's own static files and is
accessible via plain HTTP
- Deployment in enterprise production environment, for many users,
possibly accessible from the Internet.
  In this mode container should only serve the API, possibly running
in several replicas. static files and SSL
  termination should be done by _existing_ nginx or something else
present in that organisation. For that I'd wish
  to have a way to extract static files from the container for
deployment, but not changing anything in the image.

> Another reason for including SSL support, is that users have asked for it.

In my humble opinion, if users want SSL support in application
container, they are doing something wrong and are
asking for troubles. But I respect this choice and I'm ready to allow
for it. I'll integrate gunicorn server in the image, which
supports SSL.

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



[pgadmin4][patch] Fix PEP-8 issues

2018-02-26 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the issue in utils folder.
pycodestyle --config=.pycodestyle ./pgadmin/utils/


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/utils/compile_template_name.py 
b/web/pgadmin/utils/compile_template_name.py
index 28b5bf8..1e0b94f 100644
--- a/web/pgadmin/utils/compile_template_name.py
+++ b/web/pgadmin/utils/compile_template_name.py
@@ -9,8 +9,12 @@
 import os
 
 
-def compile_template_name(template_prefix, template_file_name, server_type, 
version):
-return os.path.join(compile_template_path(template_prefix, server_type, 
version), template_file_name)
+def compile_template_name(
+template_prefix, template_file_name, server_type, version):
+return os.path.join(
+compile_template_path(template_prefix, server_type, version),
+template_file_name
+)
 
 
 def compile_template_path(template_prefix, server_type, version):
diff --git a/web/pgadmin/utils/tests/test_compile_template_name.py 
b/web/pgadmin/utils/tests/test_compile_template_name.py
index 97f1b05..b7836cc 100644
--- a/web/pgadmin/utils/tests/test_compile_template_name.py
+++ b/web/pgadmin/utils/tests/test_compile_template_name.py
@@ -12,23 +12,32 @@ from pgadmin.utils.route import BaseTestGenerator
 
 class StartRunningQueryTest(BaseTestGenerator):
 """
-Check that the apply_explain_plan_weapper_if_needed method works as 
intended
+Check that the apply_explain_plan_weapper_if_needed method works as
+intended
 """
 scenarios = [
-('When server is Postgres and version is 10, it returns the path to 
the postgres template', dict(
-server_type='pg',
-version=10,
-
-expected_return_value='some/prefix/#10#/some_file.sql'
-)),
-('When server is GreenPlum and version is 5, it returns the path to 
the GreenPlum template', dict(
-server_type='gpdb',
-version=80323,
-
-expected_return_value='some/prefix/#gpdb#80323#/some_file.sql'
-)),
+(
+'When server is Postgres and version is 10, it returns the path '
+'to the postgres template',
+dict(
+server_type='pg',
+version=10,
+expected_return_value='some/prefix/#10#/some_file.sql'
+)
+),
+(
+'When server is GreenPlum and version is 5, it returns the path '
+'to the GreenPlum template',
+dict(
+server_type='gpdb',
+version=80323,
+expected_return_value='some/prefix/#gpdb#80323#/some_file.sql'
+)
+),
 ]
 
 def runTest(self):
-result = compile_template_name('some/prefix', 'some_file.sql', 
self.server_type, self.version)
+result = compile_template_name(
+'some/prefix', 'some_file.sql', self.server_type, self.version
+)
 self.assertEquals(result, self.expected_return_value)


Re: Proposal for changes in official Docker image

2018-02-26 Thread Dave Page
Hi

On Mon, Feb 26, 2018 at 10:09 AM, Максим Кольцов  wrote:

> 2018-02-25 20:59 GMT+03:00 Dave Page :
> > Hi
> >
> > On Sat, Feb 24, 2018 at 9:04 PM, Максим Кольцов 
> wrote:
> >>
> >> Hi
> >>
> >> 2018-02-19 12:13 GMT+03:00 Dave Page :
> >> > Hi
> >> >
> >> > On Sun, Feb 18, 2018 at 5:41 PM, Максим Кольцов 
> >> > wrote:
> >> >>
> >> >> Hi!
> >> >>
> >> >> I accidentially sent this email to pgsql-hackers yesterday, sorry!
> >> >>
> >> >> First of all, thanks for the great app :)
> >> >>
> >> >> I started using PgAdmin with docker image (dpage/pgadmin4) a few
> weeks
> >> >> ago, however I thought that it had some issues, so I decided to make
> >> >> my own image. Some of the advantages:
> >> >>
> >> >> - Use alpine linux instead of centos to greatly reduce image size
> >> >> (170MB vs 560MB)
> >> >> - Use lightweight pure-python HTTP server waitress instead of heavy
> >> >> apache/mod_wsgi
> >> >> - Use python 3.6
> >> >>
> >> >> You can test the image at https://hub.docker.com/r/
> maksbotan/pgadmin4/
> >> >> Readme contains more detailed explanation and usage instructions.
> >> >>
> >> >> The Dockerfile is hosted at github:
> >> >> https://github.com/maksbotan/pgadmin4_docker
> >> >>
> >> >> If you find my work useful, I'd love to make a contribution with
> these
> >> >> scripts, after some discussion with pgadmin developers and further
> >> >> improvements.
> >> >
> >> >
> >> > Please feel free to submit patches to the existing code. I have no
> >> > objection
> >> > to the any of the alternate design decisions you've made (in
> principal),
> >> > except for the intentional lack of SSL support.
> >> >
> >> > Thanks, Dave.
> >>
> >> I updated my image to simplify installing of Python packages. I
> >> decided I do not need a separate build step after all.
> >> Can you point me at documentation on submitting patches to pgadmin?
> >
> >
> > There are some docs on the git repo and mailing list at
> > https://www.pgadmin.org/development/resources/. To submit a patch, send
> an
> > email to the hackers list describing the patch and attaching the "git
> diff"
> > formatted patch file.
> >
> >>
> >>
> >> What are your points in including SSL support into container? This can
> >> be done by using, for example, gunicorn instead of waitress,
> >> but I believe that this should be handled by reverse-proxy, like
> >> nginx, in production environment. In non-production environment, i.e.
> >> on developer's localhost, you do not need SSL at all.
> >>
> >> By the way, in my opinion, on production there is one more task to be
> >> handled by reverse-proxy - static files. By that I mean that all
> >> static, not-changing files accessible at '/static/' URL should be
> >> extracted from the container and served by nginx from a local folder.
> >> This does not mean we shouldn't keep them in the image -- it's very
> >> convenient for localhost usage. I haven't found a way to extract
> >> all Flask's static files yet.
> >
> >
> > Well that additional complexity is a very good reason why using two
> > containers for this is overkill. Having two containers to run pgAdmin
> makes
> > things unnecessarily complex in my opinion, especially given that it can
> > (and is in the current container) achieved with the simple addition of a
> > config snippet for Apache and mod_ssl. The current trend for micro
> services
> > can easily be taken too far - we should keep the KISS principle in mind.
>
> I did not mean to run two containers. I mean that pgadmin image, as I
> picture it, may serve two purposes:
>
> - localhost deployment on developer's machine to ease interaction with
> postgres DB, local or remote.
>   In this mode container serves it's own static files and is
> accessible via plain HTTP
> - Deployment in enterprise production environment, for many users,
> possibly accessible from the Internet.
>   In this mode container should only serve the API, possibly running
> in several replicas. static files and SSL
>   termination should be done by _existing_ nginx or something else
> present in that organisation. For that I'd wish
>   to have a way to extract static files from the container for
> deployment, but not changing anything in the image.
>

As I see it, that does essentially mean two containers (or 1 container and
a VM or whatever). Either way, it adds a lot of complexity for the user.


>
> > Another reason for including SSL support, is that users have asked for
> it.
>
> In my humble opinion, if users want SSL support in application
> container, they are doing something wrong and are
> asking for troubles. But I respect this choice and I'm ready to allow
> for it. I'll integrate gunicorn server in the image, which
> supports SSL.


Doing it that way gives them both options (well, we'd still need to figure
out the static file extraction). Those that want a quick and easy SSL
solution can do it with one container, those running on localhost can use
plain HTTP, and those who want an external reverse proxy to add SSL would

[pgAdmin4][Patch]: RM #3094 - Notices from query n are shown in messages from query n+1

2018-02-26 Thread Khushboo Vashi
Hi,

Please find the attached patch to fix the RM #3094: Notices from query n
are shown in messages from query n+1

Thanks,
Khushboo
diff --git a/web/pgadmin/utils/driver/abstract.py b/web/pgadmin/utils/driver/abstract.py
index 32e1c97..1722e21 100644
--- a/web/pgadmin/utils/driver/abstract.py
+++ b/web/pgadmin/utils/driver/abstract.py
@@ -168,6 +168,7 @@ class BaseConnection(object):
 ASYNC_WRITE_TIMEOUT = 3
 ASYNC_NOT_CONNECTED = 4
 ASYNC_EXECUTION_ABORTED = 5
+ASYNC_TIMEOUT = 0.2
 
 @abstractmethod
 def connect(self, **kwargs):
diff --git a/web/pgadmin/utils/driver/psycopg2/__init__.py b/web/pgadmin/utils/driver/psycopg2/__init__.py
index 81442e4..a412153 100644
--- a/web/pgadmin/utils/driver/psycopg2/__init__.py
+++ b/web/pgadmin/utils/driver/psycopg2/__init__.py
@@ -110,7 +110,7 @@ class Connection(BaseConnection):
   - This method is used to wait for asynchronous connection. This is a
 blocking call.
 
-* _wait_timeout(conn, time)
+* _wait_timeout(conn)
   - This method is used to wait for asynchronous connection with timeout.
 This is a non blocking call.
 
@@ -1261,51 +1261,27 @@ Failed to reset the connection to the server due to following error:
 
 Args:
 conn: connection object
-time: wait time
 """
-
-state = conn.poll()
-if state == psycopg2.extensions.POLL_OK:
-return self.ASYNC_OK
-elif state == psycopg2.extensions.POLL_WRITE:
-# Wait for the given time and then check the return status
-# If three empty lists are returned then the time-out is reached.
-timeout_status = select.select([], [conn.fileno()], [], 0)
-if timeout_status == ([], [], []):
-return self.ASYNC_WRITE_TIMEOUT
-
-# poll again to check the state if it is still POLL_WRITE
-# then return ASYNC_WRITE_TIMEOUT else return ASYNC_OK.
+while 1:
 state = conn.poll()
-if state == psycopg2.extensions.POLL_WRITE:
-return self.ASYNC_WRITE_TIMEOUT
-return self.ASYNC_OK
-elif state == psycopg2.extensions.POLL_READ:
-# Wait for the given time and then check the return status
-# If three empty lists are returned then the time-out is reached.
-timeout_status = select.select([conn.fileno()], [], [], 0)
-if timeout_status == ([], [], []):
-return self.ASYNC_READ_TIMEOUT
-
-# select.select timeout option works only if we provide
-#  empty [] [] [] file descriptor in select.select() function
-# and that also works only on UNIX based system, it do not support
-# Windows Hence we have wrote our own pooling mechanism to read
-# data fast each call conn.poll() reads chunks of data from
-# connection object more we poll more we read data from connection
-cnt = 0
-while cnt < 1000:
-# poll again to check the state if it is still POLL_READ
-# then return ASYNC_READ_TIMEOUT else return ASYNC_OK.
-state = conn.poll()
-if state == psycopg2.extensions.POLL_OK:
-return self.ASYNC_OK
-cnt += 1
-return self.ASYNC_READ_TIMEOUT
-else:
-raise psycopg2.OperationalError(
-"poll() returned %s from _wait_timeout function" % state
-)
+if state == psycopg2.extensions.POLL_OK:
+return self.ASYNC_OK
+elif state == psycopg2.extensions.POLL_WRITE:
+# Wait for the given time and then check the return status
+# If three empty lists are returned then the time-out is reached.
+timeout_status = select.select([], [conn.fileno()], [], self.ASYNC_TIMEOUT)
+if timeout_status == ([], [], []):
+return self.ASYNC_WRITE_TIMEOUT
+elif state == psycopg2.extensions.POLL_READ:
+# Wait for the given time and then check the return status
+# If three empty lists are returned then the time-out is reached.
+timeout_status = select.select([conn.fileno()], [], [], self.ASYNC_TIMEOUT)
+if timeout_status == ([], [], []):
+return self.ASYNC_READ_TIMEOUT
+else:
+raise psycopg2.OperationalError(
+"poll() returned %s from _wait_timeout function" % state
+)
 
 def poll(self, formatted_exception_msg=False, no_result=False):
 """


Re: RM2898 Keyboard navigation in dialog tabs (nav tabs)

2018-02-26 Thread Harshal Dhumal
Hi,

Please find the updated patch for keyboard navigation.

In this patch I have reduced delay which is required until current tab
navigation is completed.
Extracted class dialogTabNavigator and put it in new file.
Added jasmine test cases.
Fixed linting issues, variable naming convention issues.



-- 
*Harshal Dhumal*
*Sr. Software Engineer*

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

On Wed, Feb 21, 2018 at 11:39 PM, Harshal Dhumal 
wrote:

> Hi,
>
> On Wed, Feb 21, 2018 at 10:59 PM, Joao De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Yep I installed the V2 file
>>
>> On Wed, Feb 21, 2018 at 11:31 AM Dave Page  wrote:
>>
>>> On Wed, Feb 21, 2018 at 4:22 PM, Joao De Almeida Pereira <
>>> jdealmeidapere...@pivotal.io> wrote:
>>>
 Hello Harshal,

 I passed the patch through our CI and all the tests passed. The changes
 do not break previous behavior but because there are no tests on the new
 feature  we could not be sure it was really working. So we did some manual
 testing and sometimes it doesn't work, like it gets stuck in a place and
 you need to press the shortcut again in order for it to move.

>>>
>>> It stuck because I have to wait until next tab is completely visible
> (fade in effect is completed).
> The fade in or fade out transition duration is 150 ms (set by bootstrap).
> So I can not set focus back to tab pane
> until fade in or fade out transition is completed. May be one improvement
> I can do is to reduce wait time to
> something 200 ms (currently it's 500 ms).
>
> Note that the original issue reported by Dave is already fixed in updated
> patch.
>
>
>> Was that with the updated patch? It sounds like the issue I saw with the
>>> original one.
>>>
>>>

 Codewise I have some suggestions:
  - dialogTabNavigator looks a nice candidate for a class with its own
 file. This way we can test the behavior

>>> Ok I'll move dialogTabNavigator to new file and will add test cases.
>
>>  - There is no difference between a variable called e and a variable
 error so for sake of clarity I would love to see variable names that
 we can easily read
  - We are also using 2 different types of variable naming camelCase and
 snake_case, if we could use only camelCase on Javascript it would make the
 code more uniform

>>> Ok I'll do this.
>
>
>>  - I noticed that there are some linting issues in the Javascript code

>>> I just found that linter was disabled for this file by adding comment
> /* eslint-disable */ at first line. (not sure why we did that)
>
>
 Summing it up I believe that despite the feature not working 100% of
 the time, looks like the code is almost there but needs some refactoring to
 make it more readable, instead of comments we could have function calls
 that more clearly state what we are looking for something like
 DialogTabNavigator.isLastTabOfChild
 ​
 ​


 Thanks
 Joao

 On Wed, Feb 21, 2018 at 4:32 AM Harshal Dhumal <
 harshal.dhu...@enterprisedb.com> wrote:

> Hi,
>
> --
> *Harshal Dhumal*
> *Sr. Software Engineer*
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Tue, Feb 20, 2018 at 10:34 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Tue, Feb 20, 2018 at 7:22 AM, Harshal Dhumal <
>> harshal.dhu...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> Please find attached patch to enable keyboard navigation in dialog.
>>>
>>> To allow navigation from one tab pane (bootstrap tab pane) to
>>> another one
>>> I have added two new shortcut preferences *Dialog tab previous *(
>>> shift+control+[ ) and *Dialog tab next* ( shift+control+] ) for backward
>>> and forward tab navigation.
>>>
>>> Also all dialog controls (within same tab pane) can be navigated
>>> using TAB key.
>>>
>>
>>
>
>> This seems unreliable to me - for example, it keeps getting stuck on
>> the connection tab on the server properties dialog.
>>
>>
>
>> Also, can we use the same wording as for the tabbed panel navigation
>> please? E.g. Next/Previous instead of Forward/Back.
>>
>
> I have fixed all of above issues. Please find updated patch.
>
> Thanks,
>
>
>>
>> --
>> 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
>>>
>>
>
diff --git a/docs/en_US/keyboard_shortcuts.rst b/docs/en_US/keyboard_shortcuts.rst
index 1142975..7699798 100644
--- a/docs/en_US/keyboard_shortcuts.rst
+++ b/docs/en_US/key

[pgAdmin4][Patch]: PEP-8 issue fixes

2018-02-26 Thread Khushboo Vashi
Hi,

Please find the attached patch to fix PEP-8 issues in the below modules:

1. about
2. feature_tests
3. misc
4. utils

Thanks,
Khushboo
diff --git a/web/pgadmin/about/__init__.py b/web/pgadmin/about/__init__.py
index 98a4dd6..6d1e0b2 100644
--- a/web/pgadmin/about/__init__.py
+++ b/web/pgadmin/about/__init__.py
@@ -8,7 +8,6 @@
 ##
 
 """A blueprint module implementing the about box."""
-MODULE_NAME = 'about'
 
 import sys
 from flask import Response, render_template, __version__, url_for
@@ -18,6 +17,8 @@ from pgadmin.utils import PgAdminModule
 from pgadmin.utils.menu import MenuItem
 import config
 
+MODULE_NAME = 'about'
+
 
 class AboutModule(PgAdminModule):
 def get_own_menuitems(self):
diff --git a/web/pgadmin/feature_tests/keyboard_shortcut_test.py b/web/pgadmin/feature_tests/keyboard_shortcut_test.py
index b83457c..443eff6 100644
--- a/web/pgadmin/feature_tests/keyboard_shortcut_test.py
+++ b/web/pgadmin/feature_tests/keyboard_shortcut_test.py
@@ -65,7 +65,8 @@ class KeyboardShortcutFeatureTest(BaseFeatureTest):
 Keys.ALT
 ).perform()
 
-print("Executing shortcut: " + self.new_shortcuts[s]['locator'] + "...", file=sys.stderr, end="")
+print("Executing shortcut: " + self.new_shortcuts[s]['locator'] +
+  "...", file=sys.stderr, end="")
 
 self.wait.until(
 EC.presence_of_element_located(
diff --git a/web/pgadmin/feature_tests/view_data_dml_queries.py b/web/pgadmin/feature_tests/view_data_dml_queries.py
index aa75b6e..12e4295 100644
--- a/web/pgadmin/feature_tests/view_data_dml_queries.py
+++ b/web/pgadmin/feature_tests/view_data_dml_queries.py
@@ -100,7 +100,7 @@ CREATE TABLE public.defaults_{0}
 test_utils.create_database(self.server, "acceptance_test_db")
 
 # Create pre-requisite table
-for k, v in { 1: 'id', 2:'"ID"' }.items():
+for k, v in {1: 'id', 2: '"ID"'}.items():
 test_utils.create_table_with_query(
 self.server,
 "acceptance_test_db",
@@ -114,7 +114,7 @@ CREATE TABLE public.defaults_{0}
 self.page.add_server(self.server)
 self._tables_node_expandable()
 # iterate on both tables
-for cnt in (1,2):
+for cnt in (1, 2):
 self.page.select_tree_item('defaults_{0}'.format(str(cnt)))
 # Open Object -> View/Edit data
 self._view_data_grid()
diff --git a/web/pgadmin/misc/bgprocess/processes.py b/web/pgadmin/misc/bgprocess/processes.py
index 0c4112a..02b953d 100644
--- a/web/pgadmin/misc/bgprocess/processes.py
+++ b/web/pgadmin/misc/bgprocess/processes.py
@@ -21,10 +21,6 @@ from subprocess import Popen
 
 from pgadmin.utils import IS_PY2, u, file_quote, fs_encoding
 
-if IS_PY2:
-from StringIO import StringIO
-else:
-from io import StringIO
 import pytz
 from dateutil import parser
 from flask import current_app
@@ -33,6 +29,10 @@ from flask_security import current_user
 
 import config
 from pgadmin.model import Process, db
+if IS_PY2:
+from StringIO import StringIO
+else:
+from io import StringIO
 
 
 def get_current_time(format='%Y-%m-%d %H:%M:%S.%f %z'):
diff --git a/web/pgadmin/utils/__init__.py b/web/pgadmin/utils/__init__.py
index 198553e..5f81e09 100644
--- a/web/pgadmin/utils/__init__.py
+++ b/web/pgadmin/utils/__init__.py
@@ -7,6 +7,8 @@
 #
 ##
 
+import os
+import sys
 from collections import defaultdict
 from operator import attrgetter
 
@@ -152,9 +154,6 @@ class PgAdminModule(Blueprint):
 return res
 
 
-import os
-import sys
-
 IS_PY2 = (sys.version_info[0] == 2)
 IS_WIN = (os.name == 'nt')
 
diff --git a/web/pgadmin/utils/compile_template_name.py b/web/pgadmin/utils/compile_template_name.py
index 28b5bf8..49c7b6a 100644
--- a/web/pgadmin/utils/compile_template_name.py
+++ b/web/pgadmin/utils/compile_template_name.py
@@ -9,8 +9,14 @@
 import os
 
 
-def compile_template_name(template_prefix, template_file_name, server_type, version):
-return os.path.join(compile_template_path(template_prefix, server_type, version), template_file_name)
+def compile_template_name(
+template_prefix,
+template_file_name,
+server_type, version
+):
+return os.path.join(
+compile_template_path(template_prefix, server_type, version),
+template_file_name)
 
 
 def compile_template_path(template_prefix, server_type, version):
diff --git a/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py b/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py
index f946cb8..7030703 100644
--- a/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py
+++ b/web/pgadmin/utils/javascript/tests/test_javascript_bundler.py
@@ -9,16 +9,15 @@
 
 
 import sys
+from pgadmin.utils.route import BaseTestGenerator
+from pgadmin.utils.javascript.javascript_bundler imp

pep-8 fixes

2018-02-26 Thread Harshal Dhumal
Hi,

Please find patch to fix pep-8 issues for given modules.

1. help (__init__.py)
2. pgadmin (__init__.py)
3. browser (__init__.py, collection.py, utils.py)


-- 
*Harshal Dhumal*
*Sr. Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index 74a3124..90ecf99 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -291,10 +291,10 @@ def create_app(app_name=None):
 # Setup authentication
 ##
 
-app.config['SQLALCHEMY_DATABASE_URI'] = u'sqlite:///{0}?timeout={1}'.format(
-config.SQLITE_PATH.replace(u'\\', u'/'),
-getattr(config, 'SQLITE_TIMEOUT', 500)
-)
+app.config['SQLALCHEMY_DATABASE_URI'] = u'sqlite:///{0}?timeout={1}'\
+.format(config.SQLITE_PATH.replace(u'\\', u'/'),
+getattr(config, 'SQLITE_TIMEOUT', 500)
+)
 
 # Create database connection object and mailer
 db.init_app(app)
@@ -406,7 +406,8 @@ def create_app(app_name=None):
 servergroup_id = servergroup.id
 
 '''Add a server to the config database'''
-def add_server(user_id, servergroup_id, name, superuser, port, discovery_id, comment):
+def add_server(user_id, servergroup_id, name, superuser, port,
+   discovery_id, comment):
 # Create a server object if needed, and store it.
 servers = Server.query.filter_by(
 user_id=user_id,
@@ -437,7 +438,7 @@ def create_app(app_name=None):
 
 try:
 proc_arch64 = os.environ['PROCESSOR_ARCHITEW6432'].lower()
-except:
+except Exception as e:
 proc_arch64 = None
 
 if proc_arch == 'x86' and not proc_arch64:
@@ -467,7 +468,8 @@ def create_app(app_name=None):
 svr_port = winreg.QueryValueEx(inst_key, 'Port')[0]
 svr_discovery_id = inst_id
 svr_comment = gettext(
-"Auto-detected %s installation with the data directory at %s" % (
+"Auto-detected %s installation with the data "
+"directory at %s" % (
 winreg.QueryValueEx(
 inst_key, 'Display Name'
 )[0],
@@ -484,7 +486,7 @@ def create_app(app_name=None):
 )
 
 inst_key.Close()
-except:
+except Exception as e:
 pass
 else:
 # We use the postgres-winreg.ini file on non-Windows
@@ -501,7 +503,8 @@ def create_app(app_name=None):
 
 # Loop the sections, and get the data from any that are PG or PPAS
 for section in sections:
-if section.startswith('PostgreSQL/') or section.startswith('EnterpriseDB/'):
+if section.startswith('PostgreSQL/') \
+or section.startswith('EnterpriseDB/'):
 svr_name = registry.get(section, 'Description')
 svr_superuser = registry.get(section, 'Superuser')
 svr_port = registry.getint(section, 'Port')
@@ -511,14 +514,17 @@ def create_app(app_name=None):
 if hasattr(str, 'decode'):
 description = description.decode('utf-8')
 data_directory = data_directory.decode('utf-8')
-svr_comment = gettext(u"Auto-detected %s installation with the data directory at %s" % (
-description,
-data_directory
-))
+svr_comment = gettext(u"Auto-detected %s installation "
+  u"with the data directory at %s" % (
+description,
+data_directory
+)
+  )
 add_server(user_id, servergroup_id, svr_name,
-   svr_superuser, svr_port, svr_discovery_id, svr_comment)
+   svr_superuser, svr_port, svr_discovery_id,
+   svr_comment)
 
-except:
+except Exception as e:
 pass
 
 @user_logged_in.connect_via(app)
@@ -545,7 +551,8 @@ def create_app(app_name=None):
 # mode, and it's not a help file request.
 if not config.SERVER_MODE and app.PGADMIN_KEY != '':
 if (
-(not 'key' in request.args or request.args['key'] != app.PGADMIN_KEY) and
+('key' not in request.args or
+request.args['k

pgAdmin 4 commit: PEP8 fixes.

2018-02-26 Thread Dave Page
PEP8 fixes.

Branch
--
master

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

Modified Files
--
web/pgadmin/utils/compile_template_name.py |  8 +++--
.../utils/tests/test_compile_template_name.py  | 37 ++
2 files changed, 29 insertions(+), 16 deletions(-)



Re: [pgadmin4][patch] Fix PEP-8 issues

2018-02-26 Thread Dave Page
Thanks, applied.

On Mon, Feb 26, 2018 at 10:32 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA minor patch to fix the issue in utils folder.
> pycodestyle --config=.pycodestyle ./pgadmin/utils/
>
>
> --
> 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: Ensure we pick up the messages from the current query

2018-02-26 Thread Dave Page
Ensure we pick up the messages from the current query and not a previous one. 
Fixes #3094

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=08b3ccc01a4d57e8ea3657f8882a53dcd1b99386
Author: Khushboo Vashi 

Modified Files
--
web/pgadmin/utils/driver/abstract.py  |  1 +
web/pgadmin/utils/driver/psycopg2/__init__.py | 64 +--
2 files changed, 21 insertions(+), 44 deletions(-)



Re: [pgAdmin4][Patch]: RM #3094 - Notices from query n are shown in messages from query n+1

2018-02-26 Thread Dave Page
Thanks, applied.

On Mon, Feb 26, 2018 at 11:05 AM, Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> Please find the attached patch to fix the RM #3094: Notices from query n
> are shown in messages from query n+1
>
> Thanks,
> Khushboo
>



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

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


Re: PoC electron and pgAdmin4

2018-02-26 Thread Joao De Almeida Pereira
Hello
That is unfortunate. Can you run directly the python app?
Go to the folder where you installed the application using a
terminal/PowerShell/cmd and use the python from the venv folder to run the
pgadmin4.py file and let me know the error that you are getting.

venv/bin/python pgadmin4/pgadmin4.py

Or
venv\Scripts\python.exe pgadmin4\pgadmin4.py

Depending on the environment

Also there might be a caption problem I am not on my machine now so I
cannot double check.

Thanks
Joao

On Mon, Feb 26, 2018, 2:44 AM Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Joao,
>
> Does not work for me either.
>
> Tested on platforms:
> Win10 Pro x64 (Old VM)
> Win10 Pro x64 (Fresh VM)
>
> Same behaviour on both of the VMs, I waited for one and half minutes but
> still it didn't start.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> On Sat, Feb 24, 2018 at 1:44 AM, Joao De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hi Hackers,
>> After the removal of the Webkit environment we gave a shot to add
>> electron as our runtime environment. We were able to do it with some degree
>> of success.
>> The links to get a version running with electron are:
>> Windows:
>> https://storage.googleapis.com/pgadmin-binaries/releases/pgAdmin%204%20Setup%203.0.0.exe
>>
>> Mac:
>> https://storage.googleapis.com/pgadmin-binaries/releases/pgAdmin%204-3.0.0.dmg
>>
>> Ubuntu:
>> https://storage.googleapis.com/pgadmin-binaries/releases/pgAdmin4_3.0.0_amd64.deb
>>
>> RPM:
>> https://storage.googleapis.com/pgadmin-binaries/releases/pgAdmin4-3.0.0.x86_64.rpm
>>
>>
>> What did we accomplish:
>>  - Use Electron as a runtime and packaging solution for the application
>>  - Support opening new windows when the preferences ask for them
>>  - Make the application generally work
>>  - Use Chrome as a default browser for the application
>>  - Building scripts for all platforms using `yarn`, please review Readme
>>  - The packaged Python version is 3.6 to Mac and Linux, and 3.4 to Windows
>>  - In our point of view it is a simpler way to generate the installers
>>
>> Work in progress:
>>  - No random port for the server, so you can only start 1 instance per
>> machine
>>  - Tab support, there is no native support for tabs in Electron. It is
>> possible to do that, and eventually you will see a option in the menu to
>> create a new tab, but for this PoC we decided to disable the creation of
>> tabs. Tabs need to be implemented using HTML and cannot be ripped of from
>> the current window, like in Chrome
>>  - Did not test in CentOS, but tested in Ubuntu and it is working (We
>> tried but the electron required GLIBC 2.25 that was not on the version of
>> CentOS that we had)
>>  - In Linux despite the fact that we close the window, the application is
>> still running and need to be killed by hand
>>  - We didn't test Debigger opening in new window
>>  - Loading screen has no reference to pgAdmin
>>  - No logging file for the runtime
>>  - Windows we are using python 3.4 and using prior version of psycopg2
>> 2.5.6 and pycrypto 2.6.1 (The version of psycopg2 is not the correct one,
>> this is because we couldn't find a precompile version of psycopg2)
>>  - This is just a spike and the code looks pretty messy. This need to be
>> changed in order to make it more readable and have some tests around it
>>
>> Please give it a try and let us know what you think about it. If you find
>> any problem let us know as well.
>> This is just a Proof Of Concept, where the majority of the application
>> should be running correctly but there might be some glitches,
>>
>> You can find the code in:
>> https://github.com/greenplum-db/pgadmin4/tree/electron-over-master
>> Readme:
>> https://github.com/greenplum-db/pgadmin4/blob/electron-over-master/electron/README.md
>>
>>
>> Thanks
>> Joao
>>
>
>


Re: RM2898 Keyboard navigation in dialog tabs (nav tabs)

2018-02-26 Thread Dave Page
Hi

On Mon, Feb 26, 2018 at 12:03 PM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> Hi,
>
> Please find the updated patch for keyboard navigation.
>
> In this patch I have reduced delay which is required until current tab
> navigation is completed.
> Extracted class dialogTabNavigator and put it in new file.
> Added jasmine test cases.
> Fixed linting issues, variable naming convention issues.
>

This is still getting stuck on the Connection tab when I test on the server
dialog.

BTW, I've updated the documentation a little - please find the attached
version.

Thanks.



>
>
>
> --
> *Harshal Dhumal*
> *Sr. Software Engineer*
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Wed, Feb 21, 2018 at 11:39 PM, Harshal Dhumal <
> harshaldhuma...@gmail.com> wrote:
>
>> Hi,
>>
>> On Wed, Feb 21, 2018 at 10:59 PM, Joao De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Yep I installed the V2 file
>>>
>>> On Wed, Feb 21, 2018 at 11:31 AM Dave Page  wrote:
>>>
 On Wed, Feb 21, 2018 at 4:22 PM, Joao De Almeida Pereira <
 jdealmeidapere...@pivotal.io> wrote:

> Hello Harshal,
>
> I passed the patch through our CI and all the tests passed. The
> changes do not break previous behavior but because there are no tests on
> the new feature  we could not be sure it was really working. So we did 
> some
> manual testing and sometimes it doesn't work, like it gets stuck in a 
> place
> and you need to press the shortcut again in order for it to move.
>

 It stuck because I have to wait until next tab is completely visible
>> (fade in effect is completed).
>> The fade in or fade out transition duration is 150 ms (set by bootstrap).
>> So I can not set focus back to tab pane
>> until fade in or fade out transition is completed. May be one improvement
>> I can do is to reduce wait time to
>> something 200 ms (currently it's 500 ms).
>>
>> Note that the original issue reported by Dave is already fixed in updated
>> patch.
>>
>>
>>> Was that with the updated patch? It sounds like the issue I saw with the
 original one.


>
> Codewise I have some suggestions:
>  - dialogTabNavigator looks a nice candidate for a class with its own
> file. This way we can test the behavior
>
 Ok I'll move dialogTabNavigator to new file and will add test cases.
>>
>>>  - There is no difference between a variable called e and a variable
> error so for sake of clarity I would love to see variable names that
> we can easily read
>  - We are also using 2 different types of variable naming camelCase
> and snake_case, if we could use only camelCase on Javascript it would make
> the code more uniform
>
 Ok I'll do this.
>>
>>
>>>  - I noticed that there are some linting issues in the Javascript code
>
 I just found that linter was disabled for this file by adding comment
>> /* eslint-disable */ at first line. (not sure why we did that)
>>
>>
> Summing it up I believe that despite the feature not working 100% of
> the time, looks like the code is almost there but needs some refactoring 
> to
> make it more readable, instead of comments we could have function calls
> that more clearly state what we are looking for something like
> DialogTabNavigator.isLastTabOfChild
> ​
> ​
>
>
> Thanks
> Joao
>
> On Wed, Feb 21, 2018 at 4:32 AM Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> --
>> *Harshal Dhumal*
>> *Sr. Software Engineer*
>>
>> EnterpriseDB India: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Tue, Feb 20, 2018 at 10:34 PM, Dave Page 
>> wrote:
>>
>>> Hi
>>>
>>> On Tue, Feb 20, 2018 at 7:22 AM, Harshal Dhumal <
>>> harshal.dhu...@enterprisedb.com> wrote:
>>>
 Hi,

 Please find attached patch to enable keyboard navigation in dialog.

 To allow navigation from one tab pane (bootstrap tab pane) to
 another one
 I have added two new shortcut preferences *Dialog tab previous *(
 shift+control+[ ) and *Dialog tab next* ( shift+control+] ) for 
 backward
 and forward tab navigation.

 Also all dialog controls (within same tab pane) can be navigated
 using TAB key.

>>>
>>>
>>
>>> This seems unreliable to me - for example, it keeps getting stuck on
>>> the connection tab on the server properties dialog.
>>>
>>>
>>
>>> Also, can we use the same wording as for the tabbed panel navigation
>>> please? E.g. Next/Previous instead of Forward/Back.
>>>
>>
>> I have fixed all of above issues. Please find updated patch.
>>
>> Thanks,
>>
>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.c

[pgAdmin4][RM#3073] Allow user to schedule without End date from UI

2018-02-26 Thread Murtuza Zabuawala
Hi,

PFA patch to fix the issue where user was not able to create pgAgent job
from UI without entering End date in schedule section.

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git 
a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js
 
b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js
index 6972dca..a88f9d0 100644
--- 
a/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js
+++ 
b/web/pgadmin/browser/server_groups/servers/pgagent/schedules/static/js/pga_schedule.js
@@ -464,18 +464,16 @@ define('pgadmin.node.pga_schedule', [
 this.errorModel.unset('jscstart');
   }
 
-  val = this.get('jscend');
-  if (_.isUndefined(val) || _.isNull(val) ||
-String(val).replace(/^\s+|\s+$/g, '') == '') {
-msg = gettext('Please enter the end time.');
-this.errorModel.set('jscend', msg);
-errMsg = errMsg || msg;
-  } else {
-this.errorModel.unset('jscend');
-  }
-
   // End time must be greater than Start time
   if(!errMsg) {
+val = this.get('jscend');
+// No further validation required if end date is not provided by
+// the user
+if (_.isUndefined(val) || _.isNull(val) ||
+  String(val).replace(/^\s+|\s+$/g, '') == '') {
+  return;
+}
+
 var start_time = this.get('jscstart'),
   end_time = this.get('jscend'),
   start_time_js =  start_time.split(' '),


Re: [pgAdmin4][Patch]: PEP-8 issue fixes

2018-02-26 Thread Dave Page
Can you rebase this please? It doesn't apply against master.

On Mon, Feb 26, 2018 at 12:04 PM, Khushboo Vashi <
khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> Please find the attached patch to fix PEP-8 issues in the below modules:
>
> 1. about
> 2. feature_tests
> 3. misc
> 4. utils
>
> Thanks,
> Khushboo
>



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

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


pgAdmin 4 commit: Update dashboard display options screenshots.

2018-02-26 Thread Dave Page
Update dashboard display options screenshots.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=51811a451d1f7d4c852372cb6088918dd44bd42f
Author: Chethana Kumar 

Modified Files
--
.../en_US/images/preferences_dashboard_display.png | Bin 333609 -> 84310 bytes
1 file changed, 0 insertions(+), 0 deletions(-)



Re: [pgAdmin4][RM#2951] Allow user to disable graphs and activity grid

2018-02-26 Thread Dave Page
Hi

On Mon, Feb 26, 2018 at 12:55 PM, Chethana Kumar <
chethana.ku...@enterprisedb.com> wrote:

> Hi Dave,
>
> I am attaching the patch that is requested and also a short note on "*How
> to resize images for documentation*".
>

Thanks, applied.


>
> *Applicable for popups only -*
> 1. First of all, the total display screenshot size should be 2560 × 1600
>

That's the browser window size, or?


> 2. As expected the popup area alone to be cropped
> 3. Then reduced it by 55% value
>

OK. What should the resulting DPI value and max size be? Any particular
resize method?


>
> Regards,
> Chethana kumar
>
>
>
> On Mon, Feb 26, 2018 at 2:52 PM, Dave Page  wrote:
>
>> Thanks, patch applied with minor changes to the description strings for
>> the options.
>>
>> Chethana, could you please send me an update of the appropriate image
>> from this patch (with my changed strings), and send a short howto on
>> creating the images properly, including the specs for them please? I'll
>> incorporate that into the docs, which should make it easier for us all to
>> update the screenshots in the future.
>>
>> Thanks!
>>
>> On Fri, Feb 23, 2018 at 10:21 AM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> PFA patch which will add functionality to allow user to disable graphs
>>> and/or activity grids.
>>>
>>> Please review.
>>>
>>> --
>>> 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
>>
>
>
>
> --
> Chethana Kumar
> Principal UI/UX Designer
> EnterpriseDB Corporation
>
>
> The Postgres Database Company
>
> P: +91 86981 57146 <+91%2086981%2057146>
> www.enterprisedb.com
>



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

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


Re: pep-8 fixes

2018-02-26 Thread Dave Page
Thanks, applied.

On Mon, Feb 26, 2018 at 1:38 PM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> Hi,
>
> Please find patch to fix pep-8 issues for given modules.
>
> 1. help (__init__.py)
> 2. pgadmin (__init__.py)
> 3. browser (__init__.py, collection.py, utils.py)
>
>
> --
> *Harshal Dhumal*
> *Sr. Software Engineer*
>
> EnterpriseDB India: 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: PEP8 fixes.

2018-02-26 Thread Dave Page
PEP8 fixes.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=43d3e0ca64179da4e52a8746085de01292972f1d
Author: Harshal Dhumal 

Modified Files
--
web/pgadmin/__init__.py   |  42 +++--
web/pgadmin/browser/__init__.py   | 124 +-
web/pgadmin/browser/collection.py |  14 +++--
web/pgadmin/browser/utils.py  |  50 ++-
web/pgadmin/help/__init__.py  |   4 +-
5 files changed, 153 insertions(+), 81 deletions(-)



Re: pgAdmin 4 commit: Ensure we pick up the messages from the current query

2018-02-26 Thread Murtuza Zabuawala
Hi Khushboo/Dave,

With given commit, I'm again seeing the issue raised in
https://redmine.postgresql.org/issues/1523 :(




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


On Mon, Feb 26, 2018 at 7:49 PM, Dave Page  wrote:

> Ensure we pick up the messages from the current query and not a previous
> one. Fixes #3094
>
> Branch
> --
> master
>
> Details
> ---
> https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=
> 08b3ccc01a4d57e8ea3657f8882a53dcd1b99386
> Author: Khushboo Vashi 
>
> Modified Files
> --
> web/pgadmin/utils/driver/abstract.py  |  1 +
> web/pgadmin/utils/driver/psycopg2/__init__.py | 64
> +--
> 2 files changed, 21 insertions(+), 44 deletions(-)
>
>


Re: pgAdmin 4 commit: Ensure we pick up the messages from the current query

2018-02-26 Thread Murtuza Zabuawala
Sent bit early,

You can run 'VACUUM FULL VERBOSE' in query tool and verify the populated
messages (pgAdmin3 vs. pgAdmin4).


On Mon, Feb 26, 2018 at 9:48 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Khushboo/Dave,
>
> With given commit, I'm again seeing the issue raised in
> https://redmine.postgresql.org/issues/1523 :(
>
>
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> On Mon, Feb 26, 2018 at 7:49 PM, Dave Page  wrote:
>
>> Ensure we pick up the messages from the current query and not a previous
>> one. Fixes #3094
>>
>> Branch
>> --
>> master
>>
>> Details
>> ---
>> https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdif
>> f;h=08b3ccc01a4d57e8ea3657f8882a53dcd1b99386
>> Author: Khushboo Vashi 
>>
>> Modified Files
>> --
>> web/pgadmin/utils/driver/abstract.py  |  1 +
>> web/pgadmin/utils/driver/psycopg2/__init__.py | 64
>> +--
>> 2 files changed, 21 insertions(+), 44 deletions(-)
>>
>>
>


Re: pgAdmin 4 commit: Ensure we pick up the messages from the current query

2018-02-26 Thread Dave Page
Argh, I ran some tests, but didn't spot any lost messages in the tests I
ran. I'll revert the patch.

Khushboo;

Please look at the following:

- Fix the patch so it doesn't drop messages.
- Add regression tests to make sure it doesn't break in the future. This
may require creating one or more functions the spew out a whole lot of
notices, and then running a couple of queries and checking the output.
- Check the messages panel on the history tab. I just noticed it seems to
only be showing an even smaller subset of the messages.

Thanks.

On Mon, Feb 26, 2018 at 4:23 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Sent bit early,
>
> You can run 'VACUUM FULL VERBOSE' in query tool and verify the populated
> messages (pgAdmin3 vs. pgAdmin4).
>
>
> On Mon, Feb 26, 2018 at 9:48 PM, Murtuza Zabuawala  enterprisedb.com> wrote:
>
>> Hi Khushboo/Dave,
>>
>> With given commit, I'm again seeing the issue raised in
>> https://redmine.postgresql.org/issues/1523 :(
>>
>>
>>
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>> On Mon, Feb 26, 2018 at 7:49 PM, Dave Page  wrote:
>>
>>> Ensure we pick up the messages from the current query and not a previous
>>> one. Fixes #3094
>>>
>>> Branch
>>> --
>>> master
>>>
>>> Details
>>> ---
>>> https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdif
>>> f;h=08b3ccc01a4d57e8ea3657f8882a53dcd1b99386
>>> Author: Khushboo Vashi 
>>>
>>> Modified Files
>>> --
>>> web/pgadmin/utils/driver/abstract.py  |  1 +
>>> web/pgadmin/utils/driver/psycopg2/__init__.py | 64
>>> +--
>>> 2 files changed, 21 insertions(+), 44 deletions(-)
>>>
>>>
>>
>


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

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


pgAdmin 4 commit: Revert "Ensure we pick up the messages from the curre

2018-02-26 Thread Dave Page
Revert "Ensure we pick up the messages from the current query and not a 
previous one. Fixes #3094"

This reverts commit 08b3ccc01a4d57e8ea3657f8882a53dcd1b99386.
It was found that this fix inadvertently re-introduces #1523

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=bcdb8eb27582eda1d04650e3fa0417be2abc44aa

Modified Files
--
web/pgadmin/utils/driver/abstract.py  |  1 -
web/pgadmin/utils/driver/psycopg2/__init__.py | 64 ++-
2 files changed, 44 insertions(+), 21 deletions(-)



Re: [pgAdmin4][RM#2900] Adding accessibility features in query tool

2018-02-26 Thread Joao De Almeida Pereira
Hello Murtuza,
We just passed the patch through our CI pipeline and all tests pass. The
patch looks good.

Sorry that the patch I sent didn't help. Nevertheless when I finish the
tasks that we want to try to get accepted for pgAdmin4 3.0 release I will
try to change the way the preferences are retrieved, because at this point
in time they work because we only ask for them after some time we try to
get them, or else the code does not work.
Unless someone want to give it a shot first. From my point of view this
functionality should work like a separate service that we include where we
need it and work with a promise system. There are some nice article about
promises and how to handle them instead of using event bouncing all around:
https://medium.com/dev-bits/writing-neat-asynchronous-node-js-code-with-promises-32ed3a4fd098

https://developers.google.com/web/fundamentals/primers/promises (this is
quite a complete guide on promises, and how to think about them)

Thanks
Joao

On Mon, Feb 26, 2018 at 4:58 AM Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Joao,
>
> I tried the solution/patch you suggested but it is not working for me, I
> always get *undefined* for preferences values.
>
> Thanks,
> Murtuza
>
> On Thu, Feb 22, 2018 at 3:17 AM, Joao De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hello Murtuza,
>> I created a small patch on the way I believe the function should work.
>> Not 100% sure why we are piggybacking on the window.top, window.opener and
>> so on to give us information. Nowadays I do not think that loading the JS
>> files again costs that much in terms of time.
>>
>> The issue I came across was that cache_preferences/get_preference behave
>> in a very strange way.
>>
>> Example:
>> If the cache is populated no problem it returns a value and it is fine
>> If the cache is not populated it sets a timeout that will check in 1
>> second if is the cache is populated if it is not then does nothing, if it
>> is then returns the value.
>> The problem is that it returns the value to no place.
>>
>> This caching implementation works until this point because for some good
>> fortune we never call get_preference before we have the cache full.
>> Is my assessment correct?
>>
>> Nevertheless if the caching was using promises we could avoid the problem
>> above.
>>
>> Thanks
>> Joao
>>
>> On Wed, Feb 21, 2018 at 12:50 PM Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi Joao,
>>>
>>> Thank you for your time in reviewing the patch.
>>>
>>>
>>> On Wed, Feb 21, 2018 at 9:11 PM, Joao De Almeida Pereira <
>>> jdealmeidapere...@pivotal.io> wrote:
>>>
 Hello Murtuza,
 After reviewing the code I have some suggestions:
  - We should split the PEP and the features into different patches, or
 else it becomes very hard to separate Feature code from Code Style change

>>> ​I'll keep that in mind next time onwards.
>>>
  - The function: `getTextRepresentaionShortcut` has a typo

>>> ​I'll fix​
>>>
>>> ​that.​
>>>
  - As a personal point I have a hard time reading multiple declarations
 of variables in javascript under a single `var`, I prefer 1 `let` per
 variable

>>>  - I think we should use cameCase for our variables in Javascript code
  - What is the reason behind the move of the key shortcuts back into
 the SQLEditorController? This look like something that could be extracted
 from SQLEditor file into its own

>>> I'll try to move that code.​
>>>
>>>
  - Looks like we are missing some test coverage on the new implemented
 parts

>>> ​I didn't added any new code as such, I just moved out preferences code
>>> out from main file.
>>>
  - The getKeyboardShortcuts function is retrieving information from
 window.top and window.opener I think that we can come up with a better
 pattern then this. Relying on window information doesn't look very good.
 That was the pattern for JQuery that the new frameworks are trying to avoid
 because polluting the global scope is almost always a Code Smell.

>>> ​What do you suggest on this?​
>>>
>>>


 I see there was some refactoring on the backend with the creation of
 RegisterQueryToolPreferences and it is looking good, hope that we can do
 this in more places specially in the front-end.

 Using the patch that you sent I passed it through our CI and everything
 is Passing.

 Thanks
 Joao

 On Tue, Feb 20, 2018 at 1:13 PM Murtuza Zabuawala <
 murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch for adding accessibility features in query tool.
> RM#2900
>
> Please review.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
>


Re: PoC electron and pgAdmin4

2018-02-26 Thread Joao De Almeida Pereira
Thanks Murtuza,
Looks like something is wrong with the venv for windows at least. Tomorrow
I will give it a try again in a VM to see if I can understand what is
happening, maybe I will need some help to understand what is added on the
current windows build to ensure we have all the required libraries present.

Thanks
Joao

On Mon, Feb 26, 2018 at 9:42 AM Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Joao,
>
> Attaching the screenshot.
>
> On Mon, Feb 26, 2018 at 7:50 PM, Joao De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hello
>> That is unfortunate. Can you run directly the python app?
>> Go to the folder where you installed the application using a
>> terminal/PowerShell/cmd and use the python from the venv folder to run the
>> pgadmin4.py file and let me know the error that you are getting.
>>
>> venv/bin/python pgadmin4/pgadmin4.py
>>
>> Or
>> venv\Scripts\python.exe pgadmin4\pgadmin4.py
>>
>> Depending on the environment
>>
>> Also there might be a caption problem I am not on my machine now so I
>> cannot double check.
>>
>> Thanks
>> Joao
>>
>> On Mon, Feb 26, 2018, 2:44 AM Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi Joao,
>>>
>>> Does not work for me either.
>>>
>>> Tested on platforms:
>>> Win10 Pro x64 (Old VM)
>>> Win10 Pro x64 (Fresh VM)
>>>
>>> Same behaviour on both of the VMs, I waited for one and half minutes but
>>> still it didn't start.
>>>
>>> --
>>> Regards,
>>> Murtuza Zabuawala
>>> EnterpriseDB: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>>
>>> On Sat, Feb 24, 2018 at 1:44 AM, Joao De Almeida Pereira <
>>> jdealmeidapere...@pivotal.io> wrote:
>>>
 Hi Hackers,
 After the removal of the Webkit environment we gave a shot to add
 electron as our runtime environment. We were able to do it with some degree
 of success.
 The links to get a version running with electron are:
 Windows:
 https://storage.googleapis.com/pgadmin-binaries/releases/pgAdmin%204%20Setup%203.0.0.exe

 Mac:
 https://storage.googleapis.com/pgadmin-binaries/releases/pgAdmin%204-3.0.0.dmg

 Ubuntu:
 https://storage.googleapis.com/pgadmin-binaries/releases/pgAdmin4_3.0.0_amd64.deb

 RPM:
 https://storage.googleapis.com/pgadmin-binaries/releases/pgAdmin4-3.0.0.x86_64.rpm


 What did we accomplish:
  - Use Electron as a runtime and packaging solution for the application
  - Support opening new windows when the preferences ask for them
  - Make the application generally work
  - Use Chrome as a default browser for the application
  - Building scripts for all platforms using `yarn`, please review Readme
  - The packaged Python version is 3.6 to Mac and Linux, and 3.4 to
 Windows
  - In our point of view it is a simpler way to generate the installers

 Work in progress:
  - No random port for the server, so you can only start 1 instance per
 machine
  - Tab support, there is no native support for tabs in Electron. It is
 possible to do that, and eventually you will see a option in the menu to
 create a new tab, but for this PoC we decided to disable the creation of
 tabs. Tabs need to be implemented using HTML and cannot be ripped of from
 the current window, like in Chrome
  - Did not test in CentOS, but tested in Ubuntu and it is working (We
 tried but the electron required GLIBC 2.25 that was not on the version of
 CentOS that we had)
  - In Linux despite the fact that we close the window, the application
 is still running and need to be killed by hand
  - We didn't test Debigger opening in new window
  - Loading screen has no reference to pgAdmin
  - No logging file for the runtime
  - Windows we are using python 3.4 and using prior version of psycopg2
 2.5.6 and pycrypto 2.6.1 (The version of psycopg2 is not the correct one,
 this is because we couldn't find a precompile version of psycopg2)
  - This is just a spike and the code looks pretty messy. This need to
 be changed in order to make it more readable and have some tests around it

 Please give it a try and let us know what you think about it. If you
 find any problem let us know as well.
 This is just a Proof Of Concept, where the majority of the application
 should be running correctly but there might be some glitches,

 You can find the code in:
 https://github.com/greenplum-db/pgadmin4/tree/electron-over-master
 Readme:
 https://github.com/greenplum-db/pgadmin4/blob/electron-over-master/electron/README.md


 Thanks
 Joao

>>>
>>>
>


Re: [pgAdmin4][RM#2900] Adding accessibility features in query tool

2018-02-26 Thread Murtuza Zabuawala
Thank you Joao for reviewing.

On Mon, Feb 26, 2018 at 10:43 PM, Joao De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hello Murtuza,
> We just passed the patch through our CI pipeline and all tests pass. The
> patch looks good.
>
> Sorry that the patch I sent didn't help. Nevertheless when I finish the
> tasks that we want to try to get accepted for pgAdmin4 3.0 release I will
> try to change the way the preferences are retrieved, because at this point
> in time they work because we only ask for them after some time we try to
> get them, or else the code does not work.
> Unless someone want to give it a shot first. From my point of view this
> functionality should work like a separate service that we include where we
> need it and work with a promise system. There are some nice article about
> promises and how to handle them instead of using event bouncing all around:
> https://medium.com/dev-bits/writing-neat-asynchronous-
> node-js-code-with-promises-32ed3a4fd098
> https://developers.google.com/web/fundamentals/primers/promises (this is
> quite a complete guide on promises, and how to think about them)
>
> Sure, I'll go through the articles you provided.

Thanks,
Murtuza


> Thanks
> Joao
>
> On Mon, Feb 26, 2018 at 4:58 AM Murtuza Zabuawala  enterprisedb.com> wrote:
>
>> Hi Joao,
>>
>> I tried the solution/patch you suggested but it is not working for me, I
>> always get *undefined* for preferences values.
>>
>> Thanks,
>> Murtuza
>>
>> On Thu, Feb 22, 2018 at 3:17 AM, Joao De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hello Murtuza,
>>> I created a small patch on the way I believe the function should work.
>>> Not 100% sure why we are piggybacking on the window.top, window.opener and
>>> so on to give us information. Nowadays I do not think that loading the JS
>>> files again costs that much in terms of time.
>>>
>>> The issue I came across was that cache_preferences/get_preference
>>> behave in a very strange way.
>>>
>>> Example:
>>> If the cache is populated no problem it returns a value and it is fine
>>> If the cache is not populated it sets a timeout that will check in 1
>>> second if is the cache is populated if it is not then does nothing, if it
>>> is then returns the value.
>>> The problem is that it returns the value to no place.
>>>
>>> This caching implementation works until this point because for some good
>>> fortune we never call get_preference before we have the cache full.
>>> Is my assessment correct?
>>>
>>> Nevertheless if the caching was using promises we could avoid the
>>> problem above.
>>>
>>> Thanks
>>> Joao
>>>
>>> On Wed, Feb 21, 2018 at 12:50 PM Murtuza Zabuawala >> enterprisedb.com> wrote:
>>>
 Hi Joao,

 Thank you for your time in reviewing the patch.


 On Wed, Feb 21, 2018 at 9:11 PM, Joao De Almeida Pereira <
 jdealmeidapere...@pivotal.io> wrote:

> Hello Murtuza,
> After reviewing the code I have some suggestions:
>  - We should split the PEP and the features into different patches, or
> else it becomes very hard to separate Feature code from Code Style change
>
 ​I'll keep that in mind next time onwards.

>  - The function: `getTextRepresentaionShortcut` has a typo
>
 ​I'll fix​

 ​that.​

>  - As a personal point I have a hard time reading multiple
> declarations of variables in javascript under a single `var`, I prefer 1
> `let` per variable
>
  - I think we should use cameCase for our variables in Javascript code
>  - What is the reason behind the move of the key shortcuts back into
> the SQLEditorController? This look like something that could be extracted
> from SQLEditor file into its own
>
 I'll try to move that code.​


>  - Looks like we are missing some test coverage on the new implemented
> parts
>
 ​I didn't added any new code as such, I just moved out preferences code
 out from main file.

>  - The getKeyboardShortcuts function is retrieving information from
> window.top and window.opener I think that we can come up with a better
> pattern then this. Relying on window information doesn't look very good.
> That was the pattern for JQuery that the new frameworks are trying to 
> avoid
> because polluting the global scope is almost always a Code Smell.
>
 ​What do you suggest on this?​


>
>
> I see there was some refactoring on the backend with the creation of
> RegisterQueryToolPreferences and it is looking good, hope that we can do
> this in more places specially in the front-end.
>
> Using the patch that you sent I passed it through our CI and
> everything is Passing.
>
> Thanks
> Joao
>
> On Tue, Feb 20, 2018 at 1:13 PM Murtuza Zabuawala  enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA patch for adding accessibility features in query tool.
>> RM#2900
>>>

Re: pgAdmin 4 commit: Ensure we pick up the messages from the current query

2018-02-26 Thread Murtuza Zabuawala
FYI, This is what I'm receiving(attachments) when I'm running vacuum full
verbose on my PG10.
​​


On Mon, Feb 26, 2018 at 10:02 PM, Dave Page  wrote:

> Argh, I ran some tests, but didn't spot any lost messages in the tests I
> ran. I'll revert the patch.
>
> Khushboo;
>
> Please look at the following:
>
> - Fix the patch so it doesn't drop messages.
> - Add regression tests to make sure it doesn't break in the future. This
> may require creating one or more functions the spew out a whole lot of
> notices, and then running a couple of queries and checking the output.
> - Check the messages panel on the history tab. I just noticed it seems to
> only be showing an even smaller subset of the messages.
>
> Thanks.
>
> On Mon, Feb 26, 2018 at 4:23 PM, Murtuza Zabuawala  enterprisedb.com> wrote:
>
>> Sent bit early,
>>
>> You can run 'VACUUM FULL VERBOSE' in query tool and verify the populated
>> messages (pgAdmin3 vs. pgAdmin4).
>>
>>
>> On Mon, Feb 26, 2018 at 9:48 PM, Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi Khushboo/Dave,
>>>
>>> With given commit, I'm again seeing the issue raised in
>>> https://redmine.postgresql.org/issues/1523 :(
>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Murtuza Zabuawala
>>> EnterpriseDB: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>>
>>> On Mon, Feb 26, 2018 at 7:49 PM, Dave Page  wrote:
>>>
 Ensure we pick up the messages from the current query and not a
 previous one. Fixes #3094

 Branch
 --
 master

 Details
 ---
 https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdif
 f;h=08b3ccc01a4d57e8ea3657f8882a53dcd1b99386
 Author: Khushboo Vashi 

 Modified Files
 --
 web/pgadmin/utils/driver/abstract.py  |  1 +
 web/pgadmin/utils/driver/psycopg2/__init__.py | 64
 +--
 2 files changed, 21 insertions(+), 44 deletions(-)


>>>
>>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
INFO:  vacuuming "public.mytable"
INFO:  "mytable": found 0 removable, 101 nonremovable row versions in 4425 
pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.17 s, system: 0.17 s, elapsed: 0.41 s.
INFO:  vacuuming "pg_catalog.pg_statistic"
INFO:  "pg_statistic": found 48 removable, 394 nonremovable row versions in 18 
pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_type"
INFO:  "pg_type": found 5 removable, 379 nonremovable row versions in 9 pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_policy"
INFO:  "pg_policy": found 0 removable, 0 nonremovable row versions in 0 pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_authid"
INFO:  "pg_authid": found 0 removable, 6 nonremovable row versions in 1 pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_user_mapping"
INFO:  "pg_user_mapping": found 0 removable, 0 nonremovable row versions in 0 
pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_subscription"
INFO:  "pg_subscription": found 0 removable, 0 nonremovable row versions in 0 
pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_attribute"
INFO:  "pg_attribute": found 22 removable, 2614 nonremovable row versions in 51 
pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_proc"
INFO:  "pg_proc": found 0 removable, 2902 nonremovable row versions in 74 pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_attrdef"
INFO:  "pg_attrdef": found 0 removable, 0 nonremovable row versions in 0 pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_constraint"
INFO:  "pg_constraint": found 0 removable, 2 nonremovable row versions in 1 
pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_inherits"
INFO:  "pg_inherits": found 0 removable, 0 nonremovable row versions in 0 pages
DETAIL:  0 dead row versions cannot be removed yet.
CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s.
INFO:  vacuuming "pg_catalog.pg_index"
INFO:  "pg_index": found 17 removable, 134 nonremovable row versions in 4 pages
DETAIL:  0 

Re: RM2898 Keyboard navigation in dialog tabs (nav tabs)

2018-02-26 Thread Harshal Dhumal
Hi,

Please find the updated patch.

On Mon, Feb 26, 2018 at 8:03 PM, Dave Page  wrote:

> Hi
>
> On Mon, Feb 26, 2018 at 12:03 PM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> Please find the updated patch for keyboard navigation.
>>
>> In this patch I have reduced delay which is required until current tab
>> navigation is completed.
>> Extracted class dialogTabNavigator and put it in new file.
>> Added jasmine test cases.
>> Fixed linting issues, variable naming convention issues.
>>
>
> This is still getting stuck on the Connection tab when I test on the
> server dialog.
>
The disabled input field (Host name/address) on connection tab was causing
issue.


>
> BTW, I've updated the documentation a little - please find the attached
> version.
>
Thanks for this. I have included revised version of documentation in
current patch.


>
> Thanks.
>
>
>
>>
>>
>>
>> --
>> *Harshal Dhumal*
>> *Sr. Software Engineer*
>>
>> EnterpriseDB India: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Wed, Feb 21, 2018 at 11:39 PM, Harshal Dhumal <
>> harshaldhuma...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> On Wed, Feb 21, 2018 at 10:59 PM, Joao De Almeida Pereira <
>>> jdealmeidapere...@pivotal.io> wrote:
>>>
 Yep I installed the V2 file

 On Wed, Feb 21, 2018 at 11:31 AM Dave Page  wrote:

> On Wed, Feb 21, 2018 at 4:22 PM, Joao De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hello Harshal,
>>
>> I passed the patch through our CI and all the tests passed. The
>> changes do not break previous behavior but because there are no tests on
>> the new feature  we could not be sure it was really working. So we did 
>> some
>> manual testing and sometimes it doesn't work, like it gets stuck in a 
>> place
>> and you need to press the shortcut again in order for it to move.
>>
>
> It stuck because I have to wait until next tab is completely visible
>>> (fade in effect is completed).
>>> The fade in or fade out transition duration is 150 ms (set by
>>> bootstrap). So I can not set focus back to tab pane
>>> until fade in or fade out transition is completed. May be one
>>> improvement I can do is to reduce wait time to
>>> something 200 ms (currently it's 500 ms).
>>>
>>> Note that the original issue reported by Dave is already fixed in
>>> updated patch.
>>>
>>>
 Was that with the updated patch? It sounds like the issue I saw with
> the original one.
>
>
>>
>> Codewise I have some suggestions:
>>  - dialogTabNavigator looks a nice candidate for a class with its own
>> file. This way we can test the behavior
>>
> Ok I'll move dialogTabNavigator to new file and will add test cases.
>>>
  - There is no difference between a variable called e and a variable
>> error so for sake of clarity I would love to see variable names that
>> we can easily read
>>  - We are also using 2 different types of variable naming camelCase
>> and snake_case, if we could use only camelCase on Javascript it would 
>> make
>> the code more uniform
>>
> Ok I'll do this.
>>>
>>>
  - I noticed that there are some linting issues in the Javascript code
>>
> I just found that linter was disabled for this file by adding comment
>>> /* eslint-disable */ at first line. (not sure why we did that)
>>>
>>>
>> Summing it up I believe that despite the feature not working 100% of
>> the time, looks like the code is almost there but needs some refactoring 
>> to
>> make it more readable, instead of comments we could have function calls
>> that more clearly state what we are looking for something like
>> DialogTabNavigator.isLastTabOfChild
>> ​
>> ​
>>
>>
>> Thanks
>> Joao
>>
>> On Wed, Feb 21, 2018 at 4:32 AM Harshal Dhumal <
>> harshal.dhu...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> --
>>> *Harshal Dhumal*
>>> *Sr. Software Engineer*
>>>
>>> EnterpriseDB India: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>> On Tue, Feb 20, 2018 at 10:34 PM, Dave Page 
>>> wrote:
>>>
 Hi

 On Tue, Feb 20, 2018 at 7:22 AM, Harshal Dhumal <
 harshal.dhu...@enterprisedb.com> wrote:

> Hi,
>
> Please find attached patch to enable keyboard navigation in dialog.
>
> To allow navigation from one tab pane (bootstrap tab pane) to
> another one
> I have added two new shortcut preferences *Dialog tab previous *(
> shift+control+[ ) and *Dialog tab next* ( shift+control+] ) for 
> backward
> and forward tab navigation.
>
> Also all dialog controls (within same tab pane) can be navigated
> using TAB key.
>


>>>
 This seems unreliable to me - for example, it keeps g

Re: [pgadmin4] Creating a new Node in ACI Tree

2018-02-26 Thread Joao De Almeida Pereira
Thanks for the stearing, I finally found out the problem. I was missing an
's' in the end of one of the names

Joao

On Fri, Feb 23, 2018 at 10:19 PM Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Joao,
>
> On Fri, Feb 23, 2018 at 11:23 PM, Joao De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hello Murtuza,
>> Do we have to have that present in python in order for it to work in the
>> javascript?
>>
>
> ​No, Just create a node modal in JS with sample fields like Name/Comment
> etc.
> There are two flags in node modal,
> one of which responsible for displaying reversed engineered sql (flag:
> hasSQL)
> ​, other is responsible for displaying Dependancies and Dependants of the
> node on their respective Panel (flag:
> hasDepends)
>
> -- Murtuza
> ​
>
>
>> I am asking this because we didn't saw any request to the backend trying
>> to fetch this information.
>>
>> Thanks
>> Joao
>>
>> On Fri, Feb 23, 2018 at 11:12 AM Murtuza Zabuawala <
>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>
>>> Hi Joao,
>>>
>>> Just like 'nodes' & 'children' operation, You have to implement several
>>> other methods,
>>>
>>> *'obj'* - To create, update, delete & properties for External Tables
>>> Ref: ../foreign_tables/__init__.py: 193
>>> Which will call associated methods, def create(..), def update(...), def
>>> delete(...) & def properties(...)
>>>
>>> *'sql'* - Displays reversed engineered sql on SQL panel
>>> Which will call to method def sql(...) method
>>>
>>> *'msql'* - Displays reversed engineered sql on Create/Properties dialog
>>> Which will call to method def msql(...) method
>>>
>>> *'stats'* -Displays object statistics sql on Statistics panel
>>> Which will call to method def statistics(...) method
>>>
>>> *'dependency'* - Displays object dependencies on Dependencies panel
>>> Which will call to method def dependencies(...) method
>>>
>>> *'dependent'* - Displays object dependents on SQL panel
>>> Which will call to method def dependents(...) method
>>>
>>> Hope that helps.
>>>
>>> --
>>> Regards,
>>> Murtuza Zabuawala
>>> EnterpriseDB: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>>
>>> On Fri, Feb 23, 2018 at 9:08 PM, Joao De Almeida Pereira <
>>> jdealmeidapere...@pivotal.io> wrote:
>>>
 Hello Hackers,
 Need some pointers while creating new node on ACI Tree.
 In GreenPlum there is a concept of External Tables that are more or
 less similar to Foreign Wrappers, but different. So we started implementing
 a new node for it.

 We copied the Foreign Wrappers node and started it playing with it. The
 current status:
 We can see the External Tables node, when we open it we see the
 External Tables.
 The problem that we are facing now is when we select a table and then
 press the tabs 'SQL' or Properties nothing happens. What do we need to do
 in order for this to work?

 Maybe the choice of foreign Wrappers was not the best to start off, but
 we would appreciate some help to make this work.


 Attached you can find the code that I currently have.

 Thanks
 Joao

>>>
>>>


pgAdmin 4 commit: PEP8 fixes for the pgAgent and Tables nodes (and subn

2018-02-26 Thread Dave Page
PEP8 fixes for the pgAgent and Tables nodes (and subnodes). Fixes #3148

Branch
--
master

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

Modified Files
--
.../servers/databases/schemas/tables/__init__.py   |  93 +---
.../databases/schemas/tables/column/__init__.py|  95 +---
.../schemas/tables/column/tests/test_column_add.py |  19 +-
.../schemas/tables/constraints/__init__.py |  12 +-
.../constraints/check_constraint/__init__.py   |  54 +++--
.../constraints/exclusion_constraint/__init__.py   |  97 
.../tables/constraints/foreign_key/__init__.py | 114 +
.../constraints/index_constraint/__init__.py   | 169 --
.../databases/schemas/tables/indexes/__init__.py   |  28 ++-
.../schemas/tables/partitions/__init__.py  |  33 ++-
.../partitions/tests/test_backend_supported.py |  56 +++--
.../databases/schemas/tables/rules/__init__.py |  12 +-
.../sql/tests/test_foreign_key_properties.py   |  11 +-
.../schemas/tables/tests/test_column_acl_sql.py|  11 +-
.../tables/tests/test_column_properties_sql.py |   8 +-
.../schemas/tables/tests/test_table_put.py |   7 +-
.../schemas/tables/tests/test_tables_acl_sql.py|  16 +-
.../schemas/tables/tests/test_tables_node_sql.py   |   8 +-
.../tables/tests/test_tables_properties_sql.py |   9 +-
.../schemas/tables/tests/test_template_create.py   |  38 ++-
.../tables/tests/test_trigger_get_oid_sql.py   |  12 +-
.../schemas/tables/tests/test_trigger_nodes_sql.py |   8 +-
.../databases/schemas/tables/tests/utils.py|  20 +-
.../databases/schemas/tables/triggers/__init__.py  |  83 ---
.../tables/triggers/tests/test_triggers_add.py |   2 +-
.../tables/triggers/tests/test_triggers_delete.py  |   2 +-
.../tables/triggers/tests/test_triggers_get.py |   2 +-
.../tables/triggers/tests/test_triggers_put.py |   2 +-
.../servers/databases/schemas/tables/utils.py  | 257 ++---
.../server_groups/servers/pgagent/__init__.py  |  25 +-
.../servers/pgagent/schedules/__init__.py  |   1 -
.../pgagent/schedules/static/js/pga_schedule.js|  18 +-
.../servers/pgagent/steps/__init__.py  |   1 -
33 files changed, 832 insertions(+), 491 deletions(-)



Re: [pgAdmin4][RM#3073] Fix PEP-8 issues

2018-02-26 Thread Dave Page
Thanks, applied.

On Mon, Feb 26, 2018 at 5:28 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA fix the issues in pgAgent node and Tables node (including its all
> subnodes)
>
> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
> servers/pgagent/
> pycodestyle --config=.pycodestyle pgadmin/browser/server_groups/
> servers/databases/schemas/tables/
>
>
>
> --
> 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


Re: RM2898 Keyboard navigation in dialog tabs (nav tabs)

2018-02-26 Thread Dave Page
Hi,

I'm still able to make it get stuck, if I tab back and forth quickly.

On Mon, Feb 26, 2018 at 6:04 PM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> Hi,
>
> Please find the updated patch.
>
> On Mon, Feb 26, 2018 at 8:03 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Mon, Feb 26, 2018 at 12:03 PM, Harshal Dhumal <
>> harshal.dhu...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> Please find the updated patch for keyboard navigation.
>>>
>>> In this patch I have reduced delay which is required until current tab
>>> navigation is completed.
>>> Extracted class dialogTabNavigator and put it in new file.
>>> Added jasmine test cases.
>>> Fixed linting issues, variable naming convention issues.
>>>
>>
>> This is still getting stuck on the Connection tab when I test on the
>> server dialog.
>>
> The disabled input field (Host name/address) on connection tab was causing
> issue.
>
>
>>
>> BTW, I've updated the documentation a little - please find the attached
>> version.
>>
> Thanks for this. I have included revised version of documentation in
> current patch.
>
>
>>
>> Thanks.
>>
>>
>>
>>>
>>>
>>>
>>> --
>>> *Harshal Dhumal*
>>> *Sr. Software Engineer*
>>>
>>> EnterpriseDB India: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>> On Wed, Feb 21, 2018 at 11:39 PM, Harshal Dhumal <
>>> harshaldhuma...@gmail.com> wrote:
>>>
 Hi,

 On Wed, Feb 21, 2018 at 10:59 PM, Joao De Almeida Pereira <
 jdealmeidapere...@pivotal.io> wrote:

> Yep I installed the V2 file
>
> On Wed, Feb 21, 2018 at 11:31 AM Dave Page  wrote:
>
>> On Wed, Feb 21, 2018 at 4:22 PM, Joao De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hello Harshal,
>>>
>>> I passed the patch through our CI and all the tests passed. The
>>> changes do not break previous behavior but because there are no tests on
>>> the new feature  we could not be sure it was really working. So we did 
>>> some
>>> manual testing and sometimes it doesn't work, like it gets stuck in a 
>>> place
>>> and you need to press the shortcut again in order for it to move.
>>>
>>
>> It stuck because I have to wait until next tab is completely visible
 (fade in effect is completed).
 The fade in or fade out transition duration is 150 ms (set by
 bootstrap). So I can not set focus back to tab pane
 until fade in or fade out transition is completed. May be one
 improvement I can do is to reduce wait time to
 something 200 ms (currently it's 500 ms).

 Note that the original issue reported by Dave is already fixed in
 updated patch.


> Was that with the updated patch? It sounds like the issue I saw with
>> the original one.
>>
>>
>>>
>>> Codewise I have some suggestions:
>>>  - dialogTabNavigator looks a nice candidate for a class with its
>>> own file. This way we can test the behavior
>>>
>> Ok I'll move dialogTabNavigator to new file and will add test cases.

>  - There is no difference between a variable called e and a variable
>>> error so for sake of clarity I would love to see variable names
>>> that we can easily read
>>>  - We are also using 2 different types of variable naming camelCase
>>> and snake_case, if we could use only camelCase on Javascript it would 
>>> make
>>> the code more uniform
>>>
>> Ok I'll do this.


>  - I noticed that there are some linting issues in the Javascript code
>>>
>> I just found that linter was disabled for this file by adding
 comment  /* eslint-disable */ at first line. (not sure why we did that)


>>> Summing it up I believe that despite the feature not working 100% of
>>> the time, looks like the code is almost there but needs some 
>>> refactoring to
>>> make it more readable, instead of comments we could have function calls
>>> that more clearly state what we are looking for something like
>>> DialogTabNavigator.isLastTabOfChild
>>> ​
>>> ​
>>>
>>>
>>> Thanks
>>> Joao
>>>
>>> On Wed, Feb 21, 2018 at 4:32 AM Harshal Dhumal <
>>> harshal.dhu...@enterprisedb.com> wrote:
>>>
 Hi,

 --
 *Harshal Dhumal*
 *Sr. Software Engineer*

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

 On Tue, Feb 20, 2018 at 10:34 PM, Dave Page 
 wrote:

> Hi
>
> On Tue, Feb 20, 2018 at 7:22 AM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> Please find attached patch to enable keyboard navigation in
>> dialog.
>>
>> To allow navigation from one tab pane (bootstrap tab pane) to
>> another one
>> I have added two new shortcut preferences *Dialog tab previous

[pgadmin4][patch] Solves the bug #3150

2018-02-26 Thread Joao De Almeida Pereira
Hi hackers,
Attached you can find the correct for the bug #3150. The functions SQL tab
stopped working after #3060, this patch changes the SQL to ensure that the
tab is working again.

Thanks
Joao


functions-display-sql-greenplum.diff
Description: Binary data


Re: RM2898 Keyboard navigation in dialog tabs (nav tabs)

2018-02-26 Thread Harshal Dhumal
Hi,

On Tue, Feb 27, 2018 at 1:08 AM, Dave Page  wrote:

> Hi,
>
> I'm still able to make it get stuck, if I tab back and forth quickly.
>
Quickly switching tabs was causing to switch to next tab before previous
navigation was completed and
this was leading to lose focus on tab pane.
Now I have made changes that it won't process any user navigation events
until current navigation is completed.


> On Mon, Feb 26, 2018 at 6:04 PM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> Please find the updated patch.
>>
>> On Mon, Feb 26, 2018 at 8:03 PM, Dave Page  wrote:
>>
>>> Hi
>>>
>>> On Mon, Feb 26, 2018 at 12:03 PM, Harshal Dhumal <
>>> harshal.dhu...@enterprisedb.com> wrote:
>>>
 Hi,

 Please find the updated patch for keyboard navigation.

 In this patch I have reduced delay which is required until current tab
 navigation is completed.
 Extracted class dialogTabNavigator and put it in new file.
 Added jasmine test cases.
 Fixed linting issues, variable naming convention issues.

>>>
>>> This is still getting stuck on the Connection tab when I test on the
>>> server dialog.
>>>
>> The disabled input field (Host name/address) on connection tab was
>> causing issue.
>>
>>
>>>
>>> BTW, I've updated the documentation a little - please find the attached
>>> version.
>>>
>> Thanks for this. I have included revised version of documentation in
>> current patch.
>>
>>
>>>
>>> Thanks.
>>>
>>>
>>>



 --
 *Harshal Dhumal*
 *Sr. Software Engineer*

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

 On Wed, Feb 21, 2018 at 11:39 PM, Harshal Dhumal <
 harshaldhuma...@gmail.com> wrote:

> Hi,
>
> On Wed, Feb 21, 2018 at 10:59 PM, Joao De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Yep I installed the V2 file
>>
>> On Wed, Feb 21, 2018 at 11:31 AM Dave Page  wrote:
>>
>>> On Wed, Feb 21, 2018 at 4:22 PM, Joao De Almeida Pereira <
>>> jdealmeidapere...@pivotal.io> wrote:
>>>
 Hello Harshal,

 I passed the patch through our CI and all the tests passed. The
 changes do not break previous behavior but because there are no tests 
 on
 the new feature  we could not be sure it was really working. So we did 
 some
 manual testing and sometimes it doesn't work, like it gets stuck in a 
 place
 and you need to press the shortcut again in order for it to move.

>>>
>>> It stuck because I have to wait until next tab is completely visible
> (fade in effect is completed).
> The fade in or fade out transition duration is 150 ms (set by
> bootstrap). So I can not set focus back to tab pane
> until fade in or fade out transition is completed. May be one
> improvement I can do is to reduce wait time to
> something 200 ms (currently it's 500 ms).
>
> Note that the original issue reported by Dave is already fixed in
> updated patch.
>
>
>> Was that with the updated patch? It sounds like the issue I saw with
>>> the original one.
>>>
>>>

 Codewise I have some suggestions:
  - dialogTabNavigator looks a nice candidate for a class with its
 own file. This way we can test the behavior

>>> Ok I'll move dialogTabNavigator to new file and will add test cases.
>
>>  - There is no difference between a variable called e and a variable
 error so for sake of clarity I would love to see variable names
 that we can easily read
  - We are also using 2 different types of variable naming camelCase
 and snake_case, if we could use only camelCase on Javascript it would 
 make
 the code more uniform

>>> Ok I'll do this.
>
>
>>  - I noticed that there are some linting issues in the Javascript code

>>> I just found that linter was disabled for this file by adding
> comment  /* eslint-disable */ at first line. (not sure why we did that)
>
>
 Summing it up I believe that despite the feature not working 100%
 of the time, looks like the code is almost there but needs some 
 refactoring
 to make it more readable, instead of comments we could have function 
 calls
 that more clearly state what we are looking for something like
 DialogTabNavigator.isLastTabOfChild
 ​
 ​


 Thanks
 Joao

 On Wed, Feb 21, 2018 at 4:32 AM Harshal Dhumal <
 harshal.dhu...@enterprisedb.com> wrote:

> Hi,
>
> --
> *Harshal Dhumal*
> *Sr. Software Engineer*
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Tue, Feb 20, 2

PEP-8 fixes

2018-02-26 Thread Harshal Dhumal
Hi,

Please find patch to fix pep-8 issues for given modules.

1. server group (__init__.py)
2. server (__init__.py, gpdb.py, types.py, utils.py)


-- 
*Harshal Dhumal*
*Sr. Software Engineer*

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/__init__.py b/web/pgadmin/browser/server_groups/__init__.py
index 73cdabe..633d9ee 100644
--- a/web/pgadmin/browser/server_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/__init__.py
@@ -240,7 +240,8 @@ class ServerGroupView(NodeView):
 
 return jsonify(
 node=self.blueprint.generate_browser_node(
-"%d" % (sg.id),None,
+"%d" % sg.id,
+None,
 sg.name,
 "icon-%s" % self.node_type,
 True,
@@ -297,7 +298,8 @@ class ServerGroupView(NodeView):
 for group in groups:
 nodes.append(
 self.blueprint.generate_browser_node(
-"%d" % (group.id), None,
+"%d" % group.id,
+None,
 group.name,
 "icon-%s" % self.node_type,
 True,
@@ -306,7 +308,7 @@ class ServerGroupView(NodeView):
 )
 else:
 group = ServerGroup.query.filter_by(user_id=current_user.id,
- id=gid).first()
+id=gid).first()
 if not group:
 return gone(
 errormsg=gettext("Could not find the server group.")
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index 08d139e..dfa9d62 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -26,6 +26,7 @@ from config import PG_DEFAULT_DRIVER
 from pgadmin.model import db, Server, ServerGroup, User
 from pgadmin.utils.driver import get_driver
 
+
 def has_any(data, keys):
 """
 Checks any one of the keys present in the data given
@@ -42,8 +43,10 @@ def has_any(data, keys):
 
 return False
 
+
 def recovery_state(connection, postgres_version):
-recovery_check_sql = render_template("connect/sql/#{0}#/check_recovery.sql".format(postgres_version))
+recovery_check_sql = render_template(
+"connect/sql/#{0}#/check_recovery.sql".format(postgres_version))
 
 status, result = connection.execute_dict(recovery_check_sql)
 if status and 'rows' in result and len(result['rows']) > 0:
@@ -54,6 +57,7 @@ def recovery_state(connection, postgres_version):
 wal_paused = None
 return in_recovery, wal_paused
 
+
 def server_icon_and_background(is_connected, manager, server):
 """
 
@@ -160,16 +164,16 @@ class ServerModule(sg.ServerGroupPluginModule):
 
 scripts.extend([{
 'name': 'pgadmin.browser.server.privilege',
-'path': url_for('%s.static'% self.name, filename='js/privilege'),
+'path': url_for('%s.static' % self.name, filename='js/privilege'),
 'when': self.node_type,
 'is_template': False,
 'deps': ['pgadmin.browser.node.ui']
 }, {
 'name': 'pgadmin.browser.server.variable',
-'path': url_for('%s.static'% self.name, filename='js/variable'),
+'path': url_for('%s.static' % self.name, filename='js/variable'),
 'when': self.node_type,
 'is_template': False
-},{
+}, {
 'name': 'pgadmin.server.supported_servers',
 'path': url_for('browser.index') + 'server/supported_servers',
 'is_template': True,
@@ -246,26 +250,32 @@ class ServerNode(PGChildNodeView):
 }],
 'check_pgpass': [{'get': 'check_pgpass'}]
 })
-EXP_IP4 = "^\s*((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\."\
-"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\."\
-"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\."\
-"(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\s*$"
-EXP_IP6 = '^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|'\
-   '(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|'\
-   '2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|'\
-   '(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|'\
-   ':((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|'\
-   '(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|'\
-   '2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|'\
-   '(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|'\
-   '[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]