From e170b719ca51d729d35ef87fdee5f7b54ff9a5d2 Mon Sep 17 00:00:00 2001 From: mrCherry97 Date: Tue, 17 Oct 2023 13:18:58 +0200 Subject: [PATCH] add functionality for filtering general --- src/components/Extensibility/ExtensibilityList.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/Extensibility/ExtensibilityList.js b/src/components/Extensibility/ExtensibilityList.js index 56cb066575..6974c8cad9 100644 --- a/src/components/Extensibility/ExtensibilityList.js +++ b/src/components/Extensibility/ExtensibilityList.js @@ -32,7 +32,8 @@ export const ExtensibilityListCore = ({ const { t: tBusola } = useTranslation(); const jsonata = useJsonata({}); - const { resource, description, features } = resMetaData?.general ?? {}; + const { resource, description, features, filter } = + resMetaData?.general ?? {}; const { disableCreate, disableEdit, disableDelete } = features?.actions ?? { disableCreate: props.disableCreate, @@ -85,9 +86,12 @@ export const ExtensibilityListCore = ({ })) : []; - const isFilterAString = typeof resMetaData?.resource?.filter === 'string'; + const isFilterAString = + typeof resMetaData?.resource?.filter === 'string' || + typeof filter === 'string'; + const filterFn = value => - applyFormula(value, resMetaData.resource.filter, tBusola); + applyFormula(value, resMetaData?.resource?.filter || filter, tBusola); listProps.filter = isFilterAString ? filterFn : filterFunction; const sortOptions = (resMetaData?.list || []).filter(element => element.sort);