diff --git a/plugins/techdocs/api-report.md b/plugins/techdocs/api-report.md index 3b953556c4..558c6397a3 100644 --- a/plugins/techdocs/api-report.md +++ b/plugins/techdocs/api-report.md @@ -85,8 +85,29 @@ export const EntityListDocsGrid: () => JSX.Element; // @public export const EntityListDocsTable: { (props: EntityListDocsTableProps): JSX.Element; - columns: typeof columnFactories; - actions: typeof actionFactories; + columns: { + createNameColumn(): TableColumn; + createOwnerColumn(): TableColumn; + createTypeColumn(): TableColumn; + }; + actions: { + createCopyDocsUrlAction(copyToClipboard: Function): (row: DocsTableRow) => { + icon: () => JSX.Element; + tooltip: string; + onClick: () => any; + }; + createStarEntityAction( + isStarredEntity: Function, + toggleStarredEntity: Function, + ): ({ entity }: DocsTableRow) => { + cellStyle: { + paddingLeft: string; + }; + icon: () => JSX.Element; + tooltip: string; + onClick: () => any; + }; + }; }; // @public @@ -361,9 +382,4 @@ export class TechDocsStorageClient implements TechDocsStorageApi { logHandler?: (line: string) => void, ): Promise; } - -// Warnings were encountered during analysis: -// -// src/home/components/Tables/EntityListDocsTable.d.ts:22:5 - (ae-forgotten-export) The symbol "columnFactories" needs to be exported by the entry point index.d.ts -// src/home/components/Tables/EntityListDocsTable.d.ts:23:5 - (ae-forgotten-export) The symbol "actionFactories" needs to be exported by the entry point index.d.ts ``` diff --git a/plugins/techdocs/src/home/components/Tables/DocsTable.tsx b/plugins/techdocs/src/home/components/Tables/DocsTable.tsx index cbc8ddc0b9..323cdab96a 100644 --- a/plugins/techdocs/src/home/components/Tables/DocsTable.tsx +++ b/plugins/techdocs/src/home/components/Tables/DocsTable.tsx @@ -31,8 +31,8 @@ import { TableColumn, TableProps, } from '@backstage/core-components'; -import * as actionFactories from './actions'; -import * as columnFactories from './columns'; +import { actionFactories } from './actions'; +import { columnFactories } from './columns'; import { toLowerMaybe } from '../../../helpers'; import { DocsTableRow } from './types'; diff --git a/plugins/techdocs/src/home/components/Tables/EntityListDocsTable.tsx b/plugins/techdocs/src/home/components/Tables/EntityListDocsTable.tsx index a963d53428..d47ddb13c4 100644 --- a/plugins/techdocs/src/home/components/Tables/EntityListDocsTable.tsx +++ b/plugins/techdocs/src/home/components/Tables/EntityListDocsTable.tsx @@ -28,8 +28,8 @@ import { useStarredEntities, } from '@backstage/plugin-catalog-react'; import { DocsTable } from './DocsTable'; -import * as actionFactories from './actions'; -import * as columnFactories from './columns'; +import { actionFactories } from './actions'; +import { columnFactories } from './columns'; import { DocsTableRow } from './types'; /** diff --git a/plugins/techdocs/src/home/components/Tables/actions.tsx b/plugins/techdocs/src/home/components/Tables/actions.tsx index 4e86fb1b89..d0dbb8bf47 100644 --- a/plugins/techdocs/src/home/components/Tables/actions.tsx +++ b/plugins/techdocs/src/home/components/Tables/actions.tsx @@ -23,39 +23,33 @@ import { import { DocsTableRow } from './types'; /** - * Utility function for creating a copy docs url action for {@link DocsTable}. + * Not directly exported, but through DocsTable.actions and EntityListDocsTable.actions * - * @internal + * @public */ - -export function createCopyDocsUrlAction(copyToClipboard: Function) { - return (row: DocsTableRow) => { - return { - icon: () => , - tooltip: 'Click to copy documentation link to clipboard', - onClick: () => - copyToClipboard(`${window.location.origin}${row.resolved.docsUrl}`), +export const actionFactories = { + createCopyDocsUrlAction(copyToClipboard: Function) { + return (row: DocsTableRow) => { + return { + icon: () => , + tooltip: 'Click to copy documentation link to clipboard', + onClick: () => + copyToClipboard(`${window.location.origin}${row.resolved.docsUrl}`), + }; }; - }; -} - -/** - * Utility function for creating a star entity action for {@link DocsTable}. - * - * @internal - */ - -export function createStarEntityAction( - isStarredEntity: Function, - toggleStarredEntity: Function, -) { - return ({ entity }: DocsTableRow) => { - const isStarred = isStarredEntity(entity); - return { - cellStyle: { paddingLeft: '1em' }, - icon: () => favoriteEntityIcon(isStarred), - tooltip: favoriteEntityTooltip(isStarred), - onClick: () => toggleStarredEntity(entity), + }, + createStarEntityAction( + isStarredEntity: Function, + toggleStarredEntity: Function, + ) { + return ({ entity }: DocsTableRow) => { + const isStarred = isStarredEntity(entity); + return { + cellStyle: { paddingLeft: '1em' }, + icon: () => favoriteEntityIcon(isStarred), + tooltip: favoriteEntityTooltip(isStarred), + onClick: () => toggleStarredEntity(entity), + }; }; - }; -} + }, +}; diff --git a/plugins/techdocs/src/home/components/Tables/columns.tsx b/plugins/techdocs/src/home/components/Tables/columns.tsx index 6f41ccb1d6..774cfc5e8a 100644 --- a/plugins/techdocs/src/home/components/Tables/columns.tsx +++ b/plugins/techdocs/src/home/components/Tables/columns.tsx @@ -25,50 +25,42 @@ function customTitle(entity: Entity): string { } /** - * Utility function for creating a name column for {@link DocsTable}. + * Not directly exported, but through DocsTable.columns and EntityListDocsTable.columns * - * @internal + * @public */ -export function createNameColumn(): TableColumn { - return { - title: 'Document', - field: 'entity.metadata.name', - highlight: true, - render: (row: DocsTableRow) => ( - {customTitle(row.entity)}} - subvalue={row.entity.metadata.description} - /> - ), - }; -} - -/** - * Utility function for creating an owner column for {@link DocsTable}. - * - * @internal - */ -export function createOwnerColumn(): TableColumn { - return { - title: 'Owner', - field: 'resolved.ownedByRelationsTitle', - render: ({ resolved }) => ( - - ), - }; -} - -/** - * Utility function for creating an spec type column for {@link DocsTable}. - * - * @internal - */ -export function createTypeColumn(): TableColumn { - return { - title: 'Type', - field: 'entity.spec.type', - }; -} +export const columnFactories = { + createNameColumn(): TableColumn { + return { + title: 'Document', + field: 'entity.metadata.name', + highlight: true, + render: (row: DocsTableRow) => ( + {customTitle(row.entity)} + } + subvalue={row.entity.metadata.description} + /> + ), + }; + }, + createOwnerColumn(): TableColumn { + return { + title: 'Owner', + field: 'resolved.ownedByRelationsTitle', + render: ({ resolved }) => ( + + ), + }; + }, + createTypeColumn(): TableColumn { + return { + title: 'Type', + field: 'entity.spec.type', + }; + }, +};