mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix various inconsistencies with databases and tablespaces:
- Display the ACL string in properties, not the subnode panel. - Offer default values for the owner of new objects. - Add missing context menu option to create a tablespace from a server node.
This commit is contained in:
@@ -205,6 +205,18 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
|
|||||||
defseqacl: [],
|
defseqacl: [],
|
||||||
deftypeacl: []
|
deftypeacl: []
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Default values!
|
||||||
|
initialize: function(attrs, args) {
|
||||||
|
var isNew = (_.size(attrs) === 0);
|
||||||
|
|
||||||
|
if (isNew) {
|
||||||
|
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||||
|
this.set({'datowner': userInfo.name}, {silent: true});
|
||||||
|
}
|
||||||
|
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
schema: [{
|
schema: [{
|
||||||
id: 'name', label: '{{ _('Database') }}', cell: 'string',
|
id: 'name', label: '{{ _('Database') }}', cell: 'string',
|
||||||
editable: false, type: 'text'
|
editable: false, type: 'text'
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
this.initialized = true;
|
this.initialized = true;
|
||||||
|
|
||||||
pgBrowser.add_menus([{
|
pgBrowser.add_menus([{
|
||||||
|
name: 'create_tablespace_on_server', node: 'server', module: this,
|
||||||
|
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||||
|
category: 'create', priority: 4, label: '{{ _('Tablespace...') }}',
|
||||||
|
icon: 'wcTabIcon icon-tablespace', data: {action: 'create'}
|
||||||
|
},{
|
||||||
name: 'create_tablespace_on_coll', node: 'coll-tablespace', module: this,
|
name: 'create_tablespace_on_coll', node: 'coll-tablespace', module: this,
|
||||||
applies: ['object', 'context'], callback: 'show_obj_properties',
|
applies: ['object', 'context'], callback: 'show_obj_properties',
|
||||||
category: 'create', priority: 4, label: '{{ _('Tablespace...') }}',
|
category: 'create', priority: 4, label: '{{ _('Tablespace...') }}',
|
||||||
@@ -79,6 +84,18 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
spcacl: [],
|
spcacl: [],
|
||||||
seclabels:[]
|
seclabels:[]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Default values!
|
||||||
|
initialize: function(attrs, args) {
|
||||||
|
var isNew = (_.size(attrs) === 0);
|
||||||
|
|
||||||
|
if (isNew) {
|
||||||
|
var userInfo = pgBrowser.serverInfo[args.node_info.server._id].user;
|
||||||
|
this.set({'spcuser': userInfo.name}, {silent: true});
|
||||||
|
}
|
||||||
|
pgAdmin.Browser.Node.Model.prototype.initialize.apply(this, arguments);
|
||||||
|
},
|
||||||
|
|
||||||
schema: [{
|
schema: [{
|
||||||
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
id: 'name', label: '{{ _('Name') }}', cell: 'string',
|
||||||
type: 'text'
|
type: 'text'
|
||||||
@@ -96,6 +113,9 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
},{
|
},{
|
||||||
id: 'spcuser', label:'{{ _('Owner') }}', cell: 'string',
|
id: 'spcuser', label:'{{ _('Owner') }}', cell: 'string',
|
||||||
type: 'text', control: 'node-list-by-name', node: 'role'
|
type: 'text', control: 'node-list-by-name', node: 'role'
|
||||||
|
},{
|
||||||
|
id: 'acl', label: '{{ _('Privileges') }}', type: 'text',
|
||||||
|
mode: ['properties'], disabled: true
|
||||||
},{
|
},{
|
||||||
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
id: 'description', label:'{{ _('Comment') }}', cell: 'string',
|
||||||
type: 'multiline'
|
type: 'multiline'
|
||||||
@@ -109,7 +129,7 @@ function($, _, S, pgAdmin, pgBrowser, alertify) {
|
|||||||
id: 'spcacl', label: 'Privileges', type: 'collection',
|
id: 'spcacl', label: 'Privileges', type: 'collection',
|
||||||
group: '{{ _('Security') }}', control: 'unique-col-collection',
|
group: '{{ _('Security') }}', control: 'unique-col-collection',
|
||||||
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['C']}),
|
model: pgAdmin.Browser.Node.PrivilegeRoleModel.extend({privileges: ['C']}),
|
||||||
mode: ['properties', 'edit', 'create'], canAdd: true, canDelete: true,
|
mode: ['edit', 'create'], canAdd: true, canDelete: true,
|
||||||
uniqueCol : ['grantee'],
|
uniqueCol : ['grantee'],
|
||||||
columns: ['grantee', 'grantor', 'privileges']
|
columns: ['grantee', 'grantor', 'privileges']
|
||||||
},{
|
},{
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
SELECT
|
SELECT
|
||||||
ts.oid, spcname AS name, spclocation, spcoptions,
|
ts.oid, spcname AS name, spclocation, spcoptions,
|
||||||
pg_get_userbyid(spcowner) as spcuser, spcacl,
|
pg_get_userbyid(spcowner) as spcuser, spcacl,
|
||||||
pg_catalog.shobj_description(oid, 'pg_tablespace') AS description
|
pg_catalog.shobj_description(oid, 'pg_tablespace') AS description,
|
||||||
|
spcacl as acl
|
||||||
FROM
|
FROM
|
||||||
pg_tablespace ts
|
pg_tablespace ts
|
||||||
{% if tsid %}
|
{% if tsid %}
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ SELECT
|
|||||||
(SELECT
|
(SELECT
|
||||||
array_agg(provider || '=' || label)
|
array_agg(provider || '=' || label)
|
||||||
FROM pg_shseclabel sl1
|
FROM pg_shseclabel sl1
|
||||||
WHERE sl1.objoid=ts.oid) AS seclabels
|
WHERE sl1.objoid=ts.oid) AS seclabels,
|
||||||
|
spcacl as acl
|
||||||
FROM
|
FROM
|
||||||
pg_tablespace ts
|
pg_tablespace ts
|
||||||
{% if tsid %}
|
{% if tsid %}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{### SQL to fetch tablespace object properties ###}
|
{### SQL to fetch tablespace object properties ###}
|
||||||
SELECT ts.oid, spcname AS name, spclocation, spcoptions, pg_get_userbyid(spcowner) as spcuser, spcacl,
|
SELECT ts.oid, spcname AS name, spclocation, spcoptions, pg_get_userbyid(spcowner) as spcuser, spcacl, spcacl as acl
|
||||||
pg_catalog.shobj_description(oid, 'pg_tablespace') AS description
|
pg_catalog.shobj_description(oid, 'pg_tablespace') AS description
|
||||||
FROM pg_tablespace ts
|
FROM pg_tablespace ts
|
||||||
{% if tsid %}
|
{% if tsid %}
|
||||||
|
|||||||
Reference in New Issue
Block a user