DepenedsOnResourcesCard, EntityHasSubcomponentsCard

now we can pass tableOptions props through them

Signed-off-by: Abhay-soni-developer <abhaysoni.developer@gmail.com>
This commit is contained in:
Abhay-soni-developer
2023-06-30 12:41:18 +05:30
parent cbd18fc0d7
commit ecacbce405
2 changed files with 12 additions and 3 deletions
@@ -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<ResourceEntity>[];
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 (
<RelatedEntitiesCard
@@ -47,6 +53,7 @@ export function DependsOnResourcesCard(props: DependsOnResourcesCardProps) {
emptyMessage="No resource is a dependency of this component"
emptyHelpLink={componentEntityHelpLink}
asRenderableEntities={asResourceEntities}
tableOptions={tableOptions}
/>
);
}
@@ -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 (
<RelatedEntitiesCard
variant={variant}
@@ -40,6 +41,7 @@ export function HasSubcomponentsCard(props: HasSubcomponentsCardProps) {
asRenderableEntities={asComponentEntities}
emptyMessage="No subcomponent is part of this component"
emptyHelpLink="https://backstage.io/docs/features/software-catalog/descriptor-format#specsubcomponentof-optional"
tableOptions={tableOptions}
/>
);
}