Merge pull request #30938 from backstage/blam/catalog-backwards-compat
`catalog-react`: Add support for backwards comat of `default*` props for Blueprints
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-react': patch
|
||||
---
|
||||
|
||||
Support `default*` for older packages as this package is in range for breaking `/alpha` changes
|
||||
@@ -86,9 +86,12 @@ export const EntityContentBlueprint = createExtensionBlueprint({
|
||||
},
|
||||
{ node, config },
|
||||
) {
|
||||
const path = config.path ?? params.path;
|
||||
const title = config.title ?? params.title;
|
||||
const group = config.group ?? params.group;
|
||||
// TODO(blam): Remove support for all the `default*` props in the future, this breaks backwards compatibility without it
|
||||
// As this is marked as BREAKING ALPHA, it doesn't affect the public API so it falls in range and gets picked
|
||||
// up by packages that depend on `catalog-react`.
|
||||
const path = config.path ?? params.path ?? params.defaultPath;
|
||||
const title = config.title ?? params.title ?? params.defaultTitle;
|
||||
const group = config.group ?? params.group ?? params.defaultGroup;
|
||||
|
||||
yield coreExtensionData.reactElement(
|
||||
ExtensionBoundary.lazy(node, params.loader),
|
||||
@@ -104,7 +107,7 @@ export const EntityContentBlueprint = createExtensionBlueprint({
|
||||
|
||||
yield* resolveEntityFilterData(params.filter, config, node);
|
||||
|
||||
if (group) {
|
||||
if (group && typeof group === 'string') {
|
||||
yield entityContentGroupDataRef(group);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -82,13 +82,19 @@ export function convertLegacyEntityContentExtension(
|
||||
}
|
||||
}
|
||||
name = name && kebabCase(name);
|
||||
|
||||
// TODO(blam): Remove support for all the `default*` props in the future, this breaks backwards compatibility without it
|
||||
// As this is marked as BREAKING ALPHA, it doesn't affect the public API so it falls in range and gets picked
|
||||
// up by packages that depend on `catalog-react`.
|
||||
return EntityContentBlueprint.make({
|
||||
name: overrides?.name ?? name,
|
||||
params: {
|
||||
filter: overrides?.filter,
|
||||
path: overrides?.path ?? `/${kebabCase(infix)}`,
|
||||
title: overrides?.title ?? startCase(infix),
|
||||
path: (overrides?.path ??
|
||||
overrides?.defaultPath ??
|
||||
`/${kebabCase(infix)}`) as string,
|
||||
title: (overrides?.title ??
|
||||
overrides?.defaultTitle ??
|
||||
startCase(infix)) as string,
|
||||
routeRef: mountPoint && convertLegacyRouteRef(mountPoint),
|
||||
loader: async () => compatWrapper(element),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user