Skip to content

Commit

Permalink
Remove concerns prop from OpenshiftVM
Browse files Browse the repository at this point in the history
There is no validation for the OpenShift providers. The assumption is
that migrations are done between clusters that have the same
version of OpenShift and KubeVirt.

Reference-Url: https://github.com/kubev2v/forklift/blob/ea39abb9a03e788fd63af010e8d48944d38a1fbf/pkg/controller/provider/web/ocp/vm.go#L131
Signed-off-by: Radoslaw Szwajkowski <[email protected]>
  • Loading branch information
rszwajko committed Sep 27, 2023
1 parent 60b0969 commit 6e5209c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,6 @@ const openShiftVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [
},
sortable: true,
},
{
resourceFieldId: 'concerns',
jsonPath: '$.concerns',
label: t('Concerns'),
isVisible: true,
sortable: true,
filter: {
type: 'enum',
primary: true,
placeholderLabel: t('Concerns'),
values: EnumToTuple({ Critical: 'Critical', Warning: 'Warning', Information: 'Information' }),
},
},
{
resourceFieldId: 'status',
jsonPath: (data: VmData) => getVmPowerState(data?.vm),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import { ResourceField, RowProps } from '@kubev2v/common';
import { Td, Tr } from '@patternfly/react-table';

import { PowerStateCellRenderer } from './components/PowerStateCellRenderer';
import { VMCellProps, VMConcernsCellRenderer, VmData, VMNameCellRenderer } from './components';
import { VMCellProps, VmData, VMNameCellRenderer } from './components';

const cellRenderers: Record<string, React.FC<VMCellProps>> = {
name: VMNameCellRenderer,
concerns: VMConcernsCellRenderer,
status: PowerStateCellRenderer,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ import { VMCellProps } from './VMCellProps';
* @returns {ReactElement} The rendered table cell.
*/
export const VMConcernsCellRenderer: React.FC<VMCellProps> = ({ data }) => {
const groupedConcerns = groupConcernsByCategory(data?.vm?.concerns);
const concerns = data?.vm?.providerType === 'openshift' ? [] : data?.vm?.concerns;

const groupedConcerns = groupConcernsByCategory(concerns);

return (
<TableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ProviderVirtualMachine } from '@kubev2v/types';
type ConcernCategory = 'Critical' | 'Warning' | 'Information';

export const getHighestPriorityConcern = (vm: ProviderVirtualMachine): ConcernCategory => {
if (!vm?.concerns) {
if (vm?.providerType === 'openshift' || !vm?.concerns) {
return undefined;
}

Expand Down
2 changes: 0 additions & 2 deletions packages/types/src/types/provider/openshift/VM.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { V1VirtualMachine } from '../../k8s/V1VirtualMachine';
import { Concern } from '../base';

import { TypedOpenshiftResource } from './TypedResource';

// https://github.com/kubev2v/forklift/blob/main/pkg/controller/provider/web/ocp/vm.go
export interface OpenshiftVM extends TypedOpenshiftResource {
concerns: Concern[];
object: V1VirtualMachine;
}

0 comments on commit 6e5209c

Please sign in to comment.