WizardV2: filesystem mountpoint size validation
This commit is contained in:
parent
561e82827e
commit
54d032e0f0
2 changed files with 9 additions and 4 deletions
|
|
@ -37,6 +37,7 @@ import { ValidatedTextInput } from '../../ValidatedTextInput';
|
|||
import {
|
||||
getDuplicateMountPoints,
|
||||
isFileSystemConfigValid,
|
||||
isMountpointMinSizeValid,
|
||||
} from '../../validators';
|
||||
|
||||
export type Partition = {
|
||||
|
|
@ -180,8 +181,8 @@ type RowPropTypes = {
|
|||
};
|
||||
|
||||
const normalizeSuffix = (rawSuffix: string) => {
|
||||
const suffix = rawSuffix.replace(/^\/+/g, '')
|
||||
return suffix.length > 0 ? '/' + suffix : ''
|
||||
const suffix = rawSuffix.replace(/^\/+/g, '');
|
||||
return suffix.length > 0 ? '/' + suffix : '';
|
||||
};
|
||||
|
||||
const getPrefix = (mountpoint: string) => {
|
||||
|
|
@ -377,8 +378,8 @@ const MinimumSize = ({ partition, units }: MinimumSizePropTypes) => {
|
|||
return (
|
||||
<ValidatedTextInput
|
||||
ariaLabel="minimum partition size"
|
||||
helperText=""
|
||||
validator={() => true}
|
||||
helperText="Must be larger than 0"
|
||||
validator={isMountpointMinSizeValid}
|
||||
value={convertToDisplayUnits(partition.min_size)}
|
||||
type="text"
|
||||
onChange={(event, minSize) => {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ export const isGcpEmailValid = (gcpShareWithAccount: string | undefined) => {
|
|||
);
|
||||
};
|
||||
|
||||
export const isMountpointMinSizeValid = (minSize: string) => {
|
||||
return /^\d+$/.test(minSize) && parseInt(minSize) > 0;
|
||||
};
|
||||
|
||||
export const isBlueprintNameValid = (blueprintName: string) =>
|
||||
blueprintName.length >= 2 &&
|
||||
blueprintName.length <= 100 &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue