catalog: gather all mount points beneath EntityLayout Routes
Co-authored-by: blam <ben@blam.sh>
This commit is contained in:
@@ -24,7 +24,14 @@ import React, {
|
||||
useState,
|
||||
} from 'react';
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Content, Header, HeaderLabel, Page, Progress } from '@backstage/core';
|
||||
import {
|
||||
attachComponentData,
|
||||
Content,
|
||||
Header,
|
||||
HeaderLabel,
|
||||
Page,
|
||||
Progress,
|
||||
} from '@backstage/core';
|
||||
import { Box } from '@material-ui/core';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
import { useNavigate } from 'react-router';
|
||||
@@ -43,6 +50,9 @@ type SubRoute = {
|
||||
|
||||
const Route: (props: SubRoute) => null = () => null;
|
||||
|
||||
// This causes all mount points that are discovered within this route to use the path of the route itself
|
||||
attachComponentData(Route, 'core.gatherMountPoints', true);
|
||||
|
||||
export function createSubRoutesFromChildren(children: ReactNode): SubRoute[] {
|
||||
return Children.toArray(children).flatMap(child => {
|
||||
if (!isValidElement(child)) {
|
||||
|
||||
Reference in New Issue
Block a user