catalog: changeset

Signed-off-by: GoFightNguyen <jsn.dev@outlook.com>
This commit is contained in:
GoFightNguyen
2023-12-24 23:25:19 +00:00
parent ebc733e677
commit e541c0ec55
+35
View File
@@ -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);
+ };
...
- <Route path="/catalog" element={<CatalogIndexPage />} />
+ <Route path="/catalog" element={<CatalogIndexPage columns={myColumnsFunc} />} />
```