From 6e57e20a9d67cd21272e8fa153035137180571a8 Mon Sep 17 00:00:00 2001 From: Scott Hampton Date: Thu, 17 Jul 2025 12:20:14 -0700 Subject: [PATCH] Fix bug in fix suggestion When initially setting this up with client resolvers I thought that the control ID had the data for what is actually the control name. Once the client resolvers were switched out, this broke the fix suggestion section. This commit switches the ID for the name so that the fix suggestion works. --- .../components/compliance_violation_details_app.vue | 2 +- .../components/fix_suggestion_section.vue | 4 ++-- .../components/compliance_violation_details_app_spec.js | 4 ++-- .../components/fix_suggestion_section_spec.js | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ee/app/assets/javascripts/compliance_violations/components/compliance_violation_details_app.vue b/ee/app/assets/javascripts/compliance_violations/components/compliance_violation_details_app.vue index fae6ad9fbeb14d..784dab48961fad 100644 --- a/ee/app/assets/javascripts/compliance_violations/components/compliance_violation_details_app.vue +++ b/ee/app/assets/javascripts/compliance_violations/components/compliance_violation_details_app.vue @@ -159,7 +159,7 @@ export default { /> diff --git a/ee/app/assets/javascripts/compliance_violations/components/fix_suggestion_section.vue b/ee/app/assets/javascripts/compliance_violations/components/fix_suggestion_section.vue index 0cbf749f6e5c82..05a19d4f9ce051 100644 --- a/ee/app/assets/javascripts/compliance_violations/components/fix_suggestion_section.vue +++ b/ee/app/assets/javascripts/compliance_violations/components/fix_suggestion_section.vue @@ -10,7 +10,7 @@ export default { GlButton, }, props: { - controlId: { + controlName: { type: String, required: true, }, @@ -21,7 +21,7 @@ export default { }, computed: { fixSuggestions() { - return statusesInfo[this.controlId]?.fixes || []; + return statusesInfo[this.controlName]?.fixes || []; }, newIssueUrl() { return `${this.projectPath}/-/issues/new`; diff --git a/ee/spec/frontend/compliance_violations/components/compliance_violation_details_app_spec.js b/ee/spec/frontend/compliance_violations/components/compliance_violation_details_app_spec.js index e6bf0fe516caf1..2408d880bec9cf 100644 --- a/ee/spec/frontend/compliance_violations/components/compliance_violation_details_app_spec.js +++ b/ee/spec/frontend/compliance_violations/components/compliance_violation_details_app_spec.js @@ -232,8 +232,8 @@ describe('ComplianceViolationDetailsApp', () => { it('renders the fix suggestion section', () => { const fixSuggestionSectionComponent = findFixSuggestionSection(); expect(fixSuggestionSectionComponent.exists()).toBe(true); - expect(fixSuggestionSectionComponent.props('controlId')).toBe( - mockComplianceViolation.complianceControl.id, + expect(fixSuggestionSectionComponent.props('controlName')).toBe( + mockComplianceViolation.complianceControl.name, ); expect(fixSuggestionSectionComponent.props('projectPath')).toBe( mockComplianceViolation.project.webUrl, diff --git a/ee/spec/frontend/compliance_violations/components/fix_suggestion_section_spec.js b/ee/spec/frontend/compliance_violations/components/fix_suggestion_section_spec.js index e55b5d5bbfa7ce..f13c8b906b3965 100644 --- a/ee/spec/frontend/compliance_violations/components/fix_suggestion_section_spec.js +++ b/ee/spec/frontend/compliance_violations/components/fix_suggestion_section_spec.js @@ -6,13 +6,13 @@ import { statusesInfo } from 'ee/compliance_dashboard/components/standards_adher describe('FixSuggestionSection', () => { let wrapper; - const mockControlId = 'minimum_approvals_required_2'; + const mockControlName = 'minimum_approvals_required_2'; const mockProjectPath = 'https://localhost:3000/project/path'; const createComponent = (props = {}) => { wrapper = shallowMountExtended(FixSuggestionSection, { propsData: { - controlId: mockControlId, + controlName: mockControlName, projectPath: mockProjectPath, ...props, }, @@ -47,14 +47,14 @@ describe('FixSuggestionSection', () => { it('renders correct description', () => { const description = findDescription(0); expect(description.exists()).toBe(true); - expect(description.text()).toContain(statusesInfo[mockControlId].fixes[0].description); + expect(description.text()).toContain(statusesInfo[mockControlName].fixes[0].description); }); it('renders correct learn more link', () => { const learnMoreLink = findLearnMoreLink(0); expect(learnMoreLink.exists()).toBe(true); expect(learnMoreLink.text()).toBe('Learn more'); - expect(learnMoreLink.attributes('href')).toBe(statusesInfo[mockControlId].fixes[0].link); + expect(learnMoreLink.attributes('href')).toBe(statusesInfo[mockControlName].fixes[0].link); }); it('renders project settings link', () => { -- GitLab