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

Commit

Permalink
Merge pull request #691 from AparnaKarve/fix_edit_plan_with_same_vms_…
Browse files Browse the repository at this point in the history
…in_csv

Fix VM validity during Plan Edit

(cherry picked from commit d48f78d)
  • Loading branch information
michaelkro authored and simaishi committed Oct 25, 2018
1 parent bdf1494 commit f2c4ceb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ class PlanWizardVMStep extends React.Component {
}
}
onCSVParseSuccess = parsedRows => {
const { infrastructure_mapping_id, validateVmsUrl, validateVmsAction } = this.props;
const { infrastructure_mapping_id, validateVmsUrl, validateVmsAction, editingPlan } = this.props;
// skip the header row
parsedRows.shift();
validateVmsAction(validateVmsUrl, infrastructure_mapping_id, parsedRows);
validateVmsAction(validateVmsUrl, infrastructure_mapping_id, parsedRows, editingPlan && editingPlan.id);
};
onCSVParseFailure = errMsg => {
const { csvParseErrorAction } = this.props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@ import { V2V_VM_STEP_RESET, V2V_VALIDATE_VMS, QUERY_V2V_PLAN_VMS } from './PlanW

export { showConfirmModalAction, hideConfirmModalAction } from '../../../../OverviewActions';

const _validateVmsActionCreator = (url, vms) => dispatch => {
const postBody = {
const _validateVmsActionCreator = (url, vms, planId) => dispatch => {
let postBody = {
action: 'validate_vms',
import: vms
};
if (planId) {
postBody = { ...postBody, service_template_id: planId };
}
dispatch({
type: V2V_VALIDATE_VMS,
payload: new Promise((resolve, reject) => {
Expand All @@ -24,10 +27,10 @@ const _validateVmsActionCreator = (url, vms) => dispatch => {
});
};

export const validateVmsAction = (url, id, vms) => {
export const validateVmsAction = (url, id, vms, planId) => {
const uri = new URI(`${url}/${id}`);

return _validateVmsActionCreator(uri.toString(), vms);
return _validateVmsActionCreator(uri.toString(), vms, planId);
};

export const csvImportAction = () => dispatch => {
Expand Down

0 comments on commit f2c4ceb

Please sign in to comment.