Filter frameworks by searching for similar names
What does this MR do and why?
Adds a new parameter search
of string type to complianceFrameworks
under namespaces
. Users can pass a possible compliance framework name as the value and all the compliance frameworks having the name value as substring of their name will be returned in response.
SQL queries
SQL Query if search parameter is passed:
Click to expand
SELECT
"compliance_management_frameworks"."id" AS t0_r0,
"compliance_management_frameworks"."name" AS t0_r1,
"compliance_management_frameworks"."description" AS t0_r2,
"compliance_management_frameworks"."color" AS t0_r3,
"compliance_management_frameworks"."namespace_id" AS t0_r4,
"compliance_management_frameworks"."pipeline_configuration_full_path" AS t0_r5,
"compliance_management_frameworks"."created_at" AS t0_r6,
"compliance_management_frameworks"."updated_at" AS t0_r7,
"namespaces"."id" AS t1_r0,
"namespaces"."name" AS t1_r1,
"namespaces"."path" AS t1_r2,
"namespaces"."owner_id" AS t1_r3,
"namespaces"."created_at" AS t1_r4,
"namespaces"."updated_at" AS t1_r5,
"namespaces"."type" AS t1_r6,
"namespaces"."description" AS t1_r7,
"namespaces"."avatar" AS t1_r8,
"namespaces"."membership_lock" AS t1_r9,
"namespaces"."share_with_group_lock" AS t1_r10,
"namespaces"."visibility_level" AS t1_r11,
"namespaces"."request_access_enabled" AS t1_r12,
"namespaces"."ldap_sync_status" AS t1_r13,
"namespaces"."ldap_sync_error" AS t1_r14,
"namespaces"."ldap_sync_last_update_at" AS t1_r15,
"namespaces"."ldap_sync_last_successful_update_at" AS t1_r16,
"namespaces"."ldap_sync_last_sync_at" AS t1_r17,
"namespaces"."description_html" AS t1_r18,
"namespaces"."lfs_enabled" AS t1_r19,
"namespaces"."parent_id" AS t1_r20,
"namespaces"."shared_runners_minutes_limit" AS t1_r21,
"namespaces"."repository_size_limit" AS t1_r22,
"namespaces"."require_two_factor_authentication" AS t1_r23,
"namespaces"."two_factor_grace_period" AS t1_r24,
"namespaces"."cached_markdown_version" AS t1_r25,
"namespaces"."project_creation_level" AS t1_r26,
"namespaces"."runners_token" AS t1_r27,
"namespaces"."file_template_project_id" AS t1_r28,
"namespaces"."saml_discovery_token" AS t1_r29,
"namespaces"."runners_token_encrypted" AS t1_r30,
"namespaces"."custom_project_templates_group_id" AS t1_r31,
"namespaces"."auto_devops_enabled" AS t1_r32,
"namespaces"."extra_shared_runners_minutes_limit" AS t1_r33,
"namespaces"."last_ci_minutes_notification_at" AS t1_r34,
"namespaces"."last_ci_minutes_usage_notification_level" AS t1_r35,
"namespaces"."subgroup_creation_level" AS t1_r36,
"namespaces"."emails_disabled" AS t1_r37,
"namespaces"."max_pages_size" AS t1_r38,
"namespaces"."max_artifacts_size" AS t1_r39,
"namespaces"."mentions_disabled" AS t1_r40,
"namespaces"."default_branch_protection" AS t1_r41,
"namespaces"."max_personal_access_token_lifetime" AS t1_r42,
"namespaces"."push_rule_id" AS t1_r43,
"namespaces"."shared_runners_enabled" AS t1_r44,
"namespaces"."allow_descendants_override_disabled_shared_runners" AS t1_r45,
"namespaces"."traversal_ids" AS t1_r46,
"namespaces"."organization_id" AS t1_r47
FROM
"compliance_management_frameworks"
LEFT OUTER JOIN "namespaces" ON "namespaces"."id" = "compliance_management_frameworks"."namespace_id"
WHERE
"namespaces"."id" = 76451741
AND "compliance_management_frameworks"."name" ILIKE '%test%'
Query plan: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/24471/commands/78120
How to set up and validate locally
- Create several compliance frameworks by following steps mentioned in https://docs.gitlab.com/ee/user/group/compliance_frameworks.html, try creating some frameworks with same substrings so that match can return multiple values too. Suggestion: You can create frameworks with names:
FirstCheck
,CheckSecond
,SomeCheckName
,RandomName
and can useCheck
as the search parameter in the following steps. - Now run the following graphql query and check the behaviour:
query namespaceComplianceFrameworks {
namespace(fullPath: "<full_path_of_compliance_group>") {
complianceFrameworks(search: "<search_string>") {
nodes {
name,
color
}
}
}
}
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.
Related to #430761 (closed)
Edited by Hitesh Raghuvanshi