public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4]: RM1845 - Add node method to fetch synonym properties
2+ messages / 2 participants
[nested] [flat]

* [pgAdmin4]: RM1845 - Add node method to fetch synonym properties
@ 2016-10-14 10:58 Surinder Kumar <[email protected]>
  2016-10-14 22:50 ` Re: [pgAdmin4]: RM1845 - Add node method to fetch synonym properties Dave Page <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Surinder Kumar @ 2016-10-14 10:58 UTC (permalink / raw)
  To: pgadmin-hackers

Hi

Implemented *node method *which returns *Synonym properties* while
refreshing node.

Please find attached patch and review.

Thanks,
Surinder Kumar


-- 
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] RM1845.patch (2.0K, 3-RM1845.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 087e26e..7cd37bb 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
@@ -22,8 +22,8 @@ from pgadmin.utils.ajax import make_json_response, \
     make_response as ajax_response, internal_server_error
 from pgadmin.utils.ajax import precondition_required
 from pgadmin.utils.driver import get_driver
-
 from config import PG_DEFAULT_DRIVER
+from pgadmin.utils.ajax import gone
 
 
 class SynonymModule(SchemaChildModule):
@@ -267,6 +267,44 @@ class SynonymView(PGChildNodeView):
         )
 
     @check_precondition
+    def node(self, gid, sid, did, scid, syid=None):
+        """
+        Return Synonym node to generate node
+
+        Args:
+            gid: Server Group Id
+            sid: Server Id
+            did: Database Id
+            scid: Schema Id
+            syid: Synonym id
+        """
+
+        sql = render_template(
+            "/".join([self.template_path, 'properties.sql']),
+            syid=syid, scid=scid
+        )
+        status, rset = self.conn.execute_2darray(sql)
+
+        if not status:
+            return internal_server_error(errormsg=rset)
+
+        if len(rset['rows']) == 0:
+            return gone(
+                gettext("""Could not find the Synonym node.""")
+            )
+
+        for row in rset['rows']:
+            return make_json_response(
+                data=self.blueprint.generate_browser_node(
+                    row['name'],
+                    scid,
+                    row['name'],
+                    icon="icon-%s" % self.node_type
+                ),
+                status=200
+            )
+
+    @check_precondition
     def get_target_objects(self, gid, sid, did, scid, syid=None):
         """
         This function will provide list of objects as per user selection.


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [pgAdmin4]: RM1845 - Add node method to fetch synonym properties
  2016-10-14 10:58 [pgAdmin4]: RM1845 - Add node method to fetch synonym properties Surinder Kumar <[email protected]>
@ 2016-10-14 22:50 ` Dave Page <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2016-10-14 22:50 UTC (permalink / raw)
  To: Surinder Kumar <[email protected]>; +Cc: pgadmin-hackers

Thanks, patch applied.

On Friday, October 14, 2016, Surinder Kumar <[email protected]>
wrote:

> Hi
>
> Implemented *node method *which returns *Synonym properties* while
> refreshing node.
>
> Please find attached patch and review.
>
> Thanks,
> Surinder Kumar
>


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

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


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-10-14 22:50 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-10-14 10:58 [pgAdmin4]: RM1845 - Add node method to fetch synonym properties Surinder Kumar <[email protected]>
2016-10-14 22:50 ` Dave Page <[email protected]>

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