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

Commit

Permalink
Revert "Using queryPlanVmsAction"
Browse files Browse the repository at this point in the history
This reverts commit 7fc262b.
  • Loading branch information
mturley committed Aug 31, 2018
1 parent 7fc262b commit 0cf2eb4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ import CSVDropzoneField from './components/CSVDropzoneField';

class PlanWizardVMStep extends React.Component {
componentDidMount() {
const { vm_choice_radio, editingPlan, queryPlanVmsAction } = this.props;
const { vm_choice_radio } = this.props;
if (vm_choice_radio === 'vms_via_discovery') {
this.validateVms();
}
if (editingPlan && editingPlan.options && editingPlan.options.config_info && editingPlan.options.config_info.actions) {
const vmIds = editingPlan.options.config_info.actions.map(action => action.vm_id);
queryPlanVmsAction(vmIds);
}
}
componentDidUpdate(prevProps) {
const { vm_choice_radio } = this.props;
Expand Down Expand Up @@ -50,9 +46,7 @@ class PlanWizardVMStep extends React.Component {
conflict_vms,
validationServiceCalled,
csvImportAction,
editingPlan,
isQueryingVms,
queryVms
editingPlan
} = this.props;
const discoveryMode = vm_choice_radio === 'vms_via_discovery';

Expand Down Expand Up @@ -86,7 +80,7 @@ class PlanWizardVMStep extends React.Component {
</div>
</div>
);
} else if ((isValidatingVms || !validationServiceCalled || (editingPlan && isQueryingVms)) && discoveryMode) {
} else if ((isValidatingVms || !validationServiceCalled) && discoveryMode) {
return (
<div className="blank-slate-pf">
<div className="spinner spinner-lg blank-slate-pf-icon" />
Expand All @@ -113,14 +107,10 @@ class PlanWizardVMStep extends React.Component {
const validVms = Immutable.asMutable(valid_vms, { deep: true });
const inValidsVms = Immutable.asMutable(invalid_vms, { deep: true });
const conflictVms = Immutable.asMutable(conflict_vms, { deep: true });
// TODO [mturley] look up and include VMs from editingPlan.options.config_info.actions
const validVmsWithSelections = discoveryMode ? validVms : validVms.map(vm => ({ ...vm, selected: true }));
const preselectedVms = editingPlan ? queryVms.map(vm => ({
...vm,
selected: true,
valid: true,
reason: __('VM already present in Plan')
})) : [];
const combined = [...preselectedVms, ...inValidsVms, ...conflictVms, ...validVmsWithSelections];
const combined = [...inValidsVms, ...conflictVms, ...validVmsWithSelections];

if (combined.length) {
return (
<React.Fragment>
Expand Down Expand Up @@ -174,10 +164,7 @@ PlanWizardVMStep.propTypes = {
valid_vms: PropTypes.array,
invalid_vms: PropTypes.array,
conflict_vms: PropTypes.array,
editingPlan: PropTypes.object,
queryPlanVmsAction: PropTypes.func.isRequired,
queryVms: PropTypes.array,
isQueryingVms: PropTypes.bool
editingPlan: PropTypes.object
};

PlanWizardVMStep.defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import URI from 'urijs';
import API from '../../../../../../../../common/API';
import { V2V_VM_STEP_RESET, V2V_VALIDATE_VMS } from './PlanWizardVMStepConstants';

export { queryPlanVmsAction } from '../../../../../Plan/PlanActions';

const _validateVmsActionCreator = (url, vms) => dispatch => {
const postBody = {
action: 'validate_vms',
Expand Down Expand Up @@ -40,4 +38,4 @@ export const csvParseErrorAction = errMsg => dispatch => {
type: `${V2V_VALIDATE_VMS}_CSV_PARSE_ERROR`,
payload: errMsg
});
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@ import { findEditingPlan } from '../../PlanWizardSelectors';

export const reducers = { planWizardVMStep: reducer };

const mapStateToProps = ({ planWizardVMStep, form, overview, plan }, ownProps) => ({
const mapStateToProps = ({ planWizardVMStep, form, overview }, ownProps) => ({
...planWizardVMStep,
...ownProps.data,
vm_choice_radio: form.planWizardGeneralStep.values.vm_choice_radio,
infrastructure_mapping_id: form.planWizardGeneralStep.values.infrastructure_mapping,
editingPlan: findEditingPlan(overview.transformationPlans, overview.editingPlanId),
queryVms: plan.vms,
isQueryingVms: plan.isQueryingVms
editingPlan: findEditingPlan(overview.transformationPlans, overview.editingPlanId)
});

export default connect(
Expand Down

0 comments on commit 0cf2eb4

Please sign in to comment.