-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
60 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React, { FC, PropsWithChildren } from 'react'; | ||
|
||
import { Spinner, SpinnerProps } from '@patternfly/react-core'; | ||
|
||
type LoadingSpinnerProps = PropsWithChildren & | ||
SpinnerProps & { | ||
isLoading: boolean; | ||
}; | ||
|
||
const LoadingSpinner: FC<LoadingSpinnerProps> = ({ isLoading, children, ...spinnerProps }) => | ||
isLoading ? <Spinner {...spinnerProps} /> : children; | ||
|
||
export default LoadingSpinner; |
14 changes: 0 additions & 14 deletions
14
packages/common/src/components/LoadingSpinner/LoadingSpinner.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/forklift-console-plugin/src/modules/Plans/actions/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { TFunction } from 'i18next'; | ||
|
||
import { PlanSummaryStatus } from '../utils'; | ||
|
||
export const getStartActionDescription = ( | ||
status: PlanSummaryStatus, | ||
isPlanValidating: boolean, | ||
t: TFunction, | ||
): string => { | ||
if (isPlanValidating) { | ||
return t('The plan is being validated'); | ||
} | ||
|
||
switch (status) { | ||
case PlanSummaryStatus.Archived: | ||
return t('Archived plans cannot be started'); | ||
case PlanSummaryStatus.Complete: | ||
return t('All VMs were migrated'); | ||
case PlanSummaryStatus.Running: | ||
return t('The plan is currently in progress'); | ||
case PlanSummaryStatus.CannotStart: | ||
return t('The plan cannot be started'); | ||
} | ||
}; | ||
|
||
export const getDuplicateActionDescription = ( | ||
status: PlanSummaryStatus, | ||
isPlanValidating: boolean, | ||
t: TFunction, | ||
): string => { | ||
if (isPlanValidating) { | ||
return t('The plan is being validated'); | ||
} | ||
|
||
if (status === PlanSummaryStatus.CannotStart) { | ||
return t('The plan cannot be duplicated'); | ||
} | ||
}; |
6 changes: 3 additions & 3 deletions
6
packages/forklift-console-plugin/src/modules/Plans/utils/helpers/getConditionTypes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { V1beta1Plan } from '@kubev2v/types'; | ||
|
||
import { PlanConditionStatus } from '../types/PlanCondition'; | ||
import { PlanConditionStatus, PlanConditionType } from '../types/PlanCondition'; | ||
|
||
/** | ||
* Gets a record of plan types with truthful ('True') statuses | ||
* @param plan V1beta1Plan | ||
* @returns Record<string, boolean> | ||
*/ | ||
export const getConditionTypes = (plan: V1beta1Plan): Record<string, boolean> => | ||
export const getConditionTypes = (plan: V1beta1Plan): Record<PlanConditionType, boolean> => | ||
plan?.status?.conditions?.reduce((acc, condition) => { | ||
if (condition.status === PlanConditionStatus.True) { | ||
acc[condition.type] = true; | ||
} | ||
|
||
return acc; | ||
}, {}); | ||
}, {} as Record<PlanConditionType, boolean>); |