Allow namespace projects to be queried by ids with GraphQL
Ref: #296665 (closed)
What does this MR do?
This MR allows to query projects by ids at the namespace level with our GraphQL API.
It includes the following items:
-
New scope to query group projects with code coverage -
Add new argument ( ids: [gids]
) to our namespace projects graphql endpoint
This MR implement our feature, we will follow up and refactor our existing NamespaceProjectsResolver
to use a proper finder in #322917 (closed).
Why are we doing this?
We are working to improve our analytic page aggregating our code coverage data at the group level.
We are currently displaying all projects in our dropdown projects as you can see below
After this MR, we will be able filter projects having a code coverage data by ids at the namespace level.
This implementation is similar to our existing one to filter projects by ids except this time we do it at the group level:
Screenshots
GraphQL request | Response |
---|---|
|
|
Database review
Query
SELECT
projects.*
FROM
projects
WHERE
projects.namespace_id = 9970
AND projects.id = 278964
Execution plan
Index Scan using index_projects_on_namespace_id_and_id on public.projects (cost=0.44..3.46 rows=1 width=720) (actual time=5.762..9.315 rows=1 loops=1)
Index Cond: ((projects.namespace_id = 9970) AND (projects.id = 278964))
Buffers: shared hit=1 read=5 dirtied=2
I/O Timings: read=8.206
Cold cache
Time: 13.953 ms
- planning: 4.575 ms
- execution: 9.378 ms
- I/O read: 8.206 ms
- I/O write: N/A
Shared buffers:
- hits: 1 (~8.00 KiB) from the buffer pool
- reads: 5 (~40.00 KiB) from the OS file cache, including disk I/O
- dirtied: 2 (~16.00 KiB)
- writes: 0
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines - [-] Merge request performance guidelines
-
Style guides - [-] Database guides
- [-] Separation of EE specific content
Availability and Testing
- [-] Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
- [-] Tested in all supported browsers
- [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
- [-] Label as security and @ mention
@gitlab-com/gl-security/appsec
- [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
- [-] Security reports checked/validated by a reviewer from the AppSec team