diff --git a/.changeset/lemon-fishes-build.md b/.changeset/lemon-fishes-build.md new file mode 100644 index 0000000000..0b1ba4090c --- /dev/null +++ b/.changeset/lemon-fishes-build.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-explore': patch +--- + +Handle Group Big Names in explore plugin diff --git a/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.test.tsx b/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.test.tsx index 3b9b523b02..66f54900c9 100644 --- a/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.test.tsx +++ b/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.test.tsx @@ -33,7 +33,7 @@ describe('', () => { }); }); - it('shows groups', async () => { + it('show single group', async () => { const catalogApi: Partial = { getEntities: () => Promise.resolve({ @@ -66,7 +66,6 @@ describe('', () => { }, }, ); - - expect(getByText('Group A')).toBeInTheDocument(); + expect(getByText('Group A', { selector: 'div' })).toBeInTheDocument(); }); }); diff --git a/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx b/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx index 71492c3520..c865920e7d 100644 --- a/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx +++ b/plugins/explore/src/components/GroupsExplorerContent/GroupsDiagram.tsx @@ -50,8 +50,33 @@ const useStyles = makeStyles((theme: BackstageTheme) => ({ fill: 'yellowgreen', stroke: theme.palette.border, }, + centeredContent: { + padding: '10px', + height: '100%', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + color: 'black', + }, + textWrapper: { + display: '-webkit-box', + WebkitBoxOrient: 'vertical', + WebkitLineClamp: 2, + overflow: 'hidden', + textOverflow: 'ellipsis', + textAlign: 'center', + fontWeight: 'bold', + fontSize: '20px', + }, })); +const dimensions = { + nodeWidth: 180, + nodeHeight: 90, + nodeCornerRadius: 20, + nodeAligmentShift: 5, +}; + function RenderNode(props: DependencyGraphTypes.RenderNodeProps) { const classes = useStyles(); const catalogEntityRoute = useRouteRef(entityRouteRef); @@ -60,20 +85,20 @@ function RenderNode(props: DependencyGraphTypes.RenderNodeProps) { return ( - {props.node.name} + - {props.node.name} - +
+
{props.node.name}
+
+
); } @@ -82,7 +107,14 @@ function RenderNode(props: DependencyGraphTypes.RenderNodeProps) { return ( - + + {props.node.name} + ) { name: ref.name, })} > - - {props.node.name} - +
+
{props.node.name}
+
+
); diff --git a/plugins/explore/src/components/GroupsExplorerContent/GroupsExplorerContent.test.tsx b/plugins/explore/src/components/GroupsExplorerContent/GroupsExplorerContent.test.tsx index 7b3a73673e..52def47f7c 100644 --- a/plugins/explore/src/components/GroupsExplorerContent/GroupsExplorerContent.test.tsx +++ b/plugins/explore/src/components/GroupsExplorerContent/GroupsExplorerContent.test.tsx @@ -79,7 +79,9 @@ describe('', () => { ); await waitFor(() => { - expect(getByText('my-namespace/group-a')).toBeInTheDocument(); + expect( + getByText('my-namespace/group-a', { selector: 'div' }), + ).toBeInTheDocument(); }); }); @@ -93,7 +95,9 @@ describe('', () => { mountedRoutes, ); - await waitFor(() => expect(getByText('Our Teams')).toBeInTheDocument()); + await waitFor(() => + expect(getByText('Our Teams', { selector: 'h2' })).toBeInTheDocument(), + ); }); it('renders a friendly error if it cannot collect domains', async () => {