diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesList.tsx index a3c48759c..756634bba 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OVirtVirtualMachinesList.tsx @@ -22,12 +22,12 @@ export const oVirtVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ }, { resourceFieldId: 'concerns', - jsonPath: '$.concerns', + jsonPath: (data: VmData) => (data.vm.providerType === 'ovirt' ? data?.vm?.concerns : []), label: t('Concerns'), isVisible: true, sortable: true, filter: { - type: 'enum', + type: 'concerns', primary: true, placeholderLabel: t('Concerns'), values: EnumToTuple({ Critical: 'Critical', Warning: 'Warning', Information: 'Information' }), diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/ProviderVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/ProviderVirtualMachinesList.tsx index d43c047bc..0d3169e11 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/ProviderVirtualMachinesList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/components/ProviderVirtualMachinesList.tsx @@ -4,8 +4,14 @@ import StandardPage from 'src/components/page/StandardPage'; import { ProviderData } from 'src/modules/Providers/utils'; import { useForkliftTranslation } from 'src/utils/i18n'; -import { loadUserSettings, ResourceFieldFactory, RowProps } from '@kubev2v/common'; -import { ProviderVirtualMachine } from '@kubev2v/types'; +import { + EnumFilter, + loadUserSettings, + ResourceFieldFactory, + RowProps, + ValueMatcher, +} from '@kubev2v/common'; +import { Concern, ProviderVirtualMachine } from '@kubev2v/types'; import { useInventoryVms } from '../utils/useInventoryVms'; @@ -49,6 +55,16 @@ export const ProviderVirtualMachinesList: React.FC ); }; + +const concernsMatcher: ValueMatcher = { + filterType: 'concerns', + matchValue: (concerns: Concern[]) => (filter: string) => + concerns.some(({ category }) => category === filter), +};