diff --git a/.changeset/popular-icons-doubt.md b/.changeset/popular-icons-doubt.md new file mode 100644 index 0000000000..4ba9728afe --- /dev/null +++ b/.changeset/popular-icons-doubt.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-catalog-react': minor +'@backstage/plugin-catalog': minor +--- + +Tables which use `EntityTableProps` now have an additional `tableOptions` prop which can be used to provide additional table options to these components. diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index e9acfa76ce..9bf87778dd 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -25,6 +25,7 @@ import { ScmIntegrationRegistry } from '@backstage/integration'; import { StyleRules } from '@material-ui/core/styles/withStyles'; import { SystemEntity } from '@backstage/catalog-model'; import { TableColumn } from '@backstage/core-components'; +import { TableOptions } from '@backstage/core-components'; // @public export const AsyncEntityProvider: ( @@ -395,6 +396,8 @@ export interface EntityTableProps { // (undocumented) entities: T[]; // (undocumented) + tableOptions?: TableOptions; + // (undocumented) title: string; // (undocumented) variant?: InfoCardVariants; diff --git a/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx b/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx index 424d8b940e..360f0ee1ac 100644 --- a/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx +++ b/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx @@ -23,6 +23,7 @@ import { InfoCardVariants, Table, TableColumn, + TableOptions, } from '@backstage/core-components'; /** @@ -36,6 +37,7 @@ export interface EntityTableProps { entities: T[]; emptyContent?: ReactNode; columns: TableColumn[]; + tableOptions?: TableOptions; } const useStyles = makeStyles(theme => ({ @@ -59,6 +61,7 @@ export const EntityTable = (props: EntityTableProps) => { emptyContent, variant = 'gridItem', columns, + tableOptions = {}, } = props; const classes = useStyles(); @@ -86,6 +89,7 @@ export const EntityTable = (props: EntityTableProps) => { actionsColumnIndex: -1, padding: 'dense', draggable: false, + ...tableOptions, }} data={entities} /> diff --git a/plugins/catalog/api-report.md b/plugins/catalog/api-report.md index 358bb82b8a..fb067150be 100644 --- a/plugins/catalog/api-report.md +++ b/plugins/catalog/api-report.md @@ -27,6 +27,7 @@ import { StarredEntitiesApi } from '@backstage/plugin-catalog-react'; import { StorageApi } from '@backstage/core-plugin-api'; import { StyleRules } from '@material-ui/core/styles/withStyles'; import { TableColumn } from '@backstage/core-components'; +import { TableOptions } from '@backstage/core-components'; import { TableProps } from '@backstage/core-components'; import { TabProps } from '@material-ui/core'; import { UserListFilterKind } from '@backstage/plugin-catalog-react'; @@ -243,6 +244,8 @@ export interface DependsOnComponentsCardProps { // (undocumented) columns?: TableColumn[]; // (undocumented) + tableOptions?: TableOptions; + // (undocumented) title?: string; // (undocumented) variant?: InfoCardVariants; @@ -253,6 +256,8 @@ export interface DependsOnResourcesCardProps { // (undocumented) columns?: TableColumn[]; // (undocumented) + tableOptions?: TableOptions; + // (undocumented) title?: string; // (undocumented) variant?: InfoCardVariants; @@ -448,6 +453,8 @@ export interface HasResourcesCardProps { // @public (undocumented) export interface HasSubcomponentsCardProps { + // (undocumented) + tableOptions?: TableOptions; // (undocumented) variant?: InfoCardVariants; } @@ -506,6 +513,7 @@ export type RelatedEntitiesCardProps = { emptyMessage: string; emptyHelpLink: string; asRenderableEntities: (entities: Entity[]) => T[]; + tableOptions?: TableOptions; }; // @public (undocumented) diff --git a/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx b/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx index a7ff97ec73..f4ea850b9b 100644 --- a/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx +++ b/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx @@ -15,7 +15,11 @@ */ import { RELATION_DEPENDS_ON, ComponentEntity } from '@backstage/catalog-model'; -import { InfoCardVariants, TableColumn } from '@backstage/core-components'; +import { + InfoCardVariants, + TableColumn, + TableOptions, +} from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -29,6 +33,7 @@ export interface DependsOnComponentsCardProps { variant?: InfoCardVariants; title?: string; columns?: TableColumn[]; + tableOptions?: TableOptions; } export function DependsOnComponentsCard(props: DependsOnComponentsCardProps) { @@ -36,6 +41,7 @@ export function DependsOnComponentsCard(props: DependsOnComponentsCardProps) { variant = 'gridItem', title = 'Depends on components', columns = componentEntityColumns, + tableOptions = {}, } = props; return ( ); } diff --git a/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx b/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx index eba6c1be6b..d99a9df387 100644 --- a/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx +++ b/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx @@ -15,7 +15,11 @@ */ import { RELATION_DEPENDS_ON, ResourceEntity } from '@backstage/catalog-model'; -import { InfoCardVariants, TableColumn } from '@backstage/core-components'; +import { + InfoCardVariants, + TableColumn, + TableOptions, +} from '@backstage/core-components'; import React from 'react'; import { asResourceEntities, @@ -29,6 +33,7 @@ export interface DependsOnResourcesCardProps { variant?: InfoCardVariants; title?: string; columns?: TableColumn[]; + tableOptions?: TableOptions; } export function DependsOnResourcesCard(props: DependsOnResourcesCardProps) { @@ -36,6 +41,7 @@ export function DependsOnResourcesCard(props: DependsOnResourcesCardProps) { variant = 'gridItem', title = 'Depends on resources', columns = resourceEntityColumns, + tableOptions = {}, } = props; return ( ); } diff --git a/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx b/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx index db95d31f9f..6c673c5818 100644 --- a/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx +++ b/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx @@ -15,7 +15,7 @@ */ import { RELATION_HAS_PART } from '@backstage/catalog-model'; -import { InfoCardVariants } from '@backstage/core-components'; +import { InfoCardVariants, TableOptions } from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -26,10 +26,11 @@ import { /** @public */ export interface HasSubcomponentsCardProps { variant?: InfoCardVariants; + tableOptions?: TableOptions; } export function HasSubcomponentsCard(props: HasSubcomponentsCardProps) { - const { variant = 'gridItem' } = props; + const { variant = 'gridItem', tableOptions = {} } = props; return ( ); } diff --git a/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx b/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx index e802b0b583..7a533dcf5b 100644 --- a/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx +++ b/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx @@ -29,6 +29,7 @@ import { Progress, ResponseErrorPanel, TableColumn, + TableOptions, } from '@backstage/core-components'; /** @public */ @@ -41,6 +42,7 @@ export type RelatedEntitiesCardProps = { emptyMessage: string; emptyHelpLink: string; asRenderableEntities: (entities: Entity[]) => T[]; + tableOptions?: TableOptions; }; /** @@ -67,6 +69,7 @@ export function RelatedEntitiesCard( emptyMessage, emptyHelpLink, asRenderableEntities, + tableOptions = {}, } = props; const { entity } = useEntity(); @@ -105,6 +108,7 @@ export function RelatedEntitiesCard( } columns={columns} entities={asRenderableEntities(entities || [])} + tableOptions={tableOptions} /> ); }