From a274fe38b9351ba91ff1003cfe97e4646d720d5d Mon Sep 17 00:00:00 2001 From: David Weber Date: Mon, 27 Jun 2022 22:58:57 +0200 Subject: [PATCH] feat: add hidden title column to catalog and API table to enable filtering by title Signed-off-by: David Weber --- .changeset/silly-geese-design.md | 6 ++++++ .../ApiExplorerPage/DefaultApiExplorerPage.tsx | 1 + plugins/catalog/api-report.md | 7 +++++++ .../src/components/CatalogTable/CatalogTable.tsx | 1 + .../catalog/src/components/CatalogTable/columns.tsx | 10 ++++++++++ 5 files changed, 25 insertions(+) create mode 100644 .changeset/silly-geese-design.md diff --git a/.changeset/silly-geese-design.md b/.changeset/silly-geese-design.md new file mode 100644 index 0000000000..d4f8de2510 --- /dev/null +++ b/.changeset/silly-geese-design.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-api-docs': patch +'@backstage/plugin-catalog': minor +--- + +Add hidden title column to catalog and API table to enable filtering by title. diff --git a/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx b/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx index 9fc6b2c3c2..b0acd3567c 100644 --- a/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx +++ b/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx @@ -40,6 +40,7 @@ import React from 'react'; import { registerComponentRouteRef } from '../../routes'; const defaultColumns: TableColumn[] = [ + CatalogTable.columns.createTitleColumn({ hidden: true }), CatalogTable.columns.createNameColumn({ defaultKind: 'API' }), CatalogTable.columns.createSystemColumn(), CatalogTable.columns.createOwnerColumn(), diff --git a/plugins/catalog/api-report.md b/plugins/catalog/api-report.md index 0d2d611412..c5ee52df5c 100644 --- a/plugins/catalog/api-report.md +++ b/plugins/catalog/api-report.md @@ -136,6 +136,13 @@ export const CatalogTable: { createSpecLifecycleColumn(): TableColumn; createMetadataDescriptionColumn(): TableColumn; createTagsColumn(): TableColumn; + createTitleColumn( + options?: + | { + hidden?: boolean | undefined; + } + | undefined, + ): TableColumn; }>; }; diff --git a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx index 94ae7c47f4..96937c52c2 100644 --- a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx +++ b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx @@ -68,6 +68,7 @@ export const CatalogTable = (props: CatalogTableProps) => { const defaultColumns: TableColumn[] = useMemo(() => { return [ + columnFactories.createTitleColumn({ hidden: true }), columnFactories.createNameColumn({ defaultKind: filters.kind?.value }), ...createEntitySpecificColumns(), columnFactories.createMetadataDescriptionColumn(), diff --git a/plugins/catalog/src/components/CatalogTable/columns.tsx b/plugins/catalog/src/components/CatalogTable/columns.tsx index 0fb91d4f3f..d8b52e276e 100644 --- a/plugins/catalog/src/components/CatalogTable/columns.tsx +++ b/plugins/catalog/src/components/CatalogTable/columns.tsx @@ -131,4 +131,14 @@ export const columnFactories = Object.freeze({ ), }; }, + createTitleColumn(options?: { + hidden?: boolean; + }): TableColumn { + return { + title: 'Title', + field: 'entity.metadata.title', + hidden: options?.hidden, + searchable: true, + }; + }, });