diff --git a/ee/app/assets/javascripts/vue_shared/security_reports/graphql/mr_security_report_summary.graphql b/ee/app/assets/javascripts/vue_shared/security_reports/graphql/mr_security_report_summary.graphql index 719590a50eee835240f1372604b946e462546188..6bda76ee0833e26f31d75285112d6d23f41e842f 100644 --- a/ee/app/assets/javascripts/vue_shared/security_reports/graphql/mr_security_report_summary.graphql +++ b/ee/app/assets/javascripts/vue_shared/security_reports/graphql/mr_security_report_summary.graphql @@ -4,13 +4,16 @@ query($fullPath: ID!, $pipelineIid: ID!) { securityReportSummary { dast { scannedResourcesCsvPath - scannedResourcesCount - scannedResources { - nodes { - requestMethod - url - } - } + # The commented out fields will be added back by + # https://gitlab.com/gitlab-org/gitlab/-/issues/321586 + # + # scannedResourcesCount + # scannedResources { + # nodes { + # requestMethod + # url + # } + # } } } } diff --git a/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue b/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue index 79b1c67df9b0b0edc85a35f2cdb38853925ea810..015fc3c5b8493b25cfbf1bc7906cd3a0a3e49435 100644 --- a/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue +++ b/ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue @@ -606,6 +606,16 @@ export default { :download-link="dastDownloadLink" /> </template> + <template v-else-if="dastDownloadLink"> + <gl-link + download + :href="dastDownloadLink" + class="gl-ml-1" + data-testid="download-link" + > + ({{ s__('SecurityReports|Download scanned resources') }}) + </gl-link> + </template> </summary-row> <grouped-issues-list v-if="hasDastIssues" diff --git a/ee/changelogs/unreleased/djadmin-dast-remove-scanned-resources.yml b/ee/changelogs/unreleased/djadmin-dast-remove-scanned-resources.yml new file mode 100644 index 0000000000000000000000000000000000000000..e03000762479171270a26cfe041d2701b3d13a65 --- /dev/null +++ b/ee/changelogs/unreleased/djadmin-dast-remove-scanned-resources.yml @@ -0,0 +1,5 @@ +--- +title: Add option to downlaod DAST scanned resources in MR Security Reports +merge_request: 61551 +author: +type: changed diff --git a/ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js b/ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js index ea1af41bfca4583751c00f83f25f1b20e8f5d4c4..ef5ec6f64cae2064f04c293c0839d77326b7eda2 100644 --- a/ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js +++ b/ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js @@ -599,6 +599,39 @@ describe('Grouped security reports app', () => { expect(wrapper.find('[data-testid="dast-ci-job-link"]').exists()).toBe(false); }); }); + + it('show download option when scanned resources are not available', () => { + mock.onGet(DAST_DIFF_ENDPOINT).reply(200, { + ...dastDiffSuccessMock, + base_report_out_of_date: true, + }); + + const summaryWithoutScannedResources = { + scannedResourcesCsvPath: 'http://test', + }; + + createWrapper( + { + ...props, + enabledReports: { + dast: true, + }, + }, + { + data: { + dastSummary: summaryWithoutScannedResources, + }, + }, + ); + + return waitForMutation(wrapper.vm.$store, types.RECEIVE_DAST_DIFF_SUCCESS).then(() => { + const findDownloadLink = wrapper.find('[data-testid="download-link"]'); + + expect(wrapper.text()).toContain('Download scanned resources'); + expect(findDownloadLink.exists()).toBe(true); + expect(findDownloadLink.attributes('href')).toBe('http://test'); + }); + }); }); describe('secret scanning reports', () => {