fix(githubPrBoard): support namespaced teams and all kinds

Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
Phil Kuang
2022-06-16 13:57:53 -04:00
parent fe391c8bb4
commit 04e1504e85
2 changed files with 12 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-github-pull-requests-board': patch
---
Support namespaced teams and fetch all kinds
@@ -14,7 +14,11 @@
* limitations under the License.
*/
import { useApi } from '@backstage/core-plugin-api';
import { useEntity, catalogApiRef } from '@backstage/plugin-catalog-react';
import {
catalogApiRef,
humanizeEntityRef,
useEntity,
} from '@backstage/plugin-catalog-react';
import { useCallback, useEffect, useState } from 'react';
import { getProjectNameFromEntity } from '../utils/functions';
@@ -26,8 +30,7 @@ export function useUserRepositories() {
const getRepositoriesNames = useCallback(async () => {
const entitiesList = await catalogApi.getEntities({
filter: {
kind: 'Component',
'spec.owner': teamEntity?.metadata?.name,
'spec.owner': humanizeEntityRef(teamEntity, { defaultKind: 'group' }),
},
});
@@ -36,7 +39,7 @@ export function useUserRepositories() {
);
setRepositories([...new Set(entitiesNames)]);
}, [catalogApi, teamEntity?.metadata?.name]);
}, [catalogApi, teamEntity]);
useEffect(() => {
getRepositoriesNames();