mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 21:21:44 +00:00
Signed-off-by: Andy Lee <andy.lee@suse.com> (cherry picked from commit 8f76d5ad30b34778d38eddc5fdb7532699cde11c)
16 lines
454 B
JavaScript
16 lines
454 B
JavaScript
export function volumeSize(size, getters, errors, validatorArgs, displayKey, value) {
|
|
if (!size) {
|
|
const key = getters['i18n/t']('harvester.volume.size');
|
|
|
|
errors.push(getters['i18n/t']('validation.required', { key }));
|
|
}
|
|
|
|
if (size && !/^([0-9][0-9]{0,8})[a-zA-Z]+$/.test(size)) {
|
|
const message = getters['i18n/t']('harvester.validation.generic.maximumSize', { max: '999999999 Gi' });
|
|
|
|
errors.push(message);
|
|
}
|
|
|
|
return errors;
|
|
}
|