Fix compliance report drawer closing incorrectly
requested to merge 356137-bug-selecting-a-compliance-violation-with-the-same-mr-should-keep-the-drawer-open into master
What does this MR do and why?
This resolves an issue #356137 (closed) where the compliance report drawer would close when another violation on the same merge request was clicked.
This work is hidden behind a development feature flag.
Screenshots or screen recordings
Before | After |
---|---|
Screen_Recording_2022-03-17_at_13.55.21 | Screen_Recording_2022-03-17_at_13.53.05 |
How to set up and validate locally
- You need a GitLab Ultimate license.
- Enable the feature flag in your terminal:
echo "Feature.enable(:compliance_violations_report);" | rails c
- View the compliance report and use the pagination feature:
[GDK_HOST]/groups/gitlab-org/-/security/compliance_dashboard
- Create several violations on the same MR by running this in
rails console
:
FactoryBot.definition_file_paths = [Rails.root.join('ee', 'spec', 'factories')]
FactoryBot.find_definitions
# Group 22 is gitlab-org by default
group = Group.find_by_id(22)
type = [:approved_by_insufficient_users, :approved_by_committer, :approved_by_merge_request_author]
project = group.projects.sample
merge_request = FactoryBot.create(:merge_request, source_project: project, target_project: project, state: :merged)
merge_request.metrics.update!(merged_at: 1.day.ago)
violations = 4.times.map {
FactoryBot.create(:compliance_violation, type.sample, severity_level: :high, merge_request: merge_request, violating_user: project.members.sample.user)
}
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 #356137 (closed)
Edited by Jiaan Louw