From d329505d37586a616a1020015806a823640dd64f Mon Sep 17 00:00:00 2001 From: Michael Haley Date: Tue, 10 May 2022 11:08:13 -0400 Subject: [PATCH 1/8] Allow tableOptions to be passed to relatedEntity components Signed-off-by: Michael Haley --- .../src/components/EntityTable/EntityTable.tsx | 16 +++++++++++----- .../DependencyOfComponentsCard.tsx | 15 ++++++++++++--- .../DependsOnComponentsCard.tsx | 12 +++++++++--- .../DependsOnResourcesCard.tsx | 8 +++++--- .../HasComponentsCard/HasComponentsCard.tsx | 8 +++++--- .../HasResourcesCard/HasResourcesCard.tsx | 8 +++++--- .../HasSubcomponentsCard.tsx | 8 +++++--- .../components/HasSystemsCard/HasSystemsCard.tsx | 5 +++-- .../RelatedEntitiesCard/RelatedEntitiesCard.tsx | 4 ++++ 9 files changed, 59 insertions(+), 25 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx b/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx index 3aa6857120..aced5b63e1 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, + TableProps, } from '@backstage/core-components'; /** @@ -36,6 +37,7 @@ export interface EntityTableProps { entities: T[]; emptyContent?: ReactNode; columns: TableColumn[]; + tableOptions?: TableProps['options']; } const useStyles = makeStyles(theme => ({ @@ -59,6 +61,7 @@ export const EntityTable = (props: EntityTableProps) => { emptyContent, variant = 'gridItem', columns, + tableOptions, } = props; const classes = useStyles(); @@ -80,11 +83,14 @@ export const EntityTable = (props: EntityTableProps) => { emptyContent &&
{emptyContent}
} options={{ - // TODO: Toolbar padding if off compared to other cards, should be: padding: 16px 24px; - search: false, - paging: false, - actionsColumnIndex: -1, - padding: 'dense', + ...{ + // TODO: Toolbar padding if off compared to other cards, should be: padding: 16px 24px; + search: false, + paging: false, + actionsColumnIndex: -1, + padding: 'dense', + }, + ...tableOptions, }} data={entities} /> diff --git a/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx b/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx index d87b558048..3b22ea2aa0 100644 --- a/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx +++ b/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx @@ -14,8 +14,11 @@ * limitations under the License. */ -import { RELATION_DEPENDENCY_OF } from '@backstage/catalog-model'; -import { InfoCardVariants } from '@backstage/core-components'; +import { + ComponentEntity, + RELATION_DEPENDENCY_OF, +} from '@backstage/catalog-model'; +import { InfoCardVariants, TableProps } from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -28,12 +31,17 @@ import { export interface DependencyOfComponentsCardProps { variant?: InfoCardVariants; title?: string; + tableOptions?: TableProps['options']; } export function DependencyOfComponentsCard( props: DependencyOfComponentsCardProps, ) { - const { variant = 'gridItem', title = 'Dependency of components' } = props; + const { + variant = 'gridItem', + title = 'Dependency of components', + tableOptions, + } = props; return ( ); } diff --git a/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx b/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx index 4f30c17a84..50e195e88a 100644 --- a/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx +++ b/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { RELATION_DEPENDS_ON } from '@backstage/catalog-model'; -import { InfoCardVariants } from '@backstage/core-components'; +import { ComponentEntity, RELATION_DEPENDS_ON } from '@backstage/catalog-model'; +import { InfoCardVariants, TableProps } from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -28,10 +28,15 @@ import { export interface DependsOnComponentsCardProps { variant?: InfoCardVariants; title?: string; + tableOptions?: TableProps['options']; } export function DependsOnComponentsCard(props: DependsOnComponentsCardProps) { - const { variant = 'gridItem', title = 'Depends on components' } = props; + const { + variant = 'gridItem', + title = 'Depends on components', + tableOptions, + } = props; return ( ); } diff --git a/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx b/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx index a0f4d399f9..49c05d5eef 100644 --- a/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx +++ b/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { RELATION_DEPENDS_ON } from '@backstage/catalog-model'; -import { InfoCardVariants } from '@backstage/core-components'; +import { RELATION_DEPENDS_ON, ResourceEntity } from '@backstage/catalog-model'; +import { InfoCardVariants, TableProps } from '@backstage/core-components'; import React from 'react'; import { asResourceEntities, @@ -27,10 +27,11 @@ import { /** @public */ export interface DependsOnResourcesCardProps { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; } export function DependsOnResourcesCard(props: DependsOnResourcesCardProps) { - const { variant = 'gridItem' } = props; + const { variant = 'gridItem', tableOptions } = props; return ( ); } diff --git a/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.tsx b/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.tsx index 9654152a5c..e0f01e932e 100644 --- a/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.tsx +++ b/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { RELATION_HAS_PART } from '@backstage/catalog-model'; -import { InfoCardVariants } from '@backstage/core-components'; +import { ComponentEntity, RELATION_HAS_PART } from '@backstage/catalog-model'; +import { InfoCardVariants, TableProps } from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -27,10 +27,11 @@ import { /** @public */ export interface HasComponentsCardProps { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; } export function HasComponentsCard(props: HasComponentsCardProps) { - const { variant = 'gridItem' } = props; + const { variant = 'gridItem', tableOptions } = props; return ( ); } diff --git a/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.tsx b/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.tsx index 8476d77bda..fc32d056d5 100644 --- a/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.tsx +++ b/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { RELATION_HAS_PART } from '@backstage/catalog-model'; -import { InfoCardVariants } from '@backstage/core-components'; +import { RELATION_HAS_PART, ResourceEntity } from '@backstage/catalog-model'; +import { InfoCardVariants, TableProps } from '@backstage/core-components'; import React from 'react'; import { asResourceEntities, @@ -27,10 +27,11 @@ import { /** @public */ export interface HasResourcesCardProps { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; } export function HasResourcesCard(props: HasResourcesCardProps) { - const { variant = 'gridItem' } = props; + const { variant = 'gridItem', tableOptions } = props; return ( ); } diff --git a/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx b/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx index db95d31f9f..9702a70788 100644 --- a/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx +++ b/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { RELATION_HAS_PART } from '@backstage/catalog-model'; -import { InfoCardVariants } from '@backstage/core-components'; +import { ComponentEntity, RELATION_HAS_PART } from '@backstage/catalog-model'; +import { InfoCardVariants, TableProps } from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -26,10 +26,11 @@ import { /** @public */ export interface HasSubcomponentsCardProps { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; } export function HasSubcomponentsCard(props: HasSubcomponentsCardProps) { - const { variant = 'gridItem' } = props; + const { variant = 'gridItem', tableOptions } = props; return ( ); } diff --git a/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.tsx b/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.tsx index 5d6fa170f5..6eb29c721b 100644 --- a/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.tsx +++ b/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { RELATION_HAS_PART } from '@backstage/catalog-model'; -import { InfoCardVariants } from '@backstage/core-components'; +import { RELATION_HAS_PART, SystemEntity } from '@backstage/catalog-model'; +import { InfoCardVariants, TableProps } from '@backstage/core-components'; import React from 'react'; import { asSystemEntities, @@ -27,6 +27,7 @@ import { /** @public */ export interface HasSystemsCardProps { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; } export function HasSystemsCard(props: HasSystemsCardProps) { diff --git a/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx b/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx index e802b0b583..80785a071d 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, + TableProps, } from '@backstage/core-components'; /** @public */ @@ -40,6 +41,7 @@ export type RelatedEntitiesCardProps = { relationType: string; emptyMessage: string; emptyHelpLink: string; + tableOptions?: TableProps['options']; asRenderableEntities: (entities: Entity[]) => T[]; }; @@ -66,6 +68,7 @@ export function RelatedEntitiesCard( relationType, emptyMessage, emptyHelpLink, + tableOptions, asRenderableEntities, } = props; @@ -105,6 +108,7 @@ export function RelatedEntitiesCard( } columns={columns} entities={asRenderableEntities(entities || [])} + tableOptions={tableOptions} /> ); } From 4263148f4739b23dba83e12879facf17494e7563 Mon Sep 17 00:00:00 2001 From: Michael Haley Date: Wed, 18 May 2022 09:49:18 -0400 Subject: [PATCH 2/8] Allow tableOptions prop on API cards Signed-off-by: Michael Haley --- .../components/ApisCards/ConsumedApisCard.tsx | 16 +++++++++++++--- .../src/components/ApisCards/HasApisCard.tsx | 12 +++++++++--- .../components/ApisCards/ProvidedApisCard.tsx | 16 +++++++++++++--- .../ComponentsCards/ConsumingComponentsCard.tsx | 11 +++++++++-- .../ComponentsCards/ProvidingComponentsCard.tsx | 11 +++++++++-- .../src/components/EntityTable/EntityTable.tsx | 2 +- .../DependencyOfComponentsCard.tsx | 2 +- .../DependsOnComponentsCard.tsx | 2 +- .../DependsOnResourcesCard.tsx | 2 +- .../HasComponentsCard/HasComponentsCard.tsx | 2 +- .../HasResourcesCard/HasResourcesCard.tsx | 2 +- .../HasSubcomponentsCard.tsx | 2 +- .../RelatedEntitiesCard/RelatedEntitiesCard.tsx | 2 +- 13 files changed, 61 insertions(+), 21 deletions(-) diff --git a/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx b/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx index fde41425c9..60d6ffb699 100644 --- a/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx +++ b/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx @@ -14,7 +14,11 @@ * limitations under the License. */ -import { ApiEntity, RELATION_CONSUMES_API } from '@backstage/catalog-model'; +import { + ApiEntity, + Entity, + RELATION_CONSUMES_API, +} from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; import { EntityTable, @@ -29,14 +33,19 @@ import { InfoCardVariants, Link, Progress, + TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; }; -export const ConsumedApisCard = ({ variant = 'gridItem' }: Props) => { +export const ConsumedApisCard = ({ + variant = 'gridItem', + tableOptions = {}, +}: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_CONSUMES_API, @@ -81,6 +90,7 @@ export const ConsumedApisCard = ({ variant = 'gridItem' }: Props) => { } columns={apiEntityColumns} entities={entities as ApiEntity[]} + tableOptions={tableOptions} /> ); }; diff --git a/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx b/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx index bb22f82269..3f9e9c8d71 100644 --- a/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx +++ b/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { ApiEntity, RELATION_HAS_PART } from '@backstage/catalog-model'; +import { ApiEntity, Entity, RELATION_HAS_PART } from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; import { EntityTable, @@ -30,11 +30,13 @@ import { Link, Progress, TableColumn, + TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; }; const columns: TableColumn[] = [ @@ -45,7 +47,10 @@ const columns: TableColumn[] = [ EntityTable.columns.createMetadataDescriptionColumn(), ]; -export const HasApisCard = ({ variant = 'gridItem' }: Props) => { +export const HasApisCard = ({ + variant = 'gridItem', + tableOptions = {}, +}: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_HAS_PART, @@ -91,6 +96,7 @@ export const HasApisCard = ({ variant = 'gridItem' }: Props) => { } columns={columns} entities={entities as ApiEntity[]} + tableOptions={tableOptions} /> ); }; diff --git a/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx b/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx index 6ffb6365d2..627a4bba37 100644 --- a/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx +++ b/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx @@ -14,7 +14,11 @@ * limitations under the License. */ -import { ApiEntity, RELATION_PROVIDES_API } from '@backstage/catalog-model'; +import { + ApiEntity, + Entity, + RELATION_PROVIDES_API, +} from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; import { EntityTable, @@ -29,14 +33,19 @@ import { InfoCardVariants, Link, Progress, + TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; }; -export const ProvidedApisCard = ({ variant = 'gridItem' }: Props) => { +export const ProvidedApisCard = ({ + variant = 'gridItem', + tableOptions = {}, +}: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_PROVIDES_API, @@ -81,6 +90,7 @@ export const ProvidedApisCard = ({ variant = 'gridItem' }: Props) => { } columns={apiEntityColumns} entities={entities as ApiEntity[]} + tableOptions={tableOptions} /> ); }; diff --git a/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.tsx b/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.tsx index af3dcb7204..62fa13c027 100644 --- a/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.tsx +++ b/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.tsx @@ -16,6 +16,7 @@ import { ComponentEntity, + Entity, RELATION_API_CONSUMED_BY, } from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; @@ -31,14 +32,19 @@ import { InfoCardVariants, Link, Progress, + TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; }; -export const ConsumingComponentsCard = ({ variant = 'gridItem' }: Props) => { +export const ConsumingComponentsCard = ({ + variant = 'gridItem', + tableOptions = {}, +}: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_API_CONSUMED_BY, @@ -82,6 +88,7 @@ export const ConsumingComponentsCard = ({ variant = 'gridItem' }: Props) => { } columns={EntityTable.componentEntityColumns} entities={entities as ComponentEntity[]} + tableOptions={tableOptions} /> ); }; diff --git a/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.tsx b/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.tsx index 0be746de6d..a16991d57a 100644 --- a/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.tsx +++ b/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.tsx @@ -16,6 +16,7 @@ import { ComponentEntity, + Entity, RELATION_API_PROVIDED_BY, } from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; @@ -31,14 +32,19 @@ import { InfoCardVariants, Link, Progress, + TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; + tableOptions?: TableProps['options']; }; -export const ProvidingComponentsCard = ({ variant = 'gridItem' }: Props) => { +export const ProvidingComponentsCard = ({ + variant = 'gridItem', + tableOptions = {}, +}: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_API_PROVIDED_BY, @@ -82,6 +88,7 @@ export const ProvidingComponentsCard = ({ variant = 'gridItem' }: Props) => { } columns={EntityTable.componentEntityColumns} entities={entities as ComponentEntity[]} + tableOptions={tableOptions} /> ); }; diff --git a/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx b/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx index aced5b63e1..9f65640569 100644 --- a/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx +++ b/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx @@ -61,7 +61,7 @@ export const EntityTable = (props: EntityTableProps) => { emptyContent, variant = 'gridItem', columns, - tableOptions, + tableOptions = {}, } = props; const classes = useStyles(); diff --git a/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx b/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx index 3b22ea2aa0..d60785d165 100644 --- a/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx +++ b/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx @@ -40,7 +40,7 @@ export function DependencyOfComponentsCard( const { variant = 'gridItem', title = 'Dependency of components', - tableOptions, + tableOptions = {}, } = props; return ( ( relationType, emptyMessage, emptyHelpLink, - tableOptions, + tableOptions = {}, asRenderableEntities, } = props; From 6a70ba2fdc4ffed0b9b790adc5dd82bf0cb96bc9 Mon Sep 17 00:00:00 2001 From: Michael Haley Date: Wed, 18 May 2022 10:26:51 -0400 Subject: [PATCH 3/8] Add changeset Signed-off-by: Michael Haley --- .changeset/lucky-zoos-own.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/lucky-zoos-own.md diff --git a/.changeset/lucky-zoos-own.md b/.changeset/lucky-zoos-own.md new file mode 100644 index 0000000000..5c7959441d --- /dev/null +++ b/.changeset/lucky-zoos-own.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-api-docs': patch +'@backstage/plugin-catalog': patch +'@backstage/plugin-catalog-react': patch +--- + +Extend `` props to allow `material-table` options to be passed via prop `tableOptions`. Prop is exposed to other components that are composed from `` From 8330eb02e581e6a1a69784b4d4b777612c8f022b Mon Sep 17 00:00:00 2001 From: Michael Haley Date: Wed, 18 May 2022 11:55:06 -0400 Subject: [PATCH 4/8] add api-reports Signed-off-by: Michael Haley --- plugins/api-docs/api-report.md | 38 +++++++++++++++++++++++++---- plugins/catalog-react/api-report.md | 3 +++ plugins/catalog/api-report.md | 18 ++++++++++++++ 3 files changed, 54 insertions(+), 5 deletions(-) diff --git a/plugins/api-docs/api-report.md b/plugins/api-docs/api-report.md index 991c73d4ab..6246ee797e 100644 --- a/plugins/api-docs/api-report.md +++ b/plugins/api-docs/api-report.md @@ -9,8 +9,11 @@ import { ApiEntity } from '@backstage/catalog-model'; import { ApiRef } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; import { CatalogTableRow } from '@backstage/plugin-catalog'; +import { ComponentEntity } from '@backstage/catalog-model'; +import { Entity } from '@backstage/catalog-model'; import { ExternalRouteRef } from '@backstage/core-plugin-api'; import { InfoCardVariants } from '@backstage/core-components'; +import { Options } from '@material-table/core'; import { default as React_2 } from 'react'; import { RouteRef } from '@backstage/core-plugin-api'; import { TableColumn } from '@backstage/core-components'; @@ -91,13 +94,19 @@ export type AsyncApiDefinitionWidgetProps = { // Warning: (ae-missing-release-tag) "ConsumedApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const ConsumedApisCard: ({ variant }: Props) => JSX.Element; +export const ConsumedApisCard: ({ + variant, + tableOptions, +}: Props) => JSX.Element; // Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "ConsumingComponentsCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const ConsumingComponentsCard: ({ variant }: Props_4) => JSX.Element; +export const ConsumingComponentsCard: ({ + variant, + tableOptions, +}: Props_4) => JSX.Element; // @public export const DefaultApiExplorerPage: ({ @@ -128,8 +137,10 @@ export const EntityApiDefinitionCard: () => JSX.Element; // @public (undocumented) export const EntityConsumedApisCard: ({ variant, + tableOptions, }: { variant?: InfoCardVariants | undefined; + tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "EntityConsumingComponentsCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -137,8 +148,10 @@ export const EntityConsumedApisCard: ({ // @public (undocumented) export const EntityConsumingComponentsCard: ({ variant, + tableOptions, }: { variant?: InfoCardVariants | undefined; + tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "EntityHasApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -146,8 +159,10 @@ export const EntityConsumingComponentsCard: ({ // @public (undocumented) export const EntityHasApisCard: ({ variant, + tableOptions, }: { variant?: InfoCardVariants | undefined; + tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "EntityProvidedApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -155,8 +170,10 @@ export const EntityHasApisCard: ({ // @public (undocumented) export const EntityProvidedApisCard: ({ variant, + tableOptions, }: { variant?: InfoCardVariants | undefined; + tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "EntityProvidingComponentsCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -164,8 +181,10 @@ export const EntityProvidedApisCard: ({ // @public (undocumented) export const EntityProvidingComponentsCard: ({ variant, + tableOptions, }: { variant?: InfoCardVariants | undefined; + tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "GraphQlDefinitionWidget" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -186,7 +205,10 @@ export type GraphQlDefinitionWidgetProps = { // Warning: (ae-missing-release-tag) "HasApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const HasApisCard: ({ variant }: Props_2) => JSX.Element; +export const HasApisCard: ({ + variant, + tableOptions, +}: Props_2) => JSX.Element; // Warning: (ae-missing-release-tag) "OpenApiDefinitionWidget" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -221,11 +243,17 @@ export type PlainApiDefinitionWidgetProps = { // Warning: (ae-missing-release-tag) "ProvidedApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const ProvidedApisCard: ({ variant }: Props_3) => JSX.Element; +export const ProvidedApisCard: ({ + variant, + tableOptions, +}: Props_3) => JSX.Element; // Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "ProvidingComponentsCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const ProvidingComponentsCard: ({ variant }: Props_5) => JSX.Element; +export const ProvidingComponentsCard: ({ + variant, + tableOptions, +}: Props_5) => JSX.Element; ``` diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 285ecafd70..48be22cd4a 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -26,6 +26,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 { TableProps } from '@backstage/core-components'; // @public export const AsyncEntityProvider: ({ @@ -332,6 +333,8 @@ export interface EntityTableProps { // (undocumented) entities: T[]; // (undocumented) + tableOptions?: TableProps['options']; + // (undocumented) title: string; // (undocumented) variant?: InfoCardVariants; diff --git a/plugins/catalog/api-report.md b/plugins/catalog/api-report.md index 3d426a0c8b..70d9b05f33 100644 --- a/plugins/catalog/api-report.md +++ b/plugins/catalog/api-report.md @@ -7,6 +7,7 @@ import { ApiHolder } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; +import { ComponentEntity } from '@backstage/catalog-model'; import { CompoundEntityRef } from '@backstage/catalog-model'; import { Entity } from '@backstage/catalog-model'; import { ExternalRouteRef } from '@backstage/core-plugin-api'; @@ -17,11 +18,13 @@ import { Observable } from '@backstage/types'; import { Overrides } from '@material-ui/core/styles/overrides'; import { default as React_2 } from 'react'; import { ReactNode } from 'react'; +import { ResourceEntity } from '@backstage/catalog-model'; import { ResultHighlight } from '@backstage/plugin-search-common'; import { RouteRef } from '@backstage/core-plugin-api'; import { StarredEntitiesApi } from '@backstage/plugin-catalog-react'; import { StorageApi } from '@backstage/core-plugin-api'; import { StyleRules } from '@material-ui/core/styles/withStyles'; +import { SystemEntity } from '@backstage/catalog-model'; import { TableColumn } from '@backstage/core-components'; import { TableProps } from '@backstage/core-components'; import { TabProps } from '@material-ui/core'; @@ -184,6 +187,8 @@ export class DefaultStarredEntitiesApi implements StarredEntitiesApi { // @public (undocumented) export interface DependencyOfComponentsCardProps { + // (undocumented) + tableOptions?: TableProps['options']; // (undocumented) title?: string; // (undocumented) @@ -192,6 +197,8 @@ export interface DependencyOfComponentsCardProps { // @public (undocumented) export interface DependsOnComponentsCardProps { + // (undocumented) + tableOptions?: TableProps['options']; // (undocumented) title?: string; // (undocumented) @@ -200,6 +207,8 @@ export interface DependsOnComponentsCardProps { // @public (undocumented) export interface DependsOnResourcesCardProps { + // (undocumented) + tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } @@ -348,24 +357,32 @@ export function hasCatalogProcessingErrors( // @public (undocumented) export interface HasComponentsCardProps { + // (undocumented) + tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } // @public (undocumented) export interface HasResourcesCardProps { + // (undocumented) + tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } // @public (undocumented) export interface HasSubcomponentsCardProps { + // (undocumented) + tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } // @public (undocumented) export interface HasSystemsCardProps { + // (undocumented) + tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } @@ -406,6 +423,7 @@ export type RelatedEntitiesCardProps = { relationType: string; emptyMessage: string; emptyHelpLink: string; + tableOptions?: TableProps['options']; asRenderableEntities: (entities: Entity[]) => T[]; }; From ed1727148cabe423787930cb395114902889775a Mon Sep 17 00:00:00 2001 From: Michael Haley Date: Tue, 24 May 2022 10:34:30 -0400 Subject: [PATCH 5/8] Allow tableOptions to be able to be passed to DefaultApiExplorerPage Signed-off-by: Michael Haley --- plugins/api-docs/api-report.md | 2 ++ .../src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx | 3 +++ 2 files changed, 5 insertions(+) diff --git a/plugins/api-docs/api-report.md b/plugins/api-docs/api-report.md index 6246ee797e..8f58a0ab86 100644 --- a/plugins/api-docs/api-report.md +++ b/plugins/api-docs/api-report.md @@ -113,6 +113,7 @@ export const DefaultApiExplorerPage: ({ initiallySelectedFilter, columns, actions, + tableOptions, }: DefaultApiExplorerPageProps) => JSX.Element; // @public @@ -120,6 +121,7 @@ export type DefaultApiExplorerPageProps = { initiallySelectedFilter?: UserListFilterKind; columns?: TableColumn[]; actions?: TableProps['actions']; + tableOptions?: TableProps['options']; }; // Warning: (ae-missing-release-tag) "defaultDefinitionWidgets" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) diff --git a/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx b/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx index 9fc6b2c3c2..06c4b6f76a 100644 --- a/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx +++ b/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx @@ -57,6 +57,7 @@ export type DefaultApiExplorerPageProps = { initiallySelectedFilter?: UserListFilterKind; columns?: TableColumn[]; actions?: TableProps['actions']; + tableOptions?: TableProps['options']; }; /** @@ -67,6 +68,7 @@ export const DefaultApiExplorerPage = ({ initiallySelectedFilter = 'all', columns, actions, + tableOptions = {}, }: DefaultApiExplorerPageProps) => { const configApi = useApi(configApiRef); const generatedSubtitle = `${ @@ -103,6 +105,7 @@ export const DefaultApiExplorerPage = ({ From 5585fa5cff2e07f044429170e7e055e75741d0c4 Mon Sep 17 00:00:00 2001 From: Michael Haley Date: Tue, 7 Jun 2022 10:15:48 -0400 Subject: [PATCH 6/8] Revert commits, to go in new direction Signed-off-by: Michael Haley --- .changeset/lucky-zoos-own.md | 7 ---- plugins/api-docs/api-report.md | 40 +++---------------- .../DefaultApiExplorerPage.tsx | 3 -- .../components/ApisCards/ConsumedApisCard.tsx | 16 ++------ .../src/components/ApisCards/HasApisCard.tsx | 12 ++---- .../components/ApisCards/ProvidedApisCard.tsx | 16 ++------ .../ConsumingComponentsCard.tsx | 11 +---- .../ProvidingComponentsCard.tsx | 11 +---- plugins/catalog-react/api-report.md | 3 -- .../components/EntityTable/EntityTable.tsx | 16 +++----- plugins/catalog/api-report.md | 18 --------- .../DependencyOfComponentsCard.tsx | 15 ++----- .../DependsOnComponentsCard.tsx | 12 ++---- .../DependsOnResourcesCard.tsx | 8 ++-- .../HasComponentsCard/HasComponentsCard.tsx | 8 ++-- .../HasResourcesCard/HasResourcesCard.tsx | 8 ++-- .../HasSubcomponentsCard.tsx | 8 ++-- .../HasSystemsCard/HasSystemsCard.tsx | 5 +-- .../RelatedEntitiesCard.tsx | 4 -- 19 files changed, 43 insertions(+), 178 deletions(-) delete mode 100644 .changeset/lucky-zoos-own.md diff --git a/.changeset/lucky-zoos-own.md b/.changeset/lucky-zoos-own.md deleted file mode 100644 index 5c7959441d..0000000000 --- a/.changeset/lucky-zoos-own.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@backstage/plugin-api-docs': patch -'@backstage/plugin-catalog': patch -'@backstage/plugin-catalog-react': patch ---- - -Extend `` props to allow `material-table` options to be passed via prop `tableOptions`. Prop is exposed to other components that are composed from `` diff --git a/plugins/api-docs/api-report.md b/plugins/api-docs/api-report.md index 8f58a0ab86..991c73d4ab 100644 --- a/plugins/api-docs/api-report.md +++ b/plugins/api-docs/api-report.md @@ -9,11 +9,8 @@ import { ApiEntity } from '@backstage/catalog-model'; import { ApiRef } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; import { CatalogTableRow } from '@backstage/plugin-catalog'; -import { ComponentEntity } from '@backstage/catalog-model'; -import { Entity } from '@backstage/catalog-model'; import { ExternalRouteRef } from '@backstage/core-plugin-api'; import { InfoCardVariants } from '@backstage/core-components'; -import { Options } from '@material-table/core'; import { default as React_2 } from 'react'; import { RouteRef } from '@backstage/core-plugin-api'; import { TableColumn } from '@backstage/core-components'; @@ -94,26 +91,19 @@ export type AsyncApiDefinitionWidgetProps = { // Warning: (ae-missing-release-tag) "ConsumedApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const ConsumedApisCard: ({ - variant, - tableOptions, -}: Props) => JSX.Element; +export const ConsumedApisCard: ({ variant }: Props) => JSX.Element; // Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "ConsumingComponentsCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const ConsumingComponentsCard: ({ - variant, - tableOptions, -}: Props_4) => JSX.Element; +export const ConsumingComponentsCard: ({ variant }: Props_4) => JSX.Element; // @public export const DefaultApiExplorerPage: ({ initiallySelectedFilter, columns, actions, - tableOptions, }: DefaultApiExplorerPageProps) => JSX.Element; // @public @@ -121,7 +111,6 @@ export type DefaultApiExplorerPageProps = { initiallySelectedFilter?: UserListFilterKind; columns?: TableColumn[]; actions?: TableProps['actions']; - tableOptions?: TableProps['options']; }; // Warning: (ae-missing-release-tag) "defaultDefinitionWidgets" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -139,10 +128,8 @@ export const EntityApiDefinitionCard: () => JSX.Element; // @public (undocumented) export const EntityConsumedApisCard: ({ variant, - tableOptions, }: { variant?: InfoCardVariants | undefined; - tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "EntityConsumingComponentsCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -150,10 +137,8 @@ export const EntityConsumedApisCard: ({ // @public (undocumented) export const EntityConsumingComponentsCard: ({ variant, - tableOptions, }: { variant?: InfoCardVariants | undefined; - tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "EntityHasApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -161,10 +146,8 @@ export const EntityConsumingComponentsCard: ({ // @public (undocumented) export const EntityHasApisCard: ({ variant, - tableOptions, }: { variant?: InfoCardVariants | undefined; - tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "EntityProvidedApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -172,10 +155,8 @@ export const EntityHasApisCard: ({ // @public (undocumented) export const EntityProvidedApisCard: ({ variant, - tableOptions, }: { variant?: InfoCardVariants | undefined; - tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "EntityProvidingComponentsCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -183,10 +164,8 @@ export const EntityProvidedApisCard: ({ // @public (undocumented) export const EntityProvidingComponentsCard: ({ variant, - tableOptions, }: { variant?: InfoCardVariants | undefined; - tableOptions?: Options | undefined; }) => JSX.Element; // Warning: (ae-missing-release-tag) "GraphQlDefinitionWidget" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) @@ -207,10 +186,7 @@ export type GraphQlDefinitionWidgetProps = { // Warning: (ae-missing-release-tag) "HasApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const HasApisCard: ({ - variant, - tableOptions, -}: Props_2) => JSX.Element; +export const HasApisCard: ({ variant }: Props_2) => JSX.Element; // Warning: (ae-missing-release-tag) "OpenApiDefinitionWidget" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // @@ -245,17 +221,11 @@ export type PlainApiDefinitionWidgetProps = { // Warning: (ae-missing-release-tag) "ProvidedApisCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const ProvidedApisCard: ({ - variant, - tableOptions, -}: Props_3) => JSX.Element; +export const ProvidedApisCard: ({ variant }: Props_3) => JSX.Element; // Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts // Warning: (ae-missing-release-tag) "ProvidingComponentsCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export const ProvidingComponentsCard: ({ - variant, - tableOptions, -}: Props_5) => JSX.Element; +export const ProvidingComponentsCard: ({ variant }: Props_5) => JSX.Element; ``` diff --git a/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx b/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx index 06c4b6f76a..9fc6b2c3c2 100644 --- a/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx +++ b/plugins/api-docs/src/components/ApiExplorerPage/DefaultApiExplorerPage.tsx @@ -57,7 +57,6 @@ export type DefaultApiExplorerPageProps = { initiallySelectedFilter?: UserListFilterKind; columns?: TableColumn[]; actions?: TableProps['actions']; - tableOptions?: TableProps['options']; }; /** @@ -68,7 +67,6 @@ export const DefaultApiExplorerPage = ({ initiallySelectedFilter = 'all', columns, actions, - tableOptions = {}, }: DefaultApiExplorerPageProps) => { const configApi = useApi(configApiRef); const generatedSubtitle = `${ @@ -105,7 +103,6 @@ export const DefaultApiExplorerPage = ({ diff --git a/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx b/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx index 60d6ffb699..fde41425c9 100644 --- a/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx +++ b/plugins/api-docs/src/components/ApisCards/ConsumedApisCard.tsx @@ -14,11 +14,7 @@ * limitations under the License. */ -import { - ApiEntity, - Entity, - RELATION_CONSUMES_API, -} from '@backstage/catalog-model'; +import { ApiEntity, RELATION_CONSUMES_API } from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; import { EntityTable, @@ -33,19 +29,14 @@ import { InfoCardVariants, Link, Progress, - TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; }; -export const ConsumedApisCard = ({ - variant = 'gridItem', - tableOptions = {}, -}: Props) => { +export const ConsumedApisCard = ({ variant = 'gridItem' }: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_CONSUMES_API, @@ -90,7 +81,6 @@ export const ConsumedApisCard = ({ } columns={apiEntityColumns} entities={entities as ApiEntity[]} - tableOptions={tableOptions} /> ); }; diff --git a/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx b/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx index 3f9e9c8d71..bb22f82269 100644 --- a/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx +++ b/plugins/api-docs/src/components/ApisCards/HasApisCard.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import { ApiEntity, Entity, RELATION_HAS_PART } from '@backstage/catalog-model'; +import { ApiEntity, RELATION_HAS_PART } from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; import { EntityTable, @@ -30,13 +30,11 @@ import { Link, Progress, TableColumn, - TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; }; const columns: TableColumn[] = [ @@ -47,10 +45,7 @@ const columns: TableColumn[] = [ EntityTable.columns.createMetadataDescriptionColumn(), ]; -export const HasApisCard = ({ - variant = 'gridItem', - tableOptions = {}, -}: Props) => { +export const HasApisCard = ({ variant = 'gridItem' }: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_HAS_PART, @@ -96,7 +91,6 @@ export const HasApisCard = ({ } columns={columns} entities={entities as ApiEntity[]} - tableOptions={tableOptions} /> ); }; diff --git a/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx b/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx index 627a4bba37..6ffb6365d2 100644 --- a/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx +++ b/plugins/api-docs/src/components/ApisCards/ProvidedApisCard.tsx @@ -14,11 +14,7 @@ * limitations under the License. */ -import { - ApiEntity, - Entity, - RELATION_PROVIDES_API, -} from '@backstage/catalog-model'; +import { ApiEntity, RELATION_PROVIDES_API } from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; import { EntityTable, @@ -33,19 +29,14 @@ import { InfoCardVariants, Link, Progress, - TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; }; -export const ProvidedApisCard = ({ - variant = 'gridItem', - tableOptions = {}, -}: Props) => { +export const ProvidedApisCard = ({ variant = 'gridItem' }: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_PROVIDES_API, @@ -90,7 +81,6 @@ export const ProvidedApisCard = ({ } columns={apiEntityColumns} entities={entities as ApiEntity[]} - tableOptions={tableOptions} /> ); }; diff --git a/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.tsx b/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.tsx index 62fa13c027..af3dcb7204 100644 --- a/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.tsx +++ b/plugins/api-docs/src/components/ComponentsCards/ConsumingComponentsCard.tsx @@ -16,7 +16,6 @@ import { ComponentEntity, - Entity, RELATION_API_CONSUMED_BY, } from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; @@ -32,19 +31,14 @@ import { InfoCardVariants, Link, Progress, - TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; }; -export const ConsumingComponentsCard = ({ - variant = 'gridItem', - tableOptions = {}, -}: Props) => { +export const ConsumingComponentsCard = ({ variant = 'gridItem' }: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_API_CONSUMED_BY, @@ -88,7 +82,6 @@ export const ConsumingComponentsCard = ({ } columns={EntityTable.componentEntityColumns} entities={entities as ComponentEntity[]} - tableOptions={tableOptions} /> ); }; diff --git a/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.tsx b/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.tsx index a16991d57a..0be746de6d 100644 --- a/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.tsx +++ b/plugins/api-docs/src/components/ComponentsCards/ProvidingComponentsCard.tsx @@ -16,7 +16,6 @@ import { ComponentEntity, - Entity, RELATION_API_PROVIDED_BY, } from '@backstage/catalog-model'; import { Typography } from '@material-ui/core'; @@ -32,19 +31,14 @@ import { InfoCardVariants, Link, Progress, - TableProps, WarningPanel, } from '@backstage/core-components'; -type Props = { +type Props = { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; }; -export const ProvidingComponentsCard = ({ - variant = 'gridItem', - tableOptions = {}, -}: Props) => { +export const ProvidingComponentsCard = ({ variant = 'gridItem' }: Props) => { const { entity } = useEntity(); const { entities, loading, error } = useRelatedEntities(entity, { type: RELATION_API_PROVIDED_BY, @@ -88,7 +82,6 @@ export const ProvidingComponentsCard = ({ } columns={EntityTable.componentEntityColumns} entities={entities as ComponentEntity[]} - tableOptions={tableOptions} /> ); }; diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 48be22cd4a..285ecafd70 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -26,7 +26,6 @@ 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 { TableProps } from '@backstage/core-components'; // @public export const AsyncEntityProvider: ({ @@ -333,8 +332,6 @@ export interface EntityTableProps { // (undocumented) entities: T[]; // (undocumented) - tableOptions?: TableProps['options']; - // (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 9f65640569..3aa6857120 100644 --- a/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx +++ b/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx @@ -23,7 +23,6 @@ import { InfoCardVariants, Table, TableColumn, - TableProps, } from '@backstage/core-components'; /** @@ -37,7 +36,6 @@ export interface EntityTableProps { entities: T[]; emptyContent?: ReactNode; columns: TableColumn[]; - tableOptions?: TableProps['options']; } const useStyles = makeStyles(theme => ({ @@ -61,7 +59,6 @@ export const EntityTable = (props: EntityTableProps) => { emptyContent, variant = 'gridItem', columns, - tableOptions = {}, } = props; const classes = useStyles(); @@ -83,14 +80,11 @@ export const EntityTable = (props: EntityTableProps) => { emptyContent &&
{emptyContent}
} options={{ - ...{ - // TODO: Toolbar padding if off compared to other cards, should be: padding: 16px 24px; - search: false, - paging: false, - actionsColumnIndex: -1, - padding: 'dense', - }, - ...tableOptions, + // TODO: Toolbar padding if off compared to other cards, should be: padding: 16px 24px; + search: false, + paging: false, + actionsColumnIndex: -1, + padding: 'dense', }} data={entities} /> diff --git a/plugins/catalog/api-report.md b/plugins/catalog/api-report.md index 70d9b05f33..3d426a0c8b 100644 --- a/plugins/catalog/api-report.md +++ b/plugins/catalog/api-report.md @@ -7,7 +7,6 @@ import { ApiHolder } from '@backstage/core-plugin-api'; import { BackstagePlugin } from '@backstage/core-plugin-api'; -import { ComponentEntity } from '@backstage/catalog-model'; import { CompoundEntityRef } from '@backstage/catalog-model'; import { Entity } from '@backstage/catalog-model'; import { ExternalRouteRef } from '@backstage/core-plugin-api'; @@ -18,13 +17,11 @@ import { Observable } from '@backstage/types'; import { Overrides } from '@material-ui/core/styles/overrides'; import { default as React_2 } from 'react'; import { ReactNode } from 'react'; -import { ResourceEntity } from '@backstage/catalog-model'; import { ResultHighlight } from '@backstage/plugin-search-common'; import { RouteRef } from '@backstage/core-plugin-api'; import { StarredEntitiesApi } from '@backstage/plugin-catalog-react'; import { StorageApi } from '@backstage/core-plugin-api'; import { StyleRules } from '@material-ui/core/styles/withStyles'; -import { SystemEntity } from '@backstage/catalog-model'; import { TableColumn } from '@backstage/core-components'; import { TableProps } from '@backstage/core-components'; import { TabProps } from '@material-ui/core'; @@ -187,8 +184,6 @@ export class DefaultStarredEntitiesApi implements StarredEntitiesApi { // @public (undocumented) export interface DependencyOfComponentsCardProps { - // (undocumented) - tableOptions?: TableProps['options']; // (undocumented) title?: string; // (undocumented) @@ -197,8 +192,6 @@ export interface DependencyOfComponentsCardProps { // @public (undocumented) export interface DependsOnComponentsCardProps { - // (undocumented) - tableOptions?: TableProps['options']; // (undocumented) title?: string; // (undocumented) @@ -207,8 +200,6 @@ export interface DependsOnComponentsCardProps { // @public (undocumented) export interface DependsOnResourcesCardProps { - // (undocumented) - tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } @@ -357,32 +348,24 @@ export function hasCatalogProcessingErrors( // @public (undocumented) export interface HasComponentsCardProps { - // (undocumented) - tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } // @public (undocumented) export interface HasResourcesCardProps { - // (undocumented) - tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } // @public (undocumented) export interface HasSubcomponentsCardProps { - // (undocumented) - tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } // @public (undocumented) export interface HasSystemsCardProps { - // (undocumented) - tableOptions?: TableProps['options']; // (undocumented) variant?: InfoCardVariants; } @@ -423,7 +406,6 @@ export type RelatedEntitiesCardProps = { relationType: string; emptyMessage: string; emptyHelpLink: string; - tableOptions?: TableProps['options']; asRenderableEntities: (entities: Entity[]) => T[]; }; diff --git a/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx b/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx index d60785d165..d87b558048 100644 --- a/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx +++ b/plugins/catalog/src/components/DependencyOfComponentsCard/DependencyOfComponentsCard.tsx @@ -14,11 +14,8 @@ * limitations under the License. */ -import { - ComponentEntity, - RELATION_DEPENDENCY_OF, -} from '@backstage/catalog-model'; -import { InfoCardVariants, TableProps } from '@backstage/core-components'; +import { RELATION_DEPENDENCY_OF } from '@backstage/catalog-model'; +import { InfoCardVariants } from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -31,17 +28,12 @@ import { export interface DependencyOfComponentsCardProps { variant?: InfoCardVariants; title?: string; - tableOptions?: TableProps['options']; } export function DependencyOfComponentsCard( props: DependencyOfComponentsCardProps, ) { - const { - variant = 'gridItem', - title = 'Dependency of components', - tableOptions = {}, - } = props; + const { variant = 'gridItem', title = 'Dependency of components' } = props; return ( ); } diff --git a/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx b/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx index 83e01f10ca..4f30c17a84 100644 --- a/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx +++ b/plugins/catalog/src/components/DependsOnComponentsCard/DependsOnComponentsCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { ComponentEntity, RELATION_DEPENDS_ON } from '@backstage/catalog-model'; -import { InfoCardVariants, TableProps } from '@backstage/core-components'; +import { RELATION_DEPENDS_ON } from '@backstage/catalog-model'; +import { InfoCardVariants } from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -28,15 +28,10 @@ import { export interface DependsOnComponentsCardProps { variant?: InfoCardVariants; title?: string; - tableOptions?: TableProps['options']; } export function DependsOnComponentsCard(props: DependsOnComponentsCardProps) { - const { - variant = 'gridItem', - title = 'Depends on components', - tableOptions = {}, - } = props; + const { variant = 'gridItem', title = 'Depends on components' } = props; return ( ); } diff --git a/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx b/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx index 820afabaa2..a0f4d399f9 100644 --- a/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx +++ b/plugins/catalog/src/components/DependsOnResourcesCard/DependsOnResourcesCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { RELATION_DEPENDS_ON, ResourceEntity } from '@backstage/catalog-model'; -import { InfoCardVariants, TableProps } from '@backstage/core-components'; +import { RELATION_DEPENDS_ON } from '@backstage/catalog-model'; +import { InfoCardVariants } from '@backstage/core-components'; import React from 'react'; import { asResourceEntities, @@ -27,11 +27,10 @@ import { /** @public */ export interface DependsOnResourcesCardProps { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; } export function DependsOnResourcesCard(props: DependsOnResourcesCardProps) { - const { variant = 'gridItem', tableOptions = {} } = props; + const { variant = 'gridItem' } = props; return ( ); } diff --git a/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.tsx b/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.tsx index b3ce15d249..9654152a5c 100644 --- a/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.tsx +++ b/plugins/catalog/src/components/HasComponentsCard/HasComponentsCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { ComponentEntity, RELATION_HAS_PART } from '@backstage/catalog-model'; -import { InfoCardVariants, TableProps } from '@backstage/core-components'; +import { RELATION_HAS_PART } from '@backstage/catalog-model'; +import { InfoCardVariants } from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -27,11 +27,10 @@ import { /** @public */ export interface HasComponentsCardProps { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; } export function HasComponentsCard(props: HasComponentsCardProps) { - const { variant = 'gridItem', tableOptions = {} } = props; + const { variant = 'gridItem' } = props; return ( ); } diff --git a/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.tsx b/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.tsx index c7e2c2423b..8476d77bda 100644 --- a/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.tsx +++ b/plugins/catalog/src/components/HasResourcesCard/HasResourcesCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { RELATION_HAS_PART, ResourceEntity } from '@backstage/catalog-model'; -import { InfoCardVariants, TableProps } from '@backstage/core-components'; +import { RELATION_HAS_PART } from '@backstage/catalog-model'; +import { InfoCardVariants } from '@backstage/core-components'; import React from 'react'; import { asResourceEntities, @@ -27,11 +27,10 @@ import { /** @public */ export interface HasResourcesCardProps { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; } export function HasResourcesCard(props: HasResourcesCardProps) { - const { variant = 'gridItem', tableOptions = {} } = props; + const { variant = 'gridItem' } = props; return ( ); } diff --git a/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx b/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx index cbfa2025db..db95d31f9f 100644 --- a/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx +++ b/plugins/catalog/src/components/HasSubcomponentsCard/HasSubcomponentsCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { ComponentEntity, RELATION_HAS_PART } from '@backstage/catalog-model'; -import { InfoCardVariants, TableProps } from '@backstage/core-components'; +import { RELATION_HAS_PART } from '@backstage/catalog-model'; +import { InfoCardVariants } from '@backstage/core-components'; import React from 'react'; import { asComponentEntities, @@ -26,11 +26,10 @@ import { /** @public */ export interface HasSubcomponentsCardProps { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; } export function HasSubcomponentsCard(props: HasSubcomponentsCardProps) { - const { variant = 'gridItem', tableOptions = {} } = props; + const { variant = 'gridItem' } = props; return ( ); } diff --git a/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.tsx b/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.tsx index 6eb29c721b..5d6fa170f5 100644 --- a/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.tsx +++ b/plugins/catalog/src/components/HasSystemsCard/HasSystemsCard.tsx @@ -14,8 +14,8 @@ * limitations under the License. */ -import { RELATION_HAS_PART, SystemEntity } from '@backstage/catalog-model'; -import { InfoCardVariants, TableProps } from '@backstage/core-components'; +import { RELATION_HAS_PART } from '@backstage/catalog-model'; +import { InfoCardVariants } from '@backstage/core-components'; import React from 'react'; import { asSystemEntities, @@ -27,7 +27,6 @@ import { /** @public */ export interface HasSystemsCardProps { variant?: InfoCardVariants; - tableOptions?: TableProps['options']; } export function HasSystemsCard(props: HasSystemsCardProps) { diff --git a/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx b/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx index 2e5d6bf9e3..e802b0b583 100644 --- a/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx +++ b/plugins/catalog/src/components/RelatedEntitiesCard/RelatedEntitiesCard.tsx @@ -29,7 +29,6 @@ import { Progress, ResponseErrorPanel, TableColumn, - TableProps, } from '@backstage/core-components'; /** @public */ @@ -41,7 +40,6 @@ export type RelatedEntitiesCardProps = { relationType: string; emptyMessage: string; emptyHelpLink: string; - tableOptions?: TableProps['options']; asRenderableEntities: (entities: Entity[]) => T[]; }; @@ -68,7 +66,6 @@ export function RelatedEntitiesCard( relationType, emptyMessage, emptyHelpLink, - tableOptions = {}, asRenderableEntities, } = props; @@ -108,7 +105,6 @@ export function RelatedEntitiesCard( } columns={columns} entities={asRenderableEntities(entities || [])} - tableOptions={tableOptions} /> ); } From 568f2d1e75ba2643f8c1d1e5ae4270e0bf97998f Mon Sep 17 00:00:00 2001 From: Michael Haley Date: Tue, 7 Jun 2022 10:28:57 -0400 Subject: [PATCH 7/8] Change Table component to no longer use draggable columns default Signed-off-by: Michael Haley --- .changeset/gorgeous-trees-sparkle.md | 5 +++++ .../catalog-react/src/components/EntityTable/EntityTable.tsx | 1 + 2 files changed, 6 insertions(+) create mode 100644 .changeset/gorgeous-trees-sparkle.md diff --git a/.changeset/gorgeous-trees-sparkle.md b/.changeset/gorgeous-trees-sparkle.md new file mode 100644 index 0000000000..692f1ad905 --- /dev/null +++ b/.changeset/gorgeous-trees-sparkle.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-catalog-react': patch +--- + +Table component no longer has draggable columns by default diff --git a/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx b/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx index 3aa6857120..424d8b940e 100644 --- a/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx +++ b/plugins/catalog-react/src/components/EntityTable/EntityTable.tsx @@ -85,6 +85,7 @@ export const EntityTable = (props: EntityTableProps) => { paging: false, actionsColumnIndex: -1, padding: 'dense', + draggable: false, }} data={entities} /> From a11506895d2a3b898c28179e959e290c60546e49 Mon Sep 17 00:00:00 2001 From: Michael Haley Date: Tue, 7 Jun 2022 18:24:29 -0400 Subject: [PATCH 8/8] Fixed verbiage in changeset Signed-off-by: Michael Haley --- .changeset/gorgeous-trees-sparkle.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/gorgeous-trees-sparkle.md b/.changeset/gorgeous-trees-sparkle.md index 692f1ad905..962cc22021 100644 --- a/.changeset/gorgeous-trees-sparkle.md +++ b/.changeset/gorgeous-trees-sparkle.md @@ -2,4 +2,4 @@ '@backstage/plugin-catalog-react': patch --- -Table component no longer has draggable columns by default +Table component no longer has drag and drop columns by default