update validation for storage classes (#10940)

pull/10949/head
Prabhat Khera 2024-01-12 09:40:55 +13:00 committed by GitHub
parent 0e6a175bf6
commit cf88570c39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -23,14 +23,15 @@ const storageClassFormValuesSchema = array()
})
)
.test(
// invalid if any storage class is not selected or if it's selected and at least one access mode is selected
// invalid if any storage class is not selected or
// if it's selected and at least one access mode is selected
'accessModes',
'Shared access policy configuration required.',
(storageClasses) => {
const isValid = storageClasses?.every(
(value) =>
!value.selected ||
value.AccessModes?.some((accessMode) => accessMode.selected)
(value.AccessModes && value.AccessModes?.length > 0)
);
return isValid || false;
}