added additional props in entity dependecies cards to manage table options
Signed-off-by: Abhay-soni-developer <abhaysoni.developer@gmail.com>
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
InfoCardVariants,
|
||||
Table,
|
||||
TableColumn,
|
||||
TableOptions,
|
||||
} from '@backstage/core-components';
|
||||
|
||||
/**
|
||||
@@ -36,6 +37,7 @@ export interface EntityTableProps<T extends Entity> {
|
||||
entities: T[];
|
||||
emptyContent?: ReactNode;
|
||||
columns: TableColumn<T>[];
|
||||
tableOptions?: TableOptions;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
@@ -59,6 +61,7 @@ export const EntityTable = <T extends Entity>(props: EntityTableProps<T>) => {
|
||||
emptyContent,
|
||||
variant = 'gridItem',
|
||||
columns,
|
||||
tableOptions = {},
|
||||
} = props;
|
||||
|
||||
const classes = useStyles();
|
||||
@@ -86,6 +89,7 @@ export const EntityTable = <T extends Entity>(props: EntityTableProps<T>) => {
|
||||
actionsColumnIndex: -1,
|
||||
padding: 'dense',
|
||||
draggable: false,
|
||||
...tableOptions,
|
||||
}}
|
||||
data={entities}
|
||||
/>
|
||||
|
||||
@@ -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<ComponentEntity>[];
|
||||
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 (
|
||||
<RelatedEntitiesCard
|
||||
@@ -47,6 +53,7 @@ export function DependsOnComponentsCard(props: DependsOnComponentsCardProps) {
|
||||
emptyMessage="No component is a dependency of this component"
|
||||
emptyHelpLink={componentEntityHelpLink}
|
||||
asRenderableEntities={asComponentEntities}
|
||||
tableOptions={tableOptions}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
Progress,
|
||||
ResponseErrorPanel,
|
||||
TableColumn,
|
||||
TableOptions,
|
||||
} from '@backstage/core-components';
|
||||
|
||||
/** @public */
|
||||
@@ -41,6 +42,7 @@ export type RelatedEntitiesCardProps<T extends Entity> = {
|
||||
emptyMessage: string;
|
||||
emptyHelpLink: string;
|
||||
asRenderableEntities: (entities: Entity[]) => T[];
|
||||
tableOptions?: TableOptions;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -67,6 +69,7 @@ export function RelatedEntitiesCard<T extends Entity>(
|
||||
emptyMessage,
|
||||
emptyHelpLink,
|
||||
asRenderableEntities,
|
||||
tableOptions = {},
|
||||
} = props;
|
||||
|
||||
const { entity } = useEntity();
|
||||
@@ -105,6 +108,7 @@ export function RelatedEntitiesCard<T extends Entity>(
|
||||
}
|
||||
columns={columns}
|
||||
entities={asRenderableEntities(entities || [])}
|
||||
tableOptions={tableOptions}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user