From 87ff4add7b6656bcd636ed454865293c07a5b97f Mon Sep 17 00:00:00 2001 From: Radoslaw Szwajkowski Date: Fri, 29 Sep 2023 14:05:57 +0200 Subject: [PATCH] Retrieve concerns prop via jsonpath Signed-off-by: Radoslaw Szwajkowski --- .../details/tabs/VirtualMachines/OVirtVirtualMachinesList.tsx | 2 +- .../tabs/VirtualMachines/OpenStackVirtualMachinesList.tsx | 2 +- .../details/tabs/VirtualMachines/OvaVirtualMachinesList.tsx | 4 ++-- .../tabs/VirtualMachines/VSphereVirtualMachinesList.tsx | 2 +- .../components/ProviderVirtualMachinesList.tsx | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) 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 5afc2ff85..a001d110f 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,7 +22,7 @@ export const oVirtVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ }, { resourceFieldId: 'concerns', - jsonPath: (data: VmData) => (data.vm.providerType === 'ovirt' ? data?.vm?.concerns : []), + jsonPath: '$.vm.concerns', label: t('Concerns'), isVisible: true, sortable: true, diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OpenStackVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OpenStackVirtualMachinesList.tsx index 11ceec0ca..ff392e83c 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OpenStackVirtualMachinesList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OpenStackVirtualMachinesList.tsx @@ -22,7 +22,7 @@ export const openStackVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ }, { resourceFieldId: 'concerns', - jsonPath: (data: VmData) => (data.vm.providerType === 'openstack' ? data?.vm?.concerns : []), + jsonPath: '$.vm.concerns', label: t('Concerns'), isVisible: true, sortable: true, diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesList.tsx index 2f542b65d..8597a3008 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/OvaVirtualMachinesList.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { EnumToTuple, ResourceFieldFactory } from '@kubev2v/common'; -import { ProviderVirtualMachinesList, VmData } from './components'; +import { ProviderVirtualMachinesList } from './components'; import { OvaVirtualMachinesRow } from './OvaVirtualMachinesRow'; import { ProviderVirtualMachinesProps } from './ProviderVirtualMachines'; @@ -21,7 +21,7 @@ export const ovaVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ }, { resourceFieldId: 'concerns', - jsonPath: (data: VmData) => (data.vm.providerType === 'ova' ? data?.vm?.concerns : []), + jsonPath: '$.vm.concerns', label: t('Concerns'), isVisible: true, sortable: true, diff --git a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesList.tsx b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesList.tsx index ace8d7558..3da749ffe 100644 --- a/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesList.tsx +++ b/packages/forklift-console-plugin/src/modules/Providers/views/details/tabs/VirtualMachines/VSphereVirtualMachinesList.tsx @@ -22,7 +22,7 @@ export const vSphereVmFieldsMetadataFactory: ResourceFieldFactory = (t) => [ }, { resourceFieldId: 'concerns', - jsonPath: (data: VmData) => (data.vm.providerType === 'vsphere' ? data?.vm?.concerns : []), + jsonPath: '$.vm.concerns', label: t('Concerns'), isVisible: true, sortable: true, 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 60632ec67..964041aac 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 @@ -62,5 +62,5 @@ export const ProviderVirtualMachinesList: React.FC (filter: string) => - concerns.some(({ category }) => category === filter), + Array.isArray(concerns) && concerns.some(({ category }) => category === filter), };