mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Ensure that template0 and template1 are available as tempates when creating databasesa. Fixes #3361
[regardless of the Show System Objects? option]
This commit is contained in:
parent
521985c11a
commit
a45c33cf76
@ -301,7 +301,26 @@ class DatabaseView(PGChildNodeView):
|
|||||||
|
|
||||||
@check_precondition(action="get_databases")
|
@check_precondition(action="get_databases")
|
||||||
def get_databases(self, gid, sid):
|
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(
|
return make_json_response(
|
||||||
data=res,
|
data=res,
|
||||||
status=200
|
status=200
|
||||||
|
@ -340,7 +340,7 @@ define('pgadmin.node.database', [
|
|||||||
else {
|
else {
|
||||||
if (data && _.isArray(data)) {
|
if (data && _.isArray(data)) {
|
||||||
_.each(data, function(d) {
|
_.each(data, function(d) {
|
||||||
res.push({label: d.label, value: d.label,
|
res.push({label: d, value: d,
|
||||||
image: 'pg-icon-database'});
|
image: 'pg-icon-database'});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user