Add autocomplete endpoints in GraphQL across Plan
Background
Within Plan, users can perform autocomplete search for assignees, epics, etc on various pages such as the issues list, epic list, boards, and roadmap pages. However, there is inconsistency between them. For example, different search endpoints are used for the same search reference. Some searches download all results then filter on the frontend, and some make a request on every search where the backend does the filtering.
Ideal autocomplete search
Every autocomplete search should use GraphQL and Vue Apollo because 1) we are GraphQL-first and 2) to take advantage of Apollo's automatic caching.
This issue identifies:
- Existing GraphQL queries we can use for autocomplete search
- Missing GraphQL queries we need for autocomplete search
Additionally, we can consider whether there's a way to make some of this logic reusable.
Autocomplete searches available in GraphQL
✅
Authors/Assignees We can search by user name and username
query{
project(fullPath: "gitlab-org/gitlab") {
projectMembers(search: "donald") {
nodes {
user {
id
avatarUrl
name
username
}
}
}
}
}
We should avoid using the autocomplete search https://gitlab.com/gitlab-org/gitlab/-/autocomplete_sources/members?type=Issue&type_id=330280
✅
Labels We can search by label title
query{
project(fullPath: "gitlab-org/gitlab") {
labels(searchTerm:"debt", includeAncestorGroups:true) {
nodes {
id
color
description
textColor
title
}
}
}
}
We should avoid using the autocomplete search https://gitlab.com/gitlab-org/gitlab/-/autocomplete_sources/labels?type=Issue&type_id=330280
✅
Milestones We can search by milestone title
query{
project(fullPath: "gitlab-org/gitlab") {
milestones(searchTitle:"13", includeAncestors:true) {
nodes {
id
title
}
}
}
}
We should avoid using the autocomplete search https://gitlab.com/gitlab-org/gitlab/-/autocomplete_sources/milestones
✅
Epics We can search by epic title
{
group(fullPath: "gitlab-org") {
epics(search: "pajamas", in: [TITLE]) {
nodes {
id
title
}
}
}
}
We should avoid using the autocomplete search https://gitlab.com/gitlab-org/gitlab/-/autocomplete_sources/epics
✅
Iterations We can search by iteration title
query{
project(fullPath: "gitlab-org/gitlab") {
iterations(title: "gitlab") {
nodes {
id
title
}
}
}
}
Autocomplete searches requiring improvements in GraphQL
❌
Issues We can search by issue title and description, but to reduce the number of unexpected results we need to be able to search by title only
// need ability to search by title only
query{
project(fullPath: "gitlab-org/gitlab") {
issues(search:"pajamas") {
nodes {
id
reference
title
}
}
}
}
We should avoid using the autocomplete search https://gitlab.com/gitlab-org/gitlab/-/autocomplete_sources/issues
Autocomplete searches not available in GraphQL
❌
Merge requests We can list merge requests but we cannot search them
// needs ability to search by title
query{
project(fullPath:"gitlab-org/gitlab") {
mergeRequests {
nodes {
id
reference
title
}
}
}
}
Merge requests are currently searched using https://gitlab.com/gitlab-org/gitlab/-/autocomplete_sources/merge_requests
❌
Releases We can list releases but we cannot search them
// needs ability to search by title
query{
project(fullPath: "gitlab-org/gitlab") {
releases {
nodes {
name
}
}
}
}
Releases are currently searched using https://gitlab.com/gitlab-org/gitlab/-/releases.json
❌
Snippets We can list snippets but we cannot search them
// needs ability to search by title, and possibly needs reference field too
query{
project(fullPath: "gitlab-org/gitlab") {
snippets {
nodes {
id
title
}
}
}
}
Snippets are currently searched using https://gitlab.com/gitlab-org/gitlab/-/autocomplete_sources/snippets
❌
Vulnerabilities We can list vulnerabilities but we cannot search them
// needs ability to search by title, and possibly needs reference field too
query{
project(fullPath: "gitlab-org/gitlab") {
vulnerabilities {
nodes {
id
title
}
}
}
}
Vulnerabilities are currently searched using https://gitlab.com/gitlab-org/gitlab/-/autocomplete_sources/vulnerabilities
❌
My-reactions We cannot list or search my-reactions via GraphQL
My-reactions are currently searched using https://gitlab.com/-/autocomplete/award_emojis
❌
Commands We cannot list or search commands via GraphQL
Commands are currently searched using https://gitlab.com/gitlab-org/gitlab/-/autocomplete_sources/commands?type=Issue&type_id=330280