filter ownership by references
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@backstage/plugin-github-issues': patch
|
||||
'@backstage/plugin-github-pull-requests-board': patch
|
||||
---
|
||||
|
||||
Properly filter on relations instead of the spec, when finding by owner
|
||||
@@ -13,13 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
import { Entity, stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
catalogApiRef,
|
||||
humanizeEntityRef,
|
||||
useEntity,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { catalogApiRef, useEntity } from '@backstage/plugin-catalog-react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
|
||||
const GITHUB_PROJECT_SLUG_ANNOTATION = 'github.com/project-slug';
|
||||
@@ -48,7 +45,7 @@ export function useEntityGitHubRepositories() {
|
||||
const entitiesList = await catalogApi.getEntities({
|
||||
filter: {
|
||||
kind: ['Component', 'API'],
|
||||
'spec.owner': humanizeEntityRef(entity, { defaultKind: 'group' }),
|
||||
'relations.ownedBy': stringifyEntityRef(entity),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -13,12 +13,10 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { useApi } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
catalogApiRef,
|
||||
humanizeEntityRef,
|
||||
useEntity,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import { catalogApiRef, useEntity } from '@backstage/plugin-catalog-react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { getProjectNameFromEntity } from '../utils/functions';
|
||||
|
||||
@@ -29,9 +27,7 @@ export function useUserRepositories() {
|
||||
|
||||
const getRepositoriesNames = useCallback(async () => {
|
||||
const entitiesList = await catalogApi.getEntities({
|
||||
filter: {
|
||||
'spec.owner': humanizeEntityRef(teamEntity, { defaultKind: 'group' }),
|
||||
},
|
||||
filter: { 'relations.ownedBy': stringifyEntityRef(teamEntity) },
|
||||
});
|
||||
|
||||
const entitiesNames: string[] = entitiesList.items.map(componentEntity =>
|
||||
|
||||
Reference in New Issue
Block a user