GitLab integration: project picker has no search, so only the first 100 projects are selectable
We're evaluating Flagsmith self-hosted and hit this while trying to link a flag to a merge request.
The project dropdown under Links > Link GitLab issue or merge request only ever contains the first 100 projects, and typing into it filters that loaded page rather than querying GitLab. So if the project you want isn't in the most recently active 100, you can't select it at all.
In our case the token's user is a member of ~1775 projects, so about 94% of them are unreachable. It's not a permissions thing, GET /projects?membership=true&search=<name> returns the project fine.
Why it happens
BrowseGitLabProjects is the only one of the three browse views that doesn't use the search-capable serializer:
# api/integrations/gitlab/views/browse_gitlab.py
class BrowseGitLabProjects(_GitLabListView[GitLabProject]): # L102
# no serializer_class
class BrowseGitLabIssues(_GitLabListView[GitLabIssue]): # L119
serializer_class = SearchQueryParamsSerializer
class BrowseGitLabMergeRequests(...): # L144
serializer_class = SearchQueryParamsSerializerSo search_text never arrives, and fetch_gitlab_projects() doesn't send search to GitLab either:
# api/integrations/gitlab/client/api.py L54
params={"membership": "true", "per_page": str(page_size), "page": str(page)}Same on the frontend, getGitLabProjects in frontend/common/services/useGitlab.ts (L42) omits search_text where the issues and MR queries include it.
With page_size capped at 100 in PaginatedQueryParamsSerializer, that's a hard ceiling on what the picker can ever show.
Suggested fix
GitLab's /projects endpoint supports search, so this can follow what issues and MRs already do:
- a serializer with pagination +
search_textbut withoutgitlab_project_id, since that one doesn't apply here BrowseGitLabProjectsuses it and passessearch_textthroughfetch_gitlab_projects()setsparams["search"]when it's given- frontend sends
search_textfrom the picker
Happy to put up a PR if you'd like, though you may have a preference on how to shape the serializer.
Environment
Self-hosted, chart 0.83.0 / appVersion 2.260.0, against a self-managed GitLab. Code references are from main at 1fd274c.
Source: Flagsmith/flagsmith