From 71573c90a398dfc068a6051d025b5631de785949 Mon Sep 17 00:00:00 2001 From: Abhay-soni-developer Date: Fri, 30 Jun 2023 10:54:48 +0530 Subject: [PATCH 1/6] added additional props in entity dependecies cards to manage table options Signed-off-by: Abhay-soni-developer --- .../src/components/EntityTable/EntityTable.tsx | 4 ++++ .../DependsOnComponentsCard/DependsOnComponentsCard.tsx | 9 ++++++++- .../RelatedEntitiesCard/RelatedEntitiesCard.tsx | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) 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/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/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} /> ); } From ecacbce405710eee0868d43aad8e67332f131c6f Mon Sep 17 00:00:00 2001 From: Abhay-soni-developer Date: Fri, 30 Jun 2023 12:41:18 +0530 Subject: [PATCH 2/6] DepenedsOnResourcesCard, EntityHasSubcomponentsCard now we can pass tableOptions props through them Signed-off-by: Abhay-soni-developer --- .../DependsOnResourcesCard/DependsOnResourcesCard.tsx | 9 ++++++++- .../HasSubcomponentsCard/HasSubcomponentsCard.tsx | 6 ++++-- 2 files changed, 12 insertions(+), 3 deletions(-) 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 ( ); } From 6bd5541e1a3886fba78f2927c5c284f13bc16d33 Mon Sep 17 00:00:00 2001 From: Abhay-soni-developer Date: Fri, 30 Jun 2023 13:56:35 +0530 Subject: [PATCH 3/6] docs modified Signed-off-by: Abhay-soni-developer --- plugins/catalog-react/api-report.md | 3 +++ plugins/catalog/api-report.md | 8 ++++++++ 2 files changed, 11 insertions(+) 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/api-report.md b/plugins/catalog/api-report.md index f053c15c8a..475fff2cad 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; @@ -437,6 +442,8 @@ export interface HasResourcesCardProps { // @public (undocumented) export interface HasSubcomponentsCardProps { + // (undocumented) + tableOptions?: TableOptions; // (undocumented) variant?: InfoCardVariants; } @@ -495,6 +502,7 @@ export type RelatedEntitiesCardProps = { emptyMessage: string; emptyHelpLink: string; asRenderableEntities: (entities: Entity[]) => T[]; + tableOptions?: TableOptions; }; // @public (undocumented) From eae0352d3864b2e0c5e5d577e5d86035dc82d87e Mon Sep 17 00:00:00 2001 From: Abhay-soni-developer Date: Wed, 5 Jul 2023 18:09:43 +0530 Subject: [PATCH 4/6] changeset added Signed-off-by: Abhay-soni-developer --- .changeset/popular-icons-doubt.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/popular-icons-doubt.md diff --git a/.changeset/popular-icons-doubt.md b/.changeset/popular-icons-doubt.md new file mode 100644 index 0000000000..137b8467df --- /dev/null +++ b/.changeset/popular-icons-doubt.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-catalog-react': minor +'@backstage/plugin-catalog': minor +--- + +I have extended the EntityHasSubcomponentsCard, EntityDependsOnResourcesCard and EntityDependsOnResourcesCard and EntityTable to supports tableOptions. From 0d28d2b5f96f069dd62927ad1dd364ce1e8688c9 Mon Sep 17 00:00:00 2001 From: Abhay-soni-developer Date: Wed, 5 Jul 2023 18:21:04 +0530 Subject: [PATCH 5/6] changeset modified Signed-off-by: Abhay-soni-developer --- .changeset/popular-icons-doubt.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/popular-icons-doubt.md b/.changeset/popular-icons-doubt.md index 137b8467df..70ad8fbdac 100644 --- a/.changeset/popular-icons-doubt.md +++ b/.changeset/popular-icons-doubt.md @@ -3,4 +3,4 @@ '@backstage/plugin-catalog': minor --- -I have extended the EntityHasSubcomponentsCard, EntityDependsOnResourcesCard and EntityDependsOnResourcesCard and EntityTable to supports tableOptions. +I have extended the EntityHasSubcomponentsCard, EntityDependsOnResourcesCard, EntityDependsOnResourcesCard and EntityTable to support table options. From 540b1c5ed2e1c10ed769711a7b30dc5c5a279222 Mon Sep 17 00:00:00 2001 From: Abhay Soni Date: Thu, 6 Jul 2023 08:49:50 +0530 Subject: [PATCH 6/6] Update .changeset/popular-icons-doubt.md feedback integrated Co-authored-by: Ben Lambert Signed-off-by: Abhay Soni --- .changeset/popular-icons-doubt.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/popular-icons-doubt.md b/.changeset/popular-icons-doubt.md index 70ad8fbdac..4ba9728afe 100644 --- a/.changeset/popular-icons-doubt.md +++ b/.changeset/popular-icons-doubt.md @@ -3,4 +3,4 @@ '@backstage/plugin-catalog': minor --- -I have extended the EntityHasSubcomponentsCard, EntityDependsOnResourcesCard, EntityDependsOnResourcesCard and EntityTable to support table options. +Tables which use `EntityTableProps` now have an additional `tableOptions` prop which can be used to provide additional table options to these components.