mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-26 02:30:21 -06:00
Prevent attempts to create server groups with no name. Fixes #2012
This commit is contained in:
parent
ae809c4506
commit
e3c8cb2706
@ -40,11 +40,21 @@ function($, _, pgAdmin, Backbone) {
|
||||
}
|
||||
],
|
||||
validate: function(attrs, options) {
|
||||
var err = {},
|
||||
errmsg = null;
|
||||
this.errorModel.clear();
|
||||
|
||||
if (!this.isNew() && 'id' in this.changed) {
|
||||
return '{{ _('The ID cannot be changed.') }}';
|
||||
errmsg = '{{ _('The ID cannot be changed.') }}';
|
||||
this.errorModel.set('id', errmsg);
|
||||
return errmsg;
|
||||
}
|
||||
if (String(this.name).replace(/^\s+|\s+$/g, '') == '') {
|
||||
return '{{ _('Name cannot be empty.') }}';
|
||||
if (_.isUndefined(this.get('name')) ||
|
||||
_.isNull(this.get('name')) ||
|
||||
String(this.get('name')).replace(/^\s+|\s+$/g, '') == '') {
|
||||
errmsg = '{{ _('Name cannot be empty.') }}';
|
||||
this.errorModel.set('name', errmsg);
|
||||
return errmsg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user