Re: [pgadmin-hackers] PATCH: Login/Group Role Node

2016-02-02 Thread Murtuza Zabuawala
Hi Ashesh,

I also found that we are not handling group role in macro templates.

Steps to re-produce the issue:
1) Create a sample Group Role.
name : my_group

Click 'Ok' to create.

2) Go to privilege tab (in my case Database node)
- Click on Add button
- Select my_group (Group) from options 
- grant any priviledges

3) Go to modified SQL tab

- You will see wrong SQL generated
GRANT ALL ON DATABASE postgres TO my_group WITH GRANT OPTIONS

Expected SQL:
GRANT ALL ON DATABASE postgres TO GROUP my_group WITH GRANT OPTIONS


Regards,
Murtuza


> On 20-Jan-2016, at 2:10 pm, Murtuza Zabuawala 
>  wrote:
> 
> Hi Ashesh,
> 
> Addition to below, I also observed two more issues,
> 
> - It's a bad idea to give md5 hash of current role's password in 
> properties/edit mode, A malicious user can use that hash to crack another 
> role's password.
> 
> - When you select a role and click on SQL panel (near to Statistic panel), we 
> encounter exception as below,
> 
>   File 
> "/home/murtuza/PROJECT/pgadmin4/web/pgadmin/browser/server_groups/servers/roles/__init__.py",
>  line 531, in wrapped
> return f(self, **kwargs)
>   File 
> "/home/murtuza/PROJECT/pgadmin4/web/pgadmin/browser/server_groups/servers/roles/__init__.py",
>  line 714, in sql
> data=self.request,
> AttributeError: 'RoleView' object has no attribute 'request'
> 
> 
> Regards,
> Murtuza
> 
> 
> On Thursday 14 January 2016 01:48 PM, Murtuza Zabuawala wrote:
>> Hi Ashesh,
>> 
>> Observed so far,
>> 
>> In pgAdmin4, 
>> 1) We are not displaying below items in properties when compare to pgAdmin3
>> - Account expires
>> - Member of
>> 
>> 2) Seems life one of menu item missing when right click on role
>> - Reassign/ Drop owned
>> 
>> 3) Security label is disabled by default, Even though security label is 
>> disabled, we get precondition error from server saying.
>> "errormsg": "Security Label must be passed as an array of JSON object in the 
>> following.."
>> 
>> Causing:
>> - When we add variables in Security tab on existing role, Sql does not gets 
>> generated in sql tab.
>> - When we add roles role membership on existing role,  Sql does not gets 
>> generated in sql tab and it also allow us to enter invalid role which does 
>> not exists.
>> 
>> 
>> Regards,
>> Murtuza
>> 
>> On Tuesday 12 January 2016 10:47 PM, Ashesh Vashi wrote:
>>> Hi Team,
>>> 
>>> Please find the patch for Login/Group Role(s).
>>> 
>>> Akshay/Murtuza,
>>> 
>>> Can you please review it?
>>> 
>>> --
>>> Thanks & Regards,
>>> 
>>> Ashesh Vashi
>>> EnterpriseDB INDIA: Enterprise PostgreSQL Company 
>>> 
>>> 
>>>  
>>> http://www.linkedin.com/in/asheshvashi
>>>  
> 



Re: [pgadmin-hackers] PATCH: Login/Group Role Node

2016-02-02 Thread Dave Page
On Tue, Feb 2, 2016 at 9:22 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Ashesh,
>
> I also found that we are not handling group role in macro templates.
>
> Steps to re-produce the issue:
> 1) Create a sample Group Role.
> name : my_group
>
> Click 'Ok' to create.
>
> 2) Go to privilege tab (in my case Database node)
> - Click on Add button
> - Select my_group (Group) from options
> - grant any priviledges
>
> 3) Go to modified SQL tab
>
> - You will see wrong SQL generated
> GRANT ALL ON DATABASE postgres *TO* my_group WITH GRANT OPTIONS
>
> *Expected SQL:*
> GRANT ALL ON DATABASE postgres *TO GROUP* my_group WITH GRANT OPTIONS
>

Isn't GROUP just a noise word that's there for backwards compatibility with
pre-role releases?



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

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


Re: [pgadmin-hackers] pgAdmin4 PATCH: Domain Module

2016-02-02 Thread Khushboo Vashi
Hi Neel,

Thanks for reviewing my patch.

I have modified the code as per your suggestions and also fixed some of the
issues got while doing unit testing.
Please find attached patch for the same.


Thanks,
Khushboo



On Wed, Jan 20, 2016 at 10:56 PM, Neel Patel 
wrote:

> Hi Khushboo,
>
> Please find below review comments.
>
> - While creating new Domain and clicking on SQL tab, python side we are
> getting error saying "*TypeError: 'bool' object is not callable".*
>   We are not able to create any domain. Fix this issue so that we can
> test other functionality.
> - Implement the reverse engineering SQL generation for the domain node.
> - As per the checklist, remove the "Use Slony" from Constraints tab, as it
> is not required.
> - No need to pass "*qtIdent=self.qtIdent*" as function argument in
> "create" and "getSQL" function in domains/__init__.py
> - In "Security" tab , provider and security label fields are not editable.
> - In PG version 9.1, when we update the existing domain name then "ALTER
> DOMAIN" is not supported.
>   Currently there is no checking for the PG version 9.1 and 9.2_plus. It
> will fail when we connect to database 9.1
>
>   e.g.
>   For PG version 9.1 - Update command should be as below.
>   ALTER TYPE xyz RENAME TO abc;
>   For PG version 9.2 onwards - Update command should be as below.
>   ALTER DOMAIN xyz RENAME TO abc;
>
> - Some of the SQL file, qtIdent is not used. Please check all the related
> SQL files.
>   e.g.  - In update.sql file "data.owner" should be
> "conn|qtIdent(data.owner)"
>
> {% if data.owner %}
> ALTER DOMAIN {{ conn|qtIdent(o_data.basensp, name) }}
>   OWNER TO {{ data.owner }};
>   {% endif %}
>
> Let us know for any issues.
>
> Thanks,
> Neel Patel
>
> On Wed, Jan 20, 2016 at 2:50 PM, Khushboo Vashi <
> khushboo.va...@enterprisedb.com> wrote:
>
>> Hi Neel,
>>
>> Please find updated patch.
>>
>> Thanks,
>> Khushboo
>>
>> On Wed, Jan 20, 2016 at 12:50 PM, Neel Patel > > wrote:
>>
>>> Hi Khushboo,
>>>
>>> While applying the patch file, we are getting below warnings.
>>>
>>> #
>>> domains (1).patch:1340: trailing whitespace.
>>>   oid: undefined,
>>> domains (1).patch:1483: trailing whitespace.
>>> (nspname = 'pg_catalog' AND EXISTS
>>> domains (1).patch:1487: trailing whitespace.
>>> OR (nspname = 'information_schema' AND EXISTS
>>> domains (1).patch:1489: trailing whitespace.
>>> OR (nspname LIKE '_%' AND EXISTS
>>> domains (1).patch:1642: trailing whitespace.
>>>  (select 1 from pg_class where relnamespace=typnamespace and relname =
>>> typname and relkind != 'c') AND (typname not like '_%' OR NOT EXISTS
>>> (select 1 from pg_class where relnamespace=typnamespace and relname =
>>> substring(typname from 2)::name and relkind != 'c'))
>>> warning: squelched 4 whitespace errors
>>> warning: 9 lines add whitespace errors.
>>> #
>>>
>>> Can you please remove the whitespace and regenerate the patch ?
>>>
>>> Thanks,
>>> Neel Patel
>>>
>>> On Wed, Jan 20, 2016 at 12:37 PM, Khushboo Vashi <
>>> khushboo.va...@enterprisedb.com> wrote:
>>>
 Resending patch with binary option.

 On Wed, Jan 20, 2016 at 10:18 AM, Khushboo Vashi <
 khushboo.va...@enterprisedb.com> wrote:

> Hi,
>
> Please find attached patch for the Domain Module.
>
> The patch will be modified after Types module implementation as we
> need to populate Base Type  and some Type related validations from the
> Types module.
>
> Please review it and let me know the feedback.
>
> Thanks,
> Khushboo
>



 --
 Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgadmin-hackers


>>>
>>
>
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py
new file mode 100644
index 000..0d029a4
--- /dev/null
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/domains/__init__.py
@@ -0,0 +1,533 @@
+##
+#
+# pgAdmin 4 - PostgreSQL Tools
+#
+# Copyright (C) 2013 - 2016, The pgAdmin Development Team
+# This software is released under the PostgreSQL Licence
+#
+##
+import json
+from flask import render_template, make_response, request, jsonify
+from flask.ext.babel import gettext
+from pgadmin.utils.ajax import make_json_response, \
+make_response as ajax_response, internal_server_error
+from pgadmin.browser.utils import PGChildNodeView
+from pgadmin.browser.collection import CollectionNodeModule
+import pgadmin.browser.server_groups.servers.databases.schemas as schemas
+from pgadmin.utils.ajax import precondition_required
+from pgadmin

Re: [pgadmin-hackers] pgAdmin III: Muliple SQL tabs

2016-02-02 Thread Dave Page
On Tue, Feb 2, 2016 at 3:17 AM, Sergey Busel  wrote:
> Patch file for multiple SQL tabs is attached.

Thanks - I see how this could be useful. I think it needs a little
work before it could be included:

- Unused code should be removed, not commented out.
- I think the tab names should reflect the file name (where there is
one) - e.g. "Query 2" should become "foo.sql" (without the path) if
you save the query.
- There should be some way for the user to see which tab the results
are related to. Maybe the output pane title should read "Output Pane
(Query 2)" or "Output Pane (foo.sql)" as appropriate? I'm not sure if
that will do weird things with the perspective though - they used to
include panel titles.
- Instead of the "Close Tab" menu option, perhaps an X button should
be added to the right-hand end of the active tab?

Thanks.

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

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


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] Updated patches

2016-02-02 Thread Neel Patel
Adding more comments.

- "Delete Database" functionality is not working, we are getting below
error.
*  The requested URL was not found on the server. If you entered the
URL manually please check your spelling and try again.*

- "Drop/Delete functionality is not working, we are getting below error."
   {"success": 0, "data": null, "info": "", "result": null, "errormsg":
"Connection to the server has been lost!"}
 To drop/delete the database, we need to first disconnect the database
connection and Drop the database, If it is unsuccessful then we again need
to
 make the connection to database.

- "Connection Limit" parameter value is not displayed properly. We set the
value to "2" then also it shows the wrong value as "-1".
- When we edit the variables parameters along with name change then query
is not taking the new database name.

*Wrong SQL:- *
ALTER DATABASE test_2 RENAME TO test_2_up;
   COMMENT ON DATABASE test_2_up
   IS 'updated comment';
   ALTER DATABASE test_2 SET wal_compression TO 'off';
   ALTER ROLE role1 IN DATABASE test_2 SET zero_damaged_pages TO 'off';

*Correct SQL:-*
 ALTER DATABASE test_2 RENAME TO test_2_up;
   COMMENT ON DATABASE test_2_up
   IS 'updated comment';
   ALTER DATABASE *test_2_up* SET wal_compression TO 'off';
   ALTER ROLE role1 IN DATABASE *test_2_up* SET zero_damaged_pages TO 'off';

- Default Privileges are not getting displayed when we select any database
node in Properties panel.
- When the database is already disconnected and when user again perform
"Disconnect database" then it gives python error in backend saying "
*NameError: **name 'unauthorized' is not defined*".
- When we update only database name then we are getting error saying "*name
'conn' is not defined*".

Thanks,
Neel Patel

On Tue, Feb 2, 2016 at 1:25 PM, Neel Patel 
wrote:

> Hi Harshal,
>
> Please find below review comments.
>
> - While applying the patch, we are getting warning regarding "trailing
> whitespace.". Please remove the warning.
> - We are getting error saying "*IndexError: tuple index out of range*" on
> python side while connecting to "template0" database.
> - Many properties are not getting displayed in "Properties" window when we
> click on any database. Check for pgadmin3 to show all the properties.
>   e.g.  Connected, System Database, Allow connections etc..
> - Do proper formatting while displaying SQL statements in SQL tab. Below
> statement semicolon should not be in next line.
>e.g.
>   CREATE DATABASE postgres
>   WITH OWNER = postgres
>   ENCODING = 'UTF8'
>   TABLESPACE = pg_default
> ;
>
> - While creating the new database, tablespace drop down values are not
> filled correctly. Current it shows the "Template" field value which is
> wrong.
> - By default, when user does not specify any "collation" and "character
> type" then it should be set as "en_US.UTF8" and accordingly it should
> display in
>   Properties and SQL window.
> - When we connect to database 9.1 then query is getting failed to execute.
> Below are the error.
>
>   *2016-02-02 11:46:59,597: ERROR pgadmin: Failed to execute query
> (execute_dict) for the server #3- DB:test_db_1 (Query-id: 9678389):*
> *Error Message:function expression in FROM cannot refer to other relations
> of same query level*
> *LINE 27:   aclexplode(datacl) d*
>
> - When we edit any database and PG version is 9.1 then in default
> privileges the "Types" tab should not allow to enter the value or it should
> not be
>   displayed.
> - We are not able to edit any database if PG version is 9.1 as we are
> getting error due to query is getting failed.
> - We need to implement "Statistics" tab window implementation to show the
> different properties.
> - When we add new parameters in "Variables", it generates the wrong SQL.
> In the below Query it should add the database name as well.
>
>   Wrong SQL : -
>   ALTER ROLE role1 SET transaction_read_only TO 'on';
>   Correct SQL:-
>   ALTER ROLE role1 IN DATABASE test_db_3 SET transaction_read_only =
> 'on';
>
> - While editing the existing database, enter some of the values from
> "Variables". Though we add the valid value, it shows error saying "Please
> enter
>   some value". It should not display the message and allow user to set the
> modified parameters.
> - When we click on any database, it shows the properties of the selected
> node in "Properties" tab. In that window, all the database properties
> should be
>   "Read only". We should not change the database properties from
> "Properties" panel.
> - In "Security" tab, After adding new privilege, we are not able to add
> the second privilege due to scroll bar issue.
> - After clicking on "Add" button in security tab, "Save" button is getting
> disabled so we are not able to save the modified parameters.
>
> We are still reviewing the code and we will send more comments once the
> review will be completed.
>
> Thanks,
> Neel Patel
>
> On Fri, Jan 22, 2016 at 6:46 PM, Ashesh Vashi <
> ashesh.v

[pgadmin-hackers] Minor issue in variable js [pgadmin4]

2016-02-02 Thread Harshal Dhumal
Hi,

PFA minor patch for variable js.

Issue fixed: Initialize boolean cell with proper data (either true or false
not undefined).

-- 
*Harshal Dhumal*
*Software Engineer *



EenterpriseDB 
diff --git a/web/pgadmin/browser/server_groups/servers/static/js/variable.js b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
index fd3a0bb..8308c27 100644
--- a/web/pgadmin/browser/server_groups/servers/static/js/variable.js
+++ b/web/pgadmin/browser/server_groups/servers/static/js/variable.js
@@ -120,7 +120,11 @@
 
   switch(variable && variable.vartype) {
 case "bool":
-  // There are no specific properties for BooleanCell.
+  /*
+   * bool cell and variable can not be stateless (i.e undefined).
+   * It should be either true or false.
+   */
+  opts.model.set("value", Boolean(opts.model.get("value")));
   break;
 
 case "enum":

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] Added variable macro for generic db objects

2016-02-02 Thread Murtuza Zabuawala
Hi,

PFA patch to add another generic macro for variable control, previously
written macro was specific to database node and not usable with other db
objects.

*How to use:*
VARIABLE.SET(conn, object_type, object_name, variable_name, value)
VARIABLE.UNSET(conn, object_type, object_name, variable_name)


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


added_generic_macro_v1.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] Added variable macro for generic db objects

2016-02-02 Thread Murtuza Zabuawala
Hi,

PFA updated patch, I missed adding parentheses in previous patch for UNSET
macro .

Thanks.

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

On Tue, Feb 2, 2016 at 5:49 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch to add another generic macro for variable control, previously
> written macro was specific to database node and not usable with other db
> objects.
>
> *How to use:*
> VARIABLE.SET(conn, object_type, object_name, variable_name, value)
> VARIABLE.UNSET(conn, object_type, object_name, variable_name)
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


added_generic_macro_v2.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] pgAdmin 4 commit: Update the runtime to properly support Windows.

2016-02-02 Thread Dave Page
Update the runtime to properly support Windows.

Branch
--
master

Details
---
http://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=efc8815ecb78b20318d18ba50588e63e554f053a
Author: Neel Patel 

Modified Files
--
runtime/Server.cpp   | 13 +++--
runtime/pgAdmin4.pro | 54 +---
2 files changed, 54 insertions(+), 13 deletions(-)


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] pgAdmin 4 commit: Adding the macros to set variable options for objects

2016-02-02 Thread Ashesh Vashi
Adding the macros to set variable options for objects other than Role.

Branch
--
master

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

Modified Files
--
.../servers/templates/macros/variable.macros | 20 ++--
1 file changed, 18 insertions(+), 2 deletions(-)


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] pgAdmin 4 commit: Do not trigger 'pgadmin-session:invalid' event, when

2016-02-02 Thread Ashesh Vashi
Do not trigger 'pgadmin-session:invalid' event, when a child object do
not have any validation error, or the validation error message is null.

Thanks Murtuza for find out the root cause.

Branch
--
master

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

Modified Files
--
web/pgadmin/browser/static/js/datamodel.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] Added variable macro for generic db objects

2016-02-02 Thread Ashesh Vashi
Thanks - checked in!

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company



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


On Tue, Feb 2, 2016 at 6:31 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA updated patch, I missed adding parentheses in previous patch for UNSET
> macro .
>
> Thanks.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Tue, Feb 2, 2016 at 5:49 PM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA patch to add another generic macro for variable control, previously
>> written macro was specific to database node and not usable with other db
>> objects.
>>
>> *How to use:*
>> VARIABLE.SET(conn, object_type, object_name, variable_name, value)
>> VARIABLE.UNSET(conn, object_type, object_name, variable_name)
>>
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


[pgadmin-hackers] pgAdmin website commit: Fix JSON syntax

2016-02-02 Thread Dave Page
Fix JSON syntax

Branch
--
master

Details
---
http://git.postgresql.org/gitweb?p=pgadmin-www.git;a=commitdiff;h=fb1c835ed37b72a51b259afea04d7ee7b9bfbab9

Modified Files
--
versions.json | 15 +++
1 file changed, 11 insertions(+), 4 deletions(-)


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] pgAdmin website commit: Simplify JSON structure

2016-02-02 Thread Dave Page
Simplify JSON structure

Branch
--
master

Details
---
http://git.postgresql.org/gitweb?p=pgadmin-www.git;a=commitdiff;h=b09ddb418b2f0a23487a49edbbae3529825a062f

Modified Files
--
versions.json | 9 -
1 file changed, 4 insertions(+), 5 deletions(-)


-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] pgAdmin III: Muliple SQL tabs

2016-02-02 Thread John Obaterspok
2016-02-02 12:08 GMT+01:00 Dave Page :

> On Tue, Feb 2, 2016 at 3:17 AM, Sergey Busel  wrote:
> > Patch file for multiple SQL tabs is attached.
>
> Thanks - I see how this could be useful. I think it needs a little
> work before it could be included:
>
> - Unused code should be removed, not commented out.
> - I think the tab names should reflect the file name (where there is
> one) - e.g. "Query 2" should become "foo.sql" (without the path) if
> you save the query.
> - There should be some way for the user to see which tab the results
> are related to. Maybe the output pane title should read "Output Pane
> (Query 2)" or "Output Pane (foo.sql)" as appropriate? I'm not sure if
> that will do weird things with the perspective though - they used to
> include panel titles.
> - Instead of the "Close Tab" menu option, perhaps an X button should
> be added to the right-hand end of the active tab?
>
>
I haven't tested this but I agree with the above comments. Regarding the
results pane I assume the output window, results window, query time, etc
all reflect the current SQL query tab? So if you have two tabs with
different queries you can switch between them and see their result window.

-- john


Re: [pgadmin-hackers] pgAdmin III: Muliple SQL tabs

2016-02-02 Thread Sergey Busel
- Removed unused/commented code.
- Tab names now reflect the file name, if such is associated with a tab.
- Removed the "Close Tab" menu item. Added X button to the active tab.
- To tell the user which tab results are related to and to avoid messing
with perspective, the name of the related tab is now displayed as "Data
Output [Query 1]" in the output pane. If the tab is named after a file,
file name will display in the square brackets. If the file name is longer
then 15 chars, it will be truncated to 15 chars.

Let me know any other suggestions you may have.

Thanks.

On Tue, Feb 2, 2016 at 5:08 AM, Dave Page  wrote:

> On Tue, Feb 2, 2016 at 3:17 AM, Sergey Busel  wrote:
> > Patch file for multiple SQL tabs is attached.
>
> Thanks - I see how this could be useful. I think it needs a little
> work before it could be included:
>
> - Unused code should be removed, not commented out.
> - I think the tab names should reflect the file name (where there is
> one) - e.g. "Query 2" should become "foo.sql" (without the path) if
> you save the query.
> - There should be some way for the user to see which tab the results
> are related to. Maybe the output pane title should read "Output Pane
> (Query 2)" or "Output Pane (foo.sql)" as appropriate? I'm not sure if
> that will do weird things with the perspective though - they used to
> include panel titles.
> - Instead of the "Close Tab" menu option, perhaps an X button should
> be added to the right-hand end of the active tab?
>
> Thanks.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
diff -aur --exclude-from expats /home/sergey/c/pgadmin3-1.22.0/pgadmin/ctl/ctlSQLBox.cpp /home/sergey/c/pgadmin3-1.22.0-dev/pgadmin/ctl/ctlSQLBox.cpp
--- /home/sergey/c/pgadmin3-1.22.0/pgadmin/ctl/ctlSQLBox.cpp	2016-01-04 07:03:33.0 -0600
+++ /home/sergey/c/pgadmin3-1.22.0-dev/pgadmin/ctl/ctlSQLBox.cpp	2016-02-02 19:54:19.875326175 -0600
@@ -184,6 +184,79 @@
 	m_database = db;
 }
 
+void ctlSQLBox::SetChanged(bool b)
+{
+	if (m_changed != b)
+	{
+		m_changed = b;
+		UpdateTitle();
+	}
+}
+
+bool ctlSQLBox::IsChanged()
+{
+	return m_changed;
+}
+
+void ctlSQLBox::SetOrigin(int origin)
+{
+	m_origin = origin;
+}
+
+int ctlSQLBox::GetOrigin()
+{
+	return m_origin;
+}
+
+void ctlSQLBox::SetFilename(wxString &filename)
+{
+	m_filename = filename;
+	UpdateTitle();
+}
+
+wxString ctlSQLBox::GetFilename()
+{
+	return m_filename;
+}
+
+void ctlSQLBox::SetTitle(wxString &title)
+{
+	m_title = title;
+}
+
+wxString ctlSQLBox::GetTitle()
+{
+	return m_title;
+}
+
+wxString ctlSQLBox::GetChangeIndicator()
+{
+	if (m_changestr.IsEmpty())
+		m_changestr = _("*");
+	return m_changestr;
+}
+
+void ctlSQLBox::UpdateTitle()
+{
+	bool hasCh = false;
+	wxString chStr = GetChangeIndicator();
+	wxString title = GetFilename();
+
+	if (!title.IsEmpty())
+		title = wxFileName::FileName(title).GetFullName();
+	else
+		title = GetTitle();
+
+	hasCh = title.EndsWith(chStr);
+
+	if (IsChanged() && !hasCh)
+		title = title + chStr;
+	else if (!IsChanged() && hasCh)
+		title = title.Mid(0, title.Len() - chStr.Len());
+
+	SetTitle(title);
+}
+
 void ctlSQLBox::OnSearchReplace(wxCommandEvent &ev)
 {
 	if (!m_dlgFindReplace)
diff -aur --exclude-from expats /home/sergey/c/pgadmin3-1.22.0/pgadmin/frm/frmQuery.cpp /home/sergey/c/pgadmin3-1.22.0-dev/pgadmin/frm/frmQuery.cpp
--- /home/sergey/c/pgadmin3-1.22.0/pgadmin/frm/frmQuery.cpp	2016-01-04 07:03:33.0 -0600
+++ /home/sergey/c/pgadmin3-1.22.0-dev/pgadmin/frm/frmQuery.cpp	2016-02-02 20:49:43.175324704 -0600
@@ -84,6 +84,7 @@
 
 #define CTRLID_CONNECTION   4200
 #define CTRLID_DATABASELABEL4201
+#define CTL_SQLQUERYBOOK4202
 
 #define XML_FROM_WXSTRING(s) ((const xmlChar *)(const char *)s.mb_str(wxConvUTF8))
 #define WXSTRING_FROM_XML(s) wxString((char *)s, wxConvUTF8)
@@ -106,6 +107,7 @@
 	EVT_MENU(MNU_OPEN,  frmQuery::OnOpen)
 	EVT_MENU(MNU_SAVE,  frmQuery::OnSave)
 	EVT_MENU(MNU_SAVEAS,frmQuery::OnSaveAs)
+	EVT_MENU(MNU_NEWSQLTAB, frmQuery::OnSqlBookAddPage)
 	EVT_MENU(MNU_EXPORT,frmQuery::OnExport)
 	EVT_MENU(MNU_SAVEAS_IMAGE_GQB, frmQuery::SaveExplainAsImage)
 	EVT_MENU(MNU_SAVEAS_IMAGE_EXPLAIN, frmQuery::SaveExplainAsImage)
@@ -170,6 +172,9 @@
 	EVT_PGQUERYRESULT(QUERY_COMPLETE, frmQuery::OnQueryComplete)
 	EVT_MENU(PGSCRIPT_COMPLETE, frmQuery::OnScriptComplete)
 	EVT_AUINOTEBOOK_PAGE_CHANGED(CTL_NTBKCENTER, frmQuery::OnChangeNotebook)
+	EVT_AUINOTEBOOK_PAGE_CHANGED(CTL_SQLQUERYBOOK, frmQuery::OnSqlBookPageChanged)
+	EVT_AUINOTEBOOK_PAGE_CHANGING(CTL_SQLQUERYBOOK, frmQuery::OnSqlBookPageChanging)
+	EVT_AUINOTEBOOK_PAGE_CLOSE(CTL_SQLQUERYBOOK, frmQuery::OnSqlBookPageClose)
 	EVT_SPLITTER_SASH_POS_CHANGED(GQB_HORZ_SASH, frmQuery::OnResizeHorizontally)
 	EVT_BUTTON(CTL_DELETECURRENTBTN, frmQuery::OnDeleteCurrent)
 	EVT_BUTTON(CTL_DELETEALLBTN, frmQuery::OnDelete

Re: [pgadmin-hackers] pgAdmin III: Muliple SQL tabs

2016-02-02 Thread Sergey Busel
No, that's not the way it works in this patch. All SQL tabs are sharing the
same output pane. At this point, the tabs only help organize code into
files. For me, it's easier to switch tabs and hit F5 then keep highlighting
the text to execute in the same query box.

I know that this is not a true and complete implementation of the tabbed UI
for a database, but making a separate output pane for each query would
require a lot more code changes. Also, you would probably want to be able
to execute code on more then one tab in parallel, which would require a
separate connection for each tab. (Although I can definitely see a benefit
of having an output pane per tab even if they all share the same
connection.) Personally, I tend to keep a lot of tabs open purely for code
organization purposes and would not want to saturate the server with so
many connections.

I might tackle some of the above points later, but seeing how I am not very
well versed in C++ and that this is my first ever contribution to this
project (or any project using C++ for that matter), I would prefer not to
take on such big changes right away. On the other hand, I would be more
then willing to collaborate with somebody on some of bigger changes, if
needed.


On Tue, Feb 2, 2016 at 12:45 PM, John Obaterspok 
wrote:

>
>
> 2016-02-02 12:08 GMT+01:00 Dave Page :
>
>> On Tue, Feb 2, 2016 at 3:17 AM, Sergey Busel  wrote:
>> > Patch file for multiple SQL tabs is attached.
>>
>> Thanks - I see how this could be useful. I think it needs a little
>> work before it could be included:
>>
>> - Unused code should be removed, not commented out.
>> - I think the tab names should reflect the file name (where there is
>> one) - e.g. "Query 2" should become "foo.sql" (without the path) if
>> you save the query.
>> - There should be some way for the user to see which tab the results
>> are related to. Maybe the output pane title should read "Output Pane
>> (Query 2)" or "Output Pane (foo.sql)" as appropriate? I'm not sure if
>> that will do weird things with the perspective though - they used to
>> include panel titles.
>> - Instead of the "Close Tab" menu option, perhaps an X button should
>> be added to the right-hand end of the active tab?
>>
>>
> I haven't tested this but I agree with the above comments. Regarding the
> results pane I assume the output window, results window, query time, etc
> all reflect the current SQL query tab? So if you have two tabs with
> different queries you can switch between them and see their result window.
>
> -- john
>


Re: [pgadmin-hackers] [pgAdmin4] Patch: Added new Control SqlFieldControl

2016-02-02 Thread Ashesh Vashi
Hi Surinder,

On Tue, Feb 2, 2016 at 1:05 PM, Surinder Kumar <
surinder.ku...@enterprisedb.com> wrote:

> Hi,
>
>
> Please find patch for SqlFieldControl.
>
Thanks for the patch.

>
> This control allows the user to write/edit SQL queries.
>
K

>
> To use SqlFieldControl, Set *control* property of field to *'sql-field' *in
> model's schema like:
>
> {
>   id: 'definition', label:'{{ _('Definition') }}', cell: 'string',
>
>   control: 'sql-field'
> }
>
K.


Please extend the SqlFieldContorl from the Backform.TextareaControl *instead
of* Backform.Control.

* Do not need to set events, TextareaControl has handled those events.
* Extend 'getValueFromDom' function in order to get the value from the sql,
and set it to the model.
* Don't listen to the 'pg-property-tab-changed' event here. (It is
redundant here).
  In your implementation, you're already refreshing lazely using setTimeout
function, which should refresh issue of CodeMirror any way.

As per our personal discussion, please update the 'updateInvalid' function
for the Control to look for only the 'input' tag with 'name' attribute.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company



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



>
>
>
> Regards,
> Surinder Kumar
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>
>


Re: [pgadmin-hackers] pgAdmin 4 commit: Update the runtime to properly support Windows.

2016-02-02 Thread Neel Patel
Hi Dave,

Below two minor changes.

  - We have added below statement two times in Qt project files so removed
the duplicate entry.
PY2_VERSION = $$find(PY_VERSION, "^2")

  - Added some instructions in README file for the Windows system.

Can you please review attached patch file and let us know for any comments.

Thanks,
Neel Patel

On Tue, Feb 2, 2016 at 6:46 PM, Dave Page  wrote:

> Update the runtime to properly support Windows.
>
> Branch
> --
> master
>
> Details
> ---
>
> http://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=efc8815ecb78b20318d18ba50588e63e554f053a
> Author: Neel Patel 
>
> Modified Files
> --
> runtime/Server.cpp   | 13 +++--
> runtime/pgAdmin4.pro | 54
> +---
> 2 files changed, 54 insertions(+), 13 deletions(-)
>
>
> --
> Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgadmin-hackers
>


windows_runtime_fix.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] PATCH: NodeAjaxOptionsControl in Subnode

2016-02-02 Thread Khushboo Vashi
Hi,

When we are using NodeAjaxOptionsControl in main model, it is working fine,
but while using it in subnode, giving an error of node is undefined.

So, I have fixed that issue and the patch for the same is attached.

Please review it and let me know in case of problem.

Thanks,
Khushboo
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index be7d177..5075af9 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -540,8 +540,8 @@
   });
 
   var generateGridColumnsFromModel = Backform.generateGridColumnsFromModel =
-function(node_info, m, type, cols) {
-  var groups = Backform.generateViewSchema(node_info, m, type, null, true),
+function(node_info, m, type, cols, node) {
+  var groups = Backform.generateViewSchema(node_info, m, type, node, true),
   schema = [],
   columns = [],
   func,
@@ -979,7 +979,7 @@
 
   var subnode = data.subnode.schema ? data.subnode : data.subnode.prototype,
   gridSchema = Backform.generateGridColumnsFromModel(
-data.node_info, subnode, this.field.get('mode'), data.columns
+data.node_info, subnode, this.field.get('mode'), data.columns, data.schema_node
 ), self = this,
   pgBrowser = window.pgAdmin.Browser;
 

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


[pgadmin-hackers] PATCH: Tablespace Node [pgAdmin4]

2016-02-02 Thread Murtuza Zabuawala
Hi,

Please find attach patch for tablespace node for pgAdmin4.


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


tablespace_node_v1.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgadmin-hackers] pgAdmin III: Muliple SQL tabs

2016-02-02 Thread John Obaterspok
It's a good start Sergey!

Sharing the same connection among the tabs is what I had in mind as well.
In the long run I would like to allow connecting to several db's from the
same pgadmin window. Then have multiple tabs for each connection. Then I
believe it would be easier to allow parallell queries if the they are
constrained to one query per connection tab.

-- john


2016-02-03 4:25 GMT+01:00 Sergey Busel :

> No, that's not the way it works in this patch. All SQL tabs are sharing
> the same output pane. At this point, the tabs only help organize code into
> files. For me, it's easier to switch tabs and hit F5 then keep highlighting
> the text to execute in the same query box.
>
> I know that this is not a true and complete implementation of the tabbed
> UI for a database, but making a separate output pane for each query would
> require a lot more code changes. Also, you would probably want to be able
> to execute code on more then one tab in parallel, which would require a
> separate connection for each tab. (Although I can definitely see a benefit
> of having an output pane per tab even if they all share the same
> connection.) Personally, I tend to keep a lot of tabs open purely for code
> organization purposes and would not want to saturate the server with so
> many connections.
>
> I might tackle some of the above points later, but seeing how I am not
> very well versed in C++ and that this is my first ever contribution to this
> project (or any project using C++ for that matter), I would prefer not to
> take on such big changes right away. On the other hand, I would be more
> then willing to collaborate with somebody on some of bigger changes, if
> needed.
>
>
> On Tue, Feb 2, 2016 at 12:45 PM, John Obaterspok <
> john.obaters...@gmail.com> wrote:
>
>>
>>
>> 2016-02-02 12:08 GMT+01:00 Dave Page :
>>
>>> On Tue, Feb 2, 2016 at 3:17 AM, Sergey Busel  wrote:
>>> > Patch file for multiple SQL tabs is attached.
>>>
>>> Thanks - I see how this could be useful. I think it needs a little
>>> work before it could be included:
>>>
>>> - Unused code should be removed, not commented out.
>>> - I think the tab names should reflect the file name (where there is
>>> one) - e.g. "Query 2" should become "foo.sql" (without the path) if
>>> you save the query.
>>> - There should be some way for the user to see which tab the results
>>> are related to. Maybe the output pane title should read "Output Pane
>>> (Query 2)" or "Output Pane (foo.sql)" as appropriate? I'm not sure if
>>> that will do weird things with the perspective though - they used to
>>> include panel titles.
>>> - Instead of the "Close Tab" menu option, perhaps an X button should
>>> be added to the right-hand end of the active tab?
>>>
>>>
>> I haven't tested this but I agree with the above comments. Regarding the
>> results pane I assume the output window, results window, query time, etc
>> all reflect the current SQL query tab? So if you have two tabs with
>> different queries you can switch between them and see their result window.
>>
>> -- john
>>
>
>


Re: [pgadmin-hackers] PATCH: Tablespace Node [pgAdmin4]

2016-02-02 Thread Murtuza Zabuawala
Hi,

PFA updated patch, Copyright year updated.


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

On Wed, Feb 3, 2016 at 12:22 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> Please find attach patch for tablespace node for pgAdmin4.
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


tablespace_node_v2.patch
Description: Binary data

-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers