Support catalogFilter array on OwnedEntityPicker; addresses https://github.com/backstage/backstage/issues/25358
Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder': patch
|
||||
---
|
||||
|
||||
Support catalogFilter array on OwnedEntityPicker
|
||||
@@ -90,17 +90,11 @@ function buildEntityPickerUISchema(
|
||||
uiSchema?.['ui:options'] || {};
|
||||
const allowedKinds = uiOptions.allowedKinds;
|
||||
|
||||
const catalogFilter = {
|
||||
...uiOptions.catalogFilter,
|
||||
...(allowedKinds
|
||||
? {
|
||||
kind: allowedKinds,
|
||||
[`relations.${RELATION_OWNED_BY}`]: identityRefs || [],
|
||||
}
|
||||
: {
|
||||
[`relations.${RELATION_OWNED_BY}`]: identityRefs || [],
|
||||
}),
|
||||
};
|
||||
const catalogFilter = asArray(uiOptions.catalogFilter).map(e => ({
|
||||
...e,
|
||||
...(allowedKinds ? { kind: allowedKinds } : {}),
|
||||
[`relations.${RELATION_OWNED_BY}`]: identityRefs || [],
|
||||
}));
|
||||
|
||||
return {
|
||||
'ui:options': {
|
||||
@@ -108,3 +102,10 @@ function buildEntityPickerUISchema(
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function asArray(catalogFilter: any): any[] {
|
||||
if (catalogFilter) {
|
||||
return Array.isArray(catalogFilter) ? catalogFilter : [catalogFilter];
|
||||
}
|
||||
return [{}];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user