diff --git a/ee/app/assets/javascripts/security_dashboard/components/security_reports_summary.vue b/ee/app/assets/javascripts/security_dashboard/components/security_reports_summary.vue index 14f74346176798528a7bc1d7048be43002f29ed2..48f17841b000079cdd3546079d1e7c155d8231be 100644 --- a/ee/app/assets/javascripts/security_dashboard/components/security_reports_summary.vue +++ b/ee/app/assets/javascripts/security_dashboard/components/security_reports_summary.vue @@ -6,6 +6,7 @@ import { GlCollapseToggleDirective, GlSprintf, GlModalDirective, + GlLink, } from '@gitlab/ui'; import Modal from 'ee/vue_shared/security_reports/components/dast_modal.vue'; import AccessorUtilities from '~/lib/utils/accessor'; @@ -21,6 +22,7 @@ export default { GlCollapse, GlSprintf, Modal, + GlLink, }, directives: { collapseToggle: GlCollapseToggleDirective, @@ -132,6 +134,16 @@ export default { :download-link="downloadLink(scanSummary)" /> </template> + <template v-else-if="scanSummary.scannedResourcesCsvPath"> + <gl-link + download + :href="downloadLink(scanSummary)" + class="gl-ml-1" + data-testid="download-link" + > + ({{ s__('SecurityReports|Download scanned resources') }}) + </gl-link> + </template> </div> </div> </gl-collapse> diff --git a/ee/app/assets/javascripts/security_dashboard/graphql/queries/pipeline_security_report_summary.query.graphql b/ee/app/assets/javascripts/security_dashboard/graphql/queries/pipeline_security_report_summary.query.graphql index 666e54ce0e58c3006cacf597d26698f550c2fffb..75a6bc74f0e5bd3ab7321c8d7c4cde5d624f533e 100644 --- a/ee/app/assets/javascripts/security_dashboard/graphql/queries/pipeline_security_report_summary.query.graphql +++ b/ee/app/assets/javascripts/security_dashboard/graphql/queries/pipeline_security_report_summary.query.graphql @@ -4,14 +4,16 @@ query($fullPath: ID!, $pipelineIid: ID!) { securityReportSummary { dast { vulnerabilitiesCount - scannedResourcesCount scannedResourcesCsvPath - scannedResources { - nodes { - requestMethod - url - } - } + # The following fields will be added in + # https://gitlab.com/gitlab-org/gitlab/-/issues/321586 + # scannedResourcesCount + # scannedResources { + # nodes { + # requestMethod + # url + # } + # } } sast { vulnerabilitiesCount diff --git a/ee/spec/frontend/security_dashboard/components/security_reports_summary_spec.js b/ee/spec/frontend/security_dashboard/components/security_reports_summary_spec.js index f4e54f928717b9142c06582db385686da381e4b5..17a6a1a9d85d243d717b7f7238b6fecda2c86e51 100644 --- a/ee/spec/frontend/security_dashboard/components/security_reports_summary_spec.js +++ b/ee/spec/frontend/security_dashboard/components/security_reports_summary_spec.js @@ -28,6 +28,7 @@ describe('Security reports summary component', () => { const findToggleButton = () => wrapper.find('[data-testid="collapse-button"]'); const findModalButton = () => wrapper.find('[data-testid="modal-button"]'); + const findDownloadLink = () => wrapper.find('[data-testid="download-link"]'); beforeEach(() => { jest.spyOn(AccessorUtilities, 'isLocalStorageAccessSafe').mockReturnValue(true); @@ -208,4 +209,23 @@ describe('Security reports summary component', () => { expect(glModalDirective).toHaveBeenCalledWith({ dastUrl: true }); }); }); + + describe('with scanned resources download path', () => { + const dastProps = { + vulnerabilitiesCount: 10, + scannedResourcesCsvPath: '/download/path', + }; + + beforeEach(() => { + createWrapper({ + propsData: { + summary: { dast: dastProps }, + }, + }); + }); + + it('should contain a download link', () => { + expect(findDownloadLink().attributes('href')).toBe('/download/path'); + }); + }); }); diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 79d393fd2224ba4a487cbc93f12cccfcefa4a8a6..3a3074e4f63e0e404c2e573402ff4ee40fa3d152 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -26204,6 +26204,9 @@ msgstr "" msgid "SecurityReports|Download results" msgstr "" +msgid "SecurityReports|Download scanned resources" +msgstr "" + msgid "SecurityReports|Either you don't have permission to view this dashboard or the dashboard has not been setup. Please check your permission settings with your administrator or check your dashboard configurations to proceed." msgstr ""