Adding info on entities selected to catalog table title

Signed-off-by: Jordan Snow <jordans@spotify.com>
This commit is contained in:
Jordan Snow
2023-05-17 13:04:50 -04:00
parent d4c5b8a517
commit 530b6f364c
3 changed files with 16 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog': patch
---
Adding in type and kind entity details to catalog table title for user clarity
@@ -95,6 +95,11 @@ describe('CatalogTable component', () => {
() => false,
() => false,
),
kind: {
value: 'component',
getCatalogFilters: () => ({ kind: 'component' }),
toQueryValue: () => 'component',
},
},
}}
>
@@ -107,7 +112,7 @@ describe('CatalogTable component', () => {
},
},
);
expect(screen.getByText(/Owned \(3\)/)).toBeInTheDocument();
expect(screen.getByText(/Owned components \(3\)/)).toBeInTheDocument();
expect(screen.getByText(/component1/)).toBeInTheDocument();
expect(screen.getByText(/component2/)).toBeInTheDocument();
expect(screen.getByText(/component3/)).toBeInTheDocument();
@@ -226,7 +226,8 @@ export const CatalogTable = (props: CatalogTableProps) => {
typeColumn.hidden = !showTypeColumn;
}
const showPagination = rows.length > 20;
const currentKind = filters.kind?.value || '';
const currentType = filters.type?.value || '';
return (
<Table<CatalogTableRow>
isLoading={loading}
@@ -241,7 +242,9 @@ export const CatalogTable = (props: CatalogTableProps) => {
pageSizeOptions: [20, 50, 100],
...tableOptions,
}}
title={`${titlePreamble} (${entities.length})`}
title={`${titlePreamble} ${currentType} ${currentKind}${
currentKind ? 's' : ''
} (${entities.length})`}
data={rows}
actions={actions || defaultActions}
subtitle={subtitle}