public inbox for [email protected]  
help / color / mirror / Atom feed
[pgadmin4][Patch]: RM #3361 Create database dialog does not show template0 and template1 database in Template dropdown
2+ messages / 2 participants
[nested] [flat]

* [pgadmin4][Patch]: RM #3361 Create database dialog does not show template0 and template1 database in Template dropdown
@ 2018-06-18 13:38 Akshay Joshi <[email protected]>
  2018-06-18 19:01 ` Re: [pgadmin4][Patch]: RM #3361 Create database dialog does not show template0 and template1 database in Template dropdown Dave Page <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Akshay Joshi @ 2018-06-18 13:38 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Hackers,

Attached is the patch for RM #3361 Create database dialog does not show
template0 and template1 database in Template drop down.

-- 
*Akshay Joshi*

*Sr. Software Architect *



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


Attachments:

  [application/octet-stream] RM_3361.patch (1.9K, 3-RM_3361.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
index 4590d6c..8d8133a 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/__init__.py
@@ -301,7 +301,26 @@ class DatabaseView(PGChildNodeView):
 
     @check_precondition(action="get_databases")
     def get_databases(self, gid, sid):
-        res = self.get_nodes(gid, sid, True)
+        """
+        This function is used to get all the databases irrespective of
+        show_system_object flag for templates in create database dialog.
+        :param gid:
+        :param sid:
+        :return:
+        """
+        res = []
+        SQL = render_template(
+            "/".join([self.template_path, 'nodes.sql']),
+            last_system_oid=0,
+        )
+        status, rset = self.conn.execute_dict(SQL)
+
+        if not status:
+            return internal_server_error(errormsg=rset)
+
+        for row in rset['rows']:
+            res.append(row['name'])
+
         return make_json_response(
             data=res,
             status=200
diff --git a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
index 2da27a3..1bb6759 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
+++ b/web/pgadmin/browser/server_groups/servers/databases/static/js/database.js
@@ -340,7 +340,7 @@ define('pgadmin.node.database', [
             else {
               if (data && _.isArray(data)) {
                 _.each(data, function(d) {
-                  res.push({label: d.label, value: d.label,
+                  res.push({label: d, value: d,
                     image: 'pg-icon-database'});
                 });
               }


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

* Re: [pgadmin4][Patch]: RM #3361 Create database dialog does not show template0 and template1 database in Template dropdown
  2018-06-18 13:38 [pgadmin4][Patch]: RM #3361 Create database dialog does not show template0 and template1 database in Template dropdown Akshay Joshi <[email protected]>
@ 2018-06-18 19:01 ` Dave Page <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Dave Page @ 2018-06-18 19:01 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Thanks, applied.

On Mon, Jun 18, 2018 at 2:38 PM, Akshay Joshi <[email protected]
> wrote:

> Hi Hackers,
>
> Attached is the patch for RM #3361 Create database dialog does not show
> template0 and template1 database in Template drop down.
>
> --
> *Akshay Joshi*
>
> *Sr. Software Architect *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>



-- 
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:[~2018-06-18 19:01 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-18 13:38 [pgadmin4][Patch]: RM #3361 Create database dialog does not show template0 and template1 database in Template dropdown Akshay Joshi <[email protected]>
2018-06-18 19:01 ` 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