From 530b6f364c8c27543275cf61ea8667f520626f64 Mon Sep 17 00:00:00 2001 From: Jordan Snow Date: Wed, 17 May 2023 13:04:50 -0400 Subject: [PATCH] Adding info on entities selected to catalog table title Signed-off-by: Jordan Snow --- .changeset/tiny-shrimps-beam.md | 5 +++++ .../src/components/CatalogTable/CatalogTable.test.tsx | 7 ++++++- .../catalog/src/components/CatalogTable/CatalogTable.tsx | 7 +++++-- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 .changeset/tiny-shrimps-beam.md diff --git a/.changeset/tiny-shrimps-beam.md b/.changeset/tiny-shrimps-beam.md new file mode 100644 index 0000000000..b538d465f9 --- /dev/null +++ b/.changeset/tiny-shrimps-beam.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog': patch +--- + +Adding in type and kind entity details to catalog table title for user clarity diff --git a/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx b/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx index c80b340349..c242372a97 100644 --- a/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx +++ b/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx @@ -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(); diff --git a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx index 3d0cc75f7c..bddf7715bf 100644 --- a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx +++ b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx @@ -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 ( 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}