Add GraphQL query for shared projects
What does this MR do and why?
Related #562257 (closed)
Needed for Setup "Shared projects" tab (#554630 - closed). We are refactoring the groups overview tabs to shared Vue components. Currently we are using a REST API to get shared projects but it doesn't support all the attributes we need and the shared Vue components work better with GraphQL. This MR adds a GraphQL query for shared projects.
Implementation reasoning
At first I was having SharedProjectsResolver extend ProjectsResolver but there are a number of arguments that don't work with the finder and maybe don't make sense for this query such as membership and personal. This MR was also getting large because I then had to have tests for every single argument that was supported.
I think looked into creating a Resolvers::Projects::BaseResolver with only the shared logic in ProjectsResolver but this seemed like we were spreading logic across multiple files but it was confusing.
I decided it made more sense to start small and only support the arguments that we needed with a bit more duplication.
Screenshots or screen recordings
How to set up and validate locally
- Go to a project -> Manage -> Members
- Click
Invite a group - Choose a group and invite
- Make note of the group's path
- Go to
/-/graphql-explorer - Run the following query
{
group(fullPath: "gitlab-org") {
sharedProjects {
nodes {
id
nameWithNamespace
}
count
}
}
}
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
