From db3cfd749279b1648cdd494d23cca095d83da578 Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Mon, 15 Dec 2025 15:48:39 +0100 Subject: [PATCH 1/7] Adds the Resource kind to the useGetEntities fallback options so that Resources are also returned by default on the group ownership card Signed-off-by: Peter Macdonald --- .changeset/five-bananas-retire.md | 5 +++++ .../org/src/components/Cards/OwnershipCard/useGetEntities.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/five-bananas-retire.md diff --git a/.changeset/five-bananas-retire.md b/.changeset/five-bananas-retire.md new file mode 100644 index 0000000000..88b1d3d6dd --- /dev/null +++ b/.changeset/five-bananas-retire.md @@ -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. diff --git a/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts b/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts index a5a5363192..56c1e8cebd 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts +++ b/plugins/org/src/components/Cards/OwnershipCard/useGetEntities.ts @@ -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, From dee48ab53779dcfa46bbdcdf1ecb4d713a27ef31 Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Tue, 16 Dec 2025 10:30:28 +0100 Subject: [PATCH 2/7] Fix test case Signed-off-by: Peter Macdonald --- .../OwnershipCard/OwnershipCard.test.tsx | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx index 6ea0f0cbc9..57ca206cc8 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx +++ b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx @@ -44,6 +44,26 @@ const items = [ }, ], }, + { + kind: 'Resource', + metadata: { + name: 'my-resource', + }, + spec: { + type: 'database', + }, + relations: [ + { + type: 'ownedBy', + targetRef: 'group:default/my-team', + target: { + name: 'my-team', + namespace: 'default', + kind: 'group', + }, + }, + ], + }, { kind: 'Component', metadata: { @@ -160,7 +180,7 @@ describe('OwnershipCard', () => { expect(mockedGetEntities).toHaveBeenCalledWith({ filter: [ { - kind: ['Component', 'API', 'System'], + kind: ['Component', 'API', 'System', 'Resource'], 'relations.ownedBy': ['group:default/my-team'], }, ], From d4abd7f0f2f7a1b1ad7a3907c4e4e6033853d904 Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Mon, 5 Jan 2026 10:23:33 +0100 Subject: [PATCH 3/7] NFS entityKindFilter Signed-off-by: Peter Macdonald --- packages/app-next/app-config.yaml | 3 +++ plugins/org/src/alpha.tsx | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/packages/app-next/app-config.yaml b/packages/app-next/app-config.yaml index 1121cfc0d5..f376c934d3 100644 --- a/packages/app-next/app-config.yaml +++ b/packages/app-next/app-config.yaml @@ -30,6 +30,9 @@ app: config: showAggregateMembersToggle: true initialRelationAggregation: aggregated + # - entity-card:org/ownership: + # config: + # entityFilterKind: ['Component', 'API', 'Resource', 'System'] # - apis.plugin.graphiql.browse.gitlab: true # - graphiql-endpoint:graphiql/gitlab: true diff --git a/plugins/org/src/alpha.tsx b/plugins/org/src/alpha.tsx index 57924a0269..5532767fea 100644 --- a/plugins/org/src/alpha.tsx +++ b/plugins/org/src/alpha.tsx @@ -65,6 +65,7 @@ const EntityOwnershipCard = EntityCardBlueprint.makeWithOverrides({ initialRelationAggregation: z => z.enum(['direct', 'aggregated']).optional(), showAggregateMembersToggle: z => z.boolean().optional(), + entityFilterKind: z => z.array(z.string()).optional(), }, }, factory(originalFactory, { config }) { @@ -79,6 +80,9 @@ const EntityOwnershipCard = EntityCardBlueprint.makeWithOverrides({ ? undefined : !config.showAggregateMembersToggle } + entityFilterKind={ + config.entityFilterKind ?? ['Component', 'API', 'System'] + } /> )), }); From 2f55092fc3c22b637ff4331c1a207e2874540430 Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Mon, 5 Jan 2026 10:26:15 +0100 Subject: [PATCH 4/7] uno reverse the filters Signed-off-by: Peter Macdonald --- packages/app-next/app-config.yaml | 6 +++--- plugins/org/src/alpha.tsx | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/app-next/app-config.yaml b/packages/app-next/app-config.yaml index f376c934d3..d297c9caca 100644 --- a/packages/app-next/app-config.yaml +++ b/packages/app-next/app-config.yaml @@ -30,9 +30,9 @@ app: config: showAggregateMembersToggle: true initialRelationAggregation: aggregated - # - entity-card:org/ownership: - # config: - # entityFilterKind: ['Component', 'API', 'Resource', 'System'] + - entity-card:org/ownership: + config: + entityFilterKind: ['Component', 'API', 'System'] # - apis.plugin.graphiql.browse.gitlab: true # - graphiql-endpoint:graphiql/gitlab: true diff --git a/plugins/org/src/alpha.tsx b/plugins/org/src/alpha.tsx index 5532767fea..729ebb063f 100644 --- a/plugins/org/src/alpha.tsx +++ b/plugins/org/src/alpha.tsx @@ -81,7 +81,12 @@ const EntityOwnershipCard = EntityCardBlueprint.makeWithOverrides({ : !config.showAggregateMembersToggle } entityFilterKind={ - config.entityFilterKind ?? ['Component', 'API', 'System'] + config.entityFilterKind ?? [ + 'Component', + 'API', + 'System', + 'Resource', + ] } /> )), From 4a1235c8786e95c22cc5e49e3121582d42625b80 Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Mon, 5 Jan 2026 11:09:57 +0100 Subject: [PATCH 5/7] api report Signed-off-by: Peter Macdonald --- plugins/org/report-alpha.api.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/org/report-alpha.api.md b/plugins/org/report-alpha.api.md index 93e81f0851..6077bb4806 100644 --- a/plugins/org/report-alpha.api.md +++ b/plugins/org/report-alpha.api.md @@ -110,11 +110,13 @@ const _default: OverridableFrontendPlugin< config: { initialRelationAggregation: 'direct' | 'aggregated' | undefined; showAggregateMembersToggle: boolean | undefined; + entityFilterKind: string[] | undefined; filter: EntityPredicate | undefined; type: 'content' | 'summary' | 'info' | undefined; }; configInput: { showAggregateMembersToggle?: boolean | undefined; + entityFilterKind?: string[] | undefined; initialRelationAggregation?: 'direct' | 'aggregated' | undefined; filter?: EntityPredicate | undefined; type?: 'content' | 'summary' | 'info' | undefined; From 32f92281ffef2c5c428a2c543e110763996b2215 Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Thu, 15 Jan 2026 19:32:22 +0100 Subject: [PATCH 6/7] change to ownedKinds, cleanup test file a bit Signed-off-by: Peter Macdonald --- packages/app-next/app-config.yaml | 2 +- plugins/org/src/alpha.tsx | 9 ++------- .../OwnershipCard/OwnershipCard.test.tsx | 20 ------------------- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/packages/app-next/app-config.yaml b/packages/app-next/app-config.yaml index d297c9caca..97e8446fa4 100644 --- a/packages/app-next/app-config.yaml +++ b/packages/app-next/app-config.yaml @@ -32,7 +32,7 @@ app: initialRelationAggregation: aggregated - entity-card:org/ownership: config: - entityFilterKind: ['Component', 'API', 'System'] + ownedKinds: ['Component', 'API', 'System'] # - apis.plugin.graphiql.browse.gitlab: true # - graphiql-endpoint:graphiql/gitlab: true diff --git a/plugins/org/src/alpha.tsx b/plugins/org/src/alpha.tsx index 729ebb063f..4e11463781 100644 --- a/plugins/org/src/alpha.tsx +++ b/plugins/org/src/alpha.tsx @@ -65,7 +65,7 @@ const EntityOwnershipCard = EntityCardBlueprint.makeWithOverrides({ initialRelationAggregation: z => z.enum(['direct', 'aggregated']).optional(), showAggregateMembersToggle: z => z.boolean().optional(), - entityFilterKind: z => z.array(z.string()).optional(), + ownedKinds: z => z.array(z.string()).optional(), }, }, factory(originalFactory, { config }) { @@ -81,12 +81,7 @@ const EntityOwnershipCard = EntityCardBlueprint.makeWithOverrides({ : !config.showAggregateMembersToggle } entityFilterKind={ - config.entityFilterKind ?? [ - 'Component', - 'API', - 'System', - 'Resource', - ] + config.ownedKinds ?? ['Component', 'API', 'System', 'Resource'] } /> )), diff --git a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx index 57ca206cc8..5bb058e1b2 100644 --- a/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx +++ b/plugins/org/src/components/Cards/OwnershipCard/OwnershipCard.test.tsx @@ -36,11 +36,6 @@ const items = [ { type: 'ownedBy', targetRef: 'group:default/my-team', - target: { - name: 'my-team', - namespace: 'default', - kind: 'group', - }, }, ], }, @@ -56,11 +51,6 @@ const items = [ { type: 'ownedBy', targetRef: 'group:default/my-team', - target: { - name: 'my-team', - namespace: 'default', - kind: 'group', - }, }, ], }, @@ -76,11 +66,6 @@ const items = [ { type: 'ownedBy', targetRef: 'group:default/my-team', - target: { - name: 'my-team', - namespace: 'default', - kind: 'group', - }, }, ], }, @@ -97,11 +82,6 @@ const items = [ { type: 'ownedBy', targetRef: 'group:default/my-team', - target: { - name: 'my-team', - namespace: 'default', - kind: 'group', - }, }, ], }, From 89345e4be3bf88e0e6fc6e9e9dd68ed6b3b98e41 Mon Sep 17 00:00:00 2001 From: Peter Macdonald Date: Thu, 15 Jan 2026 19:38:34 +0100 Subject: [PATCH 7/7] regenerate api report Signed-off-by: Peter Macdonald --- plugins/org/report-alpha.api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/org/report-alpha.api.md b/plugins/org/report-alpha.api.md index 6077bb4806..cfd2290502 100644 --- a/plugins/org/report-alpha.api.md +++ b/plugins/org/report-alpha.api.md @@ -110,14 +110,14 @@ const _default: OverridableFrontendPlugin< config: { initialRelationAggregation: 'direct' | 'aggregated' | undefined; showAggregateMembersToggle: boolean | undefined; - entityFilterKind: string[] | undefined; + ownedKinds: string[] | undefined; filter: EntityPredicate | undefined; type: 'content' | 'summary' | 'info' | undefined; }; configInput: { showAggregateMembersToggle?: boolean | undefined; - entityFilterKind?: string[] | undefined; initialRelationAggregation?: 'direct' | 'aggregated' | undefined; + ownedKinds?: string[] | undefined; filter?: EntityPredicate | undefined; type?: 'content' | 'summary' | 'info' | undefined; };