From 9454ef940c26d988ee47b8dc8d26ed439e66411d Mon Sep 17 00:00:00 2001 From: Lavanya Sainik Date: Mon, 24 Feb 2025 16:11:35 +0000 Subject: [PATCH] Added support for filtering based on system column in catalog table Signed-off-by: Lavanya Sainik --- .changeset/chilly-sheep-scream.md | 5 +++++ .../src/components/CatalogTable/columns.tsx | 15 +++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .changeset/chilly-sheep-scream.md diff --git a/.changeset/chilly-sheep-scream.md b/.changeset/chilly-sheep-scream.md new file mode 100644 index 0000000000..eb568ffd8f --- /dev/null +++ b/.changeset/chilly-sheep-scream.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': minor +--- + +Added support of filtering based on system columns in catalog table diff --git a/plugins/catalog/src/components/CatalogTable/columns.tsx b/plugins/catalog/src/components/CatalogTable/columns.tsx index d5362badda..d88cc9a77d 100644 --- a/plugins/catalog/src/components/CatalogTable/columns.tsx +++ b/plugins/catalog/src/components/CatalogTable/columns.tsx @@ -62,6 +62,21 @@ export const columnFactories = Object.freeze({ return { title: 'System', field: 'resolved.partOfSystemRelationTitle', + customFilterAndSearch: (query, row) => { + let systems: JsonArray = []; + if ( + row.entity?.spec?.system && + Array.isArray(row.entity?.spec?.system) + ) { + systems = row.entity?.spec?.system; + } else if (row.entity?.spec?.system) { + systems = [row.entity?.spec?.system]; + } + return systems + .join(', ') + .toLocaleUpperCase('en-US') + .includes(query.toLocaleUpperCase('en-US')); + }, render: ({ resolved }) => (