Fix creation of exclusion constraints. Fixes #1301

pull/3/head
Murtuza Zabuawala 2016-06-21 12:01:39 +01:00 committed by Dave Page
parent 061a9d9322
commit 3210975568
1 changed files with 14 additions and 3 deletions

View File

@ -200,7 +200,18 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
} }
}) })
} }
] ],
validate: function() {
this.errorModel.clear();
var operator = this.get('operator'),
column_name = this.get('column');
if (_.isUndefined(operator) || _.isNull(operator)) {
var msg = '{{ _('Please specify operator for column: ') }}' + column_name;
this.errorModel.set('operator', msg);
return msg;
}
return null;
}
}); });
var ExclusionConstraintColumnControl = Backform.ExclusionConstraintColumnControl = var ExclusionConstraintColumnControl = Backform.ExclusionConstraintColumnControl =
@ -246,7 +257,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
if (m.previous('name') == self.headerData.get('column')) { if (m.previous('name') == self.headerData.get('column')) {
/* /*
* Table column name has changed so update * Table column name has changed so update
* column name in exclude constraint as well. * column name in exclusion constraint as well.
*/ */
self.headerData.set( self.headerData.set(
{"column": m.get('name')}); {"column": m.get('name')});
@ -881,7 +892,7 @@ function($, _, S, pgAdmin, pgBrowser, Alertify) {
this.errorModel.clear(); this.errorModel.clear();
var columns = this.get('columns'); var columns = this.get('columns');
if ((_.isUndefined(columns) || _.isNull(columns) || columns.length < 1)) { if ((_.isUndefined(columns) || _.isNull(columns) || columns.length < 1)) {
var msg = '{{ _('Please specify columns for Exclude constraint.') }}'; var msg = '{{ _('Please specify columns for exclusion constraint.') }}';
this.errorModel.set('columns', msg); this.errorModel.set('columns', msg);
return msg; return msg;
} }