Merge pull request #32130 from Parsifal-M/patch/resource

Adds the Resource kind to the useGetEntities fallback options so that…
This commit is contained in:
Fredrik Adelöw
2026-01-16 15:30:36 +01:00
committed by GitHub
6 changed files with 31 additions and 17 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-org': patch
---
Adds the Resource kind to the `useGetEntities` fallback so that Resources are included by default when no specific kinds are provided in the group ownership card.
+3
View File
@@ -30,6 +30,9 @@ app:
config:
showAggregateMembersToggle: true
initialRelationAggregation: aggregated
- entity-card:org/ownership:
config:
ownedKinds: ['Component', 'API', 'System']
# - apis.plugin.graphiql.browse.gitlab: true
# - graphiql-endpoint:graphiql/gitlab: true
+2
View File
@@ -110,12 +110,14 @@ const _default: OverridableFrontendPlugin<
config: {
initialRelationAggregation: 'direct' | 'aggregated' | undefined;
showAggregateMembersToggle: boolean | undefined;
ownedKinds: string[] | undefined;
filter: EntityPredicate | undefined;
type: 'content' | 'summary' | 'info' | undefined;
};
configInput: {
showAggregateMembersToggle?: boolean | undefined;
initialRelationAggregation?: 'direct' | 'aggregated' | undefined;
ownedKinds?: string[] | undefined;
filter?: EntityPredicate | undefined;
type?: 'content' | 'summary' | 'info' | undefined;
};
+4
View File
@@ -65,6 +65,7 @@ const EntityOwnershipCard = EntityCardBlueprint.makeWithOverrides({
initialRelationAggregation: z =>
z.enum(['direct', 'aggregated']).optional(),
showAggregateMembersToggle: z => z.boolean().optional(),
ownedKinds: z => z.array(z.string()).optional(),
},
},
factory(originalFactory, { config }) {
@@ -79,6 +80,9 @@ const EntityOwnershipCard = EntityCardBlueprint.makeWithOverrides({
? undefined
: !config.showAggregateMembersToggle
}
entityFilterKind={
config.ownedKinds ?? ['Component', 'API', 'System', 'Resource']
}
/>
)),
});
@@ -36,11 +36,21 @@ const items = [
{
type: 'ownedBy',
targetRef: 'group:default/my-team',
target: {
name: 'my-team',
namespace: 'default',
kind: 'group',
},
},
],
},
{
kind: 'Resource',
metadata: {
name: 'my-resource',
},
spec: {
type: 'database',
},
relations: [
{
type: 'ownedBy',
targetRef: 'group:default/my-team',
},
],
},
@@ -56,11 +66,6 @@ const items = [
{
type: 'ownedBy',
targetRef: 'group:default/my-team',
target: {
name: 'my-team',
namespace: 'default',
kind: 'group',
},
},
],
},
@@ -77,11 +82,6 @@ const items = [
{
type: 'ownedBy',
targetRef: 'group:default/my-team',
target: {
name: 'my-team',
namespace: 'default',
kind: 'group',
},
},
],
},
@@ -160,7 +160,7 @@ describe('OwnershipCard', () => {
expect(mockedGetEntities).toHaveBeenCalledWith({
filter: [
{
kind: ['Component', 'API', 'System'],
kind: ['Component', 'API', 'System', 'Resource'],
'relations.ownedBy': ['group:default/my-team'],
},
],
@@ -198,7 +198,7 @@ export function useGetEntities(
error?: Error;
} {
const catalogApi = useApi(catalogApiRef);
const kinds = entityFilterKind ?? ['Component', 'API', 'System'];
const kinds = entityFilterKind ?? ['Component', 'API', 'System', 'Resource'];
const {
loading,