This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pre-fill selections in Advanced Options step
- Loading branch information
Showing
6 changed files
with
49 additions
and
16 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
1 change: 0 additions & 1 deletion
1
...Wizard/components/PlanWizardAdvancedOptionsStep/PlanWizardAdvancedOptionsStepSelectors.js
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
...reens/App/Overview/screens/PlanWizard/components/PlanWizardAdvancedOptionsStep/helpers.js
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,20 @@ | ||
export const getVMStepSelectedVms = (allVms, selectedVms) => allVms.filter(vm => selectedVms.includes(vm.id)); | ||
|
||
// Property can be 'pre_service' or 'post_service'. | ||
// Returns an array of vm ids which have a truthy value for that property in the plan being edited. | ||
export const getVmIdsWithProperty = (editingPlan, property) => { | ||
const actions = editingPlan && editingPlan.options && editingPlan.options.config_info && editingPlan.options.config_info.actions; | ||
if (!actions) return []; | ||
const actionsWithProperty = actions.filter(action => action[property]); | ||
return actionsWithProperty.map(action => action.vm_id); | ||
}; | ||
|
||
export const preselectPlaybooksForVms = (editingPlan, vms) => { | ||
const vmIdsWithPreService = getVmIdsWithProperty(editingPlan, 'pre_service'); | ||
const vmIdsWithPostService = getVmIdsWithProperty(editingPlan, 'post_service'); | ||
return vms.map(vm => ({ | ||
...vm, | ||
preMigration: vmIdsWithPreService.some(id => id === vm.id), | ||
postMigration: vmIdsWithPostService.some(id => id === vm.id) | ||
})); | ||
}; |
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