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 28, 2023
1 parent 60b0969 commit 4683337
Show file tree
Hide file tree
Showing 5 changed files with 7 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
@@ -1,6 +1,6 @@
import React from 'react';
import { TFunction } from 'react-i18next';
import { TableCell } from 'src/modules/Providers/utils';
import { TableCell, TableEmptyCell } from 'src/modules/Providers/utils';
import { useForkliftTranslation } from 'src/utils/i18n';

import { Concern } from '@kubev2v/types';
Expand All @@ -20,6 +20,10 @@ import { VMCellProps } from './VMCellProps';
* @returns {ReactElement} The rendered table cell.
*/
export const VMConcernsCellRenderer: React.FC<VMCellProps> = ({ data }) => {
if (data?.vm?.providerType === 'openshift') {
return <TableEmptyCell />;
}

const groupedConcerns = groupConcernsByCategory(data?.vm?.concerns);

return (
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 4683337

Please sign in to comment.