diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard-footer.scss b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard-footer.scss new file mode 100644 index 00000000000..ffcc6ddfc02 --- /dev/null +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard-footer.scss @@ -0,0 +1,5 @@ +.kubevirt-create-vm-modal__footer-error { + width: 100%; + margin-bottom: 1em; + align-items: center; +} diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard-footer.tsx b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard-footer.tsx new file mode 100644 index 00000000000..1e47213f406 --- /dev/null +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard-footer.tsx @@ -0,0 +1,140 @@ +import * as React from 'react'; +import { connect } from 'react-redux'; +import { css } from '@patternfly/react-styles'; +import styles from '@patternfly/react-styles/css/components/Wizard/wizard'; +import { + Alert, + Button, + ButtonVariant, + WizardContextConsumer, + WizardStep, +} from '@patternfly/react-core'; +import * as _ from 'lodash'; +import { ALL_VM_WIZARD_TABS, VMWizardTab } from './types'; +import { + hasStepAllRequiredFilled, + isStepLocked, + isStepValid, +} from './selectors/immutable/wizard-selectors'; +import { iGetCreateVMWizardTabs } from './selectors/immutable/selectors'; +import { REVIEW_AND_CREATE } from './strings/strings'; + +import './create-vm-wizard-footer.scss'; + +type WizardContext = { + onNext: () => void; + onBack: () => void; + onClose: () => void; + activeStep: WizardStep; + goToStepById: (id: number | string) => void; +}; +type CreateVMWizardFooterComponentProps = { + stepData: any; + createVMText: string; +}; + +const CreateVMWizardFooterComponent: React.FC = ({ + stepData, + createVMText, +}) => { + const [showError, setShowError] = React.useState(false); + const [prevIsValid, setPrevIsValid] = React.useState(false); + + return ( + + {({ onNext, onBack, onClose, activeStep, goToStepById }: WizardContext) => { + const activeStepID = activeStep.id as VMWizardTab; + const isLocked = _.some(ALL_VM_WIZARD_TABS, (id) => isStepLocked(stepData, id)); + const isValid = isStepValid(stepData, activeStepID); + + if (isValid !== prevIsValid) { + setPrevIsValid(isValid); + if (isValid) { + setShowError(false); + } + } + + const isFirstStep = activeStepID === VMWizardTab.VM_SETTINGS; + const isFinishingStep = [VMWizardTab.REVIEW, VMWizardTab.RESULT].includes(activeStepID); + const isLastStep = activeStepID === VMWizardTab.RESULT; + + const isNextButtonDisabled = isLocked; + const isBackButtonDisabled = isFirstStep || isLocked; + + return ( +
+ {!isValid && showError && ( + + )} + {!isLastStep && ( + + )} + {!isFinishingStep && ( + + )} + {!activeStep.hideBackButton && !isLastStep && ( + + )} + {!activeStep.hideCancelButton && ( + + )} +
+ ); + }} +
+ ); +}; + +const stateToProps = (state, { wizardReduxId }) => ({ + stepData: iGetCreateVMWizardTabs(state, wizardReduxId), +}); + +export const CreateVMWizardFooter = connect(stateToProps)(CreateVMWizardFooterComponent); diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard.tsx b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard.tsx index 4af2ea47dd0..00eaf04641d 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard.tsx +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/create-vm-wizard.tsx @@ -45,18 +45,14 @@ import { VMWizardProps, VMWizardTab, } from './types'; -import { - CREATE_VM, - CREATE_VM_TEMPLATE, - REVIEW_AND_CREATE, - TabTitleResolver, -} from './strings/strings'; +import { CREATE_VM, CREATE_VM_TEMPLATE, TabTitleResolver } from './strings/strings'; import { vmWizardActions } from './redux/actions'; import { ActionType } from './redux/types'; import { iGetCommonData, iGetCreateVMWizardTabs } from './selectors/immutable/selectors'; import { isStepLocked, isStepValid } from './selectors/immutable/wizard-selectors'; import { VMSettingsTab } from './tabs/vm-settings-tab/vm-settings-tab'; import { ResourceLoadErrors } from './resource-load-errors'; +import { CreateVMWizardFooter } from './create-vm-wizard-footer'; import './create-vm-wizard.scss'; @@ -93,6 +89,7 @@ export class CreateVMWizardComponent extends React.Component getResults(enhancedK8sMethods)) .catch((error) => cleanupAndGetResults(enhancedK8sMethods, error)) - .then(({ results, valid }) => this.props.onResultsChanged(errorsFirstSort(results), valid)) // TODO should distinguish between errors and objects in redux + .then(({ results, isValid }) => + this.props.onResultsChanged(errorsFirstSort(results), isValid), + ) // TODO should distinguish between errors and objects in redux .catch((e) => console.error(e)); // eslint-disable-line no-console } render() { - const { isCreateTemplate, stepData } = this.props; - const createVmText = isCreateTemplate ? CREATE_VM_TEMPLATE : CREATE_VM; + const { isCreateTemplate, reduxID, stepData } = this.props; + const createVMText = isCreateTemplate ? CREATE_VM_TEMPLATE : CREATE_VM; if (this.isClosed) { return null; @@ -145,11 +144,10 @@ export class CreateVMWizardComponent extends React.Component - - + + ), - nextButtonText: REVIEW_AND_CREATE, }, // { // id: VMWizardTab.NETWORKS, @@ -159,7 +157,6 @@ export class CreateVMWizardComponent extends React.ComponentVM review, }, { @@ -179,31 +176,38 @@ export class CreateVMWizardComponent extends React.Component {!isStepValid(stepData, VMWizardTab.RESULT) && (
-

{createVmText}

+

{createVMText}

)} { if (id === VMWizardTab.RESULT) { this.finish(); } }} - steps={steps.map((step, idx) => { - const valid = isStepValid(stepData, step.id); - const prevStepValid = idx === 0 ? true : isStepValid(stepData, steps[idx - 1].id); - return { + steps={steps.reduce((stepAcc, step, idx) => { + const prevStep = stepAcc[idx - 1]; + const isPrevStepValid = idx === 0 ? true : isStepValid(stepData, prevStep.id); + const canJumpToPrevStep = idx === 0 ? true : prevStep.canJumpTo; + + stepAcc.push({ ...step, name: TabTitleResolver[step.id], - enableNext: !isLocked && valid, - canJumpTo: !isLocked && prevStepValid && step.id !== VMWizardTab.RESULT, - hideBackButton: isLocked, + canJumpTo: isStepLocked(stepData, VMWizardTab.RESULT) // request finished + ? step.id === VMWizardTab.RESULT + : !isLocked && + isPrevStepValid && + canJumpToPrevStep && + step.id !== VMWizardTab.RESULT, component: step.component, - }; - })} + }); + return stepAcc; + }, [])} + footer={} /> ); @@ -230,6 +234,9 @@ const wizardDispatchToProps = (dispatch, props) => ({ }), ); }, + lockTab: (tabID) => { + dispatch(vmWizardActions[ActionType.SetTabLocked](props.reduxId, tabID, true)); + }, onCommonDataChanged: (commonData: CommonData, changedCommonData: ChangedCommonData) => { dispatch( vmWizardActions[ActionType.UpdateCommonData](props.reduxID, commonData, changedCommonData), diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/actions.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/actions.ts index fa43557c765..5986ede8cfb 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/actions.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/actions.ts @@ -73,13 +73,16 @@ export const vmWizardActions: VMWizardActions = { updateAndValidateState({ id, dispatch, changedCommonData: changedProps, getState, prevState }); }, - [ActionType.SetNetworks]: (id, value: any, valid: boolean, locked: boolean) => (dispatch) => { - dispatch(vmWizardInternalActions[InternalActionType.SetNetworks](id, value, valid, locked)); + [ActionType.SetTabLocked]: (id, value: any, isLocked: boolean) => (dispatch) => { + dispatch(vmWizardInternalActions[InternalActionType.SetTabLocked](id, value, isLocked)); }, - [ActionType.SetStorages]: (id, value: any, valid: boolean, locked: boolean) => (dispatch) => { - dispatch(vmWizardInternalActions[InternalActionType.SetStorages](id, value, valid, locked)); + [ActionType.SetNetworks]: (id, value: any, isValid: boolean, isLocked: boolean) => (dispatch) => { + dispatch(vmWizardInternalActions[InternalActionType.SetNetworks](id, value, isValid, isLocked)); }, - [ActionType.SetResults]: (id, value: any, valid: boolean) => (dispatch) => { - dispatch(vmWizardInternalActions[InternalActionType.SetResults](id, value, valid)); + [ActionType.SetStorages]: (id, value: any, isValid: boolean, isLocked: boolean) => (dispatch) => { + dispatch(vmWizardInternalActions[InternalActionType.SetStorages](id, value, isValid, isLocked)); + }, + [ActionType.SetResults]: (id, value: any, isValid: boolean) => (dispatch) => { + dispatch(vmWizardInternalActions[InternalActionType.SetResults](id, value, isValid)); }, }; diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/initial-state.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/initial-state.ts index 47b13a8a2f6..a85bb786017 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/initial-state.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/initial-state.ts @@ -21,5 +21,5 @@ export const getTabInitialState = (tabKey: VMWizardTab, props: CommonData) => { result = getter(props); } - return result || { value: {}, valid: false }; + return result || { value: {}, isValid: false, isLocked: false, hasAllRequiredFilled: false }; }; diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/networks-tab-initial-state.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/networks-tab-initial-state.ts index 20d079972d5..5e7ac74e70d 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/networks-tab-initial-state.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/networks-tab-initial-state.ts @@ -14,5 +14,6 @@ export const podNetwork = { export const getNetworksInitialState = () => ({ value: [podNetwork], - valid: true, + isValid: true, + hasAllRequiredFilled: true, }); diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/result-tab-initial-state.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/result-tab-initial-state.ts index 4f1a0b687fc..e0dfc089784 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/result-tab-initial-state.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/result-tab-initial-state.ts @@ -1,4 +1,4 @@ export const getResultInitialState = () => ({ value: {}, - valid: null, // result of the request + isValid: null, // result of the request }); diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/review-tab-initial-state.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/review-tab-initial-state.ts index a016e2bb030..41af58f215b 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/review-tab-initial-state.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/review-tab-initial-state.ts @@ -1,4 +1,5 @@ export const getReviewInitialState = () => ({ value: {}, - valid: true, + isValid: true, + hasAllRequiredFilled: true, }); diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/storage-tab-initial-state.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/storage-tab-initial-state.ts index de13ac8a42f..143fe5fa496 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/storage-tab-initial-state.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/storage-tab-initial-state.ts @@ -29,5 +29,6 @@ export const getInitialDisk = (provisionSource: ProvisionSource) => { export const getStorageInitialState = () => ({ value: [], - valid: true, // empty Storages are valid + isValid: true, // empty Storages are valid + hasAllRequiredFilled: true, }); diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/vm-settings-tab-initial-state.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/vm-settings-tab-initial-state.ts index 33ec043464f..ccd78d58327 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/vm-settings-tab-initial-state.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/initial-state/vm-settings-tab-initial-state.ts @@ -59,5 +59,5 @@ export const getInitialVmSettings = (common: CommonData) => { export const getVmSettingsInitialState = (props) => ({ value: getInitialVmSettings(props), - valid: false, + isValid: false, }); diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/internal-actions.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/internal-actions.ts index 9b14cfdf007..cd3ca6a4cb6 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/internal-actions.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/internal-actions.ts @@ -33,14 +33,28 @@ export const vmWizardInternalActions: VMWizardInternalActions = { }, type: InternalActionType.UpdateCommonData, }), - [InternalActionType.SetTabValidity]: (id, tab: VMWizardTab, valid: boolean) => ({ + [InternalActionType.SetTabValidity]: ( + id, + tab: VMWizardTab, + isValid: boolean, + hasAllRequiredFilled: boolean, + ) => ({ payload: { id, tab, - valid, + isValid, + hasAllRequiredFilled, }, type: InternalActionType.SetTabValidity, }), + [InternalActionType.SetTabLocked]: (id, tab: VMWizardTab, isLocked: boolean) => ({ + payload: { + id, + tab, + isLocked, + }, + type: InternalActionType.SetTabLocked, + }), [InternalActionType.SetVmSettingsFieldValue]: (id, key: VMSettingsField, value: string) => ({ payload: { id, @@ -79,29 +93,29 @@ export const vmWizardInternalActions: VMWizardInternalActions = { }, type: InternalActionType.UpdateVmSettings, }), - [InternalActionType.SetNetworks]: (id, value, valid: boolean, locked: boolean) => ({ + [InternalActionType.SetNetworks]: (id, value, isValid: boolean, isLocked: boolean) => ({ payload: { id, value, - valid, - locked, + isValid, + isLocked, }, type: InternalActionType.SetNetworks, }), - [InternalActionType.SetStorages]: (id, value, valid: boolean, locked: boolean) => ({ + [InternalActionType.SetStorages]: (id, value, isValid: boolean, isLocked: boolean) => ({ payload: { id, value, - valid, - locked, + isValid, + isLocked, }, type: InternalActionType.SetStorages, }), - [InternalActionType.SetResults]: (id, value, valid: boolean) => ({ + [InternalActionType.SetResults]: (id, value, isValid: boolean) => ({ payload: { id, value, - valid, + isValid, }, type: InternalActionType.SetResults, }), diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/reducers.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/reducers.ts index 9ca73dbde74..87c2afd76f1 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/reducers.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/reducers.ts @@ -15,7 +15,7 @@ const mergeDeepInSpecial = (state, path: string[], value) => return value; }); -const TAB_UPDATE_KEYS = ['value', 'valid', 'locked']; +const TAB_UPDATE_KEYS = ['value', 'isValid', 'isLocked', 'hasAllRequiredFilled']; const setTabKeys = (state, tab: VMWizardTab, action: WizardInternalAction) => TAB_UPDATE_KEYS.reduce((nextState, key) => { @@ -61,7 +61,14 @@ export default (state, action: WizardInternalAction) => { payload.value.dataIDReferences, ); case InternalActionType.SetTabValidity: - return state.setIn([dialogId, 'tabs', payload.tab, 'valid'], payload.valid); + return state + .setIn([dialogId, 'tabs', payload.tab, 'isValid'], payload.isValid) + .setIn( + [dialogId, 'tabs', payload.tab, 'hasAllRequiredFilled'], + payload.hasAllRequiredFilled, + ); + case InternalActionType.SetTabLocked: + return state.setIn([dialogId, 'tabs', payload.tab, 'isLocked'], payload.isLocked); case InternalActionType.SetVmSettingsFieldValue: return state.setIn( [dialogId, 'tabs', VMWizardTab.VM_SETTINGS, 'value', payload.key, 'value'], diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/types.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/types.ts index a6d0d21dee2..352e0ddea70 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/types.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/types.ts @@ -12,6 +12,7 @@ export enum ActionType { Dispose = 'KubevirtVMWizardDispose', UpdateCommonData = 'KubevirtVMWizardUpdateCommonData', SetVmSettingsFieldValue = 'KubevirtVMWizardSetVmSettingsFieldValue', + SetTabLocked = 'KubevirtVMWizardSetTabLocked', SetNetworks = 'KubevirtVMWizardSetNetworks', SetStorages = 'KubevirtVMWizardSetStorages', SetResults = 'KubevirtVMWizardSetResults', @@ -24,6 +25,7 @@ export enum InternalActionType { Update = 'KubevirtVMWizardUpdateInternal', UpdateCommonData = 'KubevirtVMWizardUpdateCommonData', SetTabValidity = 'KubevirtVMWizardSetTabValidityInternal', + SetTabLocked = 'KubevirtVMWizardSetTabLocked', SetVmSettingsFieldValue = 'KubevirtVMWizardSetVmSettingsFieldValueInternal', SetInVmSettings = 'KubevirtVMWizardSetInVmSettingsInternal', SetInVmSettingsBatch = 'KubevirtVMWizardSetInVmSettingsBatchInternal', @@ -39,8 +41,9 @@ export type WizardInternalAction = { payload: { id: string; value?: any; - valid?: boolean; - locked?: boolean; + isValid?: boolean; + isLocked?: boolean; + hasAllRequiredFilled?: boolean; path?: string[]; key?: VMSettingsField; tab?: VMWizardTab; diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/validations/vm-settings-tab-validation.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/validations/vm-settings-tab-validation.ts index fe073bfb274..36cdfebf344 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/validations/vm-settings-tab-validation.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/redux/validations/vm-settings-tab-validation.ts @@ -151,18 +151,24 @@ export const setVmSettingsTabValidity = (options: UpdateOptions) => { const vmSettings = iGetVmSettings(state, id); // check if all required fields are defined - let valid = vmSettings + const hasAllRequiredFilled = vmSettings .filter((field) => isFieldRequired(field)) .every((field) => field.get('value')); + let isValid = hasAllRequiredFilled; - if (valid) { + if (isValid) { // check if all fields are valid - valid = vmSettings.every( + isValid = vmSettings.every( (field) => field.getIn(['validation', 'type']) !== ValidationErrorType.Error, ); } dispatch( - vmWizardInternalActions[InternalActionType.SetTabValidity](id, VMWizardTab.VM_SETTINGS, valid), + vmWizardInternalActions[InternalActionType.SetTabValidity]( + id, + VMWizardTab.VM_SETTINGS, + isValid, + hasAllRequiredFilled, + ), ); }; diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/selectors/immutable/wizard-selectors.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/selectors/immutable/wizard-selectors.ts index a4520612037..0682b5de9bf 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/selectors/immutable/wizard-selectors.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/selectors/immutable/wizard-selectors.ts @@ -1,4 +1,6 @@ import { iGetIn } from '../../../../utils/immutable'; -export const isStepValid = (stepData, stepId: string) => !!iGetIn(stepData, [stepId, 'valid']); -export const isStepLocked = (stepData, stepId: string) => !!iGetIn(stepData, [stepId, 'locked']); +export const isStepValid = (stepData, stepId: string) => !!iGetIn(stepData, [stepId, 'isValid']); +export const isStepLocked = (stepData, stepId: string) => !!iGetIn(stepData, [stepId, 'isLocked']); +export const hasStepAllRequiredFilled = (stepData, stepId: string) => + !!iGetIn(stepData, [stepId, 'hasAllRequiredFilled']); diff --git a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/types.ts b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/types.ts index 9cc3830c026..17d24941cc5 100644 --- a/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/types.ts +++ b/frontend/packages/kubevirt-plugin/src/components/create-vm-wizard/types.ts @@ -103,5 +103,6 @@ export type CreateVMWizardComponentProps = { onInitialize: () => void; onClose: () => void; onCommonDataChanged: (commonData: CommonData, commonDataChanged: ChangedCommonData) => void; - onResultsChanged: (results, valid) => void; + onResultsChanged: (results, isValid) => void; + lockTab: (tabID: VMWizardTab) => void; }; diff --git a/frontend/packages/kubevirt-plugin/src/k8s/enhancedK8sMethods/k8sMethodsUtils.ts b/frontend/packages/kubevirt-plugin/src/k8s/enhancedK8sMethods/k8sMethodsUtils.ts index 3cea86fd1eb..b74be144554 100644 --- a/frontend/packages/kubevirt-plugin/src/k8s/enhancedK8sMethods/k8sMethodsUtils.ts +++ b/frontend/packages/kubevirt-plugin/src/k8s/enhancedK8sMethods/k8sMethodsUtils.ts @@ -39,7 +39,7 @@ type Result = { }; type ResultsWrapper = { - valid: boolean; + isValid: boolean; results: Result[]; }; @@ -100,13 +100,13 @@ export const cleanupAndGetResults = async ( } return { - valid: false, + isValid: false, results: [...errorResults, ...cleanupArray], }; }; export const getResults = (enhancedK8sMethods: EnhancedK8sMethods): ResultsWrapper => ({ - valid: true, + isValid: true, results: enhancedK8sMethods .getActualState() .map((obj) => k8sObjectToResult({ obj, content: obj, message: CREATED }))