mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2026-08-17 16:34:44 -05:00
Disable controls for shared servers that cannot be edited by the users.
This commit is contained in:
@@ -20,6 +20,7 @@ Bundled PostgreSQL Utilities
|
||||
New features
|
||||
************
|
||||
|
||||
| `Issue #0392 <https://github.com/pgadmin-org/pgadmin4/issues/0392>`_ - Added an ability to configure the font family for SQL editors.
|
||||
| `Issue #4194 <https://github.com/pgadmin-org/pgadmin4/issues/4194>`_ - Added support to automatically open a file after it is downloaded in the desktop mode.
|
||||
| `Issue #4503 <https://github.com/pgadmin-org/pgadmin4/issues/4503>`_ - Added support for post-connection SQL execution, which will be run automatically on each connection made to any database of the server.
|
||||
| `Issue #5871 <https://github.com/pgadmin-org/pgadmin4/issues/5871>`_ - Add support for restoring plain SQL database dumps.
|
||||
|
||||
@@ -26,13 +26,15 @@ class TagsSchema extends BaseUISchema {
|
||||
id: 'text', label: gettext('Text'), cell: 'text', group: null,
|
||||
mode: ['create', 'edit'], noEmpty: true, controlProps: {
|
||||
maxLength: 30,
|
||||
}
|
||||
},
|
||||
disabled : this.top.isShared(this.top.origData),
|
||||
},
|
||||
{
|
||||
id: 'color', label: gettext('Color'), cell: 'color', group: null,
|
||||
mode: ['create', 'edit'], controlProps: {
|
||||
input: true,
|
||||
}
|
||||
},
|
||||
disabled : this.top.isShared(this.top.origData),
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -194,6 +196,10 @@ export default class ServerSchema extends BaseUISchema {
|
||||
return Boolean(state.connected);
|
||||
}
|
||||
|
||||
isConnectedOrShared(state) {
|
||||
return this.isConnected(state) || this.isShared(state);
|
||||
}
|
||||
|
||||
get baseFields() {
|
||||
let obj = this;
|
||||
return [
|
||||
@@ -284,7 +290,7 @@ export default class ServerSchema extends BaseUISchema {
|
||||
},
|
||||
{
|
||||
id: 'comment', label: gettext('Comments'), type: 'multiline', group: null,
|
||||
mode: ['properties', 'edit', 'create'],
|
||||
mode: ['properties', 'edit', 'create'], disabled: obj.isShared,
|
||||
}, {
|
||||
id: 'connection_string', label: gettext('Connection String'), type: 'multiline',
|
||||
group: gettext('Connection'), mode: ['properties'], readonly: true,
|
||||
@@ -315,7 +321,7 @@ export default class ServerSchema extends BaseUISchema {
|
||||
}
|
||||
},{
|
||||
id: 'db', label: gettext('Maintenance database'), type: 'text', group: gettext('Connection'),
|
||||
mode: ['properties', 'edit', 'create'], readonly: obj.isConnected, disabled: obj.isShared,
|
||||
mode: ['properties', 'edit', 'create'], readonly: obj.isConnectedOrShared,
|
||||
noEmpty: true,
|
||||
},{
|
||||
id: 'username', label: gettext('Username'), type: 'text', group: gettext('Connection'),
|
||||
@@ -331,7 +337,7 @@ export default class ServerSchema extends BaseUISchema {
|
||||
}
|
||||
},{
|
||||
id: 'kerberos_conn', label: gettext('Kerberos authentication?'), type: 'switch',
|
||||
group: gettext('Connection'),
|
||||
group: gettext('Connection'), disabled: obj.isShared,
|
||||
},{
|
||||
id: 'gss_authenticated', label: gettext('GSS authenticated?'), type: 'switch',
|
||||
group: gettext('Connection'), mode: ['properties'], visible: obj.isConnected,
|
||||
@@ -366,7 +372,7 @@ export default class ServerSchema extends BaseUISchema {
|
||||
mode: ['properties', 'edit', 'create'], readonly: obj.isConnected,
|
||||
},{
|
||||
id: 'service', label: gettext('Service'), type: 'text',
|
||||
mode: ['properties', 'edit', 'create'], readonly: obj.isConnected,
|
||||
mode: ['properties', 'edit', 'create'], readonly: obj.isConnectedOrShared,
|
||||
group: gettext('Connection'),
|
||||
}, {
|
||||
id: 'connection_params', label: gettext('Connection Parameters'),
|
||||
@@ -464,8 +470,10 @@ export default class ServerSchema extends BaseUISchema {
|
||||
{
|
||||
id: 'db_res', label: gettext('DB restriction'), type: 'select', group: gettext('Advanced'),
|
||||
options: [],
|
||||
mode: ['properties', 'edit', 'create'], readonly: obj.isConnected, controlProps: {
|
||||
multiple: true, allowClear: false, creatable: true, noDropdown: true, placeholder: 'Specify the databases to be restrict...'},
|
||||
mode: ['properties', 'edit', 'create'], readonly: obj.isConnectedOrShared,
|
||||
controlProps: {
|
||||
multiple: true, allowClear: false, creatable: true, noDropdown: true, placeholder: 'Specify the databases to be restrict...'
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'passexec_cmd', label: gettext('Password exec command'), type: 'text',
|
||||
@@ -484,7 +492,7 @@ export default class ServerSchema extends BaseUISchema {
|
||||
},
|
||||
{
|
||||
id: 'prepare_threshold', label: gettext('Prepare threshold'), type: 'int',
|
||||
group: gettext('Advanced'),
|
||||
group: gettext('Advanced'), disabled: obj.isShared,
|
||||
mode: ['properties', 'edit', 'create'],
|
||||
helpMessageMode: ['edit', 'create'],
|
||||
helpMessage: gettext('If it is set to 0, every query is prepared the first time it is executed. If it is set to blank, prepared statements are disabled on the connection.')
|
||||
@@ -494,12 +502,12 @@ export default class ServerSchema extends BaseUISchema {
|
||||
group: gettext('Post Connection SQL'),
|
||||
mode: ['properties', 'edit', 'create'],
|
||||
type: 'sql', isFullTab: true,
|
||||
readonly: obj.isConnected,
|
||||
readonly: obj.isConnectedOrShared,
|
||||
helpMessage: gettext('Any query specified in the control below will be executed with autocommit mode enabled for each connection to any database on this server.'),
|
||||
},
|
||||
{
|
||||
id: 'tags', label: gettext('Tags'),
|
||||
type: 'collection', group: gettext('Tags'),
|
||||
type: 'collection', group: gettext('Tags'), disabled: obj.isShared,
|
||||
schema: this.tagsSchema, mode: ['edit', 'create'], uniqueCol: ['text'],
|
||||
canAdd: true, canEdit: false, canDelete: true, maxCount: pgAdmin.Browser.utils.max_server_tags_allowed,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user