You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by li...@apache.org on 2023/02/21 03:09:34 UTC

[incubator-devlake] branch release-v0.15 updated: fix(config-ui): cherry-pick and fixed #4439 and #4448 (#4467)

This is an automated email from the ASF dual-hosted git repository.

likyh pushed a commit to branch release-v0.15
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/release-v0.15 by this push:
     new 90199045b fix(config-ui): cherry-pick and fixed #4439 and #4448 (#4467)
90199045b is described below

commit 90199045b4711f7c2f3ede3a051ff0e23aa3b3a8
Author: 青湛 <0x...@gmail.com>
AuthorDate: Tue Feb 21 11:09:29 2023 +0800

    fix(config-ui): cherry-pick and fixed #4439 and #4448 (#4467)
    
    * fix(config-ui): github does not list private repositories (#4451)
    
    * fix(config-ui): github does not list private membership organizations (#4453)
---
 config-ui/src/plugins/github/api.ts                         | 13 ++++++++-----
 .../github/components/miller-columns/use-miller-columns.ts  |  8 ++++----
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/config-ui/src/plugins/github/api.ts b/config-ui/src/plugins/github/api.ts
index d174fe6b9..bb6bd00a8 100644
--- a/config-ui/src/plugins/github/api.ts
+++ b/config-ui/src/plugins/github/api.ts
@@ -25,8 +25,8 @@ type PaginationParams = {
 
 export const getUser = (prefix: string) => request(`${prefix}/user`);
 
-export const getUserOrgs = (prefix: string, username: string, params: PaginationParams) =>
-  request(`${prefix}/users/${username}/orgs`, {
+export const getUserOrgs = (prefix: string, params: PaginationParams) =>
+  request(`${prefix}/user/orgs`, {
     method: 'get',
     data: params,
   });
@@ -37,10 +37,13 @@ export const getOrgRepos = (prefix: string, org: string, params: PaginationParam
     data: params,
   });
 
-export const getUserRepos = (prefix: string, username: string, params: PaginationParams) =>
-  request(`${prefix}/users/${username}/repos`, {
+export const getUserRepos = (prefix: string, params: PaginationParams) =>
+  request(`${prefix}/user/repos`, {
     method: 'get',
-    data: params,
+    data: {
+      ...params,
+      type: 'owner',
+    },
   });
 
 type SearchRepoParams = {
diff --git a/config-ui/src/plugins/github/components/miller-columns/use-miller-columns.ts b/config-ui/src/plugins/github/components/miller-columns/use-miller-columns.ts
index 921047760..af986c4ef 100644
--- a/config-ui/src/plugins/github/components/miller-columns/use-miller-columns.ts
+++ b/config-ui/src/plugins/github/components/miller-columns/use-miller-columns.ts
@@ -85,7 +85,7 @@ export const useMillerColumns = ({ connectionId }: UseMillerColumnsProps) => {
   useEffect(() => {
     (async () => {
       const user = await API.getUser(prefix);
-      const orgs = await API.getUserOrgs(prefix, user.login, {
+      const orgs = await API.getUserOrgs(prefix, {
         page: 1,
         per_page: DEFAULT_PAGE_SIZE,
       });
@@ -114,7 +114,7 @@ export const useMillerColumns = ({ connectionId }: UseMillerColumnsProps) => {
 
       const isUser = item.id === user.login;
       const repos = isUser
-        ? await API.getUserRepos(prefix, user.login, {
+        ? await API.getUserRepos(prefix, {
             page: 1,
             per_page: DEFAULT_PAGE_SIZE,
           })
@@ -135,7 +135,7 @@ export const useMillerColumns = ({ connectionId }: UseMillerColumnsProps) => {
     const page = mapPage[column.parentId ?? 'root'];
     const isUser = column.parentId === user.login;
     const orgs = !column.parentId
-      ? await API.getUserOrgs(prefix, user.login, {
+      ? await API.getUserOrgs(prefix, {
           page,
           per_page: DEFAULT_PAGE_SIZE,
         })
@@ -143,7 +143,7 @@ export const useMillerColumns = ({ connectionId }: UseMillerColumnsProps) => {
 
     const repos = column.parentId
       ? isUser
-        ? await API.getUserRepos(prefix, user.login, {
+        ? await API.getUserRepos(prefix, {
             page,
             per_page: DEFAULT_PAGE_SIZE,
           })