mappjzc opened a new pull request, #4397:
URL: https://github.com/apache/incubator-devlake/pull/4397

   ### Summary
   In order to avoid the front end directly requesting connection
   
   The front-end does not need to worry about the version of the data source, 
so the back-end provides the following ` remote API`
   
   `curl --location --request GET 
'devlake:8080/plugins/gitlab/connections/5/remote-scopes?groupId=&pageToken='`
   
   ```json
   {
        "children": [{
                "type": "group",
                "parentId": null,
                "id": "2",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "0",
                "data": {
                        "connectionId": 0,
                        "gitlabId": 1,
                        "name": "test-1",
                        "description": "",
                        "defaultBranch": "master",
                        "pathWithNamespace": "root/test-1",
                        "webUrl": "http://devlake.gitlab.com/root/test-1";,
                        "creatorId": 0,
                        "visibility": "private",
                        "openIssuesCount": 0,
                        "starCount": 0,
                        "forkedFromProjectId": 0,
                        "forkedFromProjectWebUrl": "",
                        "httpUrlToRepo": 
"http://devlake.gitlab.com/root/test-1.git";,
                        "createdDate": "2023-02-02T11:59:23.585Z",
                        "updatedDate": "2023-02-03T15:53:20.409Z"
                }
        }],
        "nextPageToken": ""
   }
   ```
   
   `curl --location --request GET 
'devlake:8080/plugins/gitlab/connections/6/remote-scopes?groupId=&page=1&pageToken='`
   
   ```json
   {
        "children": [{
                "type": "group",
                "parentId": null,
                "id": "9269098",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "10386885",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "8378087",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "10379415",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "8638894",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "10704933",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "4497645",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "51760001",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "16034029",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "9269087",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "10386884",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "4423764",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "8496443",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "12832850",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "3696511",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "4064756",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "57311599",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "10386901",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "10386888",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "57311585",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "9455816",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "57311571",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "4811902",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "15928983",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "6706200",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "4318135",
                "data": null
        }, {
                "type": "group",
                "parentId": null,
                "id": "0",
                "data": {
                        "connectionId": 0,
                        "gitlabId": 39821323,
                        "name": "pages",
                        "description": "",
                        "defaultBranch": "main",
                        "pathWithNamespace": "mericojzc/pages",
                        "webUrl": "https://gitlab.com/mericojzc/pages";,
                        "creatorId": 0,
                        "visibility": "private",
                        "openIssuesCount": 0,
                        "starCount": 0,
                        "forkedFromProjectId": 0,
                        "forkedFromProjectWebUrl": "",
                        "httpUrlToRepo": 
"https://gitlab.com/mericojzc/pages.git";,
                        "createdDate": "2022-09-29T12:44:11.84Z",
                        "updatedDate": "2022-09-29T12:45:55.505Z"
                }
        }, {
                "type": "group",
                "parentId": null,
                "id": "0",
                "data": {
                        "connectionId": 0,
                        "gitlabId": 36300799,
                        "name": "EmptyTest",
                        "description": "",
                        "defaultBranch": "main",
                        "pathWithNamespace": "mericojzc/emptytest",
                        "webUrl": "https://gitlab.com/mericojzc/emptytest";,
                        "creatorId": 0,
                        "visibility": "private",
                        "openIssuesCount": 2,
                        "starCount": 0,
                        "forkedFromProjectId": 0,
                        "forkedFromProjectWebUrl": "",
                        "httpUrlToRepo": 
"https://gitlab.com/mericojzc/emptytest.git";,
                        "createdDate": "2022-05-19T08:10:27.786Z",
                        "updatedDate": "2022-09-29T12:48:06.216Z"
                }
        }],
        "nextPageToken": ""
   }
   ```
   
   `curl --location --request GET 
'devlake:8080/plugins/gitlab/connections/5/search-remote-scopes?groupId=&page=1&pageSize=100'`
   
   ```json
   
[{"connectionId":0,"gitlabId":1,"name":"test-1","description":"","defaultBranch":"master","pathWithNamespace":"root/test-1","webUrl":"http://devlake.gitlab.com/root/test-1","creatorId":0,"visibility":"","openIssuesCount":0,"starCount":0,"forkedFromProjectId":0,"forkedFromProjectWebUrl":"","httpUrlToRepo":"http://devlake.gitlab.com/root/test-1.git","createdDate":"2023-02-02T11:59:23.585Z","updatedDate":"2023-02-03T15:53:20.409Z"}]
   ```
   
   ### Does this close any open issues?
   Closes #4396 
   
   ### Screenshots
   
![image](https://user-images.githubusercontent.com/2921251/218363782-bb8f6a61-2547-4275-bbf8-f44b7b78869c.png)
   
![image](https://user-images.githubusercontent.com/2921251/218364341-0986f3c1-2d39-4c2a-88d4-01f4fa8bf1b3.png)
   
![image](https://user-images.githubusercontent.com/2921251/218365555-2252ffe3-848d-4397-9be9-16de34c3bb91.png)
   
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to