Merge pull request #25777 from leboncoin/fix-25452

fix(catalog-backend): preserve default allowedLocationTypes
This commit is contained in:
Patrik Oldsberg
2024-07-25 00:31:59 +02:00
committed by GitHub
2 changed files with 11 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend': patch
---
Preserve default `allowedLocationTypes` when `setAllowedLocationTypes()` of `CatalogLocationsExtensionPoint` is not called.
@@ -46,7 +46,7 @@ import { ForwardedError } from '@backstage/errors';
class CatalogLocationsExtensionPointImpl
implements CatalogLocationsExtensionPoint
{
#locationTypes = new Array<string>();
#locationTypes: string[] | undefined;
setAllowedLocationTypes(locationTypes: Array<string>) {
this.#locationTypes = locationTypes;
@@ -293,9 +293,11 @@ export const catalogPlugin = createBackendPlugin({
builder.addPermissionRules(...permissionExtensions.permissionRules);
builder.setFieldFormatValidators(modelExtensions.fieldValidators);
builder.setAllowedLocationTypes(
locationTypeExtensions.allowedLocationTypes,
);
if (locationTypeExtensions.allowedLocationTypes) {
builder.setAllowedLocationTypes(
locationTypeExtensions.allowedLocationTypes,
);
}
const { processingEngine, router } = await builder.build();