chore: reworking some thigns

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2021-06-11 10:33:10 +02:00
parent 969c6750af
commit 359a118902
6 changed files with 60 additions and 58 deletions
+1
View File
@@ -33,6 +33,7 @@
"@backstage/catalog-client": "^0.3.13",
"@backstage/catalog-model": "^0.8.2",
"@backstage/core": "^0.7.12",
"@backstage/core-plugin-api": "^0.1.1",
"@backstage/errors": "^0.1.1",
"@backstage/integration": "^0.5.6",
"@backstage/integration-react": "^0.1.3",
@@ -29,7 +29,7 @@ import {
Progress,
RoutedTabs,
} from '@backstage/core';
import { useElementCollection } from '@backstage/core-plugin-api';
import { useElementFilter } from '@backstage/core-plugin-api';
import {
EntityContext,
EntityRefLinks,
@@ -157,26 +157,28 @@ export const EntityLayout = ({
const { kind, namespace, name } = useEntityCompoundName();
const { entity, loading, error } = useContext(EntityContext);
const routes = useElementCollection(children)
.findByComponentData({
key: dataKey,
withStrictError: 'Child of EntityLayout must be an EntityLayout.Route',
})
.listElements<SubRoute>() // all nodes, element data, maintain structure or not?
.flatMap(({ props }) => {
if (props.if && entity && !props.if(entity)) {
return [];
}
const routes = useElementFilter(children, elements =>
elements
.selectByComponentData({
key: dataKey,
withStrictError: 'Child of EntityLayout must be an EntityLayout.Route',
})
.getElements<SubRoute>() // all nodes, element data, maintain structure or not?
.flatMap(({ props }) => {
if (props.if && entity && !props.if(entity)) {
return [];
}
return [
{
path: props.path,
title: props.title,
children: props.children,
tabProps: props.tabProps,
},
];
});
return [
{
path: props.path,
title: props.title,
children: props.children,
tabProps: props.tabProps,
},
];
}),
);
const { headerTitle, headerType } = headerProps(
kind,
+1 -4
View File
@@ -37,10 +37,7 @@ export const Router = () => {
.selectByComponentData({
key: FIELD_EXTENSION_WRAPPER_KEY,
})
.select({
key: FIELD_EXTENSION_WRAPPER_KEY,
})
.getComponentData<FieldExtensionOptions>({
.findComponentData<FieldExtensionOptions>({
key: FIELD_EXTENSION_KEY,
}),
);