You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 1, 2019. It is now read-only.
Describe the bug
We have a gitlab repository with hundreds of groups. Because the gitlab API paginates response the current function "async GetGroupsAsync():Promise<Array>{" won't find some of the groups because it only searches the first few groups returned by the API
To Reproduce
Steps to reproduce the behavior:
Setup your own gilab server.
Create 200+ groups but only give yourself two or 3 parentless groups. The other groups should be subgroups.
Give yourself access two or three of the groups one at the beginning and one at the end.
Expected behavior
Try use git-lab explorer in vscode to find your groups. You will only find the first group.
Desktop (please complete the following information):
OS: [e.g.Win
VSCode Version [e.g. 1.37.1]
GitLab-ce
Additional context
Here is the code that I used to fix this problem.
async GetGroupsAsync():Promise<Array<Group>>{
let groups:Array<Group> = [];
let next_groups:Array<Group> = [];
let p = 1;
try {
// Need to allow for a large number of groups on the gitlab server.
// this searches through the groups page by page and finds those without parents
let response = await this.httpClient.get('/groups?per_page=20&page='+ p.toString() );
while ( response.data && response.data.length > 0 ) {
next_groups = response.data.map((group:any)=>{
return new Group(group);
}) as Array<Group>;
next_groups = next_groups.filter((g)=>{return g.GetParentID() === null;}); //Only Root Groups
groups = groups.concat(next_groups);
p = p + 1;
response = await this.httpClient.get('/groups?per_page=20&page='+ p.toString() );
}
} catch (error) {
this.HandleError(error);
}
return groups;
}
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Describe the bug
We have a gitlab repository with hundreds of groups. Because the gitlab API paginates response the current function "async GetGroupsAsync():Promise<Array>{" won't find some of the groups because it only searches the first few groups returned by the API
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Try use git-lab explorer in vscode to find your groups. You will only find the first group.
Desktop (please complete the following information):
Additional context
Here is the code that I used to fix this problem.
The text was updated successfully, but these errors were encountered: