mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
Added unsupported_validator
dnszone attributes idnsallowquery and idnsallowtransfer have valid but currently unsupported values: 'localhost' and 'localnets'. New validator was introduced for unsuported values. By using this validator user can see that the value is currently unsupported instead of showing 'invalid value' or passing the value to server and creating error there. https://fedorahosted.org/freeipa/ticket/2351
This commit is contained in:
parent
cf60e7e71e
commit
7da8d2f296
@ -131,9 +131,11 @@ IPA.dns.zone_entity = function(spec) {
|
||||
type: 'netaddr',
|
||||
name: 'idnsallowquery',
|
||||
validators: [
|
||||
IPA.unsupported_validator({
|
||||
unsupported: ['localhost', 'localnets']
|
||||
}),
|
||||
IPA.network_validator({
|
||||
specials: ['any', 'none',
|
||||
'localhost', 'localnets'],
|
||||
specials: ['any', 'none'],
|
||||
allow_negation: true,
|
||||
allow_host_address: true
|
||||
})]
|
||||
@ -142,9 +144,11 @@ IPA.dns.zone_entity = function(spec) {
|
||||
type: 'netaddr',
|
||||
name: 'idnsallowtransfer',
|
||||
validators: [
|
||||
IPA.unsupported_validator({
|
||||
unsupported: ['localhost', 'localnets']
|
||||
}),
|
||||
IPA.network_validator({
|
||||
specials: ['any', 'none',
|
||||
'localhost', 'localnets'],
|
||||
specials: ['any', 'none'],
|
||||
allow_negation: true,
|
||||
allow_host_address: true
|
||||
})]
|
||||
|
@ -459,6 +459,25 @@ IPA.metadata_validator = function(spec) {
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.unsupported_validator = function(spec) {
|
||||
|
||||
var that = IPA.validator(spec);
|
||||
|
||||
that.unsupported = spec.unsupported || [];
|
||||
that.message = spec.message || IPA.messages.widget.validation.unsupported;
|
||||
|
||||
that.validate = function(value, context) {
|
||||
|
||||
if (IPA.is_empty(value)) return that.true_result();
|
||||
|
||||
if (that.unsupported.indexOf(value) > -1) return that.false_result();
|
||||
|
||||
return that.true_result();
|
||||
};
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
IPA.checkbox_field = function(spec) {
|
||||
|
||||
spec = spec || {};
|
||||
|
@ -434,7 +434,8 @@
|
||||
"max_value": "Maximum value is ${value}",
|
||||
"min_value": "Minimum value is ${value}",
|
||||
"net_address": "Not a valid network address",
|
||||
"required": "Required field"
|
||||
"required": "Required field",
|
||||
"unsupported": "Unsupported value"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -574,6 +574,7 @@ class i18n_messages(Command):
|
||||
"min_value": _("Minimum value is ${value}"),
|
||||
"net_address": _("Not a valid network address"),
|
||||
"required": _("Required field"),
|
||||
"unsupported": _("Unsupported value"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user