diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/Migration/MigrationVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/Migration/MigrationVirtualMachinesList.tsx
index c1b778d78..1b8ecda33 100644
--- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/Migration/MigrationVirtualMachinesList.tsx
+++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/Migration/MigrationVirtualMachinesList.tsx
@@ -18,7 +18,7 @@ import {
import { useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk';
import { HelperText, HelperTextItem } from '@patternfly/react-core';
-import { MigrationVMsCancelButton } from '../components';
+import { MigrationVMsCancelButton, PlanVMsDeleteButton } from '../components';
import { PlanData, VMData } from '../types';
import { MigrationVirtualMachinesRow } from './MigrationVirtualMachinesRow';
@@ -162,11 +162,25 @@ export const MigrationVirtualMachinesList: FC<{ obj: PlanData }> = ({ obj }) =>
const isExecuting = isPlanExecuting(plan);
- const actions: PageGlobalActions = [
- ({ selectedIds }) => (
-
- ),
- ];
+ // If plan executing allow to cancel vms, o/w remove from plan
+ let actions: PageGlobalActions;
+ if (isExecuting) {
+ actions = [
+ ({ selectedIds }) => (
+
+ ),
+ ];
+ } else {
+ actions = [
+ ({ selectedIds }) => ,
+ ];
+ }
+
+ const canSelectWhenExecuting = (item: VMData) =>
+ item?.statusVM?.completed === undefined && isExecuting;
+
+ const canSelectWhenNotExecuting = (item: VMData) =>
+ (item?.statusVM?.started === undefined || item?.statusVM?.error !== undefined) && !isExecuting;
const props: PageWithSelectionProps = {
dataSource: [vmData || [], true, undefined],
@@ -183,7 +197,7 @@ export const MigrationVirtualMachinesList: FC<{ obj: PlanData }> = ({ obj }) =>
const extendedProps = {
...props,
toId: (item: VMData) => item?.specVM?.id,
- canSelect: (item: VMData) => item?.statusVM?.completed === undefined && isExecuting,
+ canSelect: (item: VMData) => canSelectWhenExecuting(item) || canSelectWhenNotExecuting(item),
onSelect: setSelectedIds,
selectedIds: selectedIds,
onExpand: setExpandedIds,
diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/PlanVirtualMachines.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/PlanVirtualMachines.tsx
index c0d8ccf6c..2acecd030 100644
--- a/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/PlanVirtualMachines.tsx
+++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/tabs/VirtualMachines/PlanVirtualMachines.tsx
@@ -1,6 +1,6 @@
import React from 'react';
import { RouteComponentProps } from 'react-router-dom';
-import { isPlanExecuting } from 'src/modules/Plans/utils';
+import { canPlanReStart, isPlanExecuting, isPlanSucceeded } from 'src/modules/Plans/utils';
import { useGetDeleteAndEditAccessReview } from 'src/modules/Providers/hooks';
import { ModalHOC } from 'src/modules/Providers/modals';
@@ -26,6 +26,10 @@ const PlanVirtualMachines_: React.FC = (props) => {
if (isPlanExecuting(plan)) {
return ;
+ } else if (isPlanSucceeded(plan)) {
+ return ;
+ } else if (canPlanReStart(plan)) {
+ return ;
} else {
return ;
}