diff --git a/plugins/catalog/api-report.md b/plugins/catalog/api-report.md index f1a704e0d4..76aa64b6a3 100644 --- a/plugins/catalog/api-report.md +++ b/plugins/catalog/api-report.md @@ -181,12 +181,15 @@ export const CatalogTable: { }>; }; +// @public +export type CatalogTableColumnsFunc = ( + entityListContext: EntityListContextProps, +) => TableColumn[]; + // @public export interface CatalogTableProps { // (undocumented) actions?: TableProps['actions']; - // Warning: (ae-forgotten-export) The symbol "CatalogTableColumnsFunc" needs to be exported by the entry point index.d.ts - // // (undocumented) columns?: TableColumn[] | CatalogTableColumnsFunc; // (undocumented) diff --git a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx index 2663dc7fd2..f3cc0cb042 100644 --- a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx +++ b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx @@ -44,7 +44,8 @@ import React from 'react'; import { createComponentRouteRef } from '../../routes'; import { CatalogTableRow } from '../CatalogTable'; import { DefaultCatalogPage } from './DefaultCatalogPage'; -import { CatalogTableColumnsFunc } from '../CatalogTable/CatalogTable'; + +import { CatalogTableColumnsFunc } from '../CatalogTable/types'; describe('DefaultCatalogPage', () => { const origReplaceState = window.history.replaceState; diff --git a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx index 9aca36a4e1..a50cd4fa2a 100644 --- a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx +++ b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.tsx @@ -43,7 +43,8 @@ import { createComponentRouteRef } from '../../routes'; import { CatalogTable, CatalogTableRow } from '../CatalogTable'; import { catalogTranslationRef } from '../../translation'; import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; -import { CatalogTableColumnsFunc } from '../CatalogTable/CatalogTable'; + +import { CatalogTableColumnsFunc } from '../CatalogTable/types'; /** @internal */ export interface BaseCatalogPageProps { diff --git a/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx b/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx index c55b058ec5..052d8f4787 100644 --- a/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx +++ b/plugins/catalog/src/components/CatalogTable/CatalogTable.test.tsx @@ -31,7 +31,8 @@ import { import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils'; import { act, fireEvent, screen } from '@testing-library/react'; import * as React from 'react'; -import { CatalogTable, CatalogTableColumnsFunc } from './CatalogTable'; +import { CatalogTable } from './CatalogTable'; +import { CatalogTableColumnsFunc } from './types'; const entities: Entity[] = [ { diff --git a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx index d8eb2cf04e..4dd3fa257d 100644 --- a/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx +++ b/plugins/catalog/src/components/CatalogTable/CatalogTable.tsx @@ -29,7 +29,6 @@ import { WarningPanel, } from '@backstage/core-components'; import { - EntityListContextProps, getEntityRelations, humanizeEntityRef, useEntityList, @@ -46,16 +45,7 @@ import { capitalize } from 'lodash'; import pluralize from 'pluralize'; import React, { ReactNode, useMemo } from 'react'; import { columnFactories } from './columns'; -import { CatalogTableRow } from './types'; - -/** - * Typed columns function to dynamically render columns based on entity list context. - * - * @public - */ -export type CatalogTableColumnsFunc = ( - entityListContext: EntityListContextProps, -) => TableColumn[]; +import { CatalogTableColumnsFunc, CatalogTableRow } from './types'; /** * Props for {@link CatalogTable}. diff --git a/plugins/catalog/src/components/CatalogTable/index.ts b/plugins/catalog/src/components/CatalogTable/index.ts index 4e1b90f80a..f5d1ca1bb7 100644 --- a/plugins/catalog/src/components/CatalogTable/index.ts +++ b/plugins/catalog/src/components/CatalogTable/index.ts @@ -16,4 +16,4 @@ export { CatalogTable } from './CatalogTable'; export type { CatalogTableProps } from './CatalogTable'; -export type { CatalogTableRow } from './types'; +export type { CatalogTableRow, CatalogTableColumnsFunc } from './types'; diff --git a/plugins/catalog/src/components/CatalogTable/types.ts b/plugins/catalog/src/components/CatalogTable/types.ts index f2b3324169..c991205b11 100644 --- a/plugins/catalog/src/components/CatalogTable/types.ts +++ b/plugins/catalog/src/components/CatalogTable/types.ts @@ -14,7 +14,9 @@ * limitations under the License. */ -import { Entity, CompoundEntityRef } from '@backstage/catalog-model'; +import { CompoundEntityRef, Entity } from '@backstage/catalog-model'; +import { EntityListContextProps } from '@backstage/plugin-catalog-react'; +import { TableColumn } from '@backstage/core-components'; /** @public */ export interface CatalogTableRow { @@ -31,3 +33,12 @@ export interface CatalogTableRow { ownedByRelations: CompoundEntityRef[]; }; } + +/** + * Typed columns function to dynamically render columns based on entity list context. + * + * @public + */ +export type CatalogTableColumnsFunc = ( + entityListContext: EntityListContextProps, +) => TableColumn[];