Add search capabilities for the project count component
What does this MR do and why?
Add search capabilities for the project count component under dependency list. Related design.
EE: true Changelog: changed
Related issue: #409071 (closed)
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Graphql query
query {
group(fullPath: $fullPath){
projects(sbomComponentId: $sbomComponentId, includeSubgroups: $includeSubgroups, search: $search, first: $first) {
nodes{
id
name
avatarUrl
fullPath
}
}
}
}
Query plan
SELECT
"projects".*,
ROUND(CAST(((SIMILARITY(COALESCE("projects"."path", ''), 'backend') * CAST('1' AS numeric)) + (SIMILARITY(COALESCE("projects"."name", ''), 'backend') * CAST('0.7' AS numeric)) + (SIMILARITY(COALESCE("projects"."description", ''), 'backend') * CAST('0.2' AS numeric))) AS numeric), 2) AS similarity
FROM "projects"
WHERE "projects"."namespace_id" IN (
SELECT namespaces.traversal_ids[array_length(namespaces.traversal_ids, 1)] AS id
FROM "namespaces"
WHERE "namespaces"."type" = 'Group'
AND (traversal_ids @> ('{68248292}'))
)
AND (("projects"."path" ILIKE '%backend%' OR "projects"."name" ILIKE '%backend%') OR "projects"."description" ILIKE '%backend%')
AND "projects"."id" IN (
SELECT "sbom_occurrences"."project_id"
FROM "sbom_occurrences"
WHERE "sbom_occurrences"."component_id" = 211382)
ORDER BY ROUND(CAST(((SIMILARITY(COALESCE("projects"."path", ''), 'backend') * CAST('1' AS numeric)) + (SIMILARITY(COALESCE("projects"."name", ''), 'backend') * CAST('0.7' AS numeric)) + (SIMILARITY(COALESCE("projects"."description", ''), 'backend') * CAST('0.2' AS numeric))) AS numeric), 2) DESC, "projects"."id" DESC
LIMIT 51
How to set up and validate locally
- Fetch the content of both branches:
add_search_for_project_component
. - Turn on the feature flag to make
Dependency list
appear in groups:
echo "Feature.enable(:group_level_dependencies)" | rails c
- Create two projects under a group with the following content:
-
.gitlab-ci.yml
:
include:
- template: Security/Dependency-Scanning.gitlab-ci.yml
-
Gemfile.lock
: with this content
- Run a pipeline for the default branch to both projects
- Go group related to the projects created above and click on the menu option Secure -> Dependency list
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Zamir Martins