Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
Remove corresponding VMs when clearing a playbook
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelkro committed Jun 21, 2018
1 parent 185b240 commit c8c6502
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ class PlanWizardAdvancedOptionsStep extends Component {
getPlaybooksActionCreator();
}

onSelectChange = (event, scheduleType) => {
if (event.target.value === '') {
const { change, setVmsAction, vms } = this.props;
change(`playbookVms.${scheduleType}`, []);
setVmsAction(vms.map(vm => ({ ...vm, [scheduleType]: false })));
}
};

render() {
const {
playbooks,
Expand All @@ -43,6 +51,7 @@ class PlanWizardAdvancedOptionsStep extends Component {
stacked_label
controlWidth={12}
allowClear
onChange={event => this.onSelectChange(event, 'preMigration')}
/>
<Field
name="postMigrationPlaybook"
Expand All @@ -54,6 +63,7 @@ class PlanWizardAdvancedOptionsStep extends Component {
stacked_label
controlWidth={12}
allowClear
onChange={event => this.onSelectChange(event, 'postMigration')}
/>
</Form>
)}
Expand Down Expand Up @@ -91,7 +101,8 @@ PlanWizardAdvancedOptionsStep.propTypes = {
advancedOptionsStepForm: PropTypes.object,
vms: PropTypes.array,
setVmsAction: PropTypes.func,
vmStepSelectedVms: PropTypes.array
vmStepSelectedVms: PropTypes.array,
change: PropTypes.func
};

export default reduxForm({
Expand Down

0 comments on commit c8c6502

Please sign in to comment.