Commit d5c8479f authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch 'issue_233813' into 'master'

Issue 233813 - Remove confusing text and url on vulnerability finding modal

See merge request gitlab-org/gitlab!43698
parents 5262e3b1 26a9a600
......@@ -64,10 +64,6 @@ export default {
type: String,
required: true,
},
vulnerabilityFeedbackHelpPath: {
type: String,
required: true,
},
loadingErrorIllustrations: {
type: Object,
required: true,
......@@ -117,7 +113,6 @@ export default {
/>
<security-dashboard
:vulnerabilities-endpoint="vulnerabilitiesEndpoint"
:vulnerability-feedback-help-path="vulnerabilityFeedbackHelpPath"
:lock-to-project="{ id: projectId }"
:pipeline-id="pipelineId"
:loading-error-illustrations="loadingErrorIllustrations"
......
......@@ -38,10 +38,6 @@ export default {
required: false,
default: '',
},
vulnerabilityFeedbackHelpPath: {
type: String,
required: true,
},
vulnerableProjectsEndpoint: {
type: String,
required: false,
......@@ -193,7 +189,6 @@ export default {
<issue-modal
:modal="modal"
:vulnerability-feedback-help-path="vulnerabilityFeedbackHelpPath"
:can-create-issue="canCreateIssue"
:can-create-merge-request="canCreateMergeRequest"
:can-dismiss-vulnerability="canDismissVulnerability"
......
......@@ -20,7 +20,6 @@ export default () => {
projectId,
sourceBranch,
vulnerabilitiesEndpoint,
vulnerabilityFeedbackHelpPath,
emptyStateUnauthorizedSvgPath,
emptyStateForbiddenSvgPath,
projectFullPath,
......@@ -45,7 +44,6 @@ export default () => {
pipelineId: parseInt(pipelineId, 10),
pipelineIid: parseInt(pipelineIid, 10),
vulnerabilitiesEndpoint,
vulnerabilityFeedbackHelpPath,
sourceBranch,
dashboardDocumentation,
emptyStateSvgPath,
......
......@@ -27,11 +27,6 @@ export default {
type: Object,
required: true,
},
vulnerabilityFeedbackHelpPath: {
type: String,
required: false,
default: '',
},
canCreateIssue: {
type: Boolean,
required: false,
......@@ -205,7 +200,6 @@ export default {
:remediation="remediation"
:has-mr="vulnerability.hasMergeRequest"
:has-download="canDownloadPatchForThisVulnerability"
:vulnerability-feedback-help-path="vulnerabilityFeedbackHelpPath"
/>
<div v-if="showFeedbackNotes" class="card my-4">
......
<script>
import { GlIcon } from '@gitlab/ui';
import { setUrlFragment } from '~/lib/utils/url_utility';
export default {
name: 'SolutionCard',
......@@ -26,11 +25,6 @@ export default {
default: false,
required: false,
},
vulnerabilityFeedbackHelpPath: {
type: String,
default: '',
required: false,
},
isStandaloneVulnerability: {
type: Boolean,
required: false,
......@@ -41,24 +35,9 @@ export default {
solutionText() {
return (this.remediation && this.remediation.summary) || this.solution;
},
helpPath() {
return setUrlFragment(
this.vulnerabilityFeedbackHelpPath,
'solutions-for-vulnerabilities-auto-remediation',
);
},
showCreateMergeRequestMsg() {
return !this.hasMr && Boolean(this.remediation) && this.hasDownload;
},
showLearnAboutRemedationMsg() {
return !this.hasMr;
},
showMsg() {
return (
this.vulnerabilityFeedbackHelpPath &&
(this.showCreateMergeRequestMsg || this.showLearnAboutRemedationMsg)
);
},
},
};
</script>
......@@ -76,25 +55,14 @@ export default {
solutionText
}}</span>
</div>
<template v-if="showMsg">
<template v-if="showCreateMergeRequestMsg">
<div class="card-footer" :class="{ 'border-0': !solutionText }">
<em class="text-secondary">
<template v-if="showCreateMergeRequestMsg">
{{
s__(
'ciReport|Create a merge request to implement this solution, or download and apply the patch manually.',
)
}}
</template>
<a
v-if="showLearnAboutRemedationMsg"
:href="helpPath"
class="js-link-vulnerabilityFeedbackHelpPath"
>
{{ s__('ciReport|Learn more about interacting with security reports') }}
<gl-icon :size="16" name="external-link" class="align-text-top" />
</a>
{{
s__(
'ciReport|Create a merge request to implement this solution, or download and apply the patch manually.',
)
}}
</em>
</div>
</template>
......
......@@ -55,13 +55,7 @@ export default {
};
},
solutionInfo() {
const {
solution,
has_mr: hasMr,
vulnerability_feedback_help_path: vulnerabilityFeedbackHelpPath,
remediations,
state,
} = this.vulnerability;
const { solution, has_mr: hasMr, remediations, state } = this.vulnerability;
const remediation = remediations?.[0];
const hasDownload = Boolean(
......@@ -73,7 +67,6 @@ export default {
remediation,
hasDownload,
hasMr,
vulnerabilityFeedbackHelpPath,
isStandaloneVulnerability: true,
};
},
......
......@@ -18,7 +18,6 @@
pipeline_jobs_path: expose_path(api_v4_projects_pipelines_jobs_path(id: project.id, pipeline_id: pipeline.id)),
vulnerabilities_endpoint: vulnerabilities_endpoint_path,
vulnerability_exports_endpoint: vulnerability_exports_endpoint_path,
vulnerability_feedback_help_path: help_page_path('user/application_security/index'),
empty_state_unauthorized_svg_path: image_path('illustrations/user-not-logged-in.svg'),
empty_state_forbidden_svg_path: image_path('illustrations/lock_promotion.svg'),
project_full_path: project.path_with_namespace } }
......
---
title: Issue 233813 - Remove confusing text and url on vulnerability finding modal
merge_request: 43698
author: Judith Weiss
type: removed
......@@ -15,7 +15,6 @@ const pipelineIid = 4321;
const projectId = 5678;
const sourceBranch = 'feature-branch-1';
const vulnerabilitiesEndpoint = '/vulnerabilities';
const vulnerabilityFeedbackHelpPath = '/vulnerabilities_feedback_help';
const loadingErrorIllustrations = {
401: '/401.svg',
403: '/403.svg',
......@@ -56,7 +55,6 @@ describe('Pipeline Security Dashboard component', () => {
projectId,
sourceBranch,
vulnerabilitiesEndpoint,
vulnerabilityFeedbackHelpPath,
loadingErrorIllustrations,
},
...options,
......@@ -93,7 +91,6 @@ describe('Pipeline Security Dashboard component', () => {
lockToProject: { id: projectId },
pipelineId,
vulnerabilitiesEndpoint,
vulnerabilityFeedbackHelpPath,
});
});
});
......
......@@ -21,7 +21,6 @@ const vulnerabilitiesEndpoint = `${TEST_HOST}/vulnerabilities`;
const vulnerabilitiesCountEndpoint = `${TEST_HOST}/vulnerabilities_summary`;
const vulnerabilitiesHistoryEndpoint = `${TEST_HOST}/vulnerabilities_history`;
const vulnerableProjectsEndpoint = `${TEST_HOST}/vulnerable_projects`;
const vulnerabilityFeedbackHelpPath = `${TEST_HOST}/vulnerabilities_feedback_help`;
jest.mock('~/lib/utils/url_utility', () => ({
getParameterValues: jest.fn().mockReturnValue([]),
......@@ -53,7 +52,6 @@ describe('Security Dashboard component', () => {
vulnerabilitiesHistoryEndpoint,
vulnerableProjectsEndpoint,
pipelineId,
vulnerabilityFeedbackHelpPath,
...props,
},
});
......@@ -127,12 +125,6 @@ describe('Security Dashboard component', () => {
expect(wrapper.find(IssueModal).exists()).toBe(true);
});
it('passes the "vulnerabilityFeedbackHelpPath" prop to the issue modal', () => {
expect(wrapper.find(IssueModal).props('vulnerabilityFeedbackHelpPath')).toBe(
vulnerabilityFeedbackHelpPath,
);
});
it.each`
emittedModalEvent | eventPayload | expectedDispatchedAction | expectedActionPayload
${'addDismissalComment'} | ${'foo'} | ${'vulnerabilities/addDismissalComment'} | ${{ comment: 'foo', vulnerability: 'bar' }}
......@@ -166,7 +158,7 @@ describe('Security Dashboard component', () => {
describe('issue modal', () => {
it.each`
givenState | expectedProps
${{ modal: { vulnerability: 'foo' } }} | ${{ modal: { vulnerability: 'foo' }, vulnerabilityFeedbackHelpPath, canCreateIssue: false, canCreateMergeRequest: false, canDismissVulnerability: false, isCreatingIssue: false, isDismissingVulnerability: false, isCreatingMergeRequest: false }}
${{ modal: { vulnerability: 'foo' } }} | ${{ modal: { vulnerability: 'foo' }, canCreateIssue: false, canCreateMergeRequest: false, canDismissVulnerability: false, isCreatingIssue: false, isDismissingVulnerability: false, isCreatingMergeRequest: false }}
${{ modal: { vulnerability: { create_vulnerability_feedback_issue_path: 'foo' } } }} | ${expect.objectContaining({ canCreateIssue: true })}
${{ modal: { vulnerability: { create_vulnerability_feedback_merge_request_path: 'foo' } } }} | ${expect.objectContaining({ canCreateMergeRequest: true })}
${{ modal: { vulnerability: { create_vulnerability_feedback_dismissal_path: 'foo' } } }} | ${expect.objectContaining({ canDismissVulnerability: true })}
......
......@@ -131,7 +131,6 @@ describe('Security Reports modal', () => {
beforeEach(() => {
const propsData = {
modal: createState().modal,
vulnerabilityFeedbackHelpPath: 'feedbacksHelpPath',
};
propsData.modal.title = 'Arbitrary file existence disclosure in Action Pack';
mountComponent(propsData, mount);
......@@ -140,12 +139,6 @@ describe('Security Reports modal', () => {
it('renders title', () => {
expect(wrapper.text()).toContain('Arbitrary file existence disclosure in Action Pack');
});
it('renders help link', () => {
expect(wrapper.find('.js-link-vulnerabilityFeedbackHelpPath').attributes('href')).toBe(
'feedbacksHelpPath#solutions-for-vulnerabilities-auto-remediation',
);
});
});
describe('with a resolved issue', () => {
......
......@@ -8,7 +8,6 @@ describe('Solution Card', () => {
const Component = Vue.extend(component);
const solution = 'Upgrade to XYZ';
const remediation = { summary: 'Update to 123', fixes: [], diff: 'SGVsbG8gR2l0TGFi' };
const vulnerabilityFeedbackHelpPath = '/foo';
let wrapper;
......@@ -63,7 +62,7 @@ describe('Solution Card', () => {
describe('with remediation', () => {
beforeEach(() => {
const propsData = { remediation, vulnerabilityFeedbackHelpPath, hasRemediation: true };
const propsData = { remediation, hasRemediation: true };
wrapper = shallowMount(Component, { propsData });
});
......@@ -73,22 +72,12 @@ describe('Solution Card', () => {
);
});
it('renders the card footer', () => {
expect(wrapper.find('.card-footer').exists()).toBe(true);
});
describe('with download patch', () => {
beforeEach(() => {
wrapper.setProps({ hasDownload: true });
return wrapper.vm.$nextTick();
});
it('renders the learn more about remediation solutions', () => {
expect(wrapper.find('.card-footer').text()).toContain(
s__('ciReport|Learn more about interacting with security reports'),
);
});
it('does not render the download and apply solution message when there is a file download and a merge request already exists', () => {
wrapper.setProps({ hasMr: true });
return wrapper.vm.$nextTick().then(() => {
......@@ -106,24 +95,8 @@ describe('Solution Card', () => {
});
describe('without download patch', () => {
it('renders the learn more about remediation solutions', () => {
expect(wrapper.find('.card-footer').text()).toContain(
s__('ciReport|Learn more about interacting with security reports'),
);
});
it('does not render the download and apply solution message', () => {
expect(wrapper.find('.card-footer').text()).not.toContain(
s__('ciReport|Download and apply the patch manually to resolve.'),
);
});
it('does not render the create a merge request to implement this solution message', () => {
expect(wrapper.find('.card-footer').text()).not.toContain(
s__(
'ciReport|Create a merge request to implement this solution, or download and apply the patch manually.',
),
);
it('does not render the card footer', () => {
expect(wrapper.find('.card-footer').exists()).toBe(false);
});
});
});
......
......@@ -30,7 +30,6 @@ describe('Vulnerability Footer', () => {
can_modify_related_issues: true,
related_issues_help_path: 'help/path',
has_mr: false,
vulnerability_feedback_help_path: 'feedback/help/path',
pipeline: {},
};
......@@ -69,7 +68,6 @@ describe('Vulnerability Footer', () => {
remediation: properties.remediations[0],
hasDownload: true,
hasMr: vulnerability.has_mr,
vulnerabilityFeedbackHelpPath: vulnerability.vulnerability_feedback_help_path,
isStandaloneVulnerability: true,
});
});
......
......@@ -30268,9 +30268,6 @@ msgstr ""
msgid "ciReport|Investigate this vulnerability by creating an issue"
msgstr ""
msgid "ciReport|Learn more about interacting with security reports"
msgstr ""
msgid "ciReport|Load performance test metrics: "
msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment