diff --git a/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/EditProviderVDDKImage.tsx b/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/EditProviderVDDKImage.tsx index b1734cef6..78e3fca11 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/EditProviderVDDKImage.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/EditProviderVDDKImage.tsx @@ -10,7 +10,7 @@ import { validateVDDKImage } from '../../utils/validators'; import { EditModal, EditModalProps } from '../EditModal'; import { onEmptyVddkConfirm } from './onEmptyVddkConfirm'; -import { onVddkConfirm } from './onVddkConfirm'; +import { onNoneEmptyVddkConfirm } from './onNoneEmptyVddkConfirm'; export type EditProviderVDDKImageProps = Modify< EditModalProps, @@ -67,8 +67,8 @@ export const EditProviderVDDKImage: React.FC = (prop label={props?.label || t('VDDK init image')} model={ProviderModel} body={body} - validationHook={isEmptyImage ? validateEmptyVDDKImage : validateVDDKImage} - onConfirmHook={isEmptyImage ? onEmptyVddkConfirm : onVddkConfirm} + validationHook={isEmptyImage ? validateEmptyVDDKImage : validateNoneEmptyVDDKImage} + onConfirmHook={isEmptyImage ? onEmptyVddkConfirm : onNoneEmptyVddkConfirm} InputComponent={isEmptyImage ? EmptyVddkTextInput : VddkTextInput} /> ); @@ -89,3 +89,6 @@ const EmptyVddkTextInput: React.FC = () => ( // Validation of empty vddk image const validateEmptyVDDKImage = () => validateVDDKImage(undefined); + +// Validation of none empty vddk image, make sure it's not undefined +const validateNoneEmptyVDDKImage = (value) => validateVDDKImage(value || ''); diff --git a/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/index.ts b/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/index.ts index b6f0977bd..7a7e730f1 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/index.ts +++ b/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/index.ts @@ -1,5 +1,5 @@ // @index('./*.tsx', f => `export * from '${f.path}';`) export * from './EditProviderVDDKImage'; export * from './onEmptyVddkConfirm'; -export * from './onVddkConfirm'; +export * from './onNoneEmptyVddkConfirm'; // @endindex diff --git a/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/onVddkConfirm.tsx b/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/onNoneEmptyVddkConfirm.tsx similarity index 93% rename from packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/onVddkConfirm.tsx rename to packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/onNoneEmptyVddkConfirm.tsx index 5e62de1eb..a47ccee4a 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/onVddkConfirm.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/modals/EditProviderVDDKImage/onNoneEmptyVddkConfirm.tsx @@ -13,7 +13,11 @@ import { OnConfirmHookType } from '../EditModal'; * @param {any} options.newValue - The new value for the 'vddkInitImage' spec settings. * @returns {Promise} - The modified resource. */ -export const onVddkConfirm: OnConfirmHookType = async ({ resource, model, newValue: value }) => { +export const onNoneEmptyVddkConfirm: OnConfirmHookType = async ({ + resource, + model, + newValue: value, +}) => { const provider = resource as V1beta1Provider; const vddkInitImage: string = value as string; let op: string;