Skip to content

Commit

Permalink
add functionality for filtering general
Browse files Browse the repository at this point in the history
  • Loading branch information
mrCherry97 committed Oct 17, 2023
1 parent 2af0d7e commit e170b71
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/components/Extensibility/ExtensibilityList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e170b71

Please sign in to comment.