Skip to content

Commit

Permalink
Retrieve concerns prop via jsonpath
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslaw Szwajkowski <[email protected]>
  • Loading branch information
rszwajko committed Oct 2, 2023
1 parent 8756c93 commit 87ff4ad
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ export const ProviderVirtualMachinesList: React.FC<ProviderVirtualMachinesListPr
const concernsMatcher: ValueMatcher = {
filterType: 'concerns',
matchValue: (concerns: Concern[]) => (filter: string) =>
concerns.some(({ category }) => category === filter),
Array.isArray(concerns) && concerns.some(({ category }) => category === filter),
};

0 comments on commit 87ff4ad

Please sign in to comment.