Merge pull request #23226 from dotboris/searchable-location-target

Make `spec.target` searchable in catalog table for location
This commit is contained in:
Fredrik Adelöw
2024-02-27 14:26:39 +01:00
committed by GitHub
2 changed files with 20 additions and 0 deletions
@@ -86,6 +86,21 @@ export const columnFactories = Object.freeze({
return {
title: 'Targets',
field: 'entity.spec.targets',
customFilterAndSearch: (query, row) => {
let targets: JsonArray = [];
if (
row.entity?.spec?.targets &&
Array.isArray(row.entity?.spec?.targets)
) {
targets = row.entity?.spec?.targets;
} else if (row.entity?.spec?.target) {
targets = [row.entity?.spec?.target];
}
return targets
.join(', ')
.toLocaleUpperCase('en-US')
.includes(query.toLocaleUpperCase('en-US'));
},
render: ({ entity }) => (
<>
{(entity?.spec?.targets || entity?.spec?.target) && (