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
|
// ignore: prefer_function_declarations_over_variables
|
||||||
final Validator notEmptyValidator = (value) => value.isNotEmpty;
|
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
|
// ignore: prefer_function_declarations_over_variables
|
||||||
final Validator trimNotEmptyValidator = (value) => value.trim().isNotEmpty;
|
final Validator trimNotEmptyValidator = (value) => value.trim().isNotEmpty;
|
||||||
|
|
||||||
@ -112,25 +122,19 @@ List<Validator> getSettingValidators(String settingPath) {
|
|||||||
case 'HostConfig.ApiPassword':
|
case 'HostConfig.ApiPassword':
|
||||||
return [notEmptyValidator];
|
return [notEmptyValidator];
|
||||||
case 'HostConfig.ApiPort':
|
case 'HostConfig.ApiPort':
|
||||||
return [
|
return [portIsValid];
|
||||||
(value) {
|
|
||||||
int? intValue = int.tryParse(value);
|
|
||||||
if (intValue == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (intValue > 0 && intValue < 65536);
|
|
||||||
},
|
|
||||||
createUriValidator(host: 'localhost'),
|
|
||||||
];
|
|
||||||
case 'HostConfig.HostNameOrIp':
|
case 'HostConfig.HostNameOrIp':
|
||||||
return createHostNameOrIpValidators();
|
return createHostNameOrIpValidators();
|
||||||
case 'HostConfig.Protocol':
|
case 'HostConfig.Protocol':
|
||||||
return [(value) => constants.protocolTypeList.contains(value)];
|
return [(value) => constants.protocolTypeList.contains(value)];
|
||||||
|
case 'RemoteConfig.ApiPort':
|
||||||
|
return [notEmptyValidator, portIsValid];
|
||||||
case 'RemoteConfig.EncryptionToken':
|
case 'RemoteConfig.EncryptionToken':
|
||||||
return [notEmptyValidator];
|
return [notEmptyValidator];
|
||||||
case 'RemoteConfig.HostNameOrIp':
|
case 'RemoteConfig.HostNameOrIp':
|
||||||
return createHostNameOrIpValidators();
|
return createHostNameOrIpValidators();
|
||||||
|
case 'RemoteMount.ApiPort':
|
||||||
|
return [notEmptyValidator, portIsValid];
|
||||||
case 'RemoteMount.EncryptionToken':
|
case 'RemoteMount.EncryptionToken':
|
||||||
return [notEmptyValidator];
|
return [notEmptyValidator];
|
||||||
case 'RemoteMount.HostNameOrIp':
|
case 'RemoteMount.HostNameOrIp':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user