Ensure that template0 and template1 are available as tempates when creating databasesa. Fixes #3361

[regardless of the Show System Objects? option]
pull/14/head
Akshay Joshi 2018-06-18 13:41:14 -04:00 committed by Dave Page
parent 521985c11a
commit a45c33cf76
2 changed files with 21 additions and 2 deletions

View File

@ -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

View File

@ -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'});
});
}