catalog: export defaultCatalogTableColumnsFunc through CatalogTable.defaultColumnsFunc instead of directly
Signed-off-by: GoFightNguyen <jsn.dev@outlook.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
'@backstage/plugin-catalog': minor
|
||||
---
|
||||
|
||||
Exported `defaultCatalogTableColumnsFunc` to create a seam for defining the columns in `<CatalogTable />` of some Kinds while using the default columns for the others.
|
||||
Exported `CatalogTable.defaultColumnsFunc` to create a seam for defining the columns in `<CatalogTable />` 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
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
catalogPlugin,
|
||||
+ CatalogTable,
|
||||
+ CatalogTableColumnsFunc,
|
||||
+ defaultCatalogTableColumnsFunc,
|
||||
} from '@backstage/plugin-catalog';
|
||||
|
||||
+ const myColumnsFunc: CatalogTableColumnsFunc = (entityListContext) => {
|
||||
@@ -25,7 +24,7 @@ import {
|
||||
+ ];
|
||||
+ }
|
||||
+
|
||||
+ return defaultCatalogTableColumnsFunc(entityListContext);
|
||||
+ return CatalogTable.defaultColumnsFunc(entityListContext);
|
||||
+ };
|
||||
|
||||
...
|
||||
|
||||
@@ -182,6 +182,7 @@ export const CatalogTable: {
|
||||
): TableColumn<CatalogTableRow>;
|
||||
createNamespaceColumn(): TableColumn<CatalogTableRow>;
|
||||
}>;
|
||||
defaultColumnsFunc: CatalogTableColumnsFunc;
|
||||
};
|
||||
|
||||
// @public
|
||||
@@ -245,9 +246,6 @@ export interface DefaultCatalogPageProps {
|
||||
tableOptions?: TableProps<CatalogTableRow>['options'];
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export const defaultCatalogTableColumnsFunc: CatalogTableColumnsFunc;
|
||||
|
||||
// @public
|
||||
export class DefaultEntityPresentationApi implements EntityPresentationApi {
|
||||
static create(
|
||||
|
||||
@@ -226,6 +226,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
|
||||
};
|
||||
|
||||
CatalogTable.columns = columnFactories;
|
||||
CatalogTable.defaultColumnsFunc = defaultCatalogTableColumnsFunc;
|
||||
|
||||
function toEntityRow(entity: Entity) {
|
||||
const partOfSystemRelations = getEntityRelations(entity, RELATION_PART_OF, {
|
||||
|
||||
@@ -18,6 +18,8 @@ import { TableColumn } from '@backstage/core-components';
|
||||
import { columnFactories } from './columns';
|
||||
import { CatalogTableColumnsFunc, CatalogTableRow } from './types';
|
||||
|
||||
// The defaultCatalogTableColumnsFunc symbol is not directly exported, but through the
|
||||
// CatalogTable.defaultColumnsFunc field.
|
||||
/** @public */
|
||||
export const defaultCatalogTableColumnsFunc: CatalogTableColumnsFunc = ({
|
||||
filters,
|
||||
|
||||
@@ -15,6 +15,5 @@
|
||||
*/
|
||||
|
||||
export { CatalogTable } from './CatalogTable';
|
||||
export { defaultCatalogTableColumnsFunc } from './defaultCatalogTableColumnsFunc';
|
||||
export type { CatalogTableProps } from './CatalogTable';
|
||||
export type { CatalogTableRow, CatalogTableColumnsFunc } from './types';
|
||||
|
||||
Reference in New Issue
Block a user