Fixed some SonarQube issues.
parent
3a797b1efa
commit
ffdd58ffb4
|
@ -91,8 +91,6 @@ define('pgadmin.node.function', [
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
validate: function() {
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!pgBrowser.Nodes['function']) {
|
if (!pgBrowser.Nodes['function']) {
|
||||||
|
|
|
@ -125,42 +125,14 @@ define('pgadmin.node.exclusion_constraint', [
|
||||||
onText: 'ASC',
|
onText: 'ASC',
|
||||||
offText: 'DESC',
|
offText: 'DESC',
|
||||||
},
|
},
|
||||||
editable: function(m) {
|
editable: 'isEditable',
|
||||||
if (m instanceof Backbone.Collection) {
|
|
||||||
return true;
|
|
||||||
} else if ((_.has(m.collection, 'handler') &&
|
|
||||||
!_.isUndefined(m.collection.handler) &&
|
|
||||||
!_.isUndefined(m.collection.handler.get('oid')))) {
|
|
||||||
return false;
|
|
||||||
} else if (m.top.get('amname') === 'btree') {
|
|
||||||
m.set('is_sort_nulls_applicable', true);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
m.set('is_sort_nulls_applicable', false);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},{
|
},{
|
||||||
id: 'nulls_order', label: gettext('NULLs order'), type:'switch',
|
id: 'nulls_order', label: gettext('NULLs order'), type:'switch',
|
||||||
options: {
|
options: {
|
||||||
onText: 'FIRST',
|
onText: 'FIRST',
|
||||||
offText: 'LAST',
|
offText: 'LAST',
|
||||||
},
|
},
|
||||||
editable: function(m) {
|
editable: 'isEditable',
|
||||||
if (m instanceof Backbone.Collection) {
|
|
||||||
return true;
|
|
||||||
} else if ((_.has(m.collection, 'handler') &&
|
|
||||||
!_.isUndefined(m.collection.handler) &&
|
|
||||||
!_.isUndefined(m.collection.handler.get('oid')))) {
|
|
||||||
return false;
|
|
||||||
} else if (m.top.get('amname') === 'btree') {
|
|
||||||
m.set('is_sort_nulls_applicable', true);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
m.set('is_sort_nulls_applicable', false);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},{
|
},{
|
||||||
id: 'operator', label: gettext('Operator'), type: 'text',
|
id: 'operator', label: gettext('Operator'), type: 'text',
|
||||||
node: 'table', url: 'get_operator',
|
node: 'table', url: 'get_operator',
|
||||||
|
@ -220,6 +192,21 @@ define('pgadmin.node.exclusion_constraint', [
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
isEditable: function(m) {
|
||||||
|
if (m instanceof Backbone.Collection) {
|
||||||
|
return true;
|
||||||
|
} else if ((_.has(m.collection, 'handler') &&
|
||||||
|
!_.isUndefined(m.collection.handler) &&
|
||||||
|
!_.isUndefined(m.collection.handler.get('oid')))) {
|
||||||
|
return false;
|
||||||
|
} else if (m.top.get('amname') === 'btree') {
|
||||||
|
m.set('is_sort_nulls_applicable', true);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
m.set('is_sort_nulls_applicable', false);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
validate: function() {
|
validate: function() {
|
||||||
this.errorModel.clear();
|
this.errorModel.clear();
|
||||||
var operator = this.get('operator'),
|
var operator = this.get('operator'),
|
||||||
|
@ -775,22 +762,14 @@ define('pgadmin.node.exclusion_constraint', [
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
select2:{allowClear:true},
|
select2:{allowClear:true},
|
||||||
readonly: function(m) {
|
readonly: 'isReadonly',
|
||||||
return ((_.has(m, 'handler') &&
|
|
||||||
!_.isUndefined(m.handler) &&
|
|
||||||
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
|
|
||||||
},
|
|
||||||
},{
|
},{
|
||||||
id: 'fillfactor', label: gettext('Fill factor'),
|
id: 'fillfactor', label: gettext('Fill factor'),
|
||||||
type: 'int', group: gettext('Definition'), allowNull: true,
|
type: 'int', group: gettext('Definition'), allowNull: true,
|
||||||
},{
|
},{
|
||||||
id: 'condeferrable', label: gettext('Deferrable?'),
|
id: 'condeferrable', label: gettext('Deferrable?'),
|
||||||
type: 'switch', group: gettext('Definition'), deps: ['index'],
|
type: 'switch', group: gettext('Definition'), deps: ['index'],
|
||||||
readonly: function(m) {
|
readonly: 'isReadonly',
|
||||||
return ((_.has(m, 'handler') &&
|
|
||||||
!_.isUndefined(m.handler) &&
|
|
||||||
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
|
|
||||||
},
|
|
||||||
},{
|
},{
|
||||||
id: 'condeferred', label: gettext('Deferred?'),
|
id: 'condeferred', label: gettext('Deferred?'),
|
||||||
type: 'switch', group: gettext('Definition'),
|
type: 'switch', group: gettext('Definition'),
|
||||||
|
@ -817,11 +796,7 @@ define('pgadmin.node.exclusion_constraint', [
|
||||||
},{
|
},{
|
||||||
id: 'indconstraint', label: gettext('Constraint'), cell: 'string',
|
id: 'indconstraint', label: gettext('Constraint'), cell: 'string',
|
||||||
type: 'multiline', mode: ['create', 'edit', 'properties'], editable: false,
|
type: 'multiline', mode: ['create', 'edit', 'properties'], editable: false,
|
||||||
group: gettext('Definition'), readonly: function(m) {
|
group: gettext('Definition'), readonly: 'isReadonly',
|
||||||
return ((_.has(m, 'handler') &&
|
|
||||||
!_.isUndefined(m.handler) &&
|
|
||||||
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
|
|
||||||
},
|
|
||||||
},{
|
},{
|
||||||
id: 'columns', label: gettext('Columns/Expressions'),
|
id: 'columns', label: gettext('Columns/Expressions'),
|
||||||
type: 'collection', group: gettext('Columns'),
|
type: 'collection', group: gettext('Columns'),
|
||||||
|
@ -834,11 +809,7 @@ define('pgadmin.node.exclusion_constraint', [
|
||||||
},
|
},
|
||||||
control: ExclusionConstraintColumnControl,
|
control: ExclusionConstraintColumnControl,
|
||||||
model: ExclusionConstraintColumnModel,
|
model: ExclusionConstraintColumnModel,
|
||||||
readonly: function(m) {
|
readonly: 'isReadonly',
|
||||||
return ((_.has(m, 'handler') &&
|
|
||||||
!_.isUndefined(m.handler) &&
|
|
||||||
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
|
|
||||||
},
|
|
||||||
cell: Backgrid.StringCell.extend({
|
cell: Backgrid.StringCell.extend({
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
Backgrid.StringCell.prototype.initialize.apply(this, arguments);
|
Backgrid.StringCell.prototype.initialize.apply(this, arguments);
|
||||||
|
@ -1041,6 +1012,11 @@ define('pgadmin.node.exclusion_constraint', [
|
||||||
return !m.isNew();
|
return !m.isNew();
|
||||||
},
|
},
|
||||||
}],
|
}],
|
||||||
|
isReadonly: function(m) {
|
||||||
|
return ((_.has(m, 'handler') &&
|
||||||
|
!_.isUndefined(m.handler) &&
|
||||||
|
!_.isUndefined(m.get('oid'))) || (_.isFunction(m.isNew) && !m.isNew()));
|
||||||
|
},
|
||||||
validate: function() {
|
validate: function() {
|
||||||
this.errorModel.clear();
|
this.errorModel.clear();
|
||||||
var columns = this.get('columns'),
|
var columns = this.get('columns'),
|
||||||
|
|
|
@ -505,8 +505,6 @@ define('pgadmin.node.foreign_key', [
|
||||||
|
|
||||||
newRow.addClass('new');
|
newRow.addClass('new');
|
||||||
$(newRow).pgMakeVisible('backform-tab');
|
$(newRow).pgMakeVisible('backform-tab');
|
||||||
} else {
|
|
||||||
//delete m;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1083,6 +1081,15 @@ define('pgadmin.node.foreign_key', [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
isReadonly: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();
|
||||||
|
},
|
||||||
validate: function() {
|
validate: function() {
|
||||||
var columns = this.get('columns'),
|
var columns = this.get('columns'),
|
||||||
msg;
|
msg;
|
||||||
|
|
Loading…
Reference in New Issue