public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: Dave Page <[email protected]>
Cc: pgadmin-hackers <[email protected]>
Subject: Re: [pgAdmin4][Patch]: RM1728 - Properties are not refreshing after objects are edited
Date: Fri, 23 Sep 2016 16:35:11 +0530
Message-ID: <CAM5-9D9s4sz_3dC9Hr6L_O6qEyB5qWE-GjNBvvS26rhguEWCEg@mail.gmail.com> (raw)
In-Reply-To: <CA+OCxoxwp0_fAaOjReySQAOAtXnsHxQ=--K08Scayfpy=gka9Q@mail.gmail.com>
References: <CAM5-9D9n8nvcH44nSGKmMLfCDSV-ka5mrmcEKEdaPJN+zy5CHw@mail.gmail.com>
	<CA+OCxoxwp0_fAaOjReySQAOAtXnsHxQ=--K08Scayfpy=gka9Q@mail.gmail.com>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi,

Please find updated patch with changes:
1) On debugging through JS files, the issue was in synonym update method
which wasn't returning node object.
2) retrieving schema name in node.sql for creating node object in update
method.

Please review and let me know for comments.

On Fri, Sep 23, 2016 at 2:44 PM, Dave Page <[email protected]> wrote:

> Hi
>
> On Fri, Sep 23, 2016 at 7:39 AM, Surinder Kumar
> <[email protected]> wrote:
> > Hi
> >
> > Issue:
> > on updating node, we deselect and then again select the node updated to
> > refresh the panel. but it needs some delay of few milliseconds between
> > deselect and select to fix this issue.
> >
> > Please find attached patch and review.
>
> This does not resolve the issue for me. I tested using a synonym to a
> package on EPAS 9.5, by changing the target package name.
>
>
> --
> 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 ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM1728_v1.patch (4.1K, 3-RM1728_v1.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
index 95e58b6..2d2e40f 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
@@ -483,14 +483,23 @@ class SynonymView(PGChildNodeView):
                 if not status:
                     return internal_server_error(errormsg=res)

-                return make_json_response(
-                    success=1,
-                    info="Synonym updated",
-                    data={
-                        'id': syid,
-                        'scid': scid,
-                        'did': did
-                    }
+                SQL = render_template(
+                    "/".join([self.template_path, 'nodes.sql']),
+                    scid=scid
+                )
+
+                status, rset = self.conn.execute_2darray(SQL)
+                if not status:
+                    return internal_server_error(errormsg=rset)
+                row = rset['rows'][0]
+
+                return jsonify(
+                    node=self.blueprint.generate_browser_node(
+                        syid,
+                        row['schema'],
+                        row['name'],
+                        icon="icon-%s" % self.node_type
+                    )
                 )
             else:
                 return make_json_response(
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.1_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.1_plus/nodes.sql
index 1f8259b..42caf40 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.1_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.1_plus/nodes.sql
@@ -1,4 +1,4 @@
-SELECT synname as name
+SELECT synname as name, synnamespace as schema
 FROM pg_synonym s
     JOIN pg_namespace ns ON s.synnamespace = ns.oid
     AND s.synnamespace = {{scid}}::oid
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.5_plus/nodes.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.5_plus/nodes.sql
index 1f8259b..42caf40 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.5_plus/nodes.sql
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/templates/synonym/sql/9.5_plus/nodes.sql
@@ -1,4 +1,4 @@
-SELECT synname as name
+SELECT synname as name, synnamespace as schema
 FROM pg_synonym s
     JOIN pg_namespace ns ON s.synnamespace = ns.oid
     AND s.synnamespace = {{scid}}::oid
diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js
index 46c49cf..3652ec5 100644
--- a/web/pgadmin/browser/templates/browser/js/browser.js
+++ b/web/pgadmin/browser/templates/browser/js/browser.js
@@ -1148,7 +1148,8 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
             if (
               this.i && this.d && this.new._type == this.d._type
             ) {
-              var _id = this.d._id;
+              var self = this,
+              _id = this.d._id;
               if (this.new._id != this.d._id) {
                 // Found the new oid, update its node_id
                 var node_data = this.t.itemData(ctx.i);
@@ -1162,7 +1163,10 @@ function(require, $, _, S, Bootstrap, pgAdmin, Alertify, CodeMirror) {
                 this.t.setId(ctx.id, {id: this.new.id});
                 this.t.openPath(this.i);
                 this.t.deselect(this.i);
-                this.t.select(this.i);
+                // select tree item after few milliseconds
+                setTimeout(function() {
+                  self.t.select(self.i);
+                }, 10);
               }
             }
             var success = this.o && this.o.success;


view thread (12+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: [pgAdmin4][Patch]: RM1728 - Properties are not refreshing after objects are edited
  In-Reply-To: <CAM5-9D9s4sz_3dC9Hr6L_O6qEyB5qWE-GjNBvvS26rhguEWCEg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox