diff --git a/packages/forklift-console-plugin/src/modules/Plans/actions/PlanActionsDropdownItems.tsx b/packages/forklift-console-plugin/src/modules/Plans/actions/PlanActionsDropdownItems.tsx index 1a86e7661..3d22954f5 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/actions/PlanActionsDropdownItems.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/actions/PlanActionsDropdownItems.tsx @@ -14,7 +14,14 @@ import { PlanDeleteModal, PlanStartMigrationModal, } from '../modals'; -import { canPlanReStart, canPlanStart, getPlanPhase, isPlanExecuting, PlanData } from '../utils'; +import { + canPlanReStart, + canPlanStart, + getPlanPhase, + isPlanArchived, + isPlanExecuting, + PlanData, +} from '../utils'; export const PlanActionsDropdownItems = ({ data }: PlanActionsDropdownItemsProps) => { const { t } = useForkliftTranslation(); @@ -33,6 +40,7 @@ export const PlanActionsDropdownItems = ({ data }: PlanActionsDropdownItemsProps const canStart = canPlanStart(plan); const canReStart = canPlanReStart(plan); const isWarmAndExecuting = plan?.spec?.warm && isPlanExecuting(plan); + const isArchived = isPlanArchived(plan); const buttonStartLabel = canReStart ? t('Restart migration') : t('Start migration'); @@ -67,7 +75,11 @@ export const PlanActionsDropdownItems = ({ data }: PlanActionsDropdownItemsProps {buttonStartLabel} , - + {t('Cutover')} , diff --git a/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/getPlanPhase.ts b/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/getPlanPhase.ts index 44dd18a5b..c5712f3c8 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/getPlanPhase.ts +++ b/packages/forklift-console-plugin/src/modules/Plans/utils/helpers/getPlanPhase.ts @@ -117,5 +117,11 @@ export const isPlanEditable = (plan: V1beta1Plan) => { ); }; +export const isPlanArchived = (plan: V1beta1Plan) => { + const planStatus = getPlanPhase({ obj: plan }); + + return planStatus === 'Archiving' || planStatus === 'Archived'; +}; + const getConditions = (obj: V1beta1Plan) => obj?.status?.conditions?.filter((c) => c.status === 'True').map((c) => c.type); diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/list/components/ActionsCell.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/list/components/ActionsCell.tsx index a75a4d885..8a9fe3527 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/list/components/ActionsCell.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/list/components/ActionsCell.tsx @@ -1,7 +1,12 @@ import React from 'react'; import { PlanActionsDropdown } from 'src/modules/Plans/actions'; import { PlanCutoverMigrationModal, PlanStartMigrationModal } from 'src/modules/Plans/modals'; -import { canPlanReStart, canPlanStart, isPlanExecuting } from 'src/modules/Plans/utils'; +import { + canPlanReStart, + canPlanStart, + isPlanArchived, + isPlanExecuting, +} from 'src/modules/Plans/utils'; import { useModal } from 'src/modules/Providers/modals'; import { useForkliftTranslation } from 'src/utils/i18n'; @@ -23,6 +28,7 @@ export const ActionsCell = ({ data }: CellProps) => { const canReStart = canPlanReStart(plan); const isWarmAndExecuting = plan?.spec?.warm && isPlanExecuting(plan); + const isArchived = isPlanArchived(plan); const buttonStartLabel = canReStart ? t('Restart') : t('Start'); const buttonStartIcon = canReStart ? : ; @@ -50,7 +56,7 @@ export const ActionsCell = ({ data }: CellProps) => { )} - {isWarmAndExecuting && ( + {isWarmAndExecuting && !isArchived && (