do not plublicly export factories directly, but through tables
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
@@ -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<DocsTableRow>;
|
||||
createOwnerColumn(): TableColumn<DocsTableRow>;
|
||||
createTypeColumn(): TableColumn<DocsTableRow>;
|
||||
};
|
||||
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<SyncResult>;
|
||||
}
|
||||
|
||||
// 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
|
||||
```
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
/**
|
||||
|
||||
@@ -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: () => <ShareIcon fontSize="small" />,
|
||||
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: () => <ShareIcon fontSize="small" />,
|
||||
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),
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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<DocsTableRow> {
|
||||
return {
|
||||
title: 'Document',
|
||||
field: 'entity.metadata.name',
|
||||
highlight: true,
|
||||
render: (row: DocsTableRow) => (
|
||||
<SubvalueCell
|
||||
value={<Link to={row.resolved.docsUrl}>{customTitle(row.entity)}</Link>}
|
||||
subvalue={row.entity.metadata.description}
|
||||
/>
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function for creating an owner column for {@link DocsTable}.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export function createOwnerColumn(): TableColumn<DocsTableRow> {
|
||||
return {
|
||||
title: 'Owner',
|
||||
field: 'resolved.ownedByRelationsTitle',
|
||||
render: ({ resolved }) => (
|
||||
<EntityRefLinks
|
||||
entityRefs={resolved.ownedByRelations}
|
||||
defaultKind="group"
|
||||
/>
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function for creating an spec type column for {@link DocsTable}.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
export function createTypeColumn(): TableColumn<DocsTableRow> {
|
||||
return {
|
||||
title: 'Type',
|
||||
field: 'entity.spec.type',
|
||||
};
|
||||
}
|
||||
export const columnFactories = {
|
||||
createNameColumn(): TableColumn<DocsTableRow> {
|
||||
return {
|
||||
title: 'Document',
|
||||
field: 'entity.metadata.name',
|
||||
highlight: true,
|
||||
render: (row: DocsTableRow) => (
|
||||
<SubvalueCell
|
||||
value={
|
||||
<Link to={row.resolved.docsUrl}>{customTitle(row.entity)}</Link>
|
||||
}
|
||||
subvalue={row.entity.metadata.description}
|
||||
/>
|
||||
),
|
||||
};
|
||||
},
|
||||
createOwnerColumn(): TableColumn<DocsTableRow> {
|
||||
return {
|
||||
title: 'Owner',
|
||||
field: 'resolved.ownedByRelationsTitle',
|
||||
render: ({ resolved }) => (
|
||||
<EntityRefLinks
|
||||
entityRefs={resolved.ownedByRelations}
|
||||
defaultKind="group"
|
||||
/>
|
||||
),
|
||||
};
|
||||
},
|
||||
createTypeColumn(): TableColumn<DocsTableRow> {
|
||||
return {
|
||||
title: 'Type',
|
||||
field: 'entity.spec.type',
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user