Set input controls as read-only instead of disabled will allow tab navigation in the properties tab and also allow screen readers to read it. Fixes #4993

This commit is contained in:
Aditya Toshniwal 2020-01-31 12:37:44 +05:30 committed by Akshay Joshi
parent 989aa462f7
commit 0da23b837d
54 changed files with 501 additions and 501 deletions

View File

@ -30,6 +30,7 @@ Bug fixes
| `Issue #4410 <https://redmine.postgresql.org/issues/4410>`_ - Fixed an issue while editing char[] or character varying[] column from View/Edit data throwing an error.
| `Issue #4511 <https://redmine.postgresql.org/issues/4511>`_ - Fixed an issue where Grant wizard unable to handle multiple objects when the query string parameter exceeds its limit.
| `Issue #4827 <https://redmine.postgresql.org/issues/4827>`_ - Fix column resizable issue in the file explorer dialog.
| `Issue #4993 <https://redmine.postgresql.org/issues/4993>`_ - Set input controls as read-only instead of disabled will allow tab navigation in the properties tab and also allow screen readers to read it.
| `Issue #5000 <https://redmine.postgresql.org/issues/5000>`_ - Logout the pgAdmin session when no user activity of mouse move, click or keypress.
| `Issue #5025 <https://redmine.postgresql.org/issues/5025>`_ - Fix an issue where setting STORAGE_DIR to empty should show all the volumes on Windows in server mode.
| `Issue #5065 <https://redmine.postgresql.org/issues/5065>`_ - Updated the incorrect icon used for the cast node on refresh.

View File

@ -82,13 +82,13 @@ define('pgadmin.node.cast', [
// Define the schema for cast
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
editable: false, type: 'text', disabled: true, cellHeaderClasses: 'width_percent_50',
editable: false, type: 'text', readonly: true, cellHeaderClasses: 'width_percent_50',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
editable: false, type: 'text', disabled: true, mode: ['properties'],
editable: false, type: 'text', mode: ['properties'],
},{
id: 'srctyp', label: gettext('Source type'), url: 'get_type',
type: 'text', group: gettext('Definition'), disabled: function(m) {
type: 'text', group: gettext('Definition'), readonly: function(m) {
return !m.isNew();
}, mode: ['create'],
@ -132,10 +132,10 @@ define('pgadmin.node.cast', [
*/
{
id: 'srctyp', label: gettext('Source type'), type: 'text',
group: gettext('Definition'), disabled: true, mode:['properties','edit'],
group: gettext('Definition'), readonly: true, mode:['properties','edit'],
},{
id: 'trgtyp', label: gettext('Target type'), url: 'get_type',
type: 'text', group: gettext('Definition'), disabled: function(m) {
type: 'text', group: gettext('Definition'), readonly: function(m) {
return !m.isNew();
}, mode: ['create'],
transform: function(rows) {
@ -177,7 +177,7 @@ define('pgadmin.node.cast', [
*/
{
id: 'trgtyp', label: gettext('Target type'), type: 'text',
group: gettext('Definition'), disabled: true, mode:['properties','edit'],
group: gettext('Definition'), readonly: true, mode:['properties','edit'],
},
/*
@ -187,7 +187,7 @@ define('pgadmin.node.cast', [
*/
{
id: 'proname', label: gettext('Function'), deps:['srctyp', 'trgtyp'],
type: 'text', disabled: function(m) { return !m.isNew(); },
type: 'text', readonly: function(m) { return !m.isNew(); },
group: gettext('Definition'), mode: ['create'],
control: 'node-ajax-options',
options: function(control) {
@ -231,7 +231,7 @@ define('pgadmin.node.cast', [
*/
{
id: 'proname', label: gettext('Function'), type: 'text',
group: gettext('Definition'), disabled: true, mode:['properties','edit'],
group: gettext('Definition'), readonly: true, mode:['properties','edit'],
},{
id: 'castcontext', label: gettext('Context'),
options:{'onText':'IMPLICIT','offText':'EXPLICIT', width: '90'},
@ -248,7 +248,7 @@ define('pgadmin.node.cast', [
* edit mode
*/
{
id: 'castcontext', label: gettext('Context'), disabled: true,
id: 'castcontext', label: gettext('Context'), readonly: true,
options:[{
label: 'IMPLICIT', value: 'IMPLICIT',
},{
@ -259,7 +259,7 @@ define('pgadmin.node.cast', [
mode:['properties', 'edit'],
},{
id: 'syscast', label: gettext('System cast?'),
cell: 'switch', type: 'switch', mode: ['properties'], disabled: true,
cell: 'switch', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'),
type: 'multiline', cellHeaderClasses: 'width_percent_50',

View File

@ -98,7 +98,7 @@ define('pgadmin.node.extension', [
{
id: 'name', label: gettext('Name'), first_empty: true,
type: 'text', mode: ['properties', 'create', 'edit'],
visible: true, url:'avails', disabled: function(m) {
visible: true, url:'avails', readonly: function(m) {
return !m.isNew();
},
transform: function(data, cell) {
@ -182,7 +182,7 @@ define('pgadmin.node.extension', [
},
{
id: 'eid', label: gettext('OID'), cell: 'string',
type: 'text', disabled: true, mode: ['properties'],
type: 'text', mode: ['properties'],
},
{
id: 'owner', label: gettext('Owner'), control: 'node-list-by-name',
@ -231,7 +231,7 @@ define('pgadmin.node.extension', [
},
{
id: 'comment', label: gettext('Comment'), cell: 'string',
type: 'multiline', disabled: true,
type: 'multiline', readonly: true,
},
],
validate: function() {

View File

@ -135,7 +135,7 @@ define('pgadmin.node.foreign_server', [
},
},{
id: 'fsrvid', label: gettext('OID'), cell: 'string',
type: 'text', disabled: true, mode: ['properties'],
type: 'text', mode: ['properties'],
},{
id: 'fsrvowner', label: gettext('Owner'), type: 'text',
control: Backform.NodeListByNameControl, node: 'role',
@ -162,7 +162,7 @@ define('pgadmin.node.foreign_server', [
mode: ['edit', 'create'], canAdd: true, canDelete: true, uniqueCol : ['grantee'],
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},
],

View File

@ -146,7 +146,7 @@ define('pgadmin.node.user_mapping', [
},
},{
id: 'um_oid', label: gettext('OID'), cell: 'string',
type: 'text', disabled: true, mode: ['properties'],
type: 'text', mode: ['properties'],
},{
id: 'umoptions', label: gettext('Options'), type: 'collection', group: gettext('Options'),
model: OptionsModel, control: 'unique-col-collection', mode: ['create', 'edit'],

View File

@ -130,15 +130,15 @@ define('pgadmin.node.foreign_data_wrapper', [
// Defining schema for the foreign data wrapper node
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text', disabled: function() {
// name field will be disabled only if edit mode and server version is below 9.2
type: 'text', readonly: function() {
// name field will be disabled only if edit mode
return (
this.mode == 'edit' && this.node_info.server.version < 90200
this.mode == 'edit'
);
},
},{
id: 'fdwoid', label: gettext('OID'), cell: 'string',
type: 'text', disabled: true, mode: ['properties'],
type: 'text', mode: ['properties'],
},{
id: 'fdwowner', label: gettext('Owner'), type: 'text',
control: Backform.NodeListByNameControl, node: 'role',
@ -168,7 +168,7 @@ define('pgadmin.node.foreign_data_wrapper', [
}), control: 'unique-col-collection',
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
}],
/* validate function is used to validate the input given by
* the user. In case of error, message will be displayed on

View File

@ -65,7 +65,6 @@ define('pgadmin.node.language', [
icon: 'wcTabIcon icon-language', data: {action: 'create'},
}]);
},
// Define the model for language node
model: pgBrowser.Node.Model.extend({
idAttribute: 'oid',
@ -122,14 +121,14 @@ define('pgadmin.node.language', [
},
},{
id: 'oid', label: gettext('OID'), cell: 'string', mode: ['properties'],
type: 'text', disabled: true,
type: 'text',
},{
id: 'lanowner', label: gettext('Owner'), type: 'text',
control: Backform.NodeListByNameControl, node: 'role',
mode: ['edit', 'properties', 'create'], select2: { allowClear: false },
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',
@ -142,11 +141,14 @@ define('pgadmin.node.language', [
m.set({'is_template': false});
return false;
}
else
else {
m.set({'is_template': true});
return true;
}
}
return true;
return false;
},
readonly: function(m) {return !m.isNew();},
},{
id: 'lanproc', label: gettext('Handler function'), type: 'text', control: 'node-ajax-options',
group: gettext('Definition'), mode: ['edit', 'properties', 'create'], url:'get_functions',
@ -167,11 +169,16 @@ define('pgadmin.node.language', [
return res;
}, disabled: function(m) {
if (m.isNew()) {
if (m.get('template_list').indexOf(m.get('name')) == -1)
if (m.get('template_list').indexOf(m.get('name')) == -1) {
return false;
}
else {
return true;
}
}
return true;
return false;
},
readonly: function(m) {return !m.isNew();},
},{
id: 'laninl', label: gettext('Inline function'), type: 'text', control: 'node-ajax-options',
group: gettext('Definition'), mode: ['edit', 'properties', 'create'], url:'get_functions',
@ -192,11 +199,16 @@ define('pgadmin.node.language', [
return res;
}, disabled: function(m) {
if (m.isNew()) {
if (m.get('template_list').indexOf(m.get('name')) == -1)
if (m.get('template_list').indexOf(m.get('name')) == -1) {
return false;
}
else {
return true;
}
}
return true;
return false;
},
readonly: function(m) {return !m.isNew();},
},{
id: 'lanval', label: gettext('Validator function'), type: 'text', control: 'node-ajax-options',
group: gettext('Definition'), mode: ['edit', 'properties', 'create'], url:'get_functions',
@ -217,11 +229,16 @@ define('pgadmin.node.language', [
return res;
}, disabled: function(m) {
if (m.isNew()) {
if (m.get('template_list').indexOf(m.get('name')) == -1)
if (m.get('template_list').indexOf(m.get('name')) == -1) {
return false;
}
else {
return true;
}
}
return true;
return false;
},
readonly: function(m) {return !m.isNew();},
}, {
id: 'lanacl', label: gettext('Privileges'), type: 'collection',
group: gettext('Security'), control: 'unique-col-collection', mode: ['edit', 'create'],

View File

@ -54,25 +54,25 @@ define('pgadmin.node.catalog_object_column', [
},
schema: [{
id: 'attname', label: gettext('Column'), cell: 'string',
type: 'text', disabled: true,
type: 'text', readonly: true,
},{
id: 'attowner', label: gettext('Owner'), cell: 'string',
type: 'text', disabled: true,
type: 'text', readonly: true,
},{
id: 'attnum', label: gettext('Position'), cell: 'string',
type: 'text', disabled: true,
type: 'text', readonly: true,
},{
id: 'cltype', label: gettext('Data type'), cell: 'string',
group: gettext('Definition'), type: 'text', disabled: true,
group: gettext('Definition'), type: 'text', readonly: true,
},{
id: 'collspcname', label: gettext('Collation'), cell: 'string',
group: gettext('Definition'), type: 'text', disabled: true,
group: gettext('Definition'), type: 'text', readonly: true,
},{
id: 'attacl', label: gettext('Privileges'), cell: 'string',
group: gettext('Security'), type: 'text', disabled: true,
group: gettext('Security'), type: 'text', readonly: true,
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', disabled: true,
type: 'multiline', readonly: true,
}],
}),
});

View File

@ -49,16 +49,16 @@ define('pgadmin.node.catalog_object', [
},
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text', disabled: true,
type: 'text', readonly: true,
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text', disabled: true,
type: 'text',
},{
id: 'owner', label: gettext('Owner'), cell: 'string',
type: 'text', disabled: true,
type: 'text', readonly: true,
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline' , disabled: true,
type: 'multiline' , readonly: true,
},
],
}),

View File

@ -120,20 +120,22 @@ define('pgadmin.node.collation', [
control: 'node-ajax-options',
type: 'text', mode: ['create', 'edit'], group: gettext('Definition'),
url: 'get_collations', disabled: 'inSchemaWithModelCheck',
readonly: function(m) {return !m.isNew;},
deps: ['locale', 'lc_collate', 'lc_type'],
},{
id: 'locale', label: gettext('Locale'), cell: 'string',
type: 'text', mode: ['create', 'edit'], group: gettext('Definition'),
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchemaWithModelCheck', readonly: function(m) {return !m.isNew;},
deps: ['lc_collate', 'lc_type', 'copy_collation'],
},{
id: 'lc_collate', label: gettext('LC_COLLATE'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'], group: gettext('Definition'),
deps: ['locale', 'copy_collation'], disabled: 'inSchemaWithModelCheck',
readonly: function(m) {return !m.isNew;},
},{
id: 'lc_type', label: gettext('LC_TYPE'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'], group: gettext('Definition'),
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchemaWithModelCheck', readonly: function(m) {return !m.isNew;},
deps: ['locale', 'copy_collation'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
@ -221,14 +223,6 @@ define('pgadmin.node.collation', [
return true;
return false;
}
// We will disbale control if it's in 'edit' mode
if (m.isNew()) {
return false;
} else {
return true;
}
}
return true;
},

View File

@ -82,7 +82,6 @@ define('pgadmin.node.domain_constraints', [
// Domain Constraint Schema
schema: [{
id: 'name', label: gettext('Name'), type:'text', cell:'string',
disabled: 'isDisabled',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
@ -92,24 +91,18 @@ define('pgadmin.node.domain_constraints', [
},{
id: 'consrc', label: gettext('Check'), type: 'multiline', cel:
'string', group: gettext('Definition'), mode: ['properties',
'create', 'edit'], disabled: function(m) { return !m.isNew(); },
'create', 'edit'], readonly: function(m) { return !m.isNew(); },
},{
id: 'connoinherit', label: gettext('No inherit?'), type:
'switch', cell: 'boolean', group: gettext('Definition'), mode:
['properties', 'create', 'edit'], disabled: 'isDisabled',
['properties', 'create', 'edit'],
visible: false,
},{
id: 'convalidated', label: gettext('Validate?'), type: 'switch', cell:
'boolean', group: gettext('Definition'), min_version: 90200,
disabled: function(m) {
if (!m.isNew()) {
var server = this.node_info.server;
if (server.version < 90200) { return true;
}
else if(m.get('convalidated')) {
return true;
}
return false;
if (!m.isNew() && m.get('convalidated')) {
return true;
}
return false;
},
@ -140,16 +133,6 @@ define('pgadmin.node.domain_constraints', [
return null;
},
isDisabled: function(m){
if (!m.isNew()) {
var server = this.node_info.server;
if (server.version < 90200)
{
return true;
}
}
return false;
},
}),
});
}

View File

@ -188,7 +188,7 @@ define('pgadmin.node.domain', [
control: 'node-ajax-options', type: 'text', url: 'get_types',
mode:['properties', 'create', 'edit'], group: gettext('Definition'),
first_empty: true, cache_node: 'type',
disabled: function(m) {
readonly: function(m) {
return !m.isNew();
},
transform: function(d) {
@ -198,11 +198,9 @@ define('pgadmin.node.domain', [
},{
id: 'typlen', label: gettext('Length'), cell: 'string',
type: 'text', group: gettext('Definition'), deps: ['basetype'],
readonly: function(m) {return !m.isNew();},
disabled: function(m) {
// We will store type from selected from combobox
if (!m.isNew()) {
return true;
}
var of_type = m.get('basetype');
if(m.type_options) {
// iterating over all the types
@ -233,11 +231,9 @@ define('pgadmin.node.domain', [
},{
id: 'precision', label: gettext('Precision'), cell: 'string',
type: 'text', group: gettext('Definition'), deps: ['basetype'],
readonly: function(m) {return !m.isNew();},
disabled: function(m) {
// We will store type from selected from combobox
if (!m.isNew()) {
return true;
}
var of_type = m.get('basetype');
if(m.type_options) {
// iterating over all the types
@ -276,7 +272,7 @@ define('pgadmin.node.domain', [
id: 'collname', label: gettext('Collation'), cell: 'string',
control: 'node-ajax-options', type: 'text', url: 'get_collations',
group: gettext('Definition'), cache_level: 'database',
cache_node: 'schema', disabled: function(m) {
cache_node: 'schema', readonly: function(m) {
return !m.isNew();
},
},{
@ -313,16 +309,6 @@ define('pgadmin.node.domain', [
return errmsg;
},
}),
isDisabled: function(m){
if (!m.isNew()) {
var server = this.node_info.server;
if (server.version < 90200)
{
return false;
}
}
return true;
},
});
}

View File

@ -573,7 +573,7 @@ define('pgadmin.node.foreign_table', [
},{
id: 'ftsrvname', label: gettext('Foreign server'), cell: 'string', control: 'node-ajax-options',
type: 'text', group: gettext('Definition'), url: 'get_foreign_servers',
disabled: function(m) { return !m.isNew(); }, cache_node: 'database',
readonly: function(m) { return !m.isNew(); }, cache_node: 'database',
},{
id: 'inherits', label: gettext('Inherits'), group: gettext('Definition'),
type: 'array', min_version: 90500, control: NodeAjaxOptionsMultipleControl,

View File

@ -492,7 +492,7 @@ define('pgadmin.node.fts_configuration', [
type: 'text', cellHeaderClasses: 'width_percent_50',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
editable: false, type: 'text', disabled: true, mode:['properties'],
editable: false, type: 'text', mode:['properties'],
},{
id: 'owner', label: gettext('Owner'), cell: 'string',
type: 'text', mode: ['properties', 'edit','create'], node: 'role',
@ -513,11 +513,11 @@ define('pgadmin.node.fts_configuration', [
//disable parser when user select copy_config manually and vica-versa
disabled: function(m) {
var copy_config = m.get('copy_config');
return m.isNew() &&
(_.isNull(copy_config) ||
return (_.isNull(copy_config) ||
_.isUndefined(copy_config) ||
copy_config === '') ? false : true;
},
readonly: function(m) {return !m.isNew();},
},{
id: 'copy_config', label: gettext('Copy config'),type: 'text',
mode: ['create'], group: gettext('Definition'),
@ -526,11 +526,11 @@ define('pgadmin.node.fts_configuration', [
//disable copy_config when user select parser manually and vica-versa
disabled: function(m) {
var parser = m.get('prsname');
return m.isNew() &&
(_.isNull(parser) ||
return (_.isNull(parser) ||
_.isUndefined(parser) ||
parser === '') ? false : true;
},
readonly: function(m) {return !m.isNew();},
},{
id: 'tokens', label: gettext('Tokens'), type: 'collection',
group: gettext('Tokens'), control: TokenControl,

View File

@ -137,7 +137,7 @@ define('pgadmin.node.fts_dictionary', [
type: 'text', cellHeaderClasses: 'width_percent_50',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
editable: false, type: 'text', disabled: true, mode:['properties'],
editable: false, type: 'text', mode:['properties'],
},{
id: 'owner', label: gettext('Owner'), cell: 'string',
type: 'text', mode: ['properties', 'edit','create'], node: 'role',
@ -151,7 +151,7 @@ define('pgadmin.node.fts_dictionary', [
type: 'multiline', cellHeaderClasses: 'width_percent_50',
},{
id: 'template', label: gettext('Template'),type: 'text',
disabled: function(m) { return !m.isNew(); }, url: 'fetch_templates',
readonly: function(m) { return !m.isNew(); }, url: 'fetch_templates',
group: gettext('Definition'), control: 'node-ajax-options',
cache_node: 'fts_template',
},{

View File

@ -95,7 +95,7 @@ define('pgadmin.node.fts_parser', [
type: 'text', cellHeaderClasses: 'width_percent_50',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
editable: false, type: 'text', disabled: true, mode:['properties'],
editable: false, type: 'text', mode:['properties'],
},{
id: 'schema', label: gettext('Schema'), cell: 'string',
type: 'text', mode: ['create','edit'], node: 'schema',
@ -106,31 +106,31 @@ define('pgadmin.node.fts_parser', [
type: 'multiline', cellHeaderClasses: 'width_percent_50',
},{
id: 'prsstart', label: gettext('Start function'),
type: 'text', disabled: function(m) { return !m.isNew(); },
type: 'text', readonly: function(m) { return !m.isNew(); },
control: 'node-ajax-options', url: 'start_functions',
group: gettext('Definition'), cache_level: 'database',
cache_node: 'schema',
},{
id: 'prstoken', label: gettext('Get next token function'),
type: 'text', disabled: function(m) { return !m.isNew(); },
type: 'text', readonly: function(m) { return !m.isNew(); },
control: 'node-ajax-options', url: 'token_functions',
group: gettext('Definition'), cache_level: 'database',
cache_node: 'schema',
},{
id: 'prsend', label: gettext('End function'),
type: 'text', disabled: function(m) { return !m.isNew(); },
type: 'text', readonly: function(m) { return !m.isNew(); },
control: 'node-ajax-options', url: 'end_functions',
group: gettext('Definition'), cache_level: 'database',
cache_node: 'schema',
},{
id: 'prslextype', label: gettext('Lextypes function'),
type: 'text', disabled: function(m) { return !m.isNew(); },
type: 'text', readonly: function(m) { return !m.isNew(); },
control: 'node-ajax-options', url: 'lextype_functions',
group: gettext('Definition'), cache_level: 'database',
cache_node: 'schema',
},{
id: 'prsheadline', label: gettext('Headline function'),
type: 'text', disabled: function(m) { return !m.isNew(); },
type: 'text', readonly: function(m) { return !m.isNew(); },
control: 'node-ajax-options', url: 'headline_functions',
group: gettext('Definition'), cache_level: 'database',
cache_node: 'schema',

View File

@ -90,7 +90,7 @@ define('pgadmin.node.fts_template', [
type: 'text', cellHeaderClasses: 'width_percent_50',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
editable: false, type: 'text', disabled: true, mode:['properties'],
editable: false, type: 'text', mode:['properties'],
},{
id: 'schema', label: gettext('Schema'), cell: 'string',
type: 'text', mode: ['create','edit'], node: 'schema',
@ -101,13 +101,13 @@ define('pgadmin.node.fts_template', [
type: 'multiline', cellHeaderClasses: 'width_percent_50',
},{
id: 'tmplinit', label: gettext('Init function'),
group: gettext('Definition'), type: 'text', disabled: function(m) {
group: gettext('Definition'), type: 'text', readonly: function(m) {
return !m.isNew();
}, control: 'node-ajax-options', url: 'get_init',
cache_level: 'database', cache_node: 'schema',
},{
id: 'tmpllexize', label: gettext('Lexize function'), group: gettext('Definition'),
type: 'text', disabled: function(m) { return !m.isNew(); },
type: 'text', readonly: function(m) { return !m.isNew(); },
control: 'node-ajax-options', url: 'get_lexize', cache_level: 'database',
cache_node: 'schema',
}],

View File

@ -223,20 +223,18 @@ define('pgadmin.node.function', [
},{
id: 'proargs', label: gettext('Arguments'), cell: 'string',
type: 'text', group: gettext('Definition'), mode: ['properties'],
disabled: 'isDisabled',
},{
id: 'proargtypenames', label: gettext('Signature arguments'), cell:
'string', type: 'text', group: gettext('Definition'), mode: ['properties'],
disabled: 'isDisabled',
},{
id: 'prorettypename', label: gettext('Return type'), cell: 'string',
control: 'node-ajax-options', type: 'text', group: gettext('Definition'),
url: 'get_types', disabled: 'isDisabled', first_empty: true,
url: 'get_types', readonly: 'isReadonly', first_empty: true,
mode: ['create'], visible: 'isVisible',
},{
id: 'prorettypename', label: gettext('Return type'), cell: 'string',
type: 'text', group: gettext('Definition'),
mode: ['properties', 'edit'], disabled: 'isDisabled', visible: 'isVisible',
mode: ['properties', 'edit'], readonly: 'isReadonly', visible: 'isVisible',
}, {
id: 'lanname', label: gettext('Language'), cell: 'string',
control: 'node-ajax-options', type: 'text', group: gettext('Definition'),
@ -305,10 +303,10 @@ define('pgadmin.node.function', [
select2: {allowClear: false},
},{
id: 'procost', label: gettext('Estimated cost'), group: gettext('Options'),
cell:'string', type: 'text', disabled: 'isDisabled', deps: ['lanname'],
cell:'string', type: 'text', readonly: 'isReadonly', deps: ['lanname'],
},{
id: 'prorows', label: gettext('Estimated rows'), type: 'text',
deps: ['proretset'], visible: 'isVisible', disabled: 'isDisabled',
deps: ['proretset'], visible: 'isVisible', readonly: 'isReadonly',
group: gettext('Options'),
},{
id: 'proleakproof', label: gettext('Leak proof?'),
@ -432,27 +430,33 @@ define('pgadmin.node.function', [
if (this.name == 'sysproc') { return false; }
return true;
},
isDisabled: function(m) {
isDisabled: function() {
if(this.node_info && 'catalog' in this.node_info) {
return true;
}
switch(this.name){
case 'prosupportfunc':
var item = pgAdmin.Browser.tree.selected();
if(pgAdmin.Browser.Nodes['function'].getTreeNodeHierarchy(item).server.user.is_superuser)
return false;
return true;
default:
return false;
}
},
isReadonly: function(m) {
switch(this.name){
case 'proargs':
case 'proargtypenames':
case 'prorettypename':
case 'proretset':
case 'proiswindow':
case 'prorettypename':
return !m.isNew();
case 'prorows':
if(m.get('proretset') == true) {
return false;
}
return true;
case 'prosupportfunc':
var item = pgAdmin.Browser.tree.selected();
if(pgAdmin.Browser.Nodes['function'].getTreeNodeHierarchy(item).server.user.is_superuser)
return false;
return true;
default:
return false;
}

View File

@ -134,16 +134,12 @@ define('pgadmin.node.procedure', [
else{
return false;
}
case 'variables':
case 'prosecdef':
return this.node_info.server.version < 90500;
case 'prorows':
var server = this.node_info.server;
return !(server.version >= 90500 && m.get('proretset') == true);
case 'funcowner':
case 'proargs':
return true;
case 'proparallel':
if (this.node_info.server.version < 90600 ||
this.node_info.server.server_type != 'ppas' ||

View File

@ -120,18 +120,19 @@ define('pgadmin.node.trigger_function', [
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: 'isDisabled',
disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
},{
id: 'funcowner', label: gettext('Owner'), cell: 'string',
control: Backform.NodeListByNameControl, node: 'role', type:
'text', disabled: 'isDisabled',
'text', disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'pronamespace', label: gettext('Schema'), cell: 'string',
control: 'node-list-by-id', type: 'text', cache_level: 'database',
node: 'schema', disabled: 'isDisabled', mode: ['create', 'edit'],
node: 'schema', disabled: 'isDisabled', readonly: 'isReadonly',
mode: ['create', 'edit'],
},{
id: 'sysfunc', label: gettext('System function?'),
cell:'boolean', type: 'switch',
@ -142,22 +143,22 @@ define('pgadmin.node.trigger_function', [
mode: ['properties'], visible: 'isVisible',
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', disabled: 'isDisabled',
type: 'multiline', disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'pronargs', label: gettext('Argument count'), cell: 'string',
type: 'text', group: gettext('Definition'), mode: ['properties'],
},{
id: 'proargs', label: gettext('Arguments'), cell: 'string',
type: 'text', group: gettext('Definition'), mode: ['properties', 'edit'],
disabled: 'isDisabled',
disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'proargtypenames', label: gettext('Signature arguments'), cell:
'string', type: 'text', group: gettext('Definition'), mode: ['properties'],
disabled: 'isDisabled',
disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'prorettypename', label: gettext('Return type'), cell: 'string',
control: 'select2', type: 'text', group: gettext('Definition'),
disabled: 'isDisabled', first_empty: true,
disabled: 'isDisabled', readonly: 'isReadonly', first_empty: true,
select2: { width: '100%', allowClear: false },
mode: ['create'], visible: 'isVisible', options: [
{label: gettext('trigger'), value: 'trigger'},
@ -166,11 +167,12 @@ define('pgadmin.node.trigger_function', [
},{
id: 'prorettypename', label: gettext('Return type'), cell: 'string',
type: 'text', group: gettext('Definition'),
mode: ['properties', 'edit'], disabled: 'isDisabled', visible: 'isVisible',
mode: ['properties', 'edit'], disabled: 'isDisabled', readonly: 'isReadonly',
visible: 'isVisible',
}, {
id: 'lanname', label: gettext('Language'), cell: 'string',
control: 'node-ajax-options', type: 'text', group: gettext('Definition'),
url: 'get_languages', disabled: 'isDisabled',
url: 'get_languages', disabled: 'isDisabled', readonly: 'isReadonly',
transform: function(d) {
return _.reject(d, function(o) {
return o.label == 'sql' || o.label == 'edbspl';
@ -187,21 +189,21 @@ define('pgadmin.node.trigger_function', [
return false;
}
return true;
}, disabled: 'isDisabled',
}, disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'probin', label: gettext('Object file'), cell: 'string',
type: 'text', group: gettext('Definition'), deps: ['lanname'], visible:
function(m) {
if (m.get('lanname') == 'c') { return true; }
return false;
}, disabled: 'isDisabled',
}, disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'prosrc_c', label: gettext('Link symbol'), cell: 'string',
type: 'text', group: gettext('Definition'), deps: ['lanname'], visible:
function(m) {
if (m.get('lanname') == 'c') { return true; }
return false;
}, disabled: 'isDisabled',
}, disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'provolatile', label: gettext('Volatility'), cell: 'string',
control: 'node-ajax-options', type: 'text', group: gettext('Options'),
@ -209,34 +211,34 @@ define('pgadmin.node.trigger_function', [
{'label': 'VOLATILE', 'value': 'v'},
{'label': 'STABLE', 'value': 's'},
{'label': 'IMMUTABLE', 'value': 'i'},
], disabled: 'isDisabled', select2: { allowClear: false },
], disabled: 'isDisabled', readonly: 'isReadonly', select2: { allowClear: false },
},{
id: 'proretset', label: gettext('Returns a set?'), type: 'switch',
group: gettext('Options'), disabled: 'isDisabled',
group: gettext('Options'), disabled: 'isDisabled', readonly: 'isReadonly',
visible: 'isVisible',
},{
id: 'proisstrict', label: gettext('Strict?'), type: 'switch',
disabled: 'isDisabled', group: gettext('Options'),
disabled: 'isDisabled', readonly: 'isReadonly', group: gettext('Options'),
},{
id: 'prosecdef', label: gettext('Security of definer?'),
group: gettext('Options'), cell:'boolean', type: 'switch',
disabled: 'isDisabled',
disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'proiswindow', label: gettext('Window?'),
group: gettext('Options'), cell:'boolean', type: 'switch',
disabled: 'isDisabled', visible: 'isVisible',
disabled: 'isDisabled', readonly: 'isReadonly', visible: 'isVisible',
},{
id: 'procost', label: gettext('Estimated cost'), type: 'text',
group: gettext('Options'), disabled: 'isDisabled',
group: gettext('Options'), disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'prorows', label: gettext('Estimated rows'), type: 'text',
group: gettext('Options'),
disabled: 'isDisabled',
disabled: 'isDisabled', readonly: 'isReadonly',
deps: ['proretset'], visible: 'isVisible',
},{
id: 'proleakproof', label: gettext('Leak proof?'),
group: gettext('Options'), cell:'boolean', type: 'switch', min_version: 90200,
disabled: 'isDisabled',
disabled: 'isDisabled', readonly: 'isReadonly',
}, pgBrowser.SecurityGroupSchema, {
id: 'proacl', label: gettext('Privileges'), mode: ['properties'],
group: gettext('Security'), type: 'text',
@ -245,20 +247,20 @@ define('pgadmin.node.trigger_function', [
group: gettext('Parameters'), control: 'variable-collection',
model: pgBrowser.Node.VariableModel,
mode: ['edit', 'create'], canAdd: 'canVarAdd', canEdit: false,
canDelete: true, disabled: 'isDisabled',
canDelete: true, disabled: 'isDisabled', readonly: 'isReadonly',
},{
id: 'acl', label: gettext('Privileges'), editable: false,
type: 'collection', group: 'security', mode: ['edit', 'create'],
model: pgBrowser.Node.PrivilegeRoleModel.extend({
privileges: ['X'],
}), uniqueCol : ['grantee', 'grantor'], disabled: 'isDisabled',
}), uniqueCol : ['grantee', 'grantor'], disabled: 'isDisabled', readonly: 'isReadonly',
canAdd: true, canDelete: true, control: 'unique-col-collection',
},{
id: 'seclabels', label: gettext('Security labels'), canEdit: true,
model: pgBrowser.SecLabelModel, type: 'collection',
min_version: 90100, group: 'security', mode: ['edit', 'create'],
canDelete: true, control: 'unique-col-collection', canAdd: true,
uniqueCol : ['provider'], disabled: 'isDisabled',
uniqueCol : ['provider'], disabled: 'isDisabled', readonly: 'isReadonly',
}],
validate: function(keys)
{
@ -340,10 +342,7 @@ define('pgadmin.node.trigger_function', [
if (this.name == 'sysproc') { return false; }
return true;
},
isDisabled: function(m) {
if(this.node_info && 'catalog' in this.node_info) {
return true;
}
isReadonly: function(m) {
switch(this.name){
case 'proargs':
case 'proargtypenames':
@ -351,6 +350,15 @@ define('pgadmin.node.trigger_function', [
case 'proretset':
case 'proiswindow':
return !m.isNew();
default:
return false;
}
},
isDisabled: function(m) {
if(this.node_info && 'catalog' in this.node_info) {
return true;
}
switch(this.name){
case 'prorows':
if(m.get('proretset') == true) {
return false;

View File

@ -65,35 +65,31 @@ define('pgadmin.node.edbfunc', [
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text', mode: ['properties'],
disabled: true,
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
},{
id: 'funcowner', label: gettext('Owner'), cell: 'string',
type: 'text', disabled: true,
type: 'text', readonly: true,
},{
id: 'pronargs', label: gettext('Argument count'), cell: 'string',
type: 'text', group: gettext('Definition'), mode: ['properties'],
},{
id: 'proargs', label: gettext('Arguments'), cell: 'string',
type: 'text', group: gettext('Definition'), mode: ['properties'],
disabled: true,
},{
id: 'proargtypenames', label: gettext('Signature arguments'), cell:
'string', type: 'text', group: gettext('Definition'), mode: ['properties'],
disabled: true,
},{
id: 'prorettypename', label: gettext('Return type'), cell: 'string',
type: 'text', group: gettext('Definition'), disabled: true,
type: 'text', group: gettext('Definition'),
mode: ['properties'], visible: 'isVisible',
},{
id: 'visibility', label: gettext('Visibility'), cell: 'string',
type: 'text', mode: ['properties'],
disabled: true,
},{
id: 'lanname', label: gettext('Language'), cell: 'string',
type: 'text', group: gettext('Definition'), disabled: true,
type: 'text', group: gettext('Definition'), readonly: true,
},{
id: 'prosrc', label: gettext('Code'), cell: 'string',
type: 'text', mode: ['properties'],

View File

@ -57,17 +57,15 @@ define('pgadmin.node.edbvar', [
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text', mode: ['properties'],
disabled: true,
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
},{
id: 'datatype', label: gettext('Data type'), cell: 'string',
type: 'text', disabled: true,
type: 'text', readonly: true,
},{
id: 'visibility', label: gettext('Visibility'), cell: 'string',
type: 'text', mode: ['properties'],
disabled: true,
}],
validate: function()
{

View File

@ -113,7 +113,7 @@ define('pgadmin.node.package', [
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: function(m) {
readonly: function(m) {
return !m.isNew();
},
},{
@ -122,13 +122,13 @@ define('pgadmin.node.package', [
},{
id: 'owner', label: gettext('Owner'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: true, editable: false, visible: function(m) {
readonly: true, editable: false, visible: function(m) {
return !m.isNew();
},
},{
id: 'schema', label: gettext('Schema'), type: 'text', node: 'schema',
control: 'node-list-by-name',
disabled: function(m) { return !m.isNew(); }, filter: function(d) {
readonly: function(m) { return !m.isNew(); }, filter: function(d) {
// If schema name start with pg_* then we need to exclude them
if(d && d.label.match(/^pg_/))
{

View File

@ -140,7 +140,7 @@ define('pgadmin.node.sequence', [
},{
id: 'start', label: gettext('Start'), type: 'int',
mode: ['properties', 'create'], group: gettext('Definition'),
disabled: function(m) {
readonly: function(m) {
return !m.isNew();
},
},{
@ -158,7 +158,7 @@ define('pgadmin.node.sequence', [
mode: ['properties', 'create', 'edit'], group: gettext('Definition'),
}, pgBrowser.SecurityGroupSchema,{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'relacl', label: gettext('Privileges'), group: 'security',
model: pgBrowser.Node.PrivilegeRoleModel.extend({

View File

@ -60,16 +60,16 @@ define('pgadmin.node.catalog', [
},
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text', disabled: true,
type: 'text', readonly: true,
},{
id: 'oid', label: gettext('OID'), cell: 'string', mode: ['properties'],
type: 'text', disabled: true,
type: 'text',
},{
id: 'namespaceowner', label: gettext('Owner'), cell: 'string',
type: 'text', disabled: true,
type: 'text', readonly: true,
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',

View File

@ -391,32 +391,32 @@ define('pgadmin.node.schema', [
type: 'text',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text', disabled: true, mode: ['properties'],
type: 'text', mode: ['properties'],
},{
id: 'namespaceowner', label: gettext('Owner'), cell: 'string',
type: 'text', control: 'node-list-by-name', node: 'role',
select2: { allowClear: false },
},{
id: 'is_sys_object', label: gettext('System schema?'),
cell: 'switch', type: 'switch', mode: ['properties'], disabled: true,
cell: 'switch', type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'tblacl', label: gettext('Default TABLE privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'seqacl', label: gettext('Default SEQUENCE privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'funcacl', label: gettext('Default FUNCTION privileges'),
group: gettext('Security'), type: 'text', mode: ['properties'], disabled: true,
group: gettext('Security'), type: 'text', mode: ['properties'],
},{
id: 'typeacl', label: gettext('Default TYPE privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true, min_version: 90200,
group: gettext('Security'), mode: ['properties'], min_version: 90200,
visible: function() {
return this.version_compatible;
},

View File

@ -92,16 +92,16 @@ define('pgadmin.node.synonym', [
schema: [{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: function(m) { return !m.isNew(); },
},{
id: 'owner', label: gettext('Owner'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: true , control: 'node-list-by-name',
readonly: true , control: 'node-list-by-name',
node: 'role', visible: false,
},{
id: 'schema', label: gettext('Schema'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: function(m) { return !m.isNew(); }, node: 'schema',
readonly: function(m) { return !m.isNew(); }, node: 'schema',
control: 'node-list-by-name', cache_node: 'database',
cache_level: 'database',
},{
@ -181,7 +181,7 @@ define('pgadmin.node.synonym', [
},
},{
id: 'is_public_synonym', label: gettext('Public synonym?'),
disabled: true, type: 'switch', mode: ['properties'], cell: 'switch',
type: 'switch', mode: ['properties'], cell: 'switch',
options: { onText: gettext('Yes'), offText: gettext('No'), onColor: 'success',
offColor: 'primary', size: 'mini'},
},
@ -213,19 +213,6 @@ define('pgadmin.node.synonym', [
}
return false;
},
// We will check if we are under schema node & in 'create' mode
inSchemaWithModelCheck: function(m) {
if(this.node_info && 'schema' in this.node_info)
{
// We will disbale control if it's in 'edit' mode
if (m.isNew()) {
return false;
} else {
return true;
}
}
return true;
},
}),
canCreate: function(itemData, item, data) {
//If check is false then , we will allow create menu

View File

@ -344,7 +344,7 @@ define('pgadmin.node.column', [
},{
// Need to show this field only when creating new table [in SubNode control]
id: 'inheritedfrom', label: gettext('Inherited from table'),
type: 'text', disabled: true, editable: false,
type: 'text', readonly: true, editable: false,
cellHeaderClasses:'width_percent_10',
visible: function(m) {
return _.isUndefined(m.top.node_info['table'] || m.top.node_info['view'] || m.top.node_info['mview']);
@ -641,24 +641,24 @@ define('pgadmin.node.column', [
id: 'genexpr', label: gettext('Expression'), type: 'text',
mode: ['properties', 'create', 'edit'], group: gettext('Constraints'),
min_version: 120000, deps: ['colconstype'], visible: 'isTypeGenerated',
disabled: function(m) {
readonly: function(m) {
return !m.isNew();
},
},{
id: 'is_pk', label: gettext('Primary key?'),
type: 'switch', disabled: true, mode: ['properties'],
type: 'switch', mode: ['properties'],
group: gettext('Definition'),
},{
id: 'is_fk', label: gettext('Foreign key?'),
type: 'switch', disabled: true, mode: ['properties'],
type: 'switch', mode: ['properties'],
group: gettext('Definition'),
},{
id: 'is_inherited', label: gettext('Inherited?'),
type: 'switch', disabled: true, mode: ['properties'],
type: 'switch', mode: ['properties'],
group: gettext('Definition'),
},{
id: 'tbls_inherited', label: gettext('Inherited from table(s)'),
type: 'text', disabled: true, mode: ['properties'], deps: ['is_inherited'],
type: 'text', mode: ['properties'], deps: ['is_inherited'],
group: gettext('Definition'),
visible: function(m) {
if (!_.isUndefined(m.get('is_inherited')) && m.get('is_inherited')) {
@ -669,7 +669,7 @@ define('pgadmin.node.column', [
},
},{
id: 'is_sys_column', label: gettext('System column?'), cell: 'string',
type: 'switch', disabled: true, mode: ['properties'],
type: 'switch', mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', mode: ['properties', 'create', 'edit'],

View File

@ -183,7 +183,7 @@ define('pgadmin.node.compound_trigger', [
type: 'text', disabled: 'inSchema',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'int', disabled: true, mode: ['properties'],
type: 'int', mode: ['properties'],
},{
id: 'is_enable_trigger', label: gettext('Trigger enabled?'),
mode: ['edit', 'properties'],
@ -214,8 +214,9 @@ define('pgadmin.node.compound_trigger', [
var evn_insert = m.get('evnt_insert');
if (!_.isUndefined(evn_insert) && m.node_info['server']['server_type'] == 'ppas')
return false;
return m.inSchemaWithModelCheck.apply(this, [m]);
return m.inSchema.apply(this, [m]);
},
readonly: 'inEditMode',
},{
id: 'evnt_update', label: gettext('UPDATE'),
type: 'switch', mode: ['create','edit', 'properties'],
@ -227,8 +228,9 @@ define('pgadmin.node.compound_trigger', [
var evn_update = m.get('evnt_update');
if (!_.isUndefined(evn_update) && m.node_info['server']['server_type'] == 'ppas')
return false;
return m.inSchemaWithModelCheck.apply(this, [m]);
return m.inSchema.apply(this, [m]);
},
readonly: 'inEditMode',
},{
id: 'evnt_delete', label: gettext('DELETE'),
type: 'switch', mode: ['create','edit', 'properties'],
@ -240,8 +242,9 @@ define('pgadmin.node.compound_trigger', [
var evn_delete = m.get('evnt_delete');
if (!_.isUndefined(evn_delete) && m.node_info['server']['server_type'] == 'ppas')
return false;
return m.inSchemaWithModelCheck.apply(this, [m]);
return m.inSchema.apply(this, [m]);
},
readonly: 'inEditMode',
},{
id: 'evnt_truncate', label: gettext('TRUNCATE'),
type: 'switch', mode: ['create','edit', 'properties'],
@ -257,12 +260,13 @@ define('pgadmin.node.compound_trigger', [
if (!_.isUndefined(evn_truncate) && m.node_info['server']['server_type'] == 'ppas')
return false;
return m.inSchemaWithModelCheck.apply(this, [m]);
return m.inSchema.apply(this, [m]);
},
}],
readonly: 'inEditMode',
},{
id: 'whenclause', label: gettext('When'),
type: 'text', disabled: 'inSchemaWithModelCheck',
type: 'text', disabled: 'inSchema', readonly: 'inEditMode',
mode: ['create', 'edit', 'properties'],
control: 'sql-field', visible: true, group: gettext('Events'),
},{
@ -274,10 +278,6 @@ define('pgadmin.node.compound_trigger', [
if(this.node_info && 'catalog' in this.node_info) {
return true;
}
//Disable in edit mode
if (!m.isNew()) {
return true;
}
// Enable column only if update event is set true
var isUpdate = m.get('evnt_update');
if(!_.isUndefined(isUpdate) && isUpdate) {
@ -285,6 +285,7 @@ define('pgadmin.node.compound_trigger', [
}
return true;
},
readonly: 'inEditMode',
},{
id: 'prosrc', label: gettext('Code'), group: gettext('Code'),
type: 'text', mode: ['create', 'edit'],
@ -301,7 +302,8 @@ define('pgadmin.node.compound_trigger', [
},
},{
id: 'is_sys_trigger', label: gettext('System trigger?'), cell: 'string',
type: 'switch', disabled: 'inSchemaWithModelCheck', mode: ['properties'],
type: 'switch', disabled: 'inSchema', mode: ['properties'],
readonly: 'inEditMode',
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline', mode: ['properties', 'create', 'edit'],
@ -383,17 +385,8 @@ define('pgadmin.node.compound_trigger', [
}
return false;
},
// We will check if we are under schema node & in 'create' mode
inSchemaWithModelCheck: function(m) {
if(this.node_info && 'schema' in this.node_info) {
// We will disable control if it's in 'edit' mode
if (m.isNew()) {
return false;
} else {
return true;
}
}
return true;
inEditMode: function(m) {
return !m.isNew();
},
// Checks weather to enable/disable control
inSchemaWithColumnCheck: function(m) {

View File

@ -105,7 +105,7 @@ define('pgadmin.node.check_constraint', [
// Check Constraint Schema
schema: [{
id: 'name', label: gettext('Name'), type:'text', cell:'string',
disabled: 'isDisabled',
readonly: 'isReadonly',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'],
@ -126,12 +126,8 @@ define('pgadmin.node.check_constraint', [
},
},{
id: 'consrc', label: gettext('Check'), type: 'multiline', cell:
'string', group: gettext('Definition'), mode: ['properties',
'create', 'edit'], disabled: function(m) {
return ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
}, editable: false,
'string', group: gettext('Definition'), mode: ['properties', 'create', 'edit'],
readonly: 'isReadonly', editable: false,
},{
id: 'connoinherit', label: gettext('No inherit?'), type:
'switch', cell: 'boolean', group: gettext('Definition'), mode:
@ -149,10 +145,9 @@ define('pgadmin.node.check_constraint', [
return true;
}
return ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
return false;
},
readonly: 'isReadonly',
},{
id: 'convalidated', label: gettext('Don\'t validate?'), type: 'switch', cell:
'boolean', group: gettext('Definition'), min_version: 90200,
@ -189,18 +184,10 @@ define('pgadmin.node.check_constraint', [
return null;
},
isDisabled: function(m){
if ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) ||
(_.isFunction(m.isNew) && !m.isNew())) {
var server = (this.node_info || m.top.node_info).server;
if (server.version < 90200)
{
return true;
}
}
return false;
isReadonly: function(m) {
return ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
},
}),
// Below function will enable right click menu for creating check constraint.

View File

@ -360,7 +360,7 @@ define('pgadmin.node.exclusion_constraint', [
allowClear: false, width: 'style',
placeholder: 'Select column',
}, first_empty: !self.model.isNew(),
disabled: function() {
readonly: function() {
return !_.isUndefined(self.model.get('oid'));
},
}],
@ -737,7 +737,7 @@ define('pgadmin.node.exclusion_constraint', [
},
}),
select2:{allowClear:true},
disabled: function(m) {
readonly: function(m) {
return ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
@ -748,7 +748,7 @@ define('pgadmin.node.exclusion_constraint', [
},{
id: 'condeferrable', label: gettext('Deferrable?'),
type: 'switch', group: gettext('Definition'), deps: ['index'],
disabled: function(m) {
readonly: function(m) {
return ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
@ -758,12 +758,6 @@ define('pgadmin.node.exclusion_constraint', [
type: 'switch', group: gettext('Definition'),
deps: ['condeferrable'],
disabled: function(m) {
if((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew())) {
return true;
}
// Disable if condeferred is false or unselected.
if(m.get('condeferrable') == true) {
return false;
@ -775,10 +769,17 @@ define('pgadmin.node.exclusion_constraint', [
return true;
}
},
readonly: function(m) {
if((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew())) {
return true;
}
},
},{
id: 'indconstraint', label: gettext('Constraint'), cell: 'string',
type: 'multiline', mode: ['create', 'edit', 'properties'], editable: false,
group: gettext('Definition'), disabled: function(m) {
group: gettext('Definition'), readonly: function(m) {
return ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
@ -795,7 +796,7 @@ define('pgadmin.node.exclusion_constraint', [
},
control: ExclusionConstraintColumnControl,
model: ExclusionConstraintColumnModel,
disabled: function(m) {
readonly: function(m) {
return ((_.has(m, 'handler') &&
!_.isUndefined(m.handler) &&
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
@ -979,18 +980,6 @@ define('pgadmin.node.exclusion_constraint', [
}),
deps: ['index'], node: 'column',
disabled: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
// If OID is undefined then user is trying to add
// new constraint which should be allowed for Unique
return !_.isUndefined(m.get('oid'));
}
// We can't update columns of existing index constraint.
if (!m.isNew()) {
return true;
}
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
@ -1001,6 +990,18 @@ define('pgadmin.node.exclusion_constraint', [
return true;
}
},
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
// If OID is undefined then user is trying to add
// new constraint which should be allowed for Unique
return !_.isUndefined(m.get('oid'));
}
// We can't update columns of existing index constraint.
return !m.isNew();
},
}],
validate: function() {
this.errorModel.clear();

View File

@ -153,7 +153,7 @@ define('pgadmin.node.foreign_key', [
first_empty: !_.isUndefined(self.model.get('oid')),
},
version_compatible: self.field.get('version_compatible'),
disabled: function() {
readonly: function() {
return !_.isUndefined(self.model.get('oid'));
},
},{
@ -168,7 +168,7 @@ define('pgadmin.node.foreign_key', [
}),
url: 'all_tables', node: 'table',
version_compatible: self.field.get('version_compatible'),
disabled: function() {
readonly: function() {
return !_.isUndefined(self.model.get('oid'));
},
transform: function(rows) {
@ -260,7 +260,7 @@ define('pgadmin.node.foreign_key', [
},
deps:['references'], node: 'table',
version_compatible: self.field.get('version_compatible'),
disabled: function() {
readonly: function() {
return !_.isUndefined(self.model.get('oid'));
},
}],
@ -733,14 +733,13 @@ define('pgadmin.node.foreign_key', [
},{
id: 'condeferrable', label: gettext('Deferrable?'),
type: 'switch', group: gettext('Definition'),
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
}
// We can't update condeferrable of existing foreign key.
return !m.isNew();
},
},{
@ -748,14 +747,6 @@ define('pgadmin.node.foreign_key', [
type: 'switch', group: gettext('Definition'),
deps: ['condeferrable'],
disabled: function(m) {
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
} else if(!m.isNew()) {
return true;
}
// Disable if condeferred is false or unselected.
if(m.get('condeferrable') == true) {
return false;
@ -767,6 +758,15 @@ define('pgadmin.node.foreign_key', [
return true;
}
},
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
}
return !m.isNew();
},
},{
id: 'confmatchtype', label: gettext('Match type'),
type: 'switch', group: gettext('Definition'),
@ -774,7 +774,7 @@ define('pgadmin.node.foreign_key', [
onText: 'FULL',
offText: 'SIMPLE',
width: '80',
},disabled: function(m) {
},readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
@ -790,7 +790,7 @@ define('pgadmin.node.foreign_key', [
options: {
onText: gettext('Yes'),
offText: gettext('No'),
},disabled: function(m) {
},readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
@ -877,23 +877,23 @@ define('pgadmin.node.foreign_key', [
}
};
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
if (_.isUndefined(m.get('oid')) && _.isUndefined(m.handler.get('oid'))) {
return true;
} else {
return setIndexName();
}
} else if (!m.isNew() && m.get('autoindex') && !_.isUndefined(index)
if (!m.isNew() && m.get('autoindex') && !_.isUndefined(index)
&& _.isNull(index) && index == '') {
return true;
}
return setIndexName();
},
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
// new constraint which should allowed for Unique
return !_.isUndefined(m.get('oid'));
}
// We can't update columns of existing foreign key.
return !m.isNew();
},
},{
id: 'columns', label: gettext('Columns'),
type: 'collection', group: gettext('Columns'),
@ -988,7 +988,7 @@ define('pgadmin.node.foreign_key', [
}, canDelete: true,
control: ForeignKeyColumnControl,
model: ForeignKeyColumnModel,
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
@ -1008,7 +1008,7 @@ define('pgadmin.node.foreign_key', [
{label: 'CASCADE', value: 'c'},
{label: 'SET NULL', value: 'n'},
{label: 'SET DEFAULT', value: 'd'},
],disabled: function(m) {
],readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add
@ -1028,7 +1028,7 @@ define('pgadmin.node.foreign_key', [
{label: 'CASCADE', value: 'c'},
{label: 'SET NULL', value: 'n'},
{label: 'SET DEFAULT', value: 'd'},
],disabled: function(m) {
],readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'handler') && !_.isUndefined(m.handler)) {
// If OID is undefined then user is trying to add

View File

@ -388,7 +388,7 @@ define('pgadmin.node.primary_key', [
return res;
},
select2:{allowClear:false},
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -401,6 +401,8 @@ define('pgadmin.node.primary_key', [
if (!m.isNew()) {
return true;
}
},
disabled: function(m) {
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
@ -485,7 +487,7 @@ define('pgadmin.node.primary_key', [
},
}),
deps: ['index'], node: 'column',
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -498,6 +500,8 @@ define('pgadmin.node.primary_key', [
if (!m.isNew()) {
return true;
}
},
disabled: function(m) {
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
@ -542,7 +546,7 @@ define('pgadmin.node.primary_key', [
},
}),
select2:{allowClear:true}, node: 'index',
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then disable it
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -574,7 +578,7 @@ define('pgadmin.node.primary_key', [
},{
id: 'condeferrable', label: gettext('Deferrable?'),
type: 'switch', group: gettext('Definition'), deps: ['index'],
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -587,6 +591,8 @@ define('pgadmin.node.primary_key', [
if (!m.isNew()) {
return true;
}
},
disabled: function(m) {
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
@ -603,7 +609,7 @@ define('pgadmin.node.primary_key', [
id: 'condeferred', label: gettext('Deferred?'),
type: 'switch', group: gettext('Definition'),
deps: ['condeferrable'],
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -616,6 +622,8 @@ define('pgadmin.node.primary_key', [
if (!m.isNew()) {
return true;
}
},
disabled: function(m) {
// Disable if condeferred is false or unselected.
if(m.get('condeferrable') == true) {
return false;

View File

@ -374,7 +374,7 @@ define('pgadmin.node.unique_constraint', [
return res;
},
select2:{allowClear:false},
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -387,6 +387,8 @@ define('pgadmin.node.unique_constraint', [
if (!m.isNew()) {
return true;
}
},
disabled: function(m) {
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
@ -471,7 +473,7 @@ define('pgadmin.node.unique_constraint', [
},
}),
deps: ['index'], node: 'column',
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -484,6 +486,8 @@ define('pgadmin.node.unique_constraint', [
if (!m.isNew()) {
return true;
}
},
disabled: function(m) {
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
@ -531,7 +535,7 @@ define('pgadmin.node.unique_constraint', [
},
}),
select2:{allowClear:true}, node: 'index',
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then disable it
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -563,7 +567,7 @@ define('pgadmin.node.unique_constraint', [
},{
id: 'condeferrable', label: gettext('Deferrable?'),
type: 'switch', group: gettext('Definition'), deps: ['index'],
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -576,6 +580,8 @@ define('pgadmin.node.unique_constraint', [
if (!m.isNew()) {
return true;
}
},
disabled: function(m) {
// Disable if index is selected.
var index = m.get('index');
if(_.isUndefined(index) || index == '') {
@ -592,7 +598,7 @@ define('pgadmin.node.unique_constraint', [
id: 'condeferred', label: gettext('Deferred?'),
type: 'switch', group: gettext('Definition'),
deps: ['condeferrable'],
disabled: function(m) {
readonly: function(m) {
// If we are in table edit mode then
if (_.has(m, 'top') && !_.isUndefined(m.top)
&& !m.top.isNew()) {
@ -605,6 +611,8 @@ define('pgadmin.node.unique_constraint', [
if (!m.isNew()) {
return true;
}
},
disabled: function(m) {
// Disable if condeferred is false or unselected.
if(m.get('condeferrable') == true) {
return false;

View File

@ -73,7 +73,7 @@ define('pgadmin.node.index', [
schema: [
{
id: 'colname', label: gettext('Column'), cell: 'node-list-by-name',
type: 'text', disabled: 'inSchemaWithModelCheck', editable: function(m) {
type: 'text', disabled: 'inSchema', readonly: 'isEditMode', editable: function(m) {
// Header cell then skip
if (m instanceof Backbone.Collection) {
return false;
@ -84,7 +84,7 @@ define('pgadmin.node.index', [
},{
id: 'collspcname', label: gettext('Collation'),
cell: NodeAjaxOptionsDepsCell,
type: 'text', disabled: 'inSchemaWithModelCheck', editable: function(m) {
type: 'text', disabled: 'inSchema', readonly: 'isEditMode', editable: function(m) {
// Header cell then skip
if (m instanceof Backbone.Collection) {
return false;
@ -187,6 +187,9 @@ define('pgadmin.node.index', [
}
return false;
},
isEditMode: function(m) {
return !m.top.isNew();
},
// We will check if we are under schema node & in 'create' mode
inSchemaWithModelCheck: function(m) {
if(m.top.node_info && 'schema' in m.top.node_info) {
@ -293,7 +296,7 @@ define('pgadmin.node.index', [
type: 'text', disabled: 'inSchema',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'int', disabled: true, mode: ['edit', 'properties'],
type: 'int', readonly: true, mode: ['properties'],
},{
id: 'spcname', label: gettext('Tablespace'), cell: 'string',
control: 'node-list-by-name', node: 'tablespace',
@ -310,7 +313,7 @@ define('pgadmin.node.index', [
},{
id: 'amname', label: gettext('Access Method'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck', url: 'get_access_methods',
disabled: 'inSchema', readonly: 'isEditMode', url: 'get_access_methods',
url_jump_after_node: 'schema',
group: gettext('Definition'), select2: {'allowClear': true},
control: Backform.NodeAjaxOptionsControl.extend({
@ -349,7 +352,7 @@ define('pgadmin.node.index', [
type: 'array', group: gettext('Definition'),
editable: false,
canDelete: true, canAdd: true, mode: ['properties'],
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'isEditMode',
visible: function(m) {
if(!_.isUndefined(m.node_info) && !_.isUndefined(m.node_info.server)
&& !_.isUndefined(m.node_info.server.version) &&
@ -388,7 +391,7 @@ define('pgadmin.node.index', [
min: 10, max:100, group: gettext('Definition'),
},{
id: 'indisunique', label: gettext('Unique?'), cell: 'string',
type: 'switch', disabled: 'inSchemaWithModelCheck',
type: 'switch', disabled: 'inSchema', readonly: 'isEditMode',
group: gettext('Definition'),
},{
id: 'indisclustered', label: gettext('Clustered?'), cell: 'string',
@ -396,22 +399,22 @@ define('pgadmin.node.index', [
group: gettext('Definition'),
},{
id: 'indisvalid', label: gettext('Valid?'), cell: 'string',
type: 'switch', disabled: true, mode: ['properties'],
type: 'switch', mode: ['properties'],
group: gettext('Definition'),
},{
id: 'indisprimary', label: gettext('Primary?'), cell: 'string',
type: 'switch', disabled: true, mode: ['properties'],
type: 'switch', mode: ['properties'],
group: gettext('Definition'),
},{
id: 'is_sys_idx', label: gettext('System index?'), cell: 'string',
type: 'switch', disabled: true, mode: ['properties'],
type: 'switch', mode: ['properties'],
},{
id: 'isconcurrent', label: gettext('Concurrent build?'), cell: 'string',
type: 'switch', disabled: 'inSchemaWithModelCheck',
type: 'switch', disabled: 'inSchema', readonly: 'isEditMode',
mode: ['create', 'edit'], group: gettext('Definition'),
},{
id: 'indconstraint', label: gettext('Constraint'), cell: 'string',
type: 'text', disabled: 'inSchemaWithModelCheck', mode: ['create', 'edit'],
type: 'text', disabled: 'inSchema', readonly: 'isEditMode', mode: ['create', 'edit'],
control: 'sql-field', visible: true, group: gettext('Definition'),
},{
id: 'columns', label: gettext('Columns'), type: 'collection', deps: ['amname'],
@ -440,7 +443,7 @@ define('pgadmin.node.index', [
type: 'array', group: gettext('Definition'),
editable: false,
canDelete: true, canAdd: true, mode: ['edit', 'create'],
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'isEditMode',
visible: function(m) {
if(!_.isUndefined(m.node_info) && !_.isUndefined(m.node_info.server)
&& !_.isUndefined(m.node_info.server.version) &&
@ -524,6 +527,9 @@ define('pgadmin.node.index', [
}
return false;
},
isEditMode: function(m) {
return !m.isNew();
},
// We will check if we are under schema node & in 'create' mode
inSchemaWithModelCheck: function(m) {
if(this.node_info && 'schema' in this.node_info) {

View File

@ -401,7 +401,7 @@ function(
return false;
},
disabled: function(m) {
readonly: function(m) {
if (!m.isNew())
return true;
return false;
@ -799,10 +799,11 @@ function(
return false;
},
readonly: function(m) {
return !m.isNew();
},
disabled: function(m) {
if (!m.isNew() || !m.get('is_partitioned'))
return true;
return false;
return !m.get('is_partitioned');
},
},{
id: 'partition_keys', label:gettext('Partition Keys'),

View File

@ -144,7 +144,7 @@ define('pgadmin.node.rule', [
},
{
id: 'oid', label: gettext('OID'),
type: 'text', disabled: true, mode: ['properties'],
type: 'text', mode: ['properties'],
},
{
id: 'schema', label:'',

View File

@ -349,13 +349,7 @@ define('pgadmin.node.table', [
return (!(d && d.label.match(/pg_global/)));
},
deps: ['is_partitioned'],
disabled: function() {
if(this.node_info && 'catalog' in this.node_info) {
return true;
}
return false;
},
disabled: 'inSchema',
},{
id: 'partition', type: 'group', label: gettext('Partitions'),
mode: ['edit', 'create'], min_version: 100000,
@ -376,7 +370,7 @@ define('pgadmin.node.table', [
return false;
},
disabled: function(m) {
readonly: function(m) {
if (!m.isNew())
return true;
return false;
@ -898,10 +892,11 @@ define('pgadmin.node.table', [
return false;
},
disabled: function(m) {
if (!m.isNew() || !m.get('is_partitioned'))
if (!m.get('is_partitioned'))
return true;
return false;
},
readonly: function(m) {return !m.isNew();},
},{
id: 'partition_keys', label:gettext('Partition Keys'),
model: Backform.PartitionKeyModel,

View File

@ -185,7 +185,7 @@ define('pgadmin.node.trigger', [
type: 'text', disabled: 'inSchema',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'int', disabled: true, mode: ['properties'],
type: 'int', mode: ['properties'],
},{
id: 'is_enable_trigger', label: gettext('Trigger enabled?'),
mode: ['edit', 'properties'], group: gettext('Definition'),

View File

@ -326,7 +326,7 @@ define('pgadmin.node.type', [
disabled: 'schemaCheck',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text' , mode: ['properties'], disabled: true,
type: 'text' , mode: ['properties'],
},{
id: 'typeowner', label: gettext('Owner'), cell: 'string',
control: 'node-list-by-name',
@ -346,7 +346,7 @@ define('pgadmin.node.type', [
control: 'node-list-by-name', select2: {allowClear: false},
},{
id: 'typtype', label: gettext('Type'),
mode: ['create','edit'], disabled: 'inSchemaWithModelCheck',
mode: ['create','edit'], disabled: 'inSchema', readonly: 'inEditMode',
group: gettext('Definition'),
select2: { allowClear: false },
options: function() {
@ -408,7 +408,8 @@ define('pgadmin.node.type', [
control: 'node-ajax-options',
select2: { allowClear: true, placeholder: '', width: '100%' },
url: 'get_stypes', type: 'text', mode: ['properties', 'create', 'edit'],
group: gettext('Range Type'), disabled: 'inSchemaWithModelCheck',
group: gettext('Range Type'), disabled: 'inSchema',
readonly: 'inEditMode',
transform: function(d, self){
self.model.subtypes = d;
return d;
@ -416,7 +417,7 @@ define('pgadmin.node.type', [
},{
id: 'opcname', label: gettext('Subtype operator class'), cell: 'string',
mode: ['properties', 'create', 'edit'], group: gettext('Range Type'),
disabled: 'inSchemaWithModelCheck', deps: ['typname'],
disabled: 'inSchema', readonly: 'inEditMode', deps: ['typname'],
control: 'select', options: function() {
var l_typname = this.model.get('typname'),
self = this,
@ -483,7 +484,7 @@ define('pgadmin.node.type', [
id: 'rngcanonical', label: gettext('Canonical function'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
group: gettext('Range Type'),
disabled: 'inSchemaWithModelCheck', deps: ['name', 'typname'],
disabled: 'inSchema', readonly: 'inEditMode', deps: ['name', 'typname'],
control: 'select', options: function() {
var name = this.model.get('name'),
self = this,
@ -517,7 +518,7 @@ define('pgadmin.node.type', [
id: 'rngsubdiff', label: gettext('Subtype diff function'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
group: gettext('Range Type'),
disabled: 'inSchemaWithModelCheck', deps: ['opcname'],
disabled: 'inSchema', readonly: 'inEditMode', deps: ['opcname'],
control: 'select', options: function() {
var l_typname = this.model.get('typname'),
l_opcname = this.model.get('opcname'),
@ -563,7 +564,7 @@ define('pgadmin.node.type', [
id: 'typinput', label: gettext('Input function'),
cell: 'string',type: 'text',
mode: ['properties', 'create', 'edit'], group: gettext('Required'),
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'inEditMode',
control: 'node-ajax-options', url: 'get_external_functions',
transform: 'external_func_combo',
select2: { allowClear: true, placeholder: '', width: '100%' },
@ -572,8 +573,8 @@ define('pgadmin.node.type', [
cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
group: gettext('Required'),
disabled: 'inSchemaWithModelCheck'
,control: 'node-ajax-options', url: 'get_external_functions',
disabled: 'inSchema', readonly: 'inEditMode',
control: 'node-ajax-options', url: 'get_external_functions',
transform: 'external_func_combo',
select2: { allowClear: true, placeholder: '', width: '100%' },
},{
@ -582,23 +583,23 @@ define('pgadmin.node.type', [
id: 'typreceive', label: gettext('Receive function'),
cell: 'string', type: 'text', group: gettext('Optional-1'),
mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck'
,control: 'node-ajax-options', url: 'get_external_functions',
disabled: 'inSchema', readonly: 'inEditMode',
control: 'node-ajax-options', url: 'get_external_functions',
transform: 'external_func_combo',
select2: { allowClear: true, placeholder: '', width: '100%' },
},{
id: 'typsend', label: gettext('Send function'),
cell: 'string', group: gettext('Optional-1'),
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck'
,control: 'node-ajax-options', url: 'get_external_functions',
disabled: 'inSchema', readonly: 'inEditMode',
control: 'node-ajax-options', url: 'get_external_functions',
transform: 'external_func_combo',
select2: { allowClear: true, placeholder: '', width: '100%' },
},{
id: 'typmodin', label: gettext('Typmod in function'),
cell: 'string', type: 'text',
mode: ['properties', 'create', 'edit'], group: gettext('Optional-1'),
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'inEditMode',
control: 'node-ajax-options', url: 'get_external_functions',
select2: { allowClear: true, placeholder: '', width: '100%' },
transform: function(d) {
@ -615,7 +616,7 @@ define('pgadmin.node.type', [
id: 'typmodout', label: gettext('Typmod out function'),
cell: 'string', group: gettext('Optional-1'),
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'inEditMode',
control: 'node-ajax-options', url: 'get_external_functions',
select2: { allowClear: true, placeholder: '', width: '100%' },
transform: function(d) {
@ -632,30 +633,30 @@ define('pgadmin.node.type', [
id: 'typlen', label: gettext('Internal length'),
cell: 'integer', group: gettext('Optional-1'),
type: 'int', mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'inEditMode',
},{
id: 'variable', label: gettext('Variable?'), cell: 'switch',
group: gettext('Optional-1'), type: 'switch',
mode: ['create','edit'],
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'inEditMode',
},{
id: 'typdefault', label: gettext('Default?'),
cell: 'string', group: gettext('Optional-1'),
type: 'text', mode: ['properties', 'create','edit'],
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'inEditMode',
},{
id: 'typanalyze', label: gettext('Analyze function'),
cell: 'string', group: gettext('Optional-1'),
type: 'text', mode: ['properties', 'create','edit'],
disabled: 'inSchemaWithModelCheck'
,control: 'node-ajax-options', url: 'get_external_functions',
disabled: 'inSchema', readonly: 'inEditMode',
control: 'node-ajax-options', url: 'get_external_functions',
transform: 'external_func_combo',
select2: { allowClear: true, placeholder: '', width: '100%' },
},{
id: 'typcategory', label: gettext('Category type'),
cell: 'string', group: gettext('Optional-1'),
type: 'text', mode: ['properties', 'create','edit'],
disabled: 'inSchemaWithModelCheck', control: 'select2',
disabled: 'inSchema', readonly: 'inEditMode', control: 'select2',
select2: { allowClear: true, placeholder: '', width: '100%' },
options: [
{label :'', value : ''},
@ -677,7 +678,7 @@ define('pgadmin.node.type', [
},{
id: 'typispreferred', label: gettext('Preferred?'), cell: 'switch',
type: 'switch', mode: ['properties', 'create','edit'],
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'inEditMode',
group: gettext('Optional-1'),
},{
id: 'spacer_ctrl_optional_2', group: gettext('Optional-2'), mode: ['edit', 'create'], type: 'spacer',
@ -685,16 +686,17 @@ define('pgadmin.node.type', [
id: 'element', label: gettext('Element type'), cell: 'string',
control: 'node-ajax-options', group: gettext('Optional-2'),
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck', url: 'get_types',
disabled: 'inSchema', readonly: 'inEditMode', url: 'get_types',
},{
id: 'typdelim', label: gettext('Delimiter'), cell: 'string',
type: 'text', mode: ['properties', 'create', 'edit'],
group: gettext('Optional-2'), disabled: 'inSchemaWithModelCheck',
group: gettext('Optional-2'), disabled: 'inSchema',
readonly: 'inEditMode',
},{
id: 'typalign', label: gettext('Alignment type'),
cell: 'string', group: gettext('Optional-2'),
type: 'text', mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck', control: 'select2',
disabled: 'inSchema', readonly: 'inEditMode', control: 'select2',
select2: { allowClear: true, placeholder: '', width: '100%' },
options: [
{label :'', value : ''},
@ -707,7 +709,7 @@ define('pgadmin.node.type', [
id: 'typstorage', label: gettext('Storage type'),
type: 'text', mode: ['properties', 'create', 'edit'],
group: gettext('Optional-2'), cell: 'string',
disabled: 'inSchemaWithModelCheck', control: 'select2',
disabled: 'inSchema', readonly: 'inEditMode', control: 'select2',
select2: { allowClear: true, placeholder: '', width: '100%' },
options: [
{label :'', value : ''},
@ -720,12 +722,12 @@ define('pgadmin.node.type', [
id: 'typbyval', label: gettext('Passed by value?'),
cell: 'switch',
type: 'switch', mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck', group: gettext('Optional-2'),
disabled: 'inSchema', readonly: 'inEditMode', group: gettext('Optional-2'),
},{
id: 'is_collatable', label: gettext('Collatable?'),
cell: 'switch', min_version: 90100, group: gettext('Optional-2'),
type: 'switch', mode: ['properties', 'create', 'edit'],
disabled: 'inSchemaWithModelCheck',
disabled: 'inSchema', readonly: 'inEditMode',
// End of extension tab
}],
},{
@ -878,6 +880,9 @@ define('pgadmin.node.type', [
}
return false;
},
inEditMode: function(m) {
return !m.isNew();
},
schemaCheck: function(m) {
if(this.node_info && 'schema' in this.node_info)
{
@ -889,34 +894,6 @@ define('pgadmin.node.type', [
}
return true;
},
// We will check if we are under schema node & in 'create' mode
inSchemaWithModelCheck: function(m) {
if(this.node_info && 'schema' in this.node_info)
{
// We will disbale control if it's in 'edit' mode
if (m.isNew()) {
return false;
} else {
return true;
}
}
return true;
},
// We want to enable only in edit mode
inSchemaWithEditMode: function(m) {
if(this.node_info && 'schema' in this.node_info)
{
// We will disbale control if it's in 'edit' mode
if (m.isNew()) {
return true;
} else {
return false;
}
}
return true;
},
// Function will help us to fill combobox
external_func_combo: function(d) {
var result = [];

View File

@ -149,7 +149,7 @@ define('pgadmin.node.mview', [
type: 'text', disabled: 'inSchema',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text', disabled: true, mode: ['properties'],
type: 'text', mode: ['properties'],
},{
id: 'owner', label: gettext('Owner'), cell: 'string',
control: 'node-list-by-name', select2: { allowClear: false },
@ -161,7 +161,7 @@ define('pgadmin.node.mview', [
disabled: 'inSchema', select2: { allowClear: false },
},{
id: 'system_view', label: gettext('System view?'), cell: 'string',
type: 'switch', disabled: true, mode: ['properties'],
type: 'switch', mode: ['properties'],
}, pgBrowser.SecurityGroupSchema, {
id: 'acl', label: gettext('Privileges'),
mode: ['properties'], type: 'text', group: gettext('Security'),

View File

@ -113,7 +113,7 @@ define('pgadmin.node.view', [
type: 'text', disabled: 'notInSchema',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text', disabled: true, mode: ['properties'],
type: 'text', mode: ['properties'],
},{
id: 'owner', label: gettext('Owner'), cell: 'string', control: 'node-list-by-name',
node: 'role', disabled: 'notInSchema', select2: { allowClear: false },
@ -124,7 +124,7 @@ define('pgadmin.node.view', [
select2: { allowClear: false }, cache_node: 'database',
},{
id: 'system_view', label: gettext('System view?'), cell: 'string',
type: 'switch', disabled: true, mode: ['properties'],
type: 'switch', mode: ['properties'],
},{
id: 'acl', label: gettext('Privileges'),
mode: ['properties'], type: 'text', group: gettext('Security'),

View File

@ -317,31 +317,31 @@ define('pgadmin.node.database', [
control: Backform.NodeListByNameControl, select2: { allowClear: false },
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'tblacl', label: gettext('Default TABLE privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'seqacl', label: gettext('Default SEQUENCE privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'funcacl', label: gettext('Default FUNCTION privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'typeacl', label: gettext('Default TYPE privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true, min_version: 90200,
group: gettext('Security'), mode: ['properties'], min_version: 90200,
},{
id: 'comments', label: gettext('Comment'),
editable: false, type: 'multiline',
},{
id: 'encoding', label: gettext('Encoding'),
editable: false, type: 'text', group: gettext('Definition'),
disabled: function(m) { return !m.isNew(); }, url: 'get_encodings',
readonly: function(m) { return !m.isNew(); }, url: 'get_encodings',
control: 'node-ajax-options', cache_level: 'server',
},{
id: 'template', label: gettext('Template'),
editable: false, type: 'text', group: gettext('Definition'),
disabled: function(m) { return !m.isNew(); },
readonly: function(m) { return !m.isNew(); },
control: 'node-list-by-name', url: 'get_databases', cache_level: 'server',
select2: { allowClear: false }, mode: ['create'],
transform: function(data, cell) {
@ -374,12 +374,12 @@ define('pgadmin.node.database', [
},{
id: 'datcollate', label: gettext('Collation'),
editable: false, type: 'text', group: gettext('Definition'),
disabled: function(m) { return !m.isNew(); }, url: 'get_ctypes',
readonly: function(m) { return !m.isNew(); }, url: 'get_ctypes',
control: 'node-ajax-options', cache_level: 'server',
},{
id: 'datctype', label: gettext('Character type'),
editable: false, type: 'text', group: gettext('Definition'),
disabled: function(m) { return !m.isNew(); }, url: 'get_ctypes',
readonly: function(m) { return !m.isNew(); }, url: 'get_ctypes',
control: 'node-ajax-options', cache_level: 'server',
},{
id: 'datconnlimit', label: gettext('Connection limit'),
@ -387,11 +387,11 @@ define('pgadmin.node.database', [
},{
id: 'is_template', label: gettext('Template?'),
editable: false, type: 'switch', group: gettext('Definition'),
disabled: true, mode: ['properties', 'edit'],
readonly: true, mode: ['properties', 'edit'],
},{
id: 'datallowconn', label: gettext('Allow connections?'),
editable: false, type: 'switch', group: gettext('Definition'),
mode: ['properties'], disabled: true,
mode: ['properties'],
},{
id: 'datacl', label: gettext('Privileges'), type: 'collection',
model: pgBrowser.Node.PrivilegeRoleModel.extend({

View File

@ -85,7 +85,7 @@ define('pgadmin.node.resource_group', [
// Defining schema for the resource group node
schema: [{
id: 'oid', label: gettext('OID'), type: 'text',
editable: false, disabled: true, mode:['properties'],
editable: false, mode:['properties'],
},{
id: 'name', label: gettext('Name'), cell: 'string',
type: 'text',

View File

@ -386,10 +386,10 @@ define('pgadmin.node.role', [
},
schema: [{
id: 'rolname', label: gettext('Name'), type: 'text',
disabled: 'readonly',
readonly: 'readonly',
},{
id: 'oid', label: gettext('OID'), cell: 'string', mode: ['properties'],
editable: false, type: 'text', visible: true, disabled: true,
editable: false, type: 'text', visible: true,
},{
id: 'rolpassword', label: gettext('Password'), type: 'password',
group: gettext('Definition'), mode: ['edit', 'create'],
@ -404,21 +404,21 @@ define('pgadmin.node.role', [
return false;
},
},{
id: 'rolvaliduntil', disabled: 'readonly', type: 'text',
id: 'rolvaliduntil', readonly: 'readonly', type: 'text',
group: gettext('Definition'), label: gettext('Account expires'),
mode: ['properties', 'edit', 'create'], control: 'datetimepicker',
deps: ['rolcanlogin'], options: {format: 'YYYY-MM-DD HH:mm:ss Z'},
},{
id: 'rolconnlimit', type: 'int', group: gettext('Definition'),
label: gettext('Connection limit'), cell: 'integer', min : -1,
mode: ['properties', 'edit', 'create'], disabled: 'readonly',
mode: ['properties', 'edit', 'create'], readonly: 'readonly',
},{
id: 'rolcanlogin', label: gettext('Can login?'),
type: 'switch',
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
group: gettext('Privileges'),
disabled: 'readonly',
readonly: 'readonly',
},{
id: 'rolsuper', label: gettext('Superuser?'),
type: 'switch',
@ -434,33 +434,36 @@ define('pgadmin.node.role', [
this.model.set('rolcreatedb', this.model.get('rolsuper'));
},
}),
disabled: 'readonly',
readonly: 'readonly',
},{
id: 'rolcreaterole', label: gettext('Create roles?'),
group: gettext('Privileges'),
type: 'switch',
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
disabled: 'readonly',
readonly: 'readonly',
},{
id: 'description', label: gettext('Comments'), type: 'multiline',
group: null, mode: ['properties', 'edit', 'create'],
disabled: 'readonly',
readonly: 'readonly',
},{
id: 'rolcreatedb', label: gettext('Create databases?'),
group: gettext('Privileges'),
type: 'switch',
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
disabled: 'readonly',
readonly: 'readonly',
},{
id: 'rolcatupdate', label: gettext('Update catalog?'),
type: 'switch',
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
max_version: 90400,
group: gettext('Privileges'), disabled: function(m) {
return (m.get('read_only') || (!m.get('rolsuper')));
group: gettext('Privileges'), readonly: function(m) {
return m.get('read_only');
},
disabled: function(m) {
return !m.get('rolsuper');
},
},{
id: 'rolinherit', group: gettext('Privileges'),
@ -468,7 +471,7 @@ define('pgadmin.node.role', [
type: 'switch',
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
disabled: 'readonly',
readonly: 'readonly',
},{
id: 'rolreplication', group: gettext('Privileges'),
label: gettext('Can initiate streaming replication and backups?'),
@ -476,11 +479,11 @@ define('pgadmin.node.role', [
controlLabelClassName: 'control-label pg-el-sm-4 pg-el-12',
controlsClassName: 'pgadmin-controls pg-el-sm-8 pg-el-12',
min_version: 90100,
disabled: 'readonly',
readonly: 'readonly',
},{
id: 'rolmembership', label: gettext('Roles'),
group: gettext('Membership'), type: 'collection',
cell: 'string', disabled: 'readonly',
cell: 'string', readonly: 'readonly',
mode: ['properties', 'edit', 'create'],
control: RoleMembersControl, model: pgBrowser.Node.Model.extend({
keys: ['role'],
@ -509,12 +512,12 @@ define('pgadmin.node.role', [
model: pgBrowser.Node.VariableModel.extend({keys:['name', 'database']}),
control: 'variable-collection',
mode: [ 'edit', 'create'], canAdd: true, canDelete: true,
disabled: 'readonly',
readonly: 'readonly',
},{
id: 'seclabels', label: gettext('Security labels'),
model: SecurityModel, editable: false, type: 'collection',
group: gettext('Security'), mode: ['edit', 'create'],
min_version: 90200, disabled: 'readonly', canAdd: true,
min_version: 90200, readonly: 'readonly', canAdd: true,
canEdit: false, canDelete: true, control: 'unique-col-collection',
}],
readonly: function(m) {

View File

@ -169,7 +169,7 @@ define(['sources/gettext', 'underscore', 'jquery', 'backbone', 'backform',
);
},
},{
id: 'grantor', label: gettext('Grantor'), type: 'text', disabled: true,
id: 'grantor', label: gettext('Grantor'), type: 'text', readonly: true,
cell: 'node-list-by-name', node: 'role',
}],

View File

@ -406,7 +406,7 @@ define('pgadmin.node.server', [
}),
passwordChangeFields = [{
name: 'user_name', label: gettext('User'),
type: 'text', disabled: true, control: 'input',
type: 'text', readonly: true, control: 'input',
},{
name: 'password', label: gettext('Current Password'),
type: 'password', disabled: function() { return is_pgpass_file_used; },
@ -785,16 +785,16 @@ define('pgadmin.node.server', [
mode: ['properties', 'edit', 'create'],
},{
id: 'host', label: gettext('Host name/address'), type: 'text', group: gettext('Connection'),
mode: ['properties', 'edit', 'create'], disabled: 'isConnected',
mode: ['properties', 'edit', 'create'], readonly: 'isConnected',
},{
id: 'port', label: gettext('Port'), type: 'int', group: gettext('Connection'),
mode: ['properties', 'edit', 'create'], disabled: 'isConnected', min: 1, max: 65535,
mode: ['properties', 'edit', 'create'], readonly: 'isConnected', min: 1, max: 65535,
},{
id: 'db', label: gettext('Maintenance database'), type: 'text', group: gettext('Connection'),
mode: ['properties', 'edit', 'create'], disabled: 'isConnected',
mode: ['properties', 'edit', 'create'], readonly: 'isConnected',
},{
id: 'username', label: gettext('Username'), type: 'text', group: gettext('Connection'),
mode: ['properties', 'edit', 'create'], disabled: 'isConnected',
mode: ['properties', 'edit', 'create'], readonly: 'isConnected',
},{
id: 'password', label: gettext('Password'), type: 'password',
group: gettext('Connection'), control: 'input', mode: ['create'], deps: ['connect_now'],
@ -815,7 +815,11 @@ define('pgadmin.node.server', [
},
},{
id: 'role', label: gettext('Role'), type: 'text', group: gettext('Connection'),
mode: ['properties', 'edit', 'create'], disabled: 'isConnected',
mode: ['properties', 'edit', 'create'], readonly: 'isConnected',
},{
id: 'service', label: gettext('Service'), type: 'text',
mode: ['properties', 'edit', 'create'], readonly: 'isConnected',
group: gettext('Connection'),
},{
id: 'sslmode', label: gettext('SSL mode'), type: 'options', group: gettext('SSL'),
mode: ['properties', 'edit', 'create'], disabled: 'isConnected',
@ -830,32 +834,32 @@ define('pgadmin.node.server', [
},{
id: 'sslcert', label: gettext('Client certificate'), type: 'text',
group: gettext('SSL'), mode: ['edit', 'create'],
disabled: 'isSSL', control: Backform.FileControl,
disabled: 'isSSL', readonly: 'isConnected', control: Backform.FileControl,
dialog_type: 'select_file', supp_types: ['*'],
deps: ['sslmode'],
},{
id: 'sslkey', label: gettext('Client certificate key'), type: 'text',
group: gettext('SSL'), mode: ['edit', 'create'],
disabled: 'isSSL', control: Backform.FileControl,
disabled: 'isSSL', readonly: 'isConnected', control: Backform.FileControl,
dialog_type: 'select_file', supp_types: ['*'],
deps: ['sslmode'],
},{
id: 'sslrootcert', label: gettext('Root certificate'), type: 'text',
group: gettext('SSL'), mode: ['edit', 'create'],
disabled: 'isSSL', control: Backform.FileControl,
disabled: 'isSSL', readonly: 'isConnected', control: Backform.FileControl,
dialog_type: 'select_file', supp_types: ['*'],
deps: ['sslmode'],
},{
id: 'sslcrl', label: gettext('Certificate revocation list'), type: 'text',
group: gettext('SSL'), mode: ['edit', 'create'],
disabled: 'isSSL', control: Backform.FileControl,
disabled: 'isSSL', readonly: 'isConnected', control: Backform.FileControl,
dialog_type: 'select_file', supp_types: ['*'],
deps: ['sslmode'],
},{
id: 'sslcompression', label: gettext('SSL compression?'), type: 'switch',
mode: ['edit', 'create'], group: gettext('SSL'),
'options': {'size': 'mini'},
deps: ['sslmode'], disabled: 'isSSL',
deps: ['sslmode'], disabled: 'isSSL', readonly: 'isConnected',
},{
id: 'sslcert', label: gettext('Client certificate'), type: 'text',
group: gettext('SSL'), mode: ['properties'],
@ -909,26 +913,30 @@ define('pgadmin.node.server', [
return true;
}
return model.get('connected');
return false;
},
readonly: 'isConnected',
},{
id: 'tunnel_host', label: gettext('Tunnel host'), type: 'text', group: gettext('SSH Tunnel'),
mode: ['properties', 'edit', 'create'], deps: ['use_ssh_tunnel'],
disabled: function(model) {
return !model.get('use_ssh_tunnel') || model.get('connected');
return !model.get('use_ssh_tunnel');
},
readonly: 'isConnected',
},{
id: 'tunnel_port', label: gettext('Tunnel port'), type: 'int', group: gettext('SSH Tunnel'),
mode: ['properties', 'edit', 'create'], deps: ['use_ssh_tunnel'], max: 65535,
disabled: function(model) {
return !model.get('use_ssh_tunnel') || model.get('connected');
return !model.get('use_ssh_tunnel');
},
readonly: 'isConnected',
},{
id: 'tunnel_username', label: gettext('Username'), type: 'text', group: gettext('SSH Tunnel'),
mode: ['properties', 'edit', 'create'], deps: ['use_ssh_tunnel'],
disabled: function(model) {
return !model.get('use_ssh_tunnel') || model.get('connected');
return !model.get('use_ssh_tunnel');
},
readonly: 'isConnected',
},{
id: 'tunnel_authentication', label: gettext('Authentication'), type: 'switch',
mode: ['properties', 'edit', 'create'], group: gettext('SSH Tunnel'),
@ -936,11 +944,12 @@ define('pgadmin.node.server', [
'offText': gettext('Password'), 'size': 'mini', width: '90'},
deps: ['use_ssh_tunnel'],
disabled: function(model) {
return !model.get('use_ssh_tunnel') || model.get('connected');
return !model.get('use_ssh_tunnel');
},
readonly: 'isConnected',
}, {
id: 'tunnel_identity_file', label: gettext('Identity file'), type: 'text',
group: gettext('SSH Tunnel'), mode: ['edit', 'create'],
group: gettext('SSH Tunnel'), mode: ['properties', 'edit', 'create'],
control: Backform.FileControl, dialog_type: 'select_file', supp_types: ['*'],
deps: ['tunnel_authentication', 'use_ssh_tunnel'],
disabled: function(model) {
@ -952,16 +961,14 @@ define('pgadmin.node.server', [
}
return !model.get('tunnel_authentication') || !model.get('use_ssh_tunnel');
},
},{
id: 'tunnel_identity_file', label: gettext('Identity file'), type: 'text',
group: gettext('SSH Tunnel'), mode: ['properties'],
},{
id: 'tunnel_password', label: gettext('Password'), type: 'password',
group: gettext('SSH Tunnel'), control: 'input', mode: ['create'],
deps: ['use_ssh_tunnel'],
disabled: function(model) {
return !model.get('use_ssh_tunnel') || model.get('connected');
return !model.get('use_ssh_tunnel');
},
readonly: 'isConnected',
}, {
id: 'save_tunnel_password', controlLabel: gettext('Save password?'),
type: 'checkbox', group: gettext('SSH Tunnel'), mode: ['create'],
@ -977,15 +984,15 @@ define('pgadmin.node.server', [
},
}, {
id: 'hostaddr', label: gettext('Host address'), type: 'text', group: gettext('Advanced'),
mode: ['properties', 'edit', 'create'], disabled: 'isConnected',
mode: ['properties', 'edit', 'create'], readonly: 'isConnected',
},{
id: 'db_res', label: gettext('DB restriction'), type: 'select2', group: gettext('Advanced'),
mode: ['properties', 'edit', 'create'], disabled: 'isConnected', select2: {multiple: true, allowClear: false,
mode: ['properties', 'edit', 'create'], readonly: 'isConnected', select2: {multiple: true, allowClear: false,
tags: true, tokenSeparators: [','], first_empty: false, selectOnClose: true, emptyOptions: true},
},{
id: 'passfile', label: gettext('Password file'), type: 'text',
group: gettext('Advanced'), mode: ['edit', 'create'],
disabled: 'isConnectedWithValidLib', control: Backform.FileControl,
disabled: 'isValidLib', readonly: 'isConnected', control: Backform.FileControl,
dialog_type: 'select_file', supp_types: ['*'],
},{
id: 'passfile', label: gettext('Password file'), type: 'text',
@ -994,14 +1001,10 @@ define('pgadmin.node.server', [
var passfile = model.get('passfile');
return !_.isUndefined(passfile) && !_.isNull(passfile);
},
},{
id: 'service', label: gettext('Service'), type: 'text',
mode: ['properties', 'edit', 'create'], disabled: 'isConnected',
group: gettext('Connection'),
},{
id: 'connect_timeout', label: gettext('Connection timeout (seconds)'),
type: 'int', group: gettext('Advanced'),
mode: ['properties', 'edit', 'create'], disabled: 'isConnected',
mode: ['properties', 'edit', 'create'], readonly: 'isConnected',
min: 0,
}],
validate: function() {
@ -1030,16 +1033,9 @@ define('pgadmin.node.server', [
},
isSSL: function(model) {
var ssl_mode = model.get('sslmode');
// If server is not connected and have required SSL option
if(model.get('connected')) {
return true;
}
return _.indexOf(SSL_MODES, ssl_mode) == -1;
},
isConnectedWithValidLib: function(model) {
if(model.get('connected')) {
return true;
}
isValidLib: function() {
// older version of libpq do not support 'passfile' parameter in
// connect method, valid libpq must have version >= 100000
return pgBrowser.utils.pg_libpq_version < 100000;

View File

@ -342,11 +342,11 @@ define('pgadmin.node.tablespace', [
type: 'text',
},{
id: 'oid', label: gettext('OID'), cell: 'string',
type: 'text', disabled: true, mode: ['properties'],
type: 'text', mode: ['properties'],
},{
id: 'spclocation', label: gettext('Location'), cell: 'string',
group: gettext('Definition'), type: 'text', mode: ['properties', 'edit','create'],
disabled: function(m) {
readonly: function(m) {
// To disabled it in edit mode,
// We'll check if model is new if yes then disabled it
return !m.isNew();
@ -357,7 +357,7 @@ define('pgadmin.node.tablespace', [
select2: {allowClear: false},
},{
id: 'acl', label: gettext('Privileges'), type: 'text',
group: gettext('Security'), mode: ['properties'], disabled: true,
group: gettext('Security'), mode: ['properties'],
},{
id: 'description', label: gettext('Comment'), cell: 'string',
type: 'multiline',

View File

@ -1049,7 +1049,7 @@ define('pgadmin.browser.node', [
tree = pgAdmin.Browser.tree,
j = panel.$container.find('.obj_properties').first(),
view = j.data('obj-view'),
content = $('<div tabindex="1"></div>')
content = $('<div></div>')
.addClass('pg-prop-content col-12'),
confirm_close = true;

View File

@ -30,7 +30,7 @@ var cmds = CodeMirror.commands;
cmds.focusOut = function(){
event.stopPropagation();
document.activeElement.blur();
if(event.currentTarget.parents().find('.sql-code-control')) {
if(event.currentTarget.hasOwnProperty('parents') && event.currentTarget.parents().find('.sql-code-control')) {
// for code mirror in dialogs
event.currentTarget.parents().find('.sql-code-control').focus();
}

View File

@ -175,7 +175,7 @@ define([
template: _.template([
'<label class="<%=Backform.controlLabelClassName%>" for="<%=cId%>"><%=label%></label>',
'<div class="<%=Backform.controlsClassName%>">',
' <input class="<%=Backform.controlClassName%> uneditable-input" <%=disabled ? "disabled readonly" : ""%> id="<%=cId%>" value="<%-value%>" />',
' <input class="<%=Backform.controlClassName%> uneditable-input" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%> id="<%=cId%>" value="<%-value%>" />',
' <% if (helpMessage && helpMessage.length) { %>',
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
' <% } %>',
@ -233,6 +233,7 @@ define([
// Evaluate the disabled, visible, and required option
_.extend(data, {
disabled: evalF(data.disabled, data, this.model),
readonly: evalF(data.readonly, data, this.model),
visible: evalF(data.visible, data, this.model),
required: evalF(data.required, data, this.model),
});
@ -260,7 +261,7 @@ define([
template: _.template([
'<label class="<%=Backform.controlLabelClassName%>" for="<%=cId%>"><%=label%></label>',
'<div class="<%=Backform.controlContainerClassName%>">',
' <input type="<%=type%>" id="<%=cId%>" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
' <input type="<%=type%>" id="<%=cId%>" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%> <%=required ? "required" : ""%> />',
' <% if (helpMessage && helpMessage.length) { %>',
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
' <% } %>',
@ -315,7 +316,7 @@ define([
' <% if (maxlength) { %>',
' maxlength="<%=maxlength%>"',
' <% } %>',
' placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%>',
' placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%>',
' rows=<%=rows ? rows : ""%>',
' <%=required ? "required" : ""%>><%-value%></textarea>',
' <% if (helpMessage && helpMessage.length) { %>',
@ -389,7 +390,7 @@ define([
Backform.SelectControl.prototype.template = _.template([
'<label class="<%=Backform.controlLabelClassName%>" for="<%=cId%>"><%=label%></label>',
'<div class="<%=Backform.controlContainerClassName%>">',
' <select id="<%=cId%>" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" value="<%-value%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> >',
' <select id="<%=cId%>" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" value="<%-value%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%> <%=required ? "required" : ""%> >',
' <% for (var i=0; i < options.length; i++) { %>',
' <% var option = options[i]; %>',
' <option value="<%-formatter.fromRaw(option.value)%>" <%=option.value === rawValue ? "selected=\'selected\'" : ""%> <%=option.disabled ? "disabled=\'disabled\'" : ""%>><%-option.label%></option>',
@ -409,7 +410,7 @@ define([
'<% for (var i=0; i < options.length; i++) { %>',
' <% var option = options[i]; %>',
' <% if (option.value === rawValue) { %>',
' <input id="<%=cId%>" class="<%=Backform.controlClassName%> uneditable-input" disabled readonly value="<%-option.label%>"></span>',
' <input id="<%=cId%>" class="<%=Backform.controlClassName%> uneditable-input" readonly value="<%-option.label%>"></span>',
' <% } %>',
'<% } %>',
'<% if (helpMessage && helpMessage.length) { %>',
@ -557,7 +558,7 @@ define([
' data-size="<%=options.size%>" data-height="<%=options.height%>" ',
' data-on="<%=options.onText%>" data-off="<%=options.offText%>" ',
' data-onstyle="<%=options.onColor%>" data-offstyle="<%=options.offColor%>" data-width="<%=options.width%>" ',
' name="<%=name%>" <%=value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
' name="<%=name%>" <%=value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%> <%=required ? "required" : ""%> />',
' <% if (helpMessage && helpMessage.length) { %>',
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
' <% } %>',
@ -579,11 +580,11 @@ define([
if(this.$el.find('.toggle.btn').hasClass('off')) {
this.$el.find('.sr-value').text(`
${label}. ${offText}. ${gettext('Toggle button')}
${label}, ${offText}, ${gettext('Toggle button')}
`);
} else {
this.$el.find('.sr-value').text(`
${label}. ${onText}. ${gettext('Toggle button')}
${label}, ${onText}, ${gettext('Toggle button')}
`);
}
},
@ -618,6 +619,7 @@ define([
// Evaluate the disabled, visible, and required option
_.extend(data, {
disabled: evalF(field.disabled, field, this.model),
readonly: evalF(field.readonly, field, this.model),
visible: evalF(data.visible, field, this.model),
required: evalF(data.required, field, this.model),
});
@ -637,8 +639,9 @@ define([
this.$el.addClass(Backform.requiredInputClassName);
}
/* Set disabled for both disabled and readonly */
data.options = _.defaults({
disabled: evalF(field.disabled, field, this.model),
disabled: data.disabled || data.readonly,
}, this.field.get('options'), this.defaults.options,
$.fn.bootstrapToggle.defaults);
@ -651,7 +654,7 @@ define([
this.$input.bootstrapToggle();
// When disable then set tabindex value to -1
this.$el.find('.toggle.btn')
.attr('tabindex', data.options.disabled ? '-1' : '0')
.attr('tabindex', data.disabled ? '-1' : '0')
.attr('id', data.cId);
this.$el.find('.toggle.btn .toggle-group .btn').attr('aria-hidden', true);
@ -659,6 +662,12 @@ define([
this.updateInvalid();
/* Bootstrap toggle does not have option for readonly
* If readonly, then let it focus.
*/
if(data.readonly) {
this.$el.find('.select2-selection').attr('tabindex', 0);
}
return this;
},
});
@ -830,7 +839,7 @@ define([
'header': _.template([
'<div class="<%=Backform.accordianGroupClassName%>" <%=disabled ? "disabled" : ""%>>',
' <% if (legend != false) { %>',
' <div class="<%=legendClass%>" <%=collapse ? "data-toggle=\'collapse\'" : ""%> data-target="#<%=cId%>" aria-controls="<%=cId%>" role="heading" tabindex="0"><%=collapse ? "<span class=\'caret\'></span>" : "" %><%=label%></legend>',
' <div class="<%=legendClass%>" <%=collapse ? "data-toggle=\'collapse\'" : ""%> data-target="#<%=cId%>" aria-controls="<%=cId%>" aria-level="3" role="heading"><%=collapse ? "<span class=\'caret\'></span>" : "" %><%=label%></legend>',
' <% } %>',
'</div>',
].join('\n')),
@ -1718,7 +1727,7 @@ define([
},
template: _.template([
'<div class="<%=controlsClassName%>">',
' <textarea class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%>><%-value%></textarea>',
' <textarea class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%> <%=required ? "required" : ""%>><%-value%></textarea>',
' <% if (helpMessage && helpMessage.length) { %>',
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
' <% } %>',
@ -1885,7 +1894,7 @@ define([
template: _.template([
'<label for="<%=cId%>" class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
'<div class="<%=Backform.controlsClassName%>">',
' <input type="<%=type%>" id="<%=cId%>" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" min="<%=min%>" max="<%=max%>"maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
' <input type="<%=type%>" id="<%=cId%>" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" min="<%=min%>" max="<%=max%>"maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%> <%=required ? "required" : ""%> />',
' <% if (helpMessage && helpMessage.length) { %>',
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
' <% } %>',
@ -1968,8 +1977,9 @@ define([
(server_info.version <= s.max_version))));
var disabled = (
(mode == 'properties') || !ver_in_limit || in_catalog
!ver_in_limit || in_catalog
),
readonly = (mode == 'properties'),
schema_node = (s.node && _.isString(s.node) &&
s.node in pgBrowser.Nodes && pgBrowser.Nodes[s.node]) || node;
@ -1978,16 +1988,17 @@ define([
// This can be disabled in some cases (if not hidden)
disabled: (disabled ? true : evalASFunc(s.disabled)),
readonly: (readonly ? true : evalASFunc(s.readonly)),
editable: _.isUndefined(s.editable) ?
pgAdmin.editableCell : evalASFunc(s.editable),
subnode: ((_.isString(s.model) && s.model in pgBrowser.Nodes) ?
pgBrowser.Nodes[s.model].model : s.model),
canAdd: (disabled ? false : evalASFunc(s.canAdd)),
canAddRow: (disabled ? false : evalASFunc(s.canAddRow)),
canEdit: (disabled ? false : evalASFunc(s.canEdit)),
canDelete: (disabled ? false : evalASFunc(s.canDelete)),
canEditRow: (disabled ? false : evalASFunc(s.canEditRow)),
canDeleteRow: (disabled ? false : evalASFunc(s.canDeleteRow)),
canAdd: (disabled || readonly) ? false : evalASFunc(s.canAdd),
canAddRow: (disabled || readonly) ? false : evalASFunc(s.canAddRow),
canEdit: (disabled || readonly) ? false : evalASFunc(s.canEdit),
canDelete: (disabled || readonly) ? false : evalASFunc(s.canDelete),
canEditRow: (disabled || readonly) ? false : evalASFunc(s.canEditRow),
canDeleteRow: (disabled || readonly) ? false : evalASFunc(s.canDeleteRow),
transform: evalASFunc(s.transform),
mode: mode,
control: control,
@ -2130,7 +2141,7 @@ define([
'<% }%>',
'<div class="<%=Backform.controlsClassName%>">',
' <select id="<%=cId%>" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>"',
' name="<%=name%>" value="<%-value%>" <%=disabled ? "disabled" : ""%>',
' name="<%=name%>" value="<%-value%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%>',
' <%=required ? "required" : ""%><%= select2.multiple ? " multiple>" : ">" %>',
' <%=select2.first_empty ? " <option></option>" : ""%>',
' <% for (var i=0; i < options.length; i++) {%>',
@ -2142,7 +2153,7 @@ define([
' <% if (!select2.multiple && option.value === rawValue) {%>selected="selected"<%}%>',
' <% if (select2.multiple && rawValue && rawValue.indexOf(option.value) != -1){%>selected="selected" data-index="rawValue.indexOf(option.value)"<%}%>',
' <%}%>',
' <%= disabled ? "disabled" : ""%>><%-option.label%></option>',
' <%= disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%>><%-option.label%></option>',
' <%}%>',
' </select>',
' <% if (helpMessage && helpMessage.length) { %>',
@ -2191,8 +2202,10 @@ define([
});
// Evaluate the disabled, visible, and required option
// disable for readonly also and later handle readonly programmatically.
_.extend(data, {
disabled: evalF(data.disabled, data, this.model),
readonly: evalF(data.readonly, data, this.model),
visible: evalF(data.visible, data, this.model),
required: evalF(data.required, data, this.model),
});
@ -2220,7 +2233,7 @@ define([
this.$el.html(this.template(data)).addClass(field.name);
var select2Opts = _.extend({
disabled: data.disabled,
disabled: data.disabled || data.readonly,
}, field.select2, {
options: (this.field.get('options') || this.defaults.options),
});
@ -2233,7 +2246,7 @@ define([
}
// If disabled then no need to show placeholder
if (data.disabled || data.mode === 'properties') {
if (data.disabled || data.readonly) {
select2Opts['placeholder'] = '';
}
@ -2278,6 +2291,15 @@ define([
});
}
/* Select2 does not have option for readonly
* If readonly, then let it focus.
*/
if(data.readonly && !data.disabled) {
setTimeout(()=>{
this.$el.find('.select2-selection').attr('tabindex', 0);
}, 500);
}
this.updateInvalid();
return this;
@ -2419,7 +2441,7 @@ define([
'<div class="<%=Backform.controlsClassName%> sql_field_layout <%=extraClasses.join(\' \')%>">',
' <textarea ',
' class="<%=Backform.controlClassName%> " name="<%=name%>"',
' maxlength="<%=maxlength%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%>',
' maxlength="<%=maxlength%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%>',
' rows=<%=rows%>',
' <%=required ? "required" : ""%>><%-value%></textarea>',
' <% if (helpMessage && helpMessage.length) { %>',
@ -2504,6 +2526,7 @@ define([
// Evaluate the disabled, visible option
var isDisabled = evalF(data.disabled, data, this.model),
isVisible = evalF(data.visible, data, this.model),
isReadonly = evalF(data.readonly, data, this.model),
self = this;
self.sqlCtrl = CodeMirror.fromTextArea(
@ -2520,9 +2543,13 @@ define([
});
// Disable editor
if (isDisabled) {
if (isDisabled || isReadonly) {
// set read only mode to true instead of 'nocursor', and hide cursor using a class so that copying is enabled
self.sqlCtrl.setOption('readOnly', true);
self.sqlCtrl.setOption('extraKeys', {
Tab: false,
'Shift-Tab': false,
});
var cm = self.sqlCtrl.getWrapperElement();
if (cm) {
cm.className += ' cm_disabled hide-cursor-workaround';
@ -2592,7 +2619,7 @@ define([
'<div class="pgadmin-controls pg-el-12 <%=extraClasses.join(\' \')%>">',
' <textarea ',
' class="<%=Backform.controlClassName%> " name="<%=name%>"',
' maxlength="<%=maxlength%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%>',
' maxlength="<%=maxlength%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%> ',
' rows=<%=rows%>',
' <%=required ? "required" : ""%>><%-value%></textarea>',
' <% if (helpMessage && helpMessage.length) { %>',
@ -2654,9 +2681,9 @@ define([
'<label class="<%=Backform.controlLabelClassName%>" for="<%=cId%>"><%=label%></label>',
'<div class="<%=Backform.controlsClassName%>">',
'<div class="input-group">',
'<input type="<%=type%>" id="<%=cId%>" class="form-control <%=extraClasses.join(\' \')%>" name="<%=name%>" min="<%=min%>" max="<%=max%>"maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
'<input type="<%=type%>" id="<%=cId%>" class="form-control <%=extraClasses.join(\' \')%>" name="<%=name%>" min="<%=min%>" max="<%=max%>"maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%> <%=required ? "required" : ""%> />',
'<div class="input-group-append">',
'<button class="btn btn-secondary fa fa-ellipsis-h select_item" <%=disabled ? "disabled" : ""%> aria-hidden="true" aria-label="Select file" title="Select file"></button>',
'<button class="btn btn-secondary fa fa-ellipsis-h select_item" <%=disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%> aria-hidden="true" aria-label="Select file" title="Select file"></button>',
'</div>',
'</div>',
'<% if (helpMessage && helpMessage.length) { %>',
@ -2772,7 +2799,7 @@ define([
template: _.template([
'<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
'<div class="input-group <%=Backform.controlsClassName%>">',
' <input type="text" class="<%=Backform.controlClassName%> datetimepicker-input <%=extraClasses.join(\' \')%>" name="<%=name%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> data-toggle="datetimepicker"/>',
' <input type="text" class="<%=Backform.controlClassName%> datetimepicker-input <%=extraClasses.join(\' \')%>" name="<%=name%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%> <%=required ? "required" : ""%> data-toggle="datetimepicker"/>',
' <div class="input-group-append">',
' <span class="input-group-text fa fa-calendar"></span>',
' </div>',
@ -2803,6 +2830,7 @@ define([
// Evaluate the disabled, visible, and required option
_.extend(data, {
disabled: evalF(data.disabled, this.model),
readonly: evalF(data.readonly, this.model),
visible: evalF(data.visible, this.model),
required: evalF(data.required, this.model),
});

View File

@ -305,6 +305,12 @@ table.backgrid {
outline: $input-focus-border-color auto 5px !important;
}
& td.select-cell.editor select{
outline: none !important;
height: 100% !important;
width: 100% !important;
}
tr.editor-row {
background-color: $color-gray-light !important;
& > td {

View File

@ -96,3 +96,18 @@
background-color: $color-primary;
margin-bottom: 3px;
}
/* select2 readonly */
select[readonly].select2-hidden-accessible + .select2-container {
pointer-events: none;
touch-action: none;
}
select[readonly].select2-hidden-accessible + .select2-container .select2-selection {
background: #eee;
box-shadow: none;
}
select[readonly].select2-hidden-accessible + .select2-container .select2-selection__arrow, select[readonly].select2-hidden-accessible + .select2-container .select2-selection__clear {
display: none;
}

View File

@ -193,6 +193,11 @@
// (Optional - true/false/function returning boolean)
// (Default Value: false)
disabled: false,
// Make the input control readonly
// readonly control can receive focus whereas disabled cannot
// (Optional - true/false/function returning boolean)
// (Default Value: false)
readonly: false,
// Visible
// (Optional - true/false/function returning boolean)
// (Default Value: true)
@ -306,6 +311,7 @@
// Evaluate the disabled, visible, and required option
_.extend(data, {
disabled: evalF(data.disabled, this.model),
readonly: evalF(data.readonly, this.model),
visible: evalF(data.visible, this.model),
required: evalF(data.required, this.model)
});
@ -427,7 +433,7 @@
template: _.template([
'<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
'<div class="<%=Backform.controlContainerClassName%>">',
' <textarea class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" maxlength="<%=maxlength%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%>><%-value%></textarea>',
' <textarea class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" maxlength="<%=maxlength%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly" : ""%> <%=required ? "required" : ""%>><%-value%></textarea>',
' <% if (helpMessage && helpMessage.length) { %>',
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
' <% } %>',
@ -517,7 +523,7 @@
template: _.template([
'<label class="<%=Backform.controlLabelClassName%>"><%=label%></label>',
'<div class="<%=Backform.controlContainerClassName%>">',
' <input type="<%=type%>" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
' <input type="<%=type%>" class="<%=Backform.controlClassName%> <%=extraClasses.join(\' \')%>" name="<%=name%>" maxlength="<%=maxlength%>" value="<%-value%>" placeholder="<%-placeholder%>" <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly aria-readonly=true" : ""%> <%=required ? "required" : ""%> />',
' <% if (helpMessage && helpMessage.length) { %>',
' <span class="<%=Backform.helpMessageClassName%>"><%=helpMessage%></span>',
' <% } %>',
@ -544,7 +550,7 @@
'<label class="<%=Backform.controlLabelClassName%>" for="<%=id%>"><%=controlLabel%></label>',
'<div class="<%=Backform.controlContainerClassName%>">',
' <div class="form-check">',
' <input type="<%=type%>" class="form-check-input <%=extraClasses.join(\' \')%>" id="<%=id%>" name="<%=name%>" <%=value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
' <input type="<%=type%>" class="form-check-input <%=extraClasses.join(\' \')%>" id="<%=id%>" name="<%=name%>" <%=value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=readonly ? "readonly" : ""%> <%=required ? "required" : ""%> />',
' <% if (label && label.length) { %>',
' <label class="form-check-label" for="<%=id%>"><%=label%></label>',
' <% } %>',
@ -573,7 +579,7 @@
' <% var option = options[i]; %>',
' <% var id = _.uniqueId("bf_"); %>',
' <div class="form-check">',
' <input type="<%=type%>" class="<%=extraClasses.join(\' \')%>" id="<%=id%>" name="<%=name%>" value="<%-formatter.fromRaw(option.value)%>" <%=rawValue == option.value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=required ? "required" : ""%> />',
' <input type="<%=type%>" class="<%=extraClasses.join(\' \')%>" id="<%=id%>" name="<%=name%>" value="<%-formatter.fromRaw(option.value)%>" <%=rawValue == option.value ? "checked=\'checked\'" : ""%> <%=disabled ? "disabled" : ""%> <%=readonly ? "disabled" : ""%> <%=required ? "required" : ""%> />',
' <label class="form-check-label" for="<%=id%>"><%-option.label%></label>',
' </div>',
' <% } %>',