Handle the template property on databases appropriately. Fixes #1800

This commit is contained in:
Murtuza Zabuawala 2016-11-25 10:11:40 +00:00 committed by Dave Page
parent 394381bf75
commit 66b9e22d01
4 changed files with 20 additions and 10 deletions

View File

@ -269,6 +269,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
deftblacl: [], deftblacl: [],
deffuncacl: [], deffuncacl: [],
defseqacl: [], defseqacl: [],
is_template: false,
deftypeacl: [] deftypeacl: []
}, },
@ -321,7 +322,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
editable: false, type: 'text', group: 'Definition', editable: false, type: 'text', group: 'Definition',
disabled: function(m) { return !m.isNew(); }, disabled: function(m) { return !m.isNew(); },
control: 'node-list-by-name', url: 'get_databases', cache_level: 'server', control: 'node-list-by-name', url: 'get_databases', cache_level: 'server',
select2: { allowClear: false }, select2: { allowClear: false }, mode: ['create'],
transform: function(data, cell) { transform: function(data, cell) {
var res = [], var res = [],
control = cell || this, control = cell || this,
@ -362,6 +363,15 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
},{ },{
id: 'datconnlimit', label: '{{ _('Connection limit') }}', id: 'datconnlimit', label: '{{ _('Connection limit') }}',
editable: false, type: 'int', group: 'Definition', min: -1 editable: false, type: 'int', group: 'Definition', min: -1
},{
id: 'is_template', label: '{{ _('Template?') }}',
editable: false, type: 'switch', group: 'Definition',
disabled: true, mode: ['properties', 'edit'],
options: {
'onText': 'Yes', 'offText': 'No',
'onColor': 'success', 'offColor': 'primary',
'size': 'small'
}
},{ },{
id: 'datallowconn', label: '{{ _('Allow connections?') }}', id: 'datallowconn', label: '{{ _('Allow connections?') }}',
editable: false, type: 'switch', group: 'Definition', editable: false, type: 'switch', group: 'Definition',

View File

@ -1,10 +1,10 @@
SELECT SELECT
db.oid as did, db.datname as name, db.dattablespace AS spcoid, db.oid AS did, db.datname AS name, db.dattablespace AS spcoid,
spcname, datallowconn, pg_encoding_to_char(encoding) AS encoding, spcname, datallowconn, pg_encoding_to_char(encoding) AS encoding,
pg_get_userbyid(datdba) AS datowner, datcollate, datctype, datconnlimit, pg_get_userbyid(datdba) AS datowner, datcollate, datctype, datconnlimit,
has_database_privilege(db.oid, 'CREATE') as cancreate, has_database_privilege(db.oid, 'CREATE') AS cancreate,
current_setting('default_tablespace') AS default_tablespace, current_setting('default_tablespace') AS default_tablespace,
descr.description as comments, descr.description AS comments, db.datistemplate AS is_template,
{### Default ACL for Tables ###} {### Default ACL for Tables ###}
(SELECT array_to_string(ARRAY( (SELECT array_to_string(ARRAY(
SELECT array_to_string(defaclacl::text[], ', ') SELECT array_to_string(defaclacl::text[], ', ')

View File

@ -1,10 +1,10 @@
SELECT SELECT
db.oid as did, db.datname as name, db.dattablespace AS spcoid, db.oid AS did, db.datname AS name, db.dattablespace AS spcoid,
spcname, datallowconn, pg_encoding_to_char(encoding) AS encoding, spcname, datallowconn, pg_encoding_to_char(encoding) AS encoding,
pg_get_userbyid(datdba) AS datowner, datcollate, datctype, datconnlimit, pg_get_userbyid(datdba) AS datowner, datcollate, datctype, datconnlimit,
has_database_privilege(db.oid, 'CREATE') as cancreate, has_database_privilege(db.oid, 'CREATE') AS cancreate,
current_setting('default_tablespace') AS default_tablespace, current_setting('default_tablespace') AS default_tablespace,
descr.description as comments, descr.description AS comments, db.datistemplate AS is_template,
{### Default ACL for Tables ###} {### Default ACL for Tables ###}
(SELECT array_to_string(ARRAY( (SELECT array_to_string(ARRAY(
SELECT array_to_string(defaclacl::text[], ', ') SELECT array_to_string(defaclacl::text[], ', ')

View File

@ -1,10 +1,10 @@
SELECT SELECT
db.oid as did, db.datname as name, db.dattablespace AS spcoid, db.oid AS did, db.datname AS name, db.dattablespace AS spcoid,
spcname, datallowconn, pg_encoding_to_char(encoding) AS encoding, spcname, datallowconn, pg_encoding_to_char(encoding) AS encoding,
pg_get_userbyid(datdba) AS datowner, datcollate, datctype, datconnlimit, pg_get_userbyid(datdba) AS datowner, datcollate, datctype, datconnlimit,
has_database_privilege(db.oid, 'CREATE') as cancreate, has_database_privilege(db.oid, 'CREATE') AS cancreate,
current_setting('default_tablespace') AS default_tablespace, current_setting('default_tablespace') AS default_tablespace,
descr.description as comments, descr.description AS comments, db.datistemplate AS is_template,
{### Default ACL for Tables ###} {### Default ACL for Tables ###}
(SELECT array_to_string(ARRAY( (SELECT array_to_string(ARRAY(
SELECT array_to_string(defaclacl::text[], ', ') SELECT array_to_string(defaclacl::text[], ', ')