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
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': patch
---
Allow the `spec.target` field to be searchable in the catalog table for locations. Previously, only the `spec.targets` field was be searchable. This makes locations generated by providers such as the `GithubEntityProvider` searchable in the catalog table. [#23098](https://github.com/backstage/backstage/issues/23098)
@@ -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) && (