Re: [pgadmin-hackers] [pgAdmin4][Patch] Add formatted error message support in psycopg2

2016-03-31 Thread Akshay Joshi
Hi

Please ignore the last two patches, While implementing Query Tool I have
found one more issue in poll function when run queries like "create table"
, "insert table". I have added exception handling before fetching the row
from the cursor directly.

Attached is the modified patch. Please review it and if it looks good
please commit it.

On Thu, Mar 31, 2016 at 12:37 PM, Akshay Joshi <
akshay.jo...@enterprisedb.com> wrote:

> Hi
>
> On Tue, Mar 29, 2016 at 8:09 PM, Akshay Joshi  .com> wrote:
>
>> Hi All
>>
>> While implementing Query Tool, I came to know we need error message's
>> with some extra information and also I have faced one issue regarding
>> asynchronous connection polling. I have added support for formatted error
>> message and also fixed the issue.
>>
>> Attached is the patch file. Please review it and let me know the review
>> comments if any.
>>
>
>Apart from above, today I fixed one more issue. In case of user cancel
> the running transaction, poll function of psycopg2 returns
> psycopg2.extensions.POLL_OK, which is mislead by the caller of the
> function, so I have added one flag which will be true if user purposely
> cancel the transaction and from our poll function we return new status i.e.
> ASYNC_CANCEL_TRANSACTION.
>
>  Attached is the modified patch. Please review it and if it looks good
> please commit it.
>
>>
>>
>> --
>> *Akshay Joshi*
>> *Principal Software Engineer *
>>
>>
>>
>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>>
>
>
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>



-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Psycopg2_Bug_Fixed_With_Formatted_Error.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] Tree reload & panel close issue after saving new node on server [pgadmin4]

2016-03-31 Thread Harshal Dhumal
Hi,

PFA patch for node.js

Issues fixed:

1] Reload node collection when server doesn't send node data for newly
created node.
2] Close create panel either when collection node matches with newly create
node type  or *collection node type matches with newly created node's
collection type.*





-- 
*Harshal Dhumal*
*Software Engineer *



EenterpriseDB 
diff --git a/web/pgadmin/browser/templates/browser/js/node.js b/web/pgadmin/browser/templates/browser/js/node.js
index 5d6ec86..bb683ee 100644
--- a/web/pgadmin/browser/templates/browser/js/node.js
+++ b/web/pgadmin/browser/templates/browser/js/node.js
@@ -847,7 +847,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
 },
 saveNewNode = function() {
   /* TODO:: Create new tree node for this */
-  if (view.model.tnode) {
+  if (view.model.tnode && '_id' in view.model.tnode) {
 var d = _.extend({}, view.model.tnode),
   func = function(i) {
 setTimeout(function() {
@@ -888,7 +888,8 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
   if (data && data._type && data._type in pgBrowser.Nodes) {
 node = pgBrowser.Nodes[data._type];
 
-if (node && node.node && node.node == that.type) {
+if (node && ((node.node && node.node == that.type) ||
+node.type == that.collection_type)) {
   found = true;
   if (tree.wasLoad(j)) {
 tree.append(j, {
@@ -979,6 +980,48 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) {
 }
   });
 }
+  } else {
+  /*
+   * Sometime we don't get node in response even though it's saved
+   * on server. In such case just reload the collection to get newly
+   * created nodes.
+   */
+
+   var children = tree.children(item, false, false),
+openNode = function(item, animation){
+  tree.open(item, {
+success: function (item, options){
+  setTimeout(function() {
+closePanel();
+  }, 0);
+},
+fail: function (item, options){
+},
+unanimated: animation
+  });
+};
+
+if (children) {
+  _.each(children, function(child) {
+var $child = $(child);
+var data = tree.itemData($child)
+  if (data._type == that.collection_type){
+// We found collection which need to reload.
+if (tree.wasLoad($child)) {
+  tree.unload($child, {
+success: function (item, options){
+  openNode(item, true);
+},
+fail: function (item, options){
+},
+unanimated: true
+  });
+} else {
+  openNode($child, false);
+}
+  }
+  });
+}
   }
 },
 editInNewPanel = function() {

-- 
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] Add formatted error message support in psycopg2

2016-03-31 Thread Akshay Joshi
Hi

On Tue, Mar 29, 2016 at 8:09 PM, Akshay Joshi  wrote:

> Hi All
>
> While implementing Query Tool, I came to know we need error message's with
> some extra information and also I have faced one issue regarding
> asynchronous connection polling. I have added support for formatted error
> message and also fixed the issue.
>
> Attached is the patch file. Please review it and let me know the review
> comments if any.
>

   Apart from above, today I fixed one more issue. In case of user cancel
the running transaction, poll function of psycopg2 returns
psycopg2.extensions.POLL_OK, which is mislead by the caller of the
function, so I have added one flag which will be true if user purposely
cancel the transaction and from our poll function we return new status i.e.
ASYNC_CANCEL_TRANSACTION.

 Attached is the modified patch. Please review it and if it looks good
please commit it.

>
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>



-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


Psycopg_Formatted_error_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] Patch: Added select2cell editor for backgrid [pgAdmin4]

2016-03-31 Thread Murtuza Zabuawala
Hi,

We have added Select2Cell Editor for backgrid, eariler as it was not
present & causing issue in rendering in subnode control.


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


Added_Select2Cell_Editor_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