Expose all props available to underlying EntityRelationsGraph.

Signed-off-by: Aramis Sennyey <sennyeya@amazon.com>
This commit is contained in:
Aramis Sennyey
2023-02-01 17:31:08 -05:00
parent cc08d60324
commit 8657e0f05c
2 changed files with 18 additions and 25 deletions
@@ -36,8 +36,8 @@ import {
Direction,
EntityNode,
EntityRelationsGraph,
RelationPairs,
} from '../EntityRelationsGraph';
import { EntityRelationsGraphProps } from '../EntityRelationsGraph/EntityRelationsGraph';
const useStyles = makeStyles<Theme, { height: number | undefined }>(
{
@@ -55,27 +55,19 @@ const useStyles = makeStyles<Theme, { height: number | undefined }>(
{ name: 'PluginCatalogGraphCatalogGraphCard' },
);
export const CatalogGraphCard = (props: {
variant?: InfoCardVariants;
relationPairs?: RelationPairs;
maxDepth?: number;
unidirectional?: boolean;
mergeRelations?: boolean;
kinds?: string[];
relations?: string[];
direction?: Direction;
height?: number;
title?: string;
zoom?: 'enabled' | 'disabled' | 'enable-on-click';
}) => {
export const CatalogGraphCard = (
props: Omit<EntityRelationsGraphProps, 'rootEntityNames'> & {
variant?: InfoCardVariants;
height?: number;
title?: string;
},
) => {
const {
variant = 'gridItem',
relationPairs = ALL_RELATION_PAIRS,
maxDepth = 1,
unidirectional = true,
mergeRelations = true,
kinds,
relations,
direction = Direction.LEFT_RIGHT,
height,
title = 'Relations',
@@ -133,12 +125,11 @@ export const CatalogGraphCard = (props: {
}}
>
<EntityRelationsGraph
{...props}
rootEntityNames={entityName}
maxDepth={maxDepth}
unidirectional={unidirectional}
mergeRelations={mergeRelations}
kinds={kinds}
relations={relations}
direction={direction}
onNodeClick={onNodeClick}
className={classes.graph}
@@ -66,12 +66,7 @@ const useStyles = makeStyles(
{ name: 'PluginCatalogGraphEntityRelationsGraph' },
);
/**
* Core building block for custom entity relations diagrams.
*
* @public
*/
export const EntityRelationsGraph = (props: {
export interface EntityRelationsGraphProps {
rootEntityNames: CompoundEntityRef | CompoundEntityRef[];
maxDepth?: number;
unidirectional?: boolean;
@@ -86,7 +81,14 @@ export const EntityRelationsGraph = (props: {
renderNode?: DependencyGraphTypes.RenderNodeFunction<EntityNode>;
renderLabel?: DependencyGraphTypes.RenderLabelFunction<EntityEdge>;
curve?: 'curveStepBefore' | 'curveMonotoneX';
}) => {
}
/**
* Core building block for custom entity relations diagrams.
*
* @public
*/
export const EntityRelationsGraph = (props: EntityRelationsGraphProps) => {
const {
rootEntityNames,
maxDepth = 2,