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

Fix VM validity during Plan Edit #691

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,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