Commit 78341adb authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'djadmin-refix-pipeline-summary' into 'master'

Pipeline Security Summary - Add option to download scanned resources

See merge request gitlab-org/gitlab!54255
parents ed8b8224 47c5d9cc
...@@ -6,6 +6,7 @@ import { ...@@ -6,6 +6,7 @@ import {
GlCollapseToggleDirective, GlCollapseToggleDirective,
GlSprintf, GlSprintf,
GlModalDirective, GlModalDirective,
GlLink,
} from '@gitlab/ui'; } from '@gitlab/ui';
import Modal from 'ee/vue_shared/security_reports/components/dast_modal.vue'; import Modal from 'ee/vue_shared/security_reports/components/dast_modal.vue';
import AccessorUtilities from '~/lib/utils/accessor'; import AccessorUtilities from '~/lib/utils/accessor';
...@@ -21,6 +22,7 @@ export default { ...@@ -21,6 +22,7 @@ export default {
GlCollapse, GlCollapse,
GlSprintf, GlSprintf,
Modal, Modal,
GlLink,
}, },
directives: { directives: {
collapseToggle: GlCollapseToggleDirective, collapseToggle: GlCollapseToggleDirective,
...@@ -132,6 +134,16 @@ export default { ...@@ -132,6 +134,16 @@ export default {
:download-link="downloadLink(scanSummary)" :download-link="downloadLink(scanSummary)"
/> />
</template> </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>
</div> </div>
</gl-collapse> </gl-collapse>
......
...@@ -4,14 +4,16 @@ query($fullPath: ID!, $pipelineIid: ID!) { ...@@ -4,14 +4,16 @@ query($fullPath: ID!, $pipelineIid: ID!) {
securityReportSummary { securityReportSummary {
dast { dast {
vulnerabilitiesCount vulnerabilitiesCount
scannedResourcesCount
scannedResourcesCsvPath scannedResourcesCsvPath
scannedResources { # The following fields will be added in
nodes { # https://gitlab.com/gitlab-org/gitlab/-/issues/321586
requestMethod # scannedResourcesCount
url # scannedResources {
} # nodes {
} # requestMethod
# url
# }
# }
} }
sast { sast {
vulnerabilitiesCount vulnerabilitiesCount
......
...@@ -28,6 +28,7 @@ describe('Security reports summary component', () => { ...@@ -28,6 +28,7 @@ describe('Security reports summary component', () => {
const findToggleButton = () => wrapper.find('[data-testid="collapse-button"]'); const findToggleButton = () => wrapper.find('[data-testid="collapse-button"]');
const findModalButton = () => wrapper.find('[data-testid="modal-button"]'); const findModalButton = () => wrapper.find('[data-testid="modal-button"]');
const findDownloadLink = () => wrapper.find('[data-testid="download-link"]');
beforeEach(() => { beforeEach(() => {
jest.spyOn(AccessorUtilities, 'isLocalStorageAccessSafe').mockReturnValue(true); jest.spyOn(AccessorUtilities, 'isLocalStorageAccessSafe').mockReturnValue(true);
...@@ -208,4 +209,23 @@ describe('Security reports summary component', () => { ...@@ -208,4 +209,23 @@ describe('Security reports summary component', () => {
expect(glModalDirective).toHaveBeenCalledWith({ dastUrl: true }); 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');
});
});
}); });
...@@ -26207,6 +26207,9 @@ msgstr "" ...@@ -26207,6 +26207,9 @@ msgstr ""
msgid "SecurityReports|Download results" msgid "SecurityReports|Download results"
msgstr "" 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." 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 "" 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