-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add disk validation to virtual hardware
Signed-off-by: Ido Rosenzwig <irosenzw@redhat.com>
- Loading branch information
Showing
12 changed files
with
93 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ugin/src/components/create-vm-wizard/redux/validations/virtual-hardware-tab-validation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { VMWizardTab } from '../../types'; | ||
import { InternalActionType, UpdateOptions } from '../types'; | ||
import { vmWizardInternalActions } from '../internal-actions'; | ||
import { iGetIn } from '../../../../utils/immutable'; | ||
import { checkTabValidityChanged } from '../../selectors/immutable/selectors'; | ||
import { iGetStorages } from '../../selectors/immutable/storage'; | ||
|
||
export const setVirtualHardwareTabValidity = (options: UpdateOptions) => { | ||
const { id, dispatch, getState } = options; | ||
const state = getState(); | ||
|
||
const iStorages = iGetStorages(state, id).filter((iStorage) => | ||
iGetIn(iStorage, ['disk', 'cdrom']), | ||
); | ||
|
||
const hasAllRequiredFilled = iStorages.every((iStorage) => | ||
iGetIn(iStorage, ['validation', 'hasAllRequiredFilled']), | ||
); | ||
|
||
let isValid = hasAllRequiredFilled; | ||
|
||
if (isValid) { | ||
isValid = iStorages.every((iStorage) => iGetIn(iStorage, ['validation', 'isValid'])); | ||
} | ||
|
||
if ( | ||
checkTabValidityChanged( | ||
state, | ||
id, | ||
VMWizardTab.ADVANCED_VIRTUAL_HARDWARE, | ||
isValid, | ||
hasAllRequiredFilled, | ||
null, | ||
) | ||
) { | ||
dispatch( | ||
vmWizardInternalActions[InternalActionType.SetTabValidity]( | ||
id, | ||
VMWizardTab.ADVANCED_VIRTUAL_HARDWARE, | ||
isValid, | ||
hasAllRequiredFilled, | ||
null, | ||
), | ||
); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters