Create management portal in Flutter #39
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
parent
45ea5bab8f
commit
f72f86d8ae
@ -32,6 +32,16 @@ final Validator noRestrictedChars = (value) {
|
||||
// ignore: prefer_function_declarations_over_variables
|
||||
final Validator notEmptyValidator = (value) => value.isNotEmpty;
|
||||
|
||||
// ignore: prefer_function_declarations_over_variables
|
||||
final Validator portIsValid = (value) {
|
||||
int? intValue = int.tryParse(value);
|
||||
if (intValue == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (intValue > 0 && intValue < 65536);
|
||||
};
|
||||
|
||||
// ignore: prefer_function_declarations_over_variables
|
||||
final Validator trimNotEmptyValidator = (value) => value.trim().isNotEmpty;
|
||||
|
||||
@ -112,25 +122,19 @@ List<Validator> getSettingValidators(String settingPath) {
|
||||
case 'HostConfig.ApiPassword':
|
||||
return [notEmptyValidator];
|
||||
case 'HostConfig.ApiPort':
|
||||
return [
|
||||
(value) {
|
||||
int? intValue = int.tryParse(value);
|
||||
if (intValue == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (intValue > 0 && intValue < 65536);
|
||||
},
|
||||
createUriValidator(host: 'localhost'),
|
||||
];
|
||||
return [portIsValid];
|
||||
case 'HostConfig.HostNameOrIp':
|
||||
return createHostNameOrIpValidators();
|
||||
case 'HostConfig.Protocol':
|
||||
return [(value) => constants.protocolTypeList.contains(value)];
|
||||
case 'RemoteConfig.ApiPort':
|
||||
return [notEmptyValidator, portIsValid];
|
||||
case 'RemoteConfig.EncryptionToken':
|
||||
return [notEmptyValidator];
|
||||
case 'RemoteConfig.HostNameOrIp':
|
||||
return createHostNameOrIpValidators();
|
||||
case 'RemoteMount.ApiPort':
|
||||
return [notEmptyValidator, portIsValid];
|
||||
case 'RemoteMount.EncryptionToken':
|
||||
return [notEmptyValidator];
|
||||
case 'RemoteMount.HostNameOrIp':
|
||||
|
Loading…
x
Reference in New Issue
Block a user