Extract variables to utils/unit

Signed-off-by: Andy Lee <andy.lee@suse.com>
This commit is contained in:
Andy Lee
2025-03-03 16:57:25 +08:00
parent 8f76d5ad30
commit 8db4de1c4a
18 changed files with 57 additions and 34 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
import { GIBIBYTE } from '../utils/unit';
export function volumeSize(size, getters, errors, validatorArgs, displayKey, value) {
if (!size) {
const key = getters['i18n/t']('harvester.volume.size');
@@ -6,7 +8,7 @@ export function volumeSize(size, getters, errors, validatorArgs, displayKey, val
}
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' });
const message = getters['i18n/t']('harvester.validation.generic.maximumSize', { max: `999999999 ${ GIBIBYTE }` });
errors.push(message);
}