[pgAdmin4][patch]: Fixed RM #2507 : REVOKE privileges do not display in SQL tab for the function

2017-06-26 Thread Khushboo Vashi
Hi,

Please find the attached patch to fix the RM #2507: REVOKE privileges do
not display in SQL tab for the function

Thanks,
Khushboo
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
index 77f21b8..e3277e3 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/__init__.py
@@ -988,6 +988,9 @@ class FunctionView(PGChildNodeView, DataTypeReader):
 if 'acl' in resp_data:
 resp_data['acl'] = parse_priv_to_db(resp_data['acl'], ['X'])
 
+# Check Revoke all for public
+resp_data['revoke_all'] = self._set_revoke_all(resp_data['acl'])
+
 # Generate sql for "SQL panel"
 # func_def is procedure signature with default arguments
 # query_for - To distinguish the type of call
@@ -1008,6 +1011,9 @@ class FunctionView(PGChildNodeView, DataTypeReader):
 if 'acl' in resp_data:
 resp_data['acl'] = parse_priv_to_db(resp_data['acl'], ['X'])
 
+# Check Revoke all for public
+resp_data['revoke_all'] = self._set_revoke_all(resp_data['acl'])
+
 SQL = render_template("/".join([self.sql_template_path,
 'get_definition.sql']
), data=resp_data,
@@ -1215,6 +1221,9 @@ class FunctionView(PGChildNodeView, DataTypeReader):
 if 'acl' in data:
 data['acl'] = parse_priv_to_db(data['acl'], ["X"])
 
+# Check Revoke all for public
+data['revoke_all'] = self._set_revoke_all(data['acl'])
+
 args = u''
 args_without_name = []
 cnt = 1
@@ -1325,6 +1334,19 @@ class FunctionView(PGChildNodeView, DataTypeReader):
 
 return schema_name
 
+def _set_revoke_all(self, privileges):
+"""
+Check whether the function requires REVOKE statement
+for PUBLIC or not.
+"""
+revoke_all = True if len(privileges) > 0 else False
+for p in privileges:
+if p['grantee'] == 'PUBLIC':
+revoke_all = False
+break;
+
+return revoke_all
+
 @check_precondition
 def dependents(self, gid, sid, did, scid, fnid):
 """
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
index 8676b33..7300fd8 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.2_plus/create.sql
@@ -47,6 +47,10 @@ ALTER FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func_args
 {{ PRIVILEGE.SET(conn, "FUNCTION", p.grantee, data.name, p.without_grant, p.with_grant, data.pronamespace, data.func_args_without)}}
 {% endfor -%}
 {% endif -%}
+{% if data.revoke_all %}
+
+{{ PRIVILEGE.UNSETALL(conn, "FUNCTION", "PUBLIC", data.name, data.pronamespace, data.func_args_without)}}
+{% endif %}
 {% if data.description %}
 
 COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func_args_without}})
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
index 74c09c3..0f7f4f0 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.5_plus/create.sql
@@ -46,6 +46,10 @@ ALTER FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func_args
 
 {{ PRIVILEGE.SET(conn, "FUNCTION", p.grantee, data.name, p.without_grant, p.with_grant, data.pronamespace, data.func_args_without)}}
 {% endfor %}{% endif %}
+{% if data.revoke_all %}
+
+{{ PRIVILEGE.UNSETALL(conn, "FUNCTION", "PUBLIC", data.name, data.pronamespace, data.func_args_without)}}
+{% endif %}
 {% if data.description %}
 
 COMMENT ON FUNCTION {{ conn|qtIdent(data.pronamespace, data.name) }}({{data.func_args_without}})
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plus/create.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plus/create.sql
index 09022fd..0e2495d 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/function/pg/sql/9.6_plu

Re: [pgadmin-hackers][patch] History Detail Pane

2017-06-26 Thread Surinder Kumar
Hi
On Fri, Jun 23, 2017 at 11:39 PM, George Gelashvili 
wrote:

> On Fri, Jun 23, 2017 at 11:24 AM, Surinder Kumar  sedb.com> wrote:
>
>> Hi
>>
>> Review comments:
>>
>> ​1. ​
>> Can we set "message"(in message detail) style property scroll to
>> ​'​
>> auto
>> ​'​
>>  instead of
>> ​'​
>> scroll
>> ​'​
>>  ?
>>
>
> Could you elaborate why 'auto' is what we want?
>
​The scroll bars should appear only when content is beyond the width/height
of container.​ Now with 'scroll', the border layout around container
appears irrespective of content width/height. If we set 'auto', it won't
appear.

>
> ​2. CSS property flex is supported for IE >= 9 as per reference
>>> 
>>> ​. I tested this patch on IE and layout is broken.​
>>>
>>>  Anyways IE-9/10 are outdated and no longer supported by Microsoft, the
>> only supported browsers are IE-11+.
>>
>
> Does this patch work in supported IEs?
>
​I use Windows 7 which has IE9,10, but if we can fix it for IE9,10 we
should fix. Majority of people are still using IE9,10.​

>
> 3. ​Can the CSS styles in ‘history_detail_message.jsx’ moved out in a
>> separate stylesheet file
>> ​ as inline styles in html are never recommended.​
>>
>
> We've been trying to use inline styles rather than classes for our react
> jsx code, as this keeps element behavior declarative. This includes both
> functionality and appearance.
> So far the pattern has been to extract styles used by more than one
> component to jsx/styles.
>
​Can we use classes and then write css around classes thus preserving
element behaviour declarative ?​

>
> ​4. In 'codemirror.jsx', setInterval is used to bind
>> hydrateWhenBecomesVisible function after every 100ms. Can setTimeout ​be
>> used as it needs to bind only once ?
>> Also if setInterval is used, in componentWillUnmount clearInterval(...) 
>> should
>> be implemented.
>>
>
> We actually need to poll, as otherwise the codemirror element will render
> with its last state (so, incorrect query history)
>
> 5. The text like 'Rows Affected' or 'Duration' should be wrapped in
>> 'gettext' for translation?
>
>
> We are working on using translations in React components. This needs
> additional effort and we'll send this in a separate patch.
>
> Thanks
> Shruti and George
>


[pgAdmin4][Patch]: Fixed RM #1920 - [Web Based] Unexpected behaviour observed when connect server with save password option.

2017-06-26 Thread Khushboo Vashi
Hi,

Please find the attached patch to fix RM #1920 -  [Web Based] Unexpected
behaviour observed when connect server with save password option.

Thanks,
Khushboo
diff --git a/web/pgadmin/browser/server_groups/servers/__init__.py b/web/pgadmin/browser/server_groups/servers/__init__.py
index d88363a..0634e3f 100644
--- a/web/pgadmin/browser/server_groups/servers/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/__init__.py
@@ -746,6 +746,8 @@ class ServerNode(PGChildNodeView):
 _=gettext
 )
 )
+else:
+password = conn_passwd or server.password
 else:
 password = data['password'] if 'password' in data else None
 save_password = \


Re: [pgAdmin4][Patch]: Feature #2506 - Allow the dashboard panel to be closed

2017-06-26 Thread Dave Page
Hi

Looks good, except that when I close the dashboard panel, it continues
to run the queries to update the graphs until I change the selected
treeview node. Can we stop it immediately?

On Mon, Jun 26, 2017 at 1:56 AM, Khushboo Vashi
 wrote:
> Hi,
>
> Please find the attached patch for the feature #2506: Allow the dashboard
> panel to be closed.
>
> Thanks,
> Khushboo



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

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



Re: [pgAdmin4][Patch]: Using client-side 'url_for' implementation in the datagrid module

2017-06-26 Thread Dave Page
Thanks, patch applied.

On Mon, Jun 26, 2017 at 2:05 AM, Surinder Kumar
 wrote:
> Hi
>
> Changes:
>
> 1. Replace Jinja {{ url_for }} with js 'url_for'
>
> 2. While minifying JS using webpack, the code to open QueryToolPanel and
> DatagridPanel wasn't working. This is fixed.
>
> Please find attached patch.
>
> Thanks,
> Surinder Kumar



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

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



Re: [pgAdmin4][Patch]: Using client-side 'url_for' implementation in Sqleditor module

2017-06-26 Thread Dave Page
Thanks, patch applied.

On Mon, Jun 26, 2017 at 2:45 AM, Surinder Kumar
 wrote:
> Hi
>
> Changes:
>
> 1. Replace Jinja {{ url_for }} with js 'url_for'
>
> 2. While minifying JS using webpack, I got couple of errors(variables
> undefined) in browser for generated sqleditor.js, so declared those
> variables before using them.
>
> Please find attached patch.
>
> Thanks,
> Surinder Kumar



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

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



pgAdmin 4 commit: Use client-side url_for in the sql editor and data gr

2017-06-26 Thread Dave Page
Use client-side url_for in the sql editor and data grid modules.

Branch
--
master

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

Modified Files
--
web/pgadmin/tools/datagrid/__init__.py |  34 --
.../datagrid/templates/datagrid/js/datagrid.js | 118 ++--
web/pgadmin/tools/sqleditor/__init__.py| 122 +
.../sqleditor/templates/sqleditor/js/sqleditor.js  |  77 ++---
4 files changed, 251 insertions(+), 100 deletions(-)



pgAdmin 4 commit: Ensure revoked public privileges are displayed in the

2017-06-26 Thread Dave Page
Ensure revoked public privileges are displayed in the RE-SQL for functions. 
Fixes #2507

Branch
--
master

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

Modified Files
--
.../databases/schemas/functions/__init__.py| 22 ++
.../templates/function/pg/sql/9.2_plus/create.sql  |  4 
.../templates/function/pg/sql/9.5_plus/create.sql  |  4 
.../templates/function/pg/sql/9.6_plus/create.sql  |  4 
.../templates/function/pg/sql/default/create.sql   |  4 
.../function/ppas/sql/9.2_plus/create.sql  |  4 
.../function/ppas/sql/9.5_plus/create.sql  |  4 
.../function/ppas/sql/9.6_plus/create.sql  |  4 
.../templates/function/ppas/sql/default/create.sql |  4 
.../procedure/ppas/sql/9.2_plus/create.sql |  4 
.../procedure/ppas/sql/9.5_plus/create.sql |  4 
.../procedure/ppas/sql/9.6_plus/create.sql |  4 
.../procedure/ppas/sql/default/create.sql  |  4 
.../trigger_function/pg/sql/9.2_plus/create.sql|  4 
.../trigger_function/pg/sql/9.5_plus/create.sql|  4 
.../trigger_function/pg/sql/default/create.sql |  4 
.../trigger_function/ppas/sql/9.2_plus/create.sql  |  4 
.../trigger_function/ppas/sql/9.5_plus/create.sql  |  4 
.../trigger_function/ppas/sql/default/create.sql   |  4 
19 files changed, 94 insertions(+)



Re: [pgAdmin4][patch]: Fixed RM #2507 : REVOKE privileges do not display in SQL tab for the function

2017-06-26 Thread Dave Page
Thanks, patch applied.

On Mon, Jun 26, 2017 at 3:25 AM, Khushboo Vashi
 wrote:
> Hi,
>
> Please find the attached patch to fix the RM #2507: REVOKE privileges do not
> display in SQL tab for the function
>
> Thanks,
> Khushboo
>
>



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

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



Re: [pgadmin-hackers] Re: Server side cursor limitations for on demand loading of data in query tool [RM2137] [pgAdmin4]

2017-06-26 Thread Dave Page
I'm sorry, it needs rebasing again. If you can do it quickly, I'll
make sure it's the next patch I work on in that area.

Thanks.

On Mon, Jun 26, 2017 at 5:16 AM, Harshal Dhumal
 wrote:
> Hi Dave,
>
> Please find updated rebased patch for RM2137
>
> On Fri, Jun 23, 2017 at 9:00 PM, Dave Page  wrote:
>>
>> Hi Harshal,
>>
>> When can we expect an updated version of this patch? I think it's
>> important to get this into the next release.
>>
>> Thanks!
>>
>> On Fri, Jun 16, 2017 at 10:55 AM, Dave Page  wrote:
>> > Hi,
>> >
>> > That's better - the failures are far less random now :-). I got the
>> > following two though, on both PG and EPAS 9.5:
>> >
>> > ==
>> > ERROR: runTest
>> > (pgadmin.feature_tests.query_tool_tests.QueryToolFeatureTest)
>> > Query tool feature test
>> > --
>> > Traceback (most recent call last):
>> >   File
>> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_tests.py",
>> > line 95, in runTest
>> > self._query_tool_explain_analyze_buffers()
>> >   File
>> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/query_tool_tests.py",
>> > line 443, in _query_tool_explain_analyze_buffers
>> > canvas.find_element_by_xpath("//*[contains(string(), 'Shared Read
>> > Blocks')]")
>> >   File
>> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py",
>> > line 260, in find_element_by_xpath
>> > return self.find_element(by=By.XPATH, value=xpath)
>> >   File
>> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py",
>> > line 508, in find_element
>> > {"using": by, "value": value})['value']
>> >   File
>> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py",
>> > line 491, in _execute
>> > return self._parent.execute(command, params)
>> >   File
>> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py",
>> > line 238, in execute
>> > self.error_handler.check_response(response)
>> >   File
>> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py",
>> > line 193, in check_response
>> > raise exception_class(message, screen, stacktrace)
>> > NoSuchElementException: Message: no such element: Unable to locate
>> > element: {"method":"xpath","selector":"//*[contains(string(), 'Shared
>> > Read Blocks')]"}
>> >   (Session info: chrome=58.0.3029.110)
>> >   (Driver info: chromedriver=2.29.461585
>> > (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b),platform=Mac OS X 10.12.3
>> > x86_64)
>> >
>> >
>> > ==
>> > ERROR: runTest
>> > (pgadmin.feature_tests.view_data_dml_queries.CheckForViewDataTest)
>> > Validate Insert, Update operations in View data with given test data
>> > --
>> > Traceback (most recent call last):
>> >   File
>> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/view_data_dml_queries.py",
>> > line 104, in runTest
>> > self._add_row()
>> >   File
>> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/view_data_dml_queries.py",
>> > line 255, in _add_row
>> > self._update_cell(cell_xpath, config_data[str(idx)])
>> >   File
>> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/view_data_dml_queries.py",
>> > line 164, in _update_cell
>> > cell_el = self.page.find_by_xpath(xpath)
>> >   File
>> > "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
>> > line 122, in find_by_xpath
>> > return self.wait_for_element(lambda driver:
>> > driver.find_element_by_xpath(xpath))
>> >   File
>> > "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
>> > line 205, in wait_for_element
>> > return self._wait_for("element to exist", element_if_it_exists)
>> >   File
>> > "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
>> > line 255, in _wait_for
>> > "Timed out waiting for " + waiting_for_message)
>> >   File
>> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/support/wait.py",
>> > line 71, in until
>> > value = method(self._driver)
>> >   File
>> > "/Users/dpage/git/pgadmin4/web/regression/feature_utils/pgadmin_page.py",
>> > line 200, in element_if_it_exists
>> > if element.is_displayed() and element.is_enabled():
>> >   File
>> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py",
>> > line 358, in is_displayed
>> > return self._execute(Command.IS_ELEMENT_DISPLAYED)['value']
>> >   File
>> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/remote/webelement.py",
>> > line 491, in _execute
>> > return s

Re: [pgadmin-hackers] Re: Server side cursor limitations for on demand loading of data in query tool [RM2137] [pgAdmin4]

2017-06-26 Thread Harshal Dhumal
yes i'm working on that only :)


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

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

On Mon, Jun 26, 2017 at 5:22 PM, Dave Page  wrote:

> I'm sorry, it needs rebasing again. If you can do it quickly, I'll
> make sure it's the next patch I work on in that area.
>
> Thanks.
>
> On Mon, Jun 26, 2017 at 5:16 AM, Harshal Dhumal
>  wrote:
> > Hi Dave,
> >
> > Please find updated rebased patch for RM2137
> >
> > On Fri, Jun 23, 2017 at 9:00 PM, Dave Page  wrote:
> >>
> >> Hi Harshal,
> >>
> >> When can we expect an updated version of this patch? I think it's
> >> important to get this into the next release.
> >>
> >> Thanks!
> >>
> >> On Fri, Jun 16, 2017 at 10:55 AM, Dave Page  wrote:
> >> > Hi,
> >> >
> >> > That's better - the failures are far less random now :-). I got the
> >> > following two though, on both PG and EPAS 9.5:
> >> >
> >> > 
> ==
> >> > ERROR: runTest
> >> > (pgadmin.feature_tests.query_tool_tests.QueryToolFeatureTest)
> >> > Query tool feature test
> >> > 
> --
> >> > Traceback (most recent call last):
> >> >   File
> >> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/
> query_tool_tests.py",
> >> > line 95, in runTest
> >> > self._query_tool_explain_analyze_buffers()
> >> >   File
> >> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/
> query_tool_tests.py",
> >> > line 443, in _query_tool_explain_analyze_buffers
> >> > canvas.find_element_by_xpath("//*[contains(string(), 'Shared Read
> >> > Blocks')]")
> >> >   File
> >> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/remote/webelement.py",
> >> > line 260, in find_element_by_xpath
> >> > return self.find_element(by=By.XPATH, value=xpath)
> >> >   File
> >> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/remote/webelement.py",
> >> > line 508, in find_element
> >> > {"using": by, "value": value})['value']
> >> >   File
> >> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/remote/webelement.py",
> >> > line 491, in _execute
> >> > return self._parent.execute(command, params)
> >> >   File
> >> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/remote/webdriver.py",
> >> > line 238, in execute
> >> > self.error_handler.check_response(response)
> >> >   File
> >> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/remote/errorhandler.py",
> >> > line 193, in check_response
> >> > raise exception_class(message, screen, stacktrace)
> >> > NoSuchElementException: Message: no such element: Unable to locate
> >> > element: {"method":"xpath","selector":"//*[contains(string(), 'Shared
> >> > Read Blocks')]"}
> >> >   (Session info: chrome=58.0.3029.110)
> >> >   (Driver info: chromedriver=2.29.461585
> >> > (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b),platform=Mac OS X 10.12.3
> >> > x86_64)
> >> >
> >> >
> >> > 
> ==
> >> > ERROR: runTest
> >> > (pgadmin.feature_tests.view_data_dml_queries.CheckForViewDataTest)
> >> > Validate Insert, Update operations in View data with given test data
> >> > 
> --
> >> > Traceback (most recent call last):
> >> >   File
> >> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/
> view_data_dml_queries.py",
> >> > line 104, in runTest
> >> > self._add_row()
> >> >   File
> >> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/
> view_data_dml_queries.py",
> >> > line 255, in _add_row
> >> > self._update_cell(cell_xpath, config_data[str(idx)])
> >> >   File
> >> > "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/
> view_data_dml_queries.py",
> >> > line 164, in _update_cell
> >> > cell_el = self.page.find_by_xpath(xpath)
> >> >   File
> >> > "/Users/dpage/git/pgadmin4/web/regression/feature_utils/
> pgadmin_page.py",
> >> > line 122, in find_by_xpath
> >> > return self.wait_for_element(lambda driver:
> >> > driver.find_element_by_xpath(xpath))
> >> >   File
> >> > "/Users/dpage/git/pgadmin4/web/regression/feature_utils/
> pgadmin_page.py",
> >> > line 205, in wait_for_element
> >> > return self._wait_for("element to exist", element_if_it_exists)
> >> >   File
> >> > "/Users/dpage/git/pgadmin4/web/regression/feature_utils/
> pgadmin_page.py",
> >> > line 255, in _wait_for
> >> > "Timed out waiting for " + waiting_for_message)
> >> >   File
> >> > "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-
> packages/selenium/webdriver/support/wait.py",
> >> > line 71, in until
> >> > value = method(self._driver)
> >> >   File
> >> > "/Users/dpage/git/pgadmin4/web/regression/feature_utils/
> pgadmin_page.py",
> >> >

pgAdmin 4 commit: Ensure saved passwords are effective immediately, not

2017-06-26 Thread Dave Page
Ensure saved passwords are effective immediately, not just following a restart 
when first saved. Fixes #1920

Branch
--
master

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

Modified Files
--
web/pgadmin/browser/server_groups/servers/__init__.py | 2 ++
1 file changed, 2 insertions(+)



Re: [pgAdmin4][Patch]: Fixed RM #1920 - [Web Based] Unexpected behaviour observed when connect server with save password option.

2017-06-26 Thread Dave Page
Thanks, patch applied.

On Mon, Jun 26, 2017 at 5:24 AM, Khushboo Vashi
 wrote:
> Hi,
>
> Please find the attached patch to fix RM #1920 -  [Web Based] Unexpected
> behaviour observed when connect server with save password option.
>
> Thanks,
> Khushboo



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

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



Build failed in Jenkins: pgadmin4-master-python27 #202

2017-06-26 Thread pgAdmin 4 Jenkins
See 


Changes:

[Dave Page] Ensure saved passwords are effective immediately, not just 
following a

--
[...truncated 289.57 KB...]
Update materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_delete.DatabaseDeleteTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
Check Databases Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_add.ResourceGroupsAddTestCase)
Add resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_delete.ResourceGroupsDeleteTestCase)
Delete resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_put.ResourceGroupsPutTestCase)
Put resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.tests_resource_groups_get.ResourceGroupsGetTestCase)
Get resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_add.LoginRoleAddTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_delete.LoginRoleDeleteTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_get.LoginRoleGetTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_put.LoginRolePutTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_add.TableSpaceAddTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_delete.TableSpaceDeleteTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_get.TablespaceGetTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_check_recovery.TestCheckRecovery)
Test for check recovery ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependencies_sql.TestDependenciesSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependents_sql.TestDependentsSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_role_dependencies_sql.TestRoleDependenciesSql)
Test Role Dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_add.ServersAddTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_delete.ServerDeleteTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_get.ServersGetTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
Default Server Node url ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_get.SgNodeTestCase)
Check Server Group Node ... ok
runTest 
(pgadmin.utils.javascript.tests.test_javascript_bundler.JavascriptBundlerTestCase)
scenario name: JavascriptBundlerTestCase ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Render a template when called ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Render a version 9.1 template when it is present ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Render a version 9.2 template when request for a higher version ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Render default version when version 9.0 was requested and only 9.1 and 9.2 are 
present ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Raise error when version is smaller than available templates ... ok
runTest 
(regression.python_test_utils.sql_template_test_base.SQLTemplateTestBase)
parent test class ... ok

--
Ran 163 tests in 23.781s

OK

==
Test Result Summary
==

PostgreSQL 9.6:

151 tests passed
0 tests failed
12 tests skipped:
SynonymGetTes

Re: [pgAdmin4][Patch][RM_2191] : Add support for the hostaddr connection parameter

2017-06-26 Thread Atul Sharma
Hi Dave,

Yes, It makes sense to use the same approach at both ends. I have modified
the server file to use the same regex approach.
Attached is the patch for the same. Please review.

Regards,
Atul

On Sun, Jun 25, 2017 at 6:32 PM, Dave Page  wrote:

> Hi
>
> There are still validation issues unfortunately; see the attached
> screenshot.
>
> I'm a little bit worried about the validation for the IP being so
> different in Python vs. JS. We should really have both of course (Python
> for defensive purposes, JS for usability), but it's clear they can lead to
> different results. I think we should use the regexp approach in both cases
> (because client-side tests against sockets are a) probably not possible,
> and b) it's the server that matters - e.g. if the client doesn't support
> v6, but the server does). Thoughts?
>
> I've also attached an updated patch in which I tweaked a couple of things,
> including docs. Please work from that.
>
> Thanks!
>
>
> On Friday, June 23, 2017, Atul Sharma 
> wrote:
>
>> Hi Dave,
>>
>> Please find updated version attached.
>>
>> Regards,
>> Atul
>>
>> On Fri, Jun 23, 2017 at 8:49 PM, Dave Page  wrote:
>>
>>> Hi,
>>>
>>> I'm getting:
>>>
>>> (pgadmin4)piranha:pgadmin4 dpage$ git apply
>>> ~/Downloads/RM_2191_ver2.patch
>>> error: cannot apply binary patch to
>>> 'docs/en_US/images/server_advanced.png' without full index line
>>> error: docs/en_US/images/server_advanced.png: patch does not apply
>>>
>>> when trying to apply. If memory serves, this normally happens if you
>>> forget to use --binary when creating the diff.
>>>
>>> Can you send an updated version please?
>>>
>>> On Fri, Jun 23, 2017 at 3:59 PM, Atul Sharma
>>>  wrote:
>>> > Hi,
>>> >
>>> > Please find updated patch.
>>> >
>>> > Regards,
>>> > Atul
>>> >
>>> > On Thu, Jun 22, 2017 at 5:02 PM, Dave Page  wrote:
>>> >>
>>> >> Hi
>>> >>
>>> >> On Thu, Jun 22, 2017 at 11:05 AM, Atul Sharma
>>> >>  wrote:
>>> >> > Hi,
>>> >> >
>>> >> > Please find attached patch for RM #2191 : Add support for hostaddr
>>> >> > connection parameter
>>> >>
>>> >> Unfortunately there are a few issues with this patch:
>>> >>
>>> >> - It needs rebasing (blame Ashesh :-p )
>>> >>
>>> >> - It's missing the documentation update (and screenshot update)
>>> >>
>>> >> - I'm not sure the validation for a valid IPv6 address in
>>> >> check_for_valid_ipv6 is correct. For example:
>>> >>
>>> >> /^(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}$/.test('::1');
>>> >> false
>>> >> /^(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}$/.test('fe80::187f:316f
>>> :4bb8:8a3d');
>>> >> false
>>> >>
>>> >> Both of those are valid addresses.
>>> >>
>>> >> Note that I've only eye-balled the patch so far, as I was unable to
>>> >> apply it without manual work.
>>> >>
>>> >> 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
>>>
>>
>>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>


RM_2191_ver5.patch
Description: Binary data


Re: [pgAdmin4][Patch]: Using client-side 'url_for' implementation in the datagrid module

2017-06-26 Thread Harshal Dhumal
Hi Dave,

Due to this commit all features test cases which requires query tool are
failing. Reason for this is additional dummy iframe added in panel.

@@ -463,7 +501,16 @@ define([
* create new panel and add it to the dashboard panel.
*/
   var dashboardPanel = pgBrowser.docker.findPanels('dashboard');
-  queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid',
wcDocker.DOCK.STACKED, dashboardPanel[0]);
+  var $frameArea = $('');
+
+  var queryToolPanel =
pgBrowser.docker.addPanel('frm_datagrid', wcDocker.DOCK.STACKED,
dashboardPanel[0]);
+  queryToolPanel.layout().addItem($frameArea);
+  // Initialize empty frame
+  var frame = new wcIFrame($frameArea, queryToolPanel);
+  $(queryToolPanel).data('frameInitialized', false);
+  $(queryToolPanel).data('embeddedFrame', frame);
+
+  // Set panel title and icon
   queryToolPanel.title(''+panel_title+'');
   queryToolPanel.icon('fa fa-bolt');

Surinder is looking into this. I'm holding patch for RM2137 (on demand
loading of result set) until this is fixed.

Thanks,



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

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

On Mon, Jun 26, 2017 at 5:13 PM, Dave Page  wrote:

> Thanks, patch applied.
>
> On Mon, Jun 26, 2017 at 2:05 AM, Surinder Kumar
>  wrote:
> > Hi
> >
> > Changes:
> >
> > 1. Replace Jinja {{ url_for }} with js 'url_for'
> >
> > 2. While minifying JS using webpack, the code to open QueryToolPanel and
> > DatagridPanel wasn't working. This is fixed.
> >
> > Please find attached patch.
> >
> > Thanks,
> > Surinder Kumar
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>


Re: [pgAdmin4][Patch]: Using client-side 'url_for' implementation in the datagrid module

2017-06-26 Thread Surinder Kumar
Hi

Please find attached patch to revert the query tool/datagrid panel changes.

I found the frame assigned to panel after its creation is set to
'undefined' from somewhere in code(after webpack minify) so earlier
implementation is right. I will fix and send it along webpack patch.

Thanks,
Surinder

On Mon, Jun 26, 2017 at 6:54 PM, Harshal Dhumal <
harshal.dhu...@enterprisedb.com> wrote:

> Hi Dave,
>
> Due to this commit all features test cases which requires query tool are
> failing. Reason for this is additional dummy iframe added in panel.
>
> @@ -463,7 +501,16 @@ define([
> * create new panel and add it to the dashboard panel.
> */
>var dashboardPanel = pgBrowser.docker.findPanels('dashboard');
> -  queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid',
> wcDocker.DOCK.STACKED, dashboardPanel[0]);
> +  var $frameArea = $('');
> +
> +  var queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid',
> wcDocker.DOCK.STACKED, dashboardPanel[0]);
> +  queryToolPanel.layout().addItem($frameArea);
> +  // Initialize empty frame
> +  var frame = new wcIFrame($frameArea, queryToolPanel);
> +  $(queryToolPanel).data('frameInitialized', false);
> +  $(queryToolPanel).data('embeddedFrame', frame);
> +
> +  // Set panel title and icon
>queryToolPanel.title(''+pane
> l_title+'');
>queryToolPanel.icon('fa fa-bolt');
>
> Surinder is looking into this. I'm holding patch for RM2137 (on demand
> loading of result set) until this is fixed.
>
> Thanks,
>
>
>
> --
> *Harshal Dhumal*
> *Sr. Software Engineer*
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Mon, Jun 26, 2017 at 5:13 PM, Dave Page  wrote:
>
>> Thanks, patch applied.
>>
>> On Mon, Jun 26, 2017 at 2:05 AM, Surinder Kumar
>>  wrote:
>> > Hi
>> >
>> > Changes:
>> >
>> > 1. Replace Jinja {{ url_for }} with js 'url_for'
>> >
>> > 2. While minifying JS using webpack, the code to open QueryToolPanel and
>> > DatagridPanel wasn't working. This is fixed.
>> >
>> > Please find attached patch.
>> >
>> > Thanks,
>> > Surinder Kumar
>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>


revert_query_tool_changes.patch
Description: Binary data


Re: [pgAdmin4][Patch]: Using client-side 'url_for' implementation in the datagrid module

2017-06-26 Thread Dave Page
Thanks, applied.

On Mon, Jun 26, 2017 at 12:10 PM, Surinder Kumar
 wrote:
> Hi
>
> Please find attached patch to revert the query tool/datagrid panel changes.
>
> I found the frame assigned to panel after its creation is set to 'undefined'
> from somewhere in code(after webpack minify) so earlier implementation is
> right. I will fix and send it along webpack patch.
>
> Thanks,
> Surinder
>
> On Mon, Jun 26, 2017 at 6:54 PM, Harshal Dhumal
>  wrote:
>>
>> Hi Dave,
>>
>> Due to this commit all features test cases which requires query tool are
>> failing. Reason for this is additional dummy iframe added in panel.
>>
>> @@ -463,7 +501,16 @@ define([
>> * create new panel and add it to the dashboard panel.
>> */
>>var dashboardPanel = pgBrowser.docker.findPanels('dashboard');
>> -  queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid',
>> wcDocker.DOCK.STACKED, dashboardPanel[0]);
>> +  var $frameArea = $('');
>> +
>> +  var queryToolPanel =
>> pgBrowser.docker.addPanel('frm_datagrid', wcDocker.DOCK.STACKED,
>> dashboardPanel[0]);
>> +  queryToolPanel.layout().addItem($frameArea);
>> +  // Initialize empty frame
>> +  var frame = new wcIFrame($frameArea, queryToolPanel);
>> +  $(queryToolPanel).data('frameInitialized', false);
>> +  $(queryToolPanel).data('embeddedFrame', frame);
>> +
>> +  // Set panel title and icon
>>queryToolPanel.title('> title="'+panel_title+'">'+panel_title+'');
>>queryToolPanel.icon('fa fa-bolt');
>>
>> Surinder is looking into this. I'm holding patch for RM2137 (on demand
>> loading of result set) until this is fixed.
>>
>> Thanks,
>>
>>
>>
>> --
>> Harshal Dhumal
>> Sr. Software Engineer
>>
>> EnterpriseDB India: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Mon, Jun 26, 2017 at 5:13 PM, Dave Page  wrote:
>>>
>>> Thanks, patch applied.
>>>
>>> On Mon, Jun 26, 2017 at 2:05 AM, Surinder Kumar
>>>  wrote:
>>> > Hi
>>> >
>>> > Changes:
>>> >
>>> > 1. Replace Jinja {{ url_for }} with js 'url_for'
>>> >
>>> > 2. While minifying JS using webpack, the code to open QueryToolPanel
>>> > and
>>> > DatagridPanel wasn't working. This is fixed.
>>> >
>>> > Please find attached patch.
>>> >
>>> > Thanks,
>>> > Surinder Kumar
>>>
>>>
>>>
>>> --
>>> 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



pgAdmin 4 commit: Un-break query tool feature tests.

2017-06-26 Thread Dave Page
Un-break query tool feature tests.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=3f4781cdcbfcdf4436a71fdc9e6e1782303d1bc2
Author: Surinder Kumar 

Modified Files
--
.../tools/datagrid/templates/datagrid/js/datagrid.js   | 18 ++
1 file changed, 2 insertions(+), 16 deletions(-)



[pgAdmin4]: Webpacking of static JS/CSS

2017-06-26 Thread Surinder Kumar
Hi All,

I and Ashesh come up with following approach;

*Divide the JS modules in following components:*

​1. ​
Tools
​(tools.js)​ - It will contain all JS modules under tools directory

​2. ​
Browser
​(browser.js)​ - It will contain all JS modules under browser directory

​3. ​
grid.js
 - It will contains ​
Query tool & Datagrid
​ JS modules​
Done

​4. Common.js and/or vendor.js - Common.js will contains all common js
files/libraries shared by modules like backform, backbone, underscore etc.

Entry points JS: main.js - It will load above modules ascynchronusly or it
will be minified version of all.
define('', ['common', 'tools', 'browser', 'grid'], function(...) {});

or these modules can also be loaded using dependency; For example, load
grid.js on database node expand.

*Worked so far:*

 - Removed CodeMirror out of vendors directory and instead using
node_modules/codemirror files. I didn't sent its patch as codemirror CSS is
inserted directly into markup.

 - The file grid.js(datagrid.js and sqleditor.js) is generated including
all of its dependency, resolved all errors(dependency/JS errors) occurred
while running in browser. Modules like explain, file manager, history tab
and grid rendering is working except grid tool menu expand not working(will
look into this).

 - The file common.js is generated which contains JS files shared among
modules.

 - The template JS modules such as node.js, browser.js are not included in
webpack since they are templates containing Jinja syntax, they are added as
dependency and loaded dynamically.

As discussed with Ashesh, we need to determine which file is 'static' JS or
dynamic JS as we cannot hardcode, till now I didn't find any way to use
is_template flag introduced in def get_own_javascripts(self):
​​
 will search how can I use this variable.

​Currently I am working on converting 'requirejs config shim dependency
into webpack' using imports-loader and exports-loader which is taking time
and will look for alternative if it doesn't works. Once dependency is
properly defined, the task to generate other module JS will become quite
easy.

I also found, the CSS imported using import
'slickgrid/slick.grid.css'; statement
is put into  tags
​ in html​
, instead must be loaded separately as a file so overrides.css can work.

Thoughts?

Thanks,
Surinder


pgAdmin 4 commit: Add support for the hostaddr connection parameter. Th

2017-06-26 Thread Dave Page
Add support for the hostaddr connection parameter. This helps us play nicely 
with Kerberos/SSPI and friends. Fixes #2191

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=15cb9fc35b41736a331a452b9303a79e8f13ee36
Author: Atul Sharma 

Modified Files
--
docs/en_US/images/server_advanced.png  | Bin 0 -> 75902 bytes
docs/en_US/server_dialog.rst   |   7 +++
web/migrations/versions/3c1e4b6eda55_.py   |  35 
.../browser/server_groups/servers/__init__.py  |  47 +++-
.../server_groups/servers/static/js/server.js  |  60 +++--
web/pgadmin/model/__init__.py  |   3 ++
web/pgadmin/utils/driver/psycopg2/__init__.py  |   4 ++
7 files changed, 149 insertions(+), 7 deletions(-)



Re: [pgAdmin4][Patch][RM_2191] : Add support for the hostaddr connection parameter

2017-06-26 Thread Dave Page
Hi

Awesome - that works nicely. Patch committed.

Congratulations on your first feature!

Regards, Dave.

On Mon, Jun 26, 2017 at 8:56 AM, Atul Sharma
 wrote:
> Hi Dave,
>
> Yes, It makes sense to use the same approach at both ends. I have modified
> the server file to use the same regex approach.
> Attached is the patch for the same. Please review.
>
> Regards,
> Atul
>
> On Sun, Jun 25, 2017 at 6:32 PM, Dave Page  wrote:
>>
>> Hi
>>
>> There are still validation issues unfortunately; see the attached
>> screenshot.
>>
>> I'm a little bit worried about the validation for the IP being so
>> different in Python vs. JS. We should really have both of course (Python for
>> defensive purposes, JS for usability), but it's clear they can lead to
>> different results. I think we should use the regexp approach in both cases
>> (because client-side tests against sockets are a) probably not possible, and
>> b) it's the server that matters - e.g. if the client doesn't support v6, but
>> the server does). Thoughts?
>>
>> I've also attached an updated patch in which I tweaked a couple of things,
>> including docs. Please work from that.
>>
>> Thanks!
>>
>>
>> On Friday, June 23, 2017, Atul Sharma 
>> wrote:
>>>
>>> Hi Dave,
>>>
>>> Please find updated version attached.
>>>
>>> Regards,
>>> Atul
>>>
>>> On Fri, Jun 23, 2017 at 8:49 PM, Dave Page  wrote:

 Hi,

 I'm getting:

 (pgadmin4)piranha:pgadmin4 dpage$ git apply
 ~/Downloads/RM_2191_ver2.patch
 error: cannot apply binary patch to
 'docs/en_US/images/server_advanced.png' without full index line
 error: docs/en_US/images/server_advanced.png: patch does not apply

 when trying to apply. If memory serves, this normally happens if you
 forget to use --binary when creating the diff.

 Can you send an updated version please?

 On Fri, Jun 23, 2017 at 3:59 PM, Atul Sharma
  wrote:
 > Hi,
 >
 > Please find updated patch.
 >
 > Regards,
 > Atul
 >
 > On Thu, Jun 22, 2017 at 5:02 PM, Dave Page  wrote:
 >>
 >> Hi
 >>
 >> On Thu, Jun 22, 2017 at 11:05 AM, Atul Sharma
 >>  wrote:
 >> > Hi,
 >> >
 >> > Please find attached patch for RM #2191 : Add support for hostaddr
 >> > connection parameter
 >>
 >> Unfortunately there are a few issues with this patch:
 >>
 >> - It needs rebasing (blame Ashesh :-p )
 >>
 >> - It's missing the documentation update (and screenshot update)
 >>
 >> - I'm not sure the validation for a valid IPv6 address in
 >> check_for_valid_ipv6 is correct. For example:
 >>
 >> /^(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}$/.test('::1');
 >> false
 >>
 >> /^(?:[A-F0-9]{1,4}:){7}[A-F0-9]{1,4}$/.test('fe80::187f:316f:4bb8:8a3d');
 >> false
 >>
 >> Both of those are valid addresses.
 >>
 >> Note that I've only eye-balled the patch so far, as I was unable to
 >> apply it without manual work.
 >>
 >> 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
>>>
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>



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

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



Re: [pgadmin-hackers][patch] History Detail Pane

2017-06-26 Thread Dave Page
On Mon, Jun 26, 2017 at 10:08 AM, Joao Pedro De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:
> Hi Surinder,
>
> You can find our answers inline and attached the patch with the change of
> scrolls from "scroll" to "auto"
>
> On Mon, Jun 26, 2017 at 4:47 AM, Surinder Kumar
>  wrote:
>>
>> Hi
>> On Fri, Jun 23, 2017 at 11:39 PM, George Gelashvili
>>  wrote:
>>>
>>> On Fri, Jun 23, 2017 at 11:24 AM, Surinder Kumar
>>>  wrote:

 Hi

 Review comments:

 1.
 Can we set "message"(in message detail) style property scroll to
 '
 auto
 '
  instead of
 '
 scroll
 '
  ?
>>>
>>>
>>> Could you elaborate why 'auto' is what we want?
>>
>> The scroll bars should appear only when content is beyond the
width/height
>> of container. Now with 'scroll', the border layout around container
appears
>> irrespective of content width/height. If we set 'auto', it won't appear.
>
>
> We changed that in the attached patch. The scroll bars will now appear
when
> the text exceeds the window.
>
>>>
> 2. CSS property flex is supported for IE >= 9 as per reference
> . I tested this patch on IE and layout is broken.
>
  Anyways IE-9/10 are outdated and no longer supported by Microsoft, the
 only supported browsers are IE-11+.
>>>
>>>
>>> Does this patch work in supported IEs?
>>
>> I use Windows 7 which has IE9,10, but if we can fix it for IE9,10 we
>> should fix. Majority of people are still using IE9,10.
>
>
> We based almost 100% of this patch on Flexbox. In order to use another
> structure, we would have to rewrite the html blocks (the majority of the
> UI). If the community believes that is important to keep giving support to
> Browsers that are no longer supported then we can use a library like
> modernizr to try to support all the existing browser. Nevertheless we
> believe that this should be done in a future patch.

Here are the IE stats from www.pgadmin.org:

Browser Version

Sessions

%

11.0

1233

92.85%

8.0

32

2.41%

10.0

29

2.18%

9.0

23

1.73%

7.0

10

0.75%

5.0

1

0.08%


1328

100.00%

I think it's fairly safe to ignore IE <= 10.0

 3. Can the CSS styles in ‘history_detail_message.jsx’ moved out in a
 separate stylesheet file
 as inline styles in html are never recommended.
>>>
>>>
>>> We've been trying to use inline styles rather than classes for our react
>>> jsx code, as this keeps element behavior declarative. This includes both
>>> functionality and appearance.
>>> So far the pattern has been to extract styles used by more than one
>>> component to jsx/styles.
>>
>> Can we use classes and then write css around classes thus preserving
>> element behaviour declarative ?
>
>
> We believe that this should be a conversation to have next Friday in the
> Hackers Community Forum. In the meanwhile we hope this is not a blocker to
> the merge of this patch.
>
>>>
>>>
 4. In 'codemirror.jsx', setInterval is used to bind
 hydrateWhenBecomesVisible function after every 100ms. Can setTimeout
be used
 as it needs to bind only once ?
 Also if setInterval is used, in componentWillUnmount clearInterval(...)
 should be implemented.
>>>
>>>
>>> We actually need to poll, as otherwise the codemirror element will
render
>>> with its last state (so, incorrect query history)
>>>
 5. The text like 'Rows Affected' or 'Duration' should be wrapped in
 'gettext' for translation?
>>>
>>>
>>> We are working on using translations in React components. This needs
>>> additional effort and we'll send this in a separate patch.
>>>
>>> Thanks
>>> Shruti and George
>>
>>
>
> Thanks,
> Joao and Shruti



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

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


Jenkins build is back to normal : pgadmin4-master-python27 #203

2017-06-26 Thread pgAdmin 4 Jenkins
See 





Build failed in Jenkins: pgadmin4-master-python26 #319

2017-06-26 Thread pgAdmin 4 Jenkins
See 


Changes:

[Dave Page] Add support for the hostaddr connection parameter. This helps us 
play

--
[...truncated 292.60 KB...]
Update materialized view under schema node ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_add.DatabaseAddTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_delete.DatabaseDeleteTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_get.DatabasesGetTestCase)
Check Databases Node URL ... ok
runTest 
(pgadmin.browser.server_groups.servers.databases.tests.test_db_put.DatabasesUpdateTestCase)
Check Databases Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_add.ResourceGroupsAddTestCase)
Add resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_delete.ResourceGroupsDeleteTestCase)
Delete resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.test_resource_groups_put.ResourceGroupsPutTestCase)
Put resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.resource_groups.tests.tests_resource_groups_get.ResourceGroupsGetTestCase)
Get resource groups ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_add.LoginRoleAddTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_delete.LoginRoleDeleteTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_get.LoginRoleGetTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.roles.tests.test_role_put.LoginRolePutTestCase)
Check Role Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_add.TableSpaceAddTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_delete.TableSpaceDeleteTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_get.TablespaceGetTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tablespaces.tests.test_tbspc_put.TableSpaceUpdateTestCase)
Check Tablespace Node ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_check_recovery.TestCheckRecovery)
Test for check recovery ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependencies_sql.TestDependenciesSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_dependents_sql.TestDependentsSql)
Test dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_role_dependencies_sql.TestRoleDependenciesSql)
Test Role Dependencies SQL file ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_add.ServersAddTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_delete.ServerDeleteTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_get.ServersGetTestCase)
Default Server Node url ... ok
runTest 
(pgadmin.browser.server_groups.servers.tests.test_server_put.ServerUpdateTestCase)
Default Server Node url ... ok
runTest (pgadmin.browser.server_groups.tests.test_sg_get.SgNodeTestCase)
Check Server Group Node ... ok
runTest 
(pgadmin.utils.javascript.tests.test_javascript_bundler.JavascriptBundlerTestCase)
scenario name: JavascriptBundlerTestCase ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Render a template when called ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Render a version 9.1 template when it is present ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Render a version 9.2 template when request for a higher version ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Render default version when version 9.0 was requested and only 9.1 and 9.2 are 
present ... ok
runTest 
(pgadmin.utils.tests.test_versioned_template_loader.TestVersionedTemplateLoader)
Raise error when version is smaller than available templates ... ok
runTest 
(regression.python_test_utils.sql_template_test_base.SQLTemplateTestBase)
parent test class ... ok

--
Ran 163 tests in 23.434s

OK

==
Test Result Summary
==

PostgreSQL 9.6:

151 tests passed
0 tests failed
12 tests skipped:
SynonymGetTest

Re: [pgAdmin4][Patch]: Feature #2506 - Allow the dashboard panel to be closed

2017-06-26 Thread Khushboo Vashi
Hi,

Please find the attached updated patch.

Thanks,
Khushboo

On Mon, Jun 26, 2017 at 5:08 PM, Dave Page  wrote:

> Hi
>
> Looks good, except that when I close the dashboard panel, it continues
> to run the queries to update the graphs until I change the selected
> treeview node. Can we stop it immediately?
>
> Fixed

> On Mon, Jun 26, 2017 at 1:56 AM, Khushboo Vashi
>  wrote:
> > Hi,
> >
> > Please find the attached patch for the feature #2506: Allow the dashboard
> > panel to be closed.
> >
> > Thanks,
> > Khushboo
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff --git a/web/pgadmin/browser/static/js/panel.js b/web/pgadmin/browser/static/js/panel.js
index 71d2c68..ce21f0d 100644
--- a/web/pgadmin/browser/static/js/panel.js
+++ b/web/pgadmin/browser/static/js/panel.js
@@ -7,7 +7,8 @@ function(_, pgAdmin) {
   pgAdmin.Browser.Panel = function(options) {
 var defaults = [
   'name', 'title', 'width', 'height', 'showTitle', 'isCloseable',
-  'isPrivate', 'content', 'icon', 'events', 'onCreate', 'elContainer'
+  'isPrivate', 'content', 'icon', 'events', 'onCreate', 'elContainer',
+  'canHide', 'limit'
 ];
 _.extend(this, _.pick(options, defaults));
   }
@@ -25,12 +26,14 @@ function(_, pgAdmin) {
 panel: null,
 onCreate: null,
 elContainer: false,
+limit: null,
 load: function(docker, title) {
   var that = this;
   if (!that.panel) {
 docker.registerPanelType(that.name, {
   title: that.title,
   isPrivate: that.isPrivate,
+  limit: that.limit,
   onCreate: function(myPanel) {
 $(myPanel).data('pgAdminName', that.name);
 myPanel.initSize(that.width, that.height);
@@ -85,6 +88,14 @@ function(_, pgAdmin) {
   });
   that.resizedContainer.apply(myPanel);
 }
+
+// Bind events only if they are configurable
+if (that.canHide) {
+  _.each([wcDocker.EVENT.CLOSED, wcDocker.EVENT.VISIBILITY_CHANGED],
+function(ev) {
+  myPanel.on(ev, that.handleVisibility.bind(myPanel, ev));
+});
+}
   }
 });
   }
@@ -134,7 +145,32 @@ function(_, pgAdmin) {
   100
 );
   }
+},
+handleVisibility: function(eventName) {
+  // Currently this function only works with dashboard panel but
+  // as per need it can be extended
+  if (this._type != 'dashboard')
+return;
+
+  if (eventName == 'panelClosed') {
+pgBrowser.save_current_layout(pgBrowser);
+pgAdmin.Dashboard.toggleVisibility(false);
+  }
+  else if (eventName == 'panelVisibilityChanged') {
+if (pgBrowser.tree) {
+  pgBrowser.save_current_layout(pgBrowser);
+  var selectedNode = pgBrowser.tree.selected();
+  // Discontinue this event after first time visible
+  this.off(wcDocker.EVENT.VISIBILITY_CHANGED);
+  if (!_.isUndefined(pgAdmin.Dashboard))
+pgAdmin.Dashboard.toggleVisibility(true);
+  // Explicitly trigger tree selected event when we add the tab.
+  pgBrowser.Events.trigger('pgadmin-browser:tree:selected', selectedNode,
+  pgBrowser.tree.itemData(selectedNode), pgBrowser.Node);
+}
+  }
 }
+
   });
 
   return pgAdmin.Browser.Panel;
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js
index 4494e7a..4588128 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -177,7 +177,9 @@ define(
 showTitle: {% if panel_item.showTitle %}true{% else %}false{% endif %},
 isCloseable: {% if panel_item.isCloseable %}true{% else %}false{% endif %},
 isPrivate: {% if panel_item.isPrivate %}true{% else %}false{% endif %},
-content: '{{ panel_item.content }}'{% if panel_item.events is not none %},
+content: '{{ panel_item.content }}',
+canHide: {% if panel_item.canHide %}true{% else %}false{% endif %}{% if panel_item.limit is not none %},
+limit: {{ panel_item.limit }}{% endif %}{% if panel_item.events is not none %},
 events: {{ panel_item.events }} {% endif %}
   }){% endif %}{% endfor %}
 },
@@ -364,15 +366,17 @@ define(
 
 // Listen to panel attach/detach event so that last layout will be remembered
 _.each(obj.panels, function(panel, name) {
-  panel.panel.on(wcDocker.EVENT.ATTACHED, function() {
-obj.save_current_layout(obj);
-  });
-  panel.panel.on(wcDocker.EVENT.DETACHED, function() {
-obj.save_current_layout(obj);
-  });
-  panel.panel.on(wcDocker.EVENT.MOVE_ENDED, function() {
-obj.save_current_layout(obj);
-  });
+