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

Commit

Permalink
Adjustments w.r.t the new structure of the vm_id array retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
AparnaKarve committed Jul 9, 2018
1 parent 8228673 commit e6f6846
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ const MigrationsCompletedList = ({
const tasks = {};
let tasksOfPlan = {};
if (requestsOfAssociatedPlan.length > 0) {
tasksOfPlan = getMostRecentVMTasksFromRequests(requestsOfAssociatedPlan, plan.options.config_info.vm_ids);
tasksOfPlan = getMostRecentVMTasksFromRequests(
requestsOfAssociatedPlan,
plan.options.config_info.actions
);
} else if (mostRecentRequest) {
tasksOfPlan = mostRecentRequest.miq_request_tasks;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const MigrationsInProgressCard = ({ plan, allRequestsWithTasks, reloadCard, hand
const tasks = {};
let tasksOfPlan = {};
if (requestsOfAssociatedPlan.length > 0) {
tasksOfPlan = getMostRecentVMTasksFromRequests(requestsOfAssociatedPlan, plan.options.config_info.vm_ids);
tasksOfPlan = getMostRecentVMTasksFromRequests(requestsOfAssociatedPlan, plan.options.config_info.actions);
} else if (mostRecentRequest) {
tasksOfPlan = mostRecentRequest.miq_request_tasks;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import commonUtilitiesHelper from '../../../../common/commonUtilitiesHelper';

const getMostRecentVMTasksFromRequests = (requests, vm_ids) => {
const getMostRecentVMTasksFromRequests = (requests, actions) => {
const vm_ids = actions.map(a => a.vm_id);

const allTasks = requests.map(request => request.miq_request_tasks);

const flattenAllTasks = [];
Expand Down
6 changes: 3 additions & 3 deletions app/javascript/react/screens/App/Plan/PlanReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ const processVMTasks = vmTasks => {
return tasks;
};

const allVMTasksForRequestOfPlan = (requestWithTasks, vm_ids) => {
const tasksOfPlan = getMostRecentVMTasksFromRequests(requestWithTasks, vm_ids);
const allVMTasksForRequestOfPlan = (requestWithTasks, actions) => {
const tasksOfPlan = getMostRecentVMTasksFromRequests(requestWithTasks, actions);
return processVMTasks(tasksOfPlan);
};

Expand Down Expand Up @@ -129,7 +129,7 @@ export default (state = initialState, action) => {
return state
.set(
'planRequestTasks',
allVMTasksForRequestOfPlan(action.payload.data.results, state.plan.options.config_info.vm_ids)
allVMTasksForRequestOfPlan(action.payload.data.results, state.plan.options.config_info.actions)
)
.set('allRequestsWithTasksForPlan', action.payload.data.results)
.set('planRequestPreviouslyFetched', true)
Expand Down

0 comments on commit e6f6846

Please sign in to comment.