From e541c0ec551cee11c12278ea865830f5c29c5f5a Mon Sep 17 00:00:00 2001 From: GoFightNguyen Date: Sun, 24 Dec 2023 23:25:19 +0000 Subject: [PATCH] catalog: changeset Signed-off-by: GoFightNguyen --- .changeset/seven-dots-serve.md | 35 ++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .changeset/seven-dots-serve.md diff --git a/.changeset/seven-dots-serve.md b/.changeset/seven-dots-serve.md new file mode 100644 index 0000000000..79f8f62abb --- /dev/null +++ b/.changeset/seven-dots-serve.md @@ -0,0 +1,35 @@ +--- +'@backstage/plugin-catalog': minor +--- + +Exported `defaultCatalogTableColumnsFunc` to create a seam for defining the columns in [CatalogTable](https://github.com/backstage/backstage/blob/master/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx) of some Kinds while using the default columns for the others. +This is useful for defining the columns of a custom Kind or to redefine the columns for a built-in Kind. + +```diff +// packages/app/src/App.tsx + +import { + CatalogEntityPage, + CatalogIndexPage, + catalogPlugin, ++ CatalogTable, ++ CatalogTableColumnsFunc, ++ defaultCatalogTableColumnsFunc, +} from '@backstage/plugin-catalog'; + ++ const myColumnsFunc: CatalogTableColumnsFunc = (entityListContext) => { ++ if (entityListContext.filters.kind?.value === 'MyKind') { ++ return [ ++ CatalogTable.columns.createNameColumn(), ++ CatalogTable.columns.createOwnerColumn() ++ ]; ++ } ++ ++ return defaultCatalogTableColumnsFunc(entityListContext); ++ }; + +... + +- } /> ++ } /> +```