Re: [pgadmin-hackers] [pgAdmin4][Patch][RM_2400]: Columns with defaults set to NULL when removing contents after pasting in the edit grid

2017-05-17 Thread Surinder Kumar
Hi Dave,

Please review the updated patch.

On Wed, May 17, 2017 at 8:46 PM, Dave Page  wrote:

> Hi
>
> On Wed, May 17, 2017 at 3:08 PM, Surinder Kumar <
> surinder.ku...@enterprisedb.com> wrote:
>
>> Hi Dave,
>>
>> *Implementation:*
>>
>> 1) Took a flag 'is_row_copied' for each copied row:
>>
>>  - to distinguish it from add/update row.
>>  - to write code specific to copied row only as it requires different
>> logic than add row.
>>
>> 2) After pasting an existing row:
>>
>>  - If a user clear the cell value, it must set cell to [default] value if
>> default value is explicitly given for column while creating table otherwise
>> [null].
>>
>>  - Again, if a user entered a value in same cell, then removes that
>> value, set it to [null] (the same behaviour is for add row).
>>
>> 3) Took a 2-dimensional array "grid.copied_rows" to keep track the
>> changes of each row's cell so that changes made to each cell are
>> independent and removed once data is saved.
>>
>> 4) On pasting a row, the cell must be highlighted with light green
>> colour, so triggers an addNewRow event. Now copied row will add to grid
>> instead of re-rendering all rows again.
>>
>> 5) Moved the common logic into functions.
>>
>> This patch pass the feature test cases and jasmine test case.
>> Also I will add the test cases for copy row and send an updated patch.
>>
>> Please find attached patch and review.
>>
>
> Looks good. I saw the following issues:
>
> - The "new" row is not available once I've created the first new row, or
> pasted some.
>
​Fixed.

>
> - Rows are pasted in reverse order.
>
​Fixed.

>
> - If I copy/paste a new row that has yet to be saved, none of the values
> are actually copied.
>
​Fixed.​

>
> - Attempting to save a row that contains all null/default values results
> in an invalid query:
>
> INSERT INTO public.defaults (
> ) VALUES (
> );
>
> I think the only answer here is to explicitly insert NULL into any columns
> *without* a default value.
>
​I could not reproduce, However  #3 might have fixed it too.​

Apart from this, I noticed epicRandomString(...) function doesn't generate
unique number always, due to this save and delete rows was affected. Not
all rows saved or deleted. The new function always returns a unique random
number.
Fixed.

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


RM_2400_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] [patch] upgrade slickgrid

2017-05-17 Thread Matthew Kleiman
Hi Dave

Have you confirmed that removing the changes we made to shorten the class
> names used for rows and cells doesn't affect the performance or memory
> utilisation of the grid?


We haven't noticed any performance issues with this upgraded version of
SlickGrid, nor our other changes to the query results grid on the branch
that we will be submitting soon. Do you have an example of a large table
that used to cause you performance problems?

Also... would this be an appropriate time to remove the embedded libraries
> altogether, and move to npm/yarn installations of them?


I think that would be a great idea. Moving the vendor-ed libraries into a
package manager would help us manage upgrading of libraries. The
package.json file is a more standard format for managing javascript
dependencies, when compared to our libraries.txt file.

Regards,
Matt

On Wed, May 17, 2017 at 9:04 AM Dave Page  wrote:

> On Wed, May 17, 2017 at 1:59 PM, Dave Page  wrote:
>
>> Hi
>>
>> On Mon, May 15, 2017 at 7:35 PM, Joao Pedro De Almeida Pereira <
>> jdealmeidapere...@pivotal.io> wrote:
>>
>>> Hello Hackers
>>>
>>> We upgraded SlickGrid to the latest version + 53ee34. We upgraded since
>>> we are working on some changes to the query results functionality,
>>> including improvements to column selection and shortcuts.
>>>
>>> This SlickGrid upgrade includes a PR we wrote that simplifies some of
>>> these changes.
>>>
>>> Please note that we are not requesting this be included in the 1.5
>>> release.
>>>
>>
>> Have you confirmed that removing the changes we made to shorten the class
>> names used for rows and cells doesn't affect the performance or memory
>> utilisation of the grid?
>>
>
> Also... would this be an appropriate time to remove the embedded libraries
> altogether, and move to npm/yarn installations of them?
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


Re: [pgadmin-hackers] [pgAdmin4][Patch][RM_2400]: Columns with defaults set to NULL when removing contents after pasting in the edit grid

2017-05-17 Thread Dave Page
Hi

On Wed, May 17, 2017 at 3:08 PM, Surinder Kumar <
surinder.ku...@enterprisedb.com> wrote:

> Hi Dave,
>
> *Implementation:*
>
> 1) Took a flag 'is_row_copied' for each copied row:
>
>  - to distinguish it from add/update row.
>  - to write code specific to copied row only as it requires different
> logic than add row.
>
> 2) After pasting an existing row:
>
>  - If a user clear the cell value, it must set cell to [default] value if
> default value is explicitly given for column while creating table otherwise
> [null].
>
>  - Again, if a user entered a value in same cell, then removes that value,
> set it to [null] (the same behaviour is for add row).
>
> 3) Took a 2-dimensional array "grid.copied_rows" to keep track the changes
> of each row's cell so that changes made to each cell are independent and
> removed once data is saved.
>
> 4) On pasting a row, the cell must be highlighted with light green colour,
> so triggers an addNewRow event. Now copied row will add to grid instead of
> re-rendering all rows again.
>
> 5) Moved the common logic into functions.
>
> This patch pass the feature test cases and jasmine test case.
> Also I will add the test cases for copy row and send an updated patch.
>
> Please find attached patch and review.
>

Looks good. I saw the following issues:

- The "new" row is not available once I've created the first new row, or
pasted some.

- Rows are pasted in reverse order.

- If I copy/paste a new row that has yet to be saved, none of the values
are actually copied.

- Attempting to save a row that contains all null/default values results in
an invalid query:

INSERT INTO public.defaults (
) VALUES (
);

I think the only answer here is to explicitly insert NULL into any columns
*without* a default value.

Thanks.

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

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


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-05-17 Thread Dave Page
On Wed, May 17, 2017 at 11:41 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi Joao,
>
> Yes, this patch is related to browser tree issue, In this patch we have
> fixed some issues with 'onUpdateTreeNode' function to handle some corner
> cases for server & server-group nodes, Current code for 'onAddTreeNode',
> 'onUpdateTreeNode', 'onRefreshTreeNode' functions for browser tree is
> coupled with their respective inner function calls and recursive in nature
> due to aciTree API implementation for making function calls in orderly
> manner.
>
> @Ashesh,
> Any thoughts on this?
>

I'm obviously not Ashesh, but in general, I agree with what Joao suggests -
treeview related code should be refactored into testable modules, that are
independent of the tree (for the most part) whenever it makes sense to do
so, and tests added to aid future replacement of aciTree/Backbone. That
said, if it's not feasible in a given case, then we should go ahead and fix
the existing code.

In this case, I'm leaning towards the view that this code is too tightly
coupled with aciTree to be worth changing more than necessary. What do you
guys think?

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

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


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in server group node

2017-05-17 Thread Dave Page
Thanks, patch applied.

On Wed, May 17, 2017 at 8:28 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA minor patch to fix the in server group node, If you user
> creates/update server group name which is already present in tree then it
> fails and it does not provide clear informative error message regarding
> failure.
>
> Issue found during testing node rename issue :)
> RM#2414
>
> --
> 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
>
>


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

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


[pgadmin-hackers] pgAdmin 4 commit: Improve error handling in cases where the user tries

2017-05-17 Thread Dave Page
Improve error handling in cases where the user tries to rename or create a 
server group that would duplicate an existing group. Fixes #2414

Branch
--
master

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

Modified Files
--
web/pgadmin/browser/server_groups/__init__.py | 28 +--
1 file changed, 13 insertions(+), 15 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: Fix server stats display for EPAS 9.2, where inet nee

2017-05-17 Thread Dave Page
Fix server stats display for EPAS 9.2, where inet needs casting to text for 
concatenation. Fixes #1831

Branch
--
master

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

Modified Files
--
.../server_groups/servers/templates/servers/sql/9.2_plus/stats.sql| 4 ++--
.../server_groups/servers/templates/servers/sql/9.6_plus/stats.sql| 4 ++--
.../server_groups/servers/templates/servers/sql/default/stats.sql | 4 ++--
3 files changed, 6 insertions(+), 6 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] [pgAdmin4][PATCH] To fix the issue in server stats sql (PPAS9.2)

2017-05-17 Thread Dave Page
Thanks - patch applied.

On Tue, May 16, 2017 at 4:43 PM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA minor patch to fix the in server stats sql where it was fails to
> execute because it is not able to concat inet (type) when using with ||
> operator.
>
> *Fails:*
> select client_addr || ':' || client_port from pg_stat_activity
>
> *Works:*
> select client_addr::text || ':' || client_port from pg_stat_activity
>
> Fixes RM#1831
>
> --
> 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
>
>


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

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


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in function node

2017-05-17 Thread Dave Page
Thanks, applied.

On Tue, May 16, 2017 at 11:05 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> PFA patch to fix the issue in function node where it was displaying wrong
> query if function returns table.
> RM#1851
>
> --
> 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
>
>


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

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


[pgadmin-hackers] pgAdmin 4 commit: Reverse engineer SQL for table-returning functions co

2017-05-17 Thread Dave Page
Reverse engineer SQL for table-returning functions correctly. Fixes #1851

Branch
--
master

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

Modified Files
--
.../schemas/functions/templates/function/pg/sql/9.2_plus/create.sql | 2 +-
.../schemas/functions/templates/function/pg/sql/9.5_plus/create.sql | 2 +-
.../schemas/functions/templates/function/pg/sql/9.6_plus/create.sql | 2 +-
.../schemas/functions/templates/function/pg/sql/default/create.sql  | 2 +-
.../schemas/functions/templates/function/ppas/sql/9.2_plus/create.sql   | 2 +-
.../schemas/functions/templates/function/ppas/sql/9.5_plus/create.sql   | 2 +-
.../schemas/functions/templates/function/ppas/sql/9.6_plus/create.sql   | 2 +-
.../schemas/functions/templates/function/ppas/sql/default/create.sql| 2 +-
8 files changed, 8 insertions(+), 8 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] [pgAdmin4][Patch][RM_2400]: Columns with defaults set to NULL when removing contents after pasting in the edit grid

2017-05-17 Thread Surinder Kumar
Hi Dave,

*Implementation:*

1) Took a flag 'is_row_copied' for each copied row:

 - to distinguish it from add/update row.
 - to write code specific to copied row only as it requires different logic
than add row.

2) After pasting an existing row:

 - If a user clear the cell value, it must set cell to [default] value if
default value is explicitly given for column while creating table otherwise
[null].

 - Again, if a user entered a value in same cell, then removes that value,
set it to [null] (the same behaviour is for add row).

3) Took a 2-dimensional array "grid.copied_rows" to keep track the changes
of each row's cell so that changes made to each cell are independent and
removed once data is saved.

4) On pasting a row, the cell must be highlighted with light green colour,
so triggers an addNewRow event. Now copied row will add to grid instead of
re-rendering all rows again.

5) Moved the common logic into functions.

This patch pass the feature test cases and jasmine test case.
Also I will add the test cases for copy row and send an updated patch.

Please find attached patch and review.


Thanks,
Surinder Kumar


RM_2400.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] Jenkins build is back to normal : pgadmin4-master-python27 #125

2017-05-17 Thread pgAdmin 4 Jenkins
See 




-- 
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] [pgAdmin4][PATCH] To fix the issue in FTS dictonory

2017-05-17 Thread Dave Page
Thanks, applied.

On Tue, May 16, 2017 at 7:54 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> ++ Attaching patch.
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Tue, May 16, 2017 at 12:20 PM, Murtuza Zabuawala  enterprisedb.com> wrote:
>
>> Hi,
>>
>> PFA patch to fix the issue in FTS dictionary as below,
>> 1) Strip the quotes from the options.
>> 2) Template is not shown in properties views if it is not in a system
>> schema.
>> RM#1126
>>
>> --
>> 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
>
>


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

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


[pgadmin-hackers] pgAdmin 4 commit: Various FTS dictionary cleanups. Fixes #1126

2017-05-17 Thread Dave Page
Various FTS dictionary cleanups. Fixes #1126

Branch
--
master

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

Modified Files
--
.../databases/schemas/fts_dictionaries/__init__.py | 103 +++--
.../templates/fts_dictionary/js/fts_dictionary.js  |   4 +-
.../fts_dictionary/sql/default/create.sql  |   2 +-
.../fts_dictionary/sql/default/properties.sql  |   1 +
.../templates/fts_dictionary/sql/default/sql.sql   |  52 ---
.../templates/fts_template/js/fts_templates.js |   2 +-
6 files changed, 80 insertions(+), 84 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] [patch] upgrade slickgrid

2017-05-17 Thread Dave Page
On Wed, May 17, 2017 at 1:59 PM, Dave Page  wrote:

> Hi
>
> On Mon, May 15, 2017 at 7:35 PM, Joao Pedro De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hello Hackers
>>
>> We upgraded SlickGrid to the latest version + 53ee34. We upgraded since
>> we are working on some changes to the query results functionality,
>> including improvements to column selection and shortcuts.
>>
>> This SlickGrid upgrade includes a PR we wrote that simplifies some of
>> these changes.
>>
>> Please note that we are not requesting this be included in the 1.5
>> release.
>>
>
> Have you confirmed that removing the changes we made to shorten the class
> names used for rows and cells doesn't affect the performance or memory
> utilisation of the grid?
>

Also... would this be an appropriate time to remove the embedded libraries
altogether, and move to npm/yarn installations of them?


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

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


Re: [pgadmin-hackers] [patch] upgrade slickgrid

2017-05-17 Thread Dave Page
Hi

On Mon, May 15, 2017 at 7:35 PM, Joao Pedro De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hello Hackers
>
> We upgraded SlickGrid to the latest version + 53ee34. We upgraded since we
> are working on some changes to the query results functionality, including
> improvements to column selection and shortcuts.
>
> This SlickGrid upgrade includes a PR we wrote that simplifies some of
> these changes.
>
> Please note that we are not requesting this be included in the 1.5 release.
>

Have you confirmed that removing the changes we made to shorten the class
names used for rows and cells doesn't affect the performance or memory
utilisation of the grid?

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

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


Re: [pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue with Node rename

2017-05-17 Thread Murtuza Zabuawala
Hi Joao,

Yes, this patch is related to browser tree issue, In this patch we have
fixed some issues with 'onUpdateTreeNode' function to handle some corner
cases for server & server-group nodes, Current code for 'onAddTreeNode',
'onUpdateTreeNode', 'onRefreshTreeNode' functions for browser tree is
coupled with their respective inner function calls and recursive in nature
due to aciTree API implementation for making function calls in orderly
manner.

@Ashesh,
Any thoughts on this?

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

On Tue, May 16, 2017 at 7:07 PM, Joao Pedro De Almeida Pereira <
jdealmeidapere...@pivotal.io> wrote:

> Hello Hackers,
>
> We looked into this patch and it looks like it touches part of the tree
> menu am I correct?
> In our previous conversations with Dave, he mentioned that he wanted to
> replace the tree menu with a more stable version of it. In our perspective,
> every time that we have the opportunity extract functions that are relevant
> to the tree, we should do it and also wrap them with tests so that in the
> future, when the community starts the work of upgrading the tree we could
> have some confidence that our changes are not breaking any functionality.
> Also removing as much code from template files as possible should also be
> a goal that we aim for, because that code becomes testable.
>
> Thanks
> Joao
>
> On Tue, May 16, 2017 at 8:36 AM, Harshal Dhumal <
> harshal.dhu...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> Here is updated patch to fix issue with node rename. In this patch I have
>> fixed issue which I mentioned earlier in this mail thread.
>>
>> @Murtuza, as you know all other scenarios, can you please test this patch
>> once.
>>
>> Thanks,
>>
>>
>>
>> --
>> *Harshal Dhumal*
>> *Sr. Software Engineer*
>>
>> EnterpriseDB India: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Mon, May 15, 2017 at 2:46 PM, Dave Page  wrote:
>>
>>> OK, that needs fixing then...
>>>
>>>
>>> On Mon, May 15, 2017 at 9:59 AM, Harshal Dhumal <
>>> harshal.dhu...@enterprisedb.com> wrote:
>>>
 Hi Dave,


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

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

 On Mon, May 15, 2017 at 1:43 PM, Dave Page  wrote:

> So is the last patch considered good?
>
 Except one thing, when user renames server group (note that server
 group should never be expanded before renaming) and then expands it by
 clicking + icon then it's old name gets restored.

 Step:
 1. Load application in browser.
 2. Do not expand any of the server group.
 3. Rename Server group (new name gets updated in tree).
 4. Now expand Server group (old name gets restored in tree).

 Note that this happens only when Server groups was never expanded
 before.



>
> On Mon, May 15, 2017 at 9:11 AM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi Dave,
>>
>> Yes, It is existing one only, We did not touch on any part of sorting
>> algorithm in this patch.
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Mon, May 15, 2017 at 1:24 PM, Dave Page  wrote:
>>
>>> Ashesh is out this week. As long as new nodes are sorted with the
>>> same algorithm as existing ones, that's fine.
>>>
>>> On Mon, May 15, 2017 at 8:48 AM, Murtuza Zabuawala <
>>> murtuza.zabuaw...@enterprisedb.com> wrote:
>>>
 Hi Harshal,

 We are using https://github.com/javve/natural-sort for sorting
 nodes which is implemented by Ashesh.

 @Ashesh,
 Any suggestion on this?

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

 On Mon, May 15, 2017 at 1:07 PM, Harshal Dhumal <
 harshal.dhu...@enterprisedb.com> wrote:

> Hi Murtuza,
>
> Currently nodes are sorted in case sensitive manner it should
> be case insensitive.
>
>
>
> See current Server group order is A, Servers, a1, a​2. It should
> be A, a1, a2, Servers.
> Similarly check sorting order for server and database nodes
>
>
> --
> *Harshal Dhumal*
> *Sr. Software Engineer*
>
> EnterpriseDB India: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
> On Fri, May 12, 2017 at 7:08 PM, Murtuza Zabuawala <
> murtuza.zabuaw...@enterprisedb.com> wrote:
>
>> Hi Ashesh,
>>
>> Please find updated patch as discussed.
>>
>> --
>> Regards,
>>

[pgadmin-hackers] [pgAdmin4][PATCH] To fix the issue in server group node

2017-05-17 Thread Murtuza Zabuawala
Hi,

PFA minor patch to fix the in server group node, If you user creates/update
server group name which is already present in tree then it fails and it
does not provide clear informative error message regarding failure.

Issue found during testing node rename issue :)
RM#2414

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
diff --git a/web/pgadmin/browser/server_groups/__init__.py 
b/web/pgadmin/browser/server_groups/__init__.py
index 8d28ec4..e337d85 100644
--- a/web/pgadmin/browser/server_groups/__init__.py
+++ b/web/pgadmin/browser/server_groups/__init__.py
@@ -19,9 +19,9 @@ from flask_security import current_user
 from pgadmin.browser import BrowserPluginModule
 from pgadmin.browser.utils import NodeView
 from pgadmin.utils.ajax import make_json_response, gone, \
-make_response as ajax_response
+make_response as ajax_response, bad_request
 from pgadmin.utils.menu import MenuItem
-
+from sqlalchemy import exc
 from pgadmin.model import db, ServerGroup
 
 
@@ -174,6 +174,10 @@ class ServerGroupView(NodeView):
 if u'name' in data:
 servergroup.name = data[u'name']
 db.session.commit()
+except exc.IntegrityError:
+return bad_request(gettext(
+"The specified server group already exists."
+))
 except Exception as e:
 return make_json_response(
 status=410, success=0, errormsg=e.message
@@ -220,18 +224,6 @@ class ServerGroupView(NodeView):
 )
 if data[u'name'] != '':
 try:
-check_sg = ServerGroup.query.filter_by(
-user_id=current_user.id,
-name=data[u'name']).first()
-
-# Throw error if server group already exists...
-if check_sg is not None:
-return make_json_response(
-status=409,
-success=0,
-errormsg=gettext('Server group already exists')
-)
-
 sg = ServerGroup(
 user_id=current_user.id,
 name=data[u'name'])
@@ -248,9 +240,15 @@ class ServerGroupView(NodeView):
 "icon-%s" % self.node_type,
 True,
 self.node_type,
-can_delete=True  # This is user created hence can 
deleted
+# This is user created hence can deleted
+can_delete=True
 )
 )
+except exc.IntegrityError:
+return bad_request(gettext(
+"The specified server group already exists."
+))
+
 except Exception as e:
 return make_json_response(
 status=410,

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